我使用tiny_mce作爲iframe中textareas中的詞語編輯器。我想要使用整個iframe空間。 TinyMCE有一個全屏按鈕,但是我需要在插件加載時自動設置全屏模式。是否有一個函數/觸發器來調用此模式(或按鈕)?感謝幫助。小小的MCE - 在編輯器加載時設置全屏幕?
7
A
回答
8
在IFRAME文檔中,您可以指示TinyMCE在textarea初始化後切換到全屏模式。下面的代碼將需要進入你的IFRAME:
<script type="text/javascript">
tinyMCE.init({
mode : "exact",
elements : "description", // This is the id of the textarea
plugins : "fullscreen",
theme : "advanced",
theme_advanced_buttons1 : "fullscreen,code",
theme_advanced_buttons2 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
oninit : function() { // Once initialized, tell the editor to go fullscreen
tinyMCE.get('description').execCommand('mceFullScreen');
}
});
</script>
....
<textarea id="description"></textarea>
TinyMCE的全屏插件將填補當前窗口 - 而且,因爲IFRAME是它自己的窗口,這應該填補IFRAME。
編輯:此技術也可以用於TinyMCE JQuery庫。選項是相同的,但調用語法稍有不同。再次,關鍵線路是oninit
回調:
$(document).ready(function() {
$('#description').tinymce({ // "description" is the id of the TEXTAREA
// ... same options inserted here ...
oninit : function() {
tinyMCE.get('description').execCommand('mceFullScreen');
}
});
});
0
你只需要插入下面的代碼插入到tinyMCE.init({})功能:
setup : function(ed) {
ed.on('load',function(e){
ed.execCommand('mceFullScreen');
});
},
詩:記住逗號,如果你之後有其他指令,或者它會失敗。 ;-)
-1
setTimeout(\'(function(){tinyMCE.get("YourElementID").execCommand("mceFullScreen");})()\',2500);
+0
解釋代碼不會在你的答案是什麼,並進行修改! – gsamaras 2015-04-07 17:24:38
如何設置內容的TinyMCE時,其全屏 – 2010-12-24 09:44:50