用 tinymce 实现附件变动监听
在 tinymce 使用附件插件时,监视器无法监听附件的插入和删除变动。如何解决这一问题?
已实现的解决方案:
在 init 中添加回调:
tinymce.init({ ... attach_callbacks: { blur: function(){}, clear: function(){}, attach: function(){} } ... });
监听 value 并处理光标问题:
watch: { value: { handler(val){ content = val; } } }
在 methods 中添加方法:
methods: { insertattachment(){ var editor = tinymce.activeeditor; const folderpath = this.params.folder.path; attachmentfieldservice.insertattach(this.params, function(attach){ editor.insertcontent('@@##@@'); handletextareacontent(); }); } }
在成功插入附件后再次调用方法:
AttachmentFieldService.insertAttach(this.params, function(attach){ handleTextareaContent(); });
以上解决方案成功实现了对 tinymce 附件变动的监听,包括插入和删除。
以上就是如何在 TinyMCE 中监听附件的插入和删除变动?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号