Reputation: 12712
I want to disable the Aloha Editor sidebar. I've seen the following code in various places, which doesn't work for me:
Aloha.settings = {
sidebar: { disabled: true }
};
If I add it after the call to aloha()
, nothing happens and the sidebar remains. If I add it before I call aloha()
on elements, I get the following error:
Uncaught TypeError: Cannot read property 'getContents' of undefined
All of this is taking place in Aloha.ready
and isn't fixed if I move the code above my call to Aloha.ready
.
If it's helpful, here are the files I'm loading in the <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" />
(I'm currently adding some CSS, which feels wrong. I'd prefer a nicer solution.)
Upvotes: 2
Views: 1470
Reputation: 2854
Run JS for settings before calling 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>
Upvotes: 10