【发布时间】:2014-12-29 15:46:36
【问题描述】:
我正在使用 wsyihtml5 (0.3.0) 和 bootstrap 使 textarea 能够编辑富文本。
一切正常,除了我只需要它。
//Element declaration
<textarea readonly name="overview" class="form-control" id="OverviewContent" style="width: 100%; height: 200px"></textarea>
[...]
//JS at bottom of page
<script>
$("#OverviewContent").wysihtml5(
{
"font-styles": false,
"color": false,
"emphasis": false,
"textAlign": false,
"lists": false,
"blockquote": false,
"link": false,
"table": false,
"image": false,
"video": false,
"html": false
});
$(document).ready(function()
{
alert("Starting disable");
//I've tried all three of these lines individually
$('#OverviewContent').data('wysihtml5').editor.disable()
//$('#OverviewContent').data('wysihtml5').editor.composer.disable();
//$('#OverviewContent').data('wysihtml5').editor.composer.element.setAttribute('contenteditable', false);
alert("Disabled?");
});
</script>
文本区域看起来总是可以编辑的。
警报弹出正常,chrome 中没有控制台错误,文本区域显示富文本正常。
【问题讨论】:
-
如果你不能使用编辑器还有什么意义?一个更简单的语法荧光笔会更合适。
-
我的目标是显示富文本。不幸的是,我对此没有太多经验,所以我使用 wysihtml5 来显示它。我还使用 wysihtml5 在单独的页面上编辑富文本。
标签: javascript twitter-bootstrap textarea readonly wysihtml5