Created
February 6, 2012 17:03
-
-
Save robertbasic/1753335 to your computer and use it in GitHub Desktop.
Dojo Editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define([ | |
| 'dojo/query', | |
| 'dojo/dom-construct', | |
| 'dojo/dom-attr', | |
| 'dijit/Editor', | |
| "dijit/_editor/plugins/LinkDialog", | |
| "dijit/_editor/plugins/ViewSource" | |
| ], | |
| function(query, construct, attr, Editor) { | |
| var editors = query(".dojoed-form textarea.dojo-editor"); | |
| editors.forEach(function(editor) { | |
| var name = attr.get(editor, 'name'); | |
| var value = attr.get(editor, 'value'); | |
| var div = construct.create( | |
| "div", | |
| { | |
| innerHTML: value, | |
| className: 'dojo-editor-holder' | |
| }, | |
| editor, | |
| "after" | |
| ); | |
| var hidden = construct.create( | |
| "input", | |
| { | |
| type: 'hidden', | |
| name: name, | |
| id: name, | |
| value: value | |
| }, | |
| editor, | |
| "after" | |
| ); | |
| new Editor({ | |
| height: 'auto', | |
| plugins: ['bold', 'italic', '|', 'insertUnorderedList', 'insertOrderedList'], | |
| extraPlugins:['createLink','insertImage','|','viewsource'], | |
| onChange: function(value) { | |
| attr.set(name, 'value', value.replace(/<br \/>$/, '')); | |
| } | |
| }, div); | |
| construct.destroy(editor); | |
| }) | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment