Froala editor is not showing correct linkEditButtons

吃可爱长大的小学妹 提交于 2019-12-11 12:40:01

问题


I am trying to insert multiple files in Froala editor. Each File has to show different linkEditButtons based on some conditions.

LinkEditButtons are not shown correctly. The alerts below shows correct buttons . But editor is not getting updated.

How should I get the updated editor instance .

$("#froala").on("froalaEditor.file.inserted", function (e, editor, files) {
var editor= $('#froala').data('froala.editor');
var url = editor.link.get();                                                                                                                                     alert("editor.opts.linkEditButtons" + editor.opts.linkEditButtons);
var base = 'pdf;base64';
if (files[0].href.indexOf(base) !== -1) {                                                                        
 editor.opts.linkEditButtons = ['linkRemove'];                                                                        
 alert("editor.opts.linkEditButtons" + editor.opts.linkEditButtons);
} else {                                                                        
editor.opts.linkEditButtons = ['linkOpen', 'linkRemove'];
 alert("editor.opts.linkEditButtons" + editor.opts.linkEditButtons);
}

来源:https://stackoverflow.com/questions/56669183/froala-editor-is-not-showing-correct-linkeditbuttons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!