我正在使用TinyMCE & jQuery,并且在将TinyMCE的外部工具栏移动到DOM中的另一个位置时出现问题。如何将TinyMCE的工具栏移动到模态弹出窗口中?
若要进一步复杂化,页面上有多个TinyMCE实例。我只想要当前正在编辑的那个工具栏。
下面是一些示例代码:
$(textarea).tinymce({
setup: function(ed) {setupMCEToolbar(ed, componentID, displaySettingsPane)}
,script_url: '/clubs/data/shared/scripts/tiny_mce/tiny_mce.js'
,theme : "advanced"
,plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template"
,theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect"
,theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor"
,theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen"
,theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak"
,theme_advanced_toolbar_location : "external"
,theme_advanced_toolbar_align : "left"
,theme_advanced_statusbar_location : "bottom"
,theme_advanced_resizing : true
});
var setupMCEToolbar = function (mce, componentID, displaySettingsPane)
{
mce.onClick.add(function(ed,e){
displaySettingsPane($('#' + componentID));
$('#' + componentID).fetch('.mceExternalToolbar').eq(0).appendTo('#settingsPaneContent');
});
}
基本上,它好像在setupMCEToolbar功能无法追查mceExternalToolbar移动它。
有没有人试图做过这样的事情?
编辑 这是一个星期一好了...这可能不是因为我是用儿童()找到外部工具栏,而不是取()。
还有一个问题: 1)移动它非常慢,2)一旦移动,TinyMCE就会中断。
更EDIT 2 一些说明:该模式可拖动,从而使任何纯CSS的变通方法有点别扭......
它看起来像你说真正移动整个编辑块进入弹出窗口?这可能是我最终需要做的事情,但是我真的希望内容在编辑时保持在页面的流程中。 – 2009-10-19 19:16:41
刚刚用css重新定位它怎么样?我最初一定误解了这个问题。 – 2009-10-19 19:28:19
不幸的是,我必须很难...模式弹出是可拖动的。通过CSS重新定位工具栏将是可行的,但通过拖动模式拖动时通过JS进行更新会很渺茫。我应该在我最初的发帖中澄清。 – 2009-10-19 20:28:37