CKEditor 中的上传回调
我正在尝试配置 CKEditor 以允许用户从她的计算机上传图像。我正在使用 filebrowserUploadUrl,因此我可以将图像上传到服务器并取回分配给它的 URL,但我不知道如何将 URL 传递给实际的编辑器......
网上的一些例子谈论从服务器返回类似于
I'm trying to configure CKEditor to allow the user to upload an image from her computer. I'm using filebrowserUploadUrl, so I can upload the image to the server and get back the URL assigned to it, but I can't figure out how to pass the URL to the actual editor...
Some examples on the net talk about returning from the server something like <script>parent.CKEDITOR.tools.callFunction ...
, but I think it's quite ugly, isn't there a way to tell CKEditor "after the image is uploaded, call this function'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
服务器不应返回 javascript 供客户端渲染。
尽管以下是一个丑陋丑陋...丑陋的黑客..我仍然更喜欢它而不是从服务器发送javascript:(
上传图像后自动在编辑器中插入图像的示例 - 适用于 4.4.7)
当然,正确的方法是创建一个自定义插件。
The server shouldn't return javascript for the client to render.
Even though the following is an ugly ugly... ugly hack.. I still prefer it over sending javascript from the server:
(Example of automatically inserting the image in the editor once the image is uploaded - works with 4.4.7)
Of course, the right way would be to create a custom plugin.
再次阅读语法:您获取 CKEDITOR 对象并告诉它回调函数,因此它完全按照您的要求执行。
Read again the syntax: you get the CKEDITOR object and tell it to call back a function, so it does exactly what you want.