Browse files

allow for custom settings to be init'd from the bespin Component

  • Loading branch information...
1 parent b91526a commit 6b10558e7372d0084d40dcba9eaa5943588d694d Dion Almaer committed Apr 8, 2009
Showing with 18 additions and 1 deletion.
  1. +6 −0 docs/embed.html
  2. +8 −0 frontend/js/bespin/editor/component.js
  3. +4 −1 frontend/tests/editor/singleeditor.html
View
6 docs/embed.html
@@ -53,6 +53,12 @@ <h1 style="border-bottom: 1px solid #ccc">Usage</h1>
<li><code>content</code>: Feed the editor the string as the initial content (loadfromdiv trumps this)</li>
<li><code>language</code>: The given syntax highlighter language to turn on (not people language!)</li>
<li><code>dontstealfocus</code>: by default the component will steal focus when it loads, but you can change that by setting this to true</li>
+ <li><code>set</code>: can contain a hash of settings that match the <a href="https://wiki.mozilla.org/Labs/Bespin/Settings">settings</a> available for Bespin. For example:
+ <pre>
+ set: {
+ strictlines: 'on'
+ }
+ </pre>
</ul>
</p>
View
8 frontend/js/bespin/editor/component.js
@@ -89,6 +89,14 @@ dojo.declare("bespin.editor.Component", null, {
if (!opts.dontstealfocus) {
this.editor.canvas.focus();
}
+
+ if (opts.set) { // we have generic settings
+ for (var key in opts.set) {
+ if (opts.set.hasOwnProperty(key)) {
+ this.set(key, opts.set[key]);
+ }
+ }
+ }
},
// ** {{{ getContent }}} **
View
5 frontend/tests/editor/singleeditor.html
@@ -45,7 +45,10 @@
window.onload = function() {
_editorComponent = new bespin.editor.Component('editor', {
language: "js",
- loadfromdiv: true
+ loadfromdiv: true,
+ set: {
+ strictlines: 'on'
+ }
});
};

0 comments on commit 6b10558

Please sign in to comment.