禁用Aloha Editor侧栏

时间:2013-03-01 23:05:55

标签: javascript aloha-editor

我想禁用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,感觉不对。我更喜欢更好的解决方案。)

1 个答案:

答案 0 :(得分:10)

在强调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>