2

我想禁用Aloha 编辑器侧边栏。我在各个地方都看到了以下代码,这对我不起作用:

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" />

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

4

1 回答 1

10

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

<script>
Aloha = {};
Aloha.settings = { sidebar: { disabled: true } };
</script>
<script src="aloha/lib/vendor/require.js"></script>
<script src="aloha/lib/aloha.js"></script>
于 2013-03-02T12:07:46.090 回答