TinyMCE Toolbar location

时光怂恿深爱的人放手 提交于 2019-12-03 08:47:57

This has been an issue for me a few months ago. All you need to do is to move the external toolbar to the place you want it to be. I wrote a function in one of my plugins. On my page i have created a div with class "externalToolbarWrapper" in which i insert the toolbar. Here is that function. You might need to tweak it a bit, but think it will be of help to you.

    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
    },

Update:

You should call it onInit (use the setup configuration parameter here)

   setup : function(ed) {
      ed.onInit.add(function(ed) {
          // place your code here
      });
   },
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!