Kendo ui 无法配置在没有工具栏的div元素上应用的剑道编辑器
我在一个div元素上应用了剑道编辑器,而不是使用textarea,因为它给iPad带来了一些问题。现在,我不希望编辑器有工具栏来格式化文本 我尝试将样式作为“无”和“设置工具”应用于空数组,但工具栏中仍然显示一个可拖动按钮Kendo ui 无法配置在没有工具栏的div元素上应用的剑道编辑器,kendo-ui,kendo-editor,Kendo Ui,Kendo Editor,我在一个div元素上应用了剑道编辑器,而不是使用textarea,因为它给iPad带来了一些问题。现在,我不希望编辑器有工具栏来格式化文本 我尝试将样式作为“无”和“设置工具”应用于空数组,但工具栏中仍然显示一个可拖动按钮 <div id="targetdiv" contenteditable="true" style = "resize: none;width: 100% !important; height:150px; max-height:150px;max-width:
<div id="targetdiv" contenteditable="true" style = "resize: none;width:
100%
!important; height:150px; max-height:150px;max-width: 100% !important;">
</div>
<script>
$("#targetdiv").kendoEditor({
tools: []});
</script>
方法3:(部分有效)
添加了一个选择事件,但工具栏仍会出现一瞬间,然后消失
$("#targetdiv").kendoEditor({
tools: [],
//Fires when the Editor selection has changed.
select: function (e) {
let editor = $("#targetdiv").data("kendoEditor");
editor.toolbar.hide();
});
如果不想显示工具栏,请在KendoUI编辑器初始化中定义空工具:
$("#editor").kendoEditor({
// Empty tools so do not display toolbar
tools: [ ]
});
如果要禁用该版本,应使用:
$(editor.body).attr('contenteditable',false);
你也可以试试这个
.k-editor-toolbar
{display:none !important;}
最后,
我必须订阅编辑器工具栏的打开事件并阻止其执行。这解决了我的问题
let editor = $("#targetdiv").getKendoEditor();
editor.toolbar.window.bind("open", function (e) {
e.preventDefault();
});
我已经试过了,它显示了带有可拖动图标的空工具栏。请检查有问题的图片本身。你能试着检查UI并找到父类吗。我们可以做的是,我们必须找到剑道控件的父类,然后您可以从jq$(“.parentclass”).hide()设置或设置该类的样式。我希望这对你有帮助
.k-editor-toolbar
{display:none !important;}
let editor = $("#targetdiv").getKendoEditor();
editor.toolbar.window.bind("open", function (e) {
e.preventDefault();
});