How can I put tinymce toolbar on external div? I try this successfull:
It put toolbar on external but it doesn't load css theme for displaying toolbar, because css are load in iframe, so toolbar isn't shown.
How can I put tinymce toolbar on external div? I try this successfull:
It put toolbar on external but it doesn't load css theme for displaying toolbar, because css are load in iframe, so toolbar isn't shown.
几个月前,这对我来说一直是个问题。您需要做的就是将外部工具栏移动到您想要的位置。我在我的一个插件中编写了一个函数。在我的页面上,我创建了一个带有“externalToolbarWrapper”类的 div,我在其中插入了工具栏。这是那个功能。您可能需要稍微调整一下,但认为它会对您有所帮助。
showExternalToolbar: function(){
if (this.editor.getParam('theme_advanced_toolbar_location') != 'external') return;
if (!document.getElementById('externalToolbarWrapper')) $(document.body).prepend('<div id="externalToolbarWrapper"></div>');
var $toolbar = $('#'+this.editor.id + '_external');
// inserts the external toolbar in the external wrapper
$('#externalToolbarWrapper').append('<div id="replacementDiv"></div>');
$('#replacementDiv').replaceWith($toolbar.show());
$toolbar.css('top','0px');
$toolbar.css('display','block');
$('#' + this.editor.id + '_external_close').remove();
$('#' + this.editor.id +'_toolbargroup').css('width', innerWidth || 800); // innerwidth is an integer value
},
如果您不想将上面的代码放在自己的插件中,则应该调用上面的代码 onInit(在此处使用setup 配置参数)
setup : function(ed) {
ed.onInit.add(function(ed) {
// place your code here
});
},
伙计们,如果你想试试这个,它更容易更短
setup:function(ed){
ed.onInit.add(function(ed, evt){
$toolbar = $('#'+ed.id+'_external');
$toolbar.hide().appendTo('yourExternalDiv');
});
}
“穆西夫·穆拉”