gpt4 book ai didi

javascript - 禁用 Aloha Editor 侧边栏

转载 作者:行者123 更新时间:2023-12-03 16:40:26 24 4
gpt4 key购买 nike

我想禁用 Aloha Editor边栏。我在不同的地方看到了以下代码,这对我不起作用:

Aloha.settings = {
sidebar: { disabled: true }
};

如果我在调用 aloha() 之后 添加它,没有任何反应,侧边栏仍然存在。如果我在 之前添加它,我会调用 aloha()在元素上,我收到以下错误:

Uncaught TypeError: Cannot read property 'getContents' of undefined

所有这一切都发生在Aloha.ready如果我将代码移到对 Aloha.ready 的调用上方,则不会修复.

如果有帮助,这是我在 <head> 中加载的文件:

<script src="http://cdn.aloha-editor.org/latest/lib/require.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://cdn.aloha-editor.org/latest/lib/aloha.js" data-aloha-plugins="common/ui, common/format, common/list, common/link, common/highlighteditables, common/horizontalruler, common/undo, common/paste"></script>
<link href="http://cdn.aloha-editor.org/latest/css/aloha.css" rel="stylesheet" type="text/css" />

(我目前正在添加 some CSS,感觉不对。我更喜欢更好的解决方案。)

最佳答案

调用 aloha.js 之前运行 JS 进行设置:

<script>
Aloha = {};
Aloha.settings = { sidebar: { disabled: true } };
</script>
<script src="aloha/lib/vendor/require.js"></script>
<script src="aloha/lib/aloha.js"></script>

关于javascript - 禁用 Aloha Editor 侧边栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15168342/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com