Mar*_*tin 7 javascript iframe tinymce
我在iframe中的textareas中使用tiny_mce作为类似于字的编辑器.我想使用整个iframe空间.TinyMCE有一个全屏按钮,但我需要在插件加载时自动设置全屏模式.是否有功能/触发器来调用此模式(或按钮)?感谢帮助.
在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>
Run Code Online (Sandbox Code Playgroud)
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');
}
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6240 次 |
| 最近记录: |