如何停用Bootstrap-wysihtml5 jQuery编辑器实例? [英] How do I deactivate Bootstrap-wysihtml5 jquery editor instance?
问题描述
我正在使用Bootstrap-wysihtml5 jQuery插件( https://github.com/jhollingworth/bootstrap-wysihtml5/)将文本区域转换为所见即所得.我希望能够通过单击2个按钮来激活和停用编辑器,到目前为止,我可以显示编辑器,请您让我知道如何停用编辑器并仅保留textarea及其值.我的代码如下:-
I'm using the Bootstrap-wysihtml5 jquery plugin (https://github.com/jhollingworth/bootstrap-wysihtml5/) to convert textareas to WYSIWYG. I would like to be able to activate and deactivate the editor by clicking on 2 buttons, so far i can show the editor, please will you let me know how i can deactivate the editor and leave just the textarea and its value. My code is as follows:-
HTML
<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
<input type="button" id="button1" value="Show Editor">
<input type="button" id="button2" value="Hide Editor">
脚本
$("#button1").click(function(){
$('textarea').wysihtml5();
});
$("#button2").click(function(){
// this is where i'm stuck
});
谢谢
推荐答案
我在尝试禁用/隐藏工具栏和编辑器时遇到了同样的问题,并且在使用以下命令(禁用编辑器)时遇到了麻烦.我正在使用wysihtml5-0.3.0_rc2.js版本)
I had the same problem trying to disable/hide the toolbar and editor and had luck with the following commands (to disable the editor). I'm using version wysihtml5-0.3.0_rc2.js)
$('#editorId').data('wysihtml5').editor.composer.disable();
$('#editorId').data('wysihtml5').editor.composer.enable();
或(隐藏编辑器)
$('#editorId').data('wysihtml5').editor.composer.hide();
$('#editorId').data('wysihtml5').editor.composer.show();
要对工具栏执行相同操作,请执行以下操作以隐藏/显示(找不到用于禁用工具栏的工具):
To do the same to the toolbar you do the following to hide/show (can't find a wat to disable the toolbar):
$('#editorId').data('wysihtml5').editor.toolbar.hide();
$('#editorId').data('wysihtml5').editor.toolbar.show();
这篇关于如何停用Bootstrap-wysihtml5 jQuery编辑器实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!