我正在尝试使用Wysihtml5编辑器在我的网站上的一个文本区。如果我使用默认设置并且没有指定工具栏,我会得到默认的工具栏,但是如果我按照wysihtml5网站上的文档操作,我就得不到任何工具栏。
我的自定义工具栏:
<div id="wysihtml5-toolbar" style="display: none;">
<header>
<a data-wysihtml5-command="bold">bold</a>
<a data-wysihtml5-command="italic">italic</a>
<a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="red">red</a>
<a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="green">green</a>
<a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="blue">blue</a>
</header>
<a data-wysihtml5-command="createLink">insert link</a>
<div data-wysihtml5-dialog="createLink" style="display: none;">
<label>
Link:
<input data-wysihtml5-dialog-field="href" value="http://" class="text">
</label>
<a data-wysihtml5-dialog-action="save">OK</a> <a data-wysihtml5-dialog-action="cancel">Cancel</a>
</div>
</div>
<textarea id='Body'></textarea>
以及使文本区域成为wysihtml5编辑器的脚本:
<script>
$(document).ready(function () {
$('#Body').wysihtml5({
toolbar: 'wysihtml5-toolbar'
});
});
</script>
我现在已经创建了我所设置的jsfiddle。我似乎还是不能按照说明来控制工具栏。
发布于 2015-03-14 23:27:11
我有完全相同的问题,我解决了一个有趣的解决方案。转到这里(http://xing.github.io/wysihtml5/),打开页面源代码,从那里获取css和script code.Be当你在javascript中导入css时要小心!
发布于 2015-12-25 17:28:44
自从他们发布更新后,它就被更改了
现在它应该是这样的
<script>
$(document).ready(function () {
$('#Body').wysihtml5({
toolbar: {
"font-styles": false, // Font styling, e.g. h1, h2, etc.
"emphasis": true, // Italics, bold, etc.
"lists": true, // (Un)ordered lists, e.g. Bullets, Numbers.
"html": false, // Button which allows you to edit the generated HTML.
"link": false, // Button to insert a link.
"image": false, // Button to insert an image.
"color": true, // Button to change color of font
"blockquote": true, // Blockquote
"indent": false,
"outdent": false,
}
});
});
</script>
https://stackoverflow.com/questions/29047130
复制相似问题