Changeset 13699
- Timestamp:
- 05/12/08 09:16:21 (6 months ago)
- Location:
- dijit/trunk
- Files:
-
- 3 modified
-
Editor.js (modified) (2 diffs)
-
tests/test_Editor.html (modified) (6 diffs)
-
_editor/RichText.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/Editor.js
r13415 r13699 12 12 dijit._editor.RichText, 13 13 { 14 // summary: A rich-text Editing widget 14 // summary: 15 // A rich text Editing widget 16 // 17 // description: 18 // This widget provides basic WYSIWYG editing features, based on the browser's 19 // underlying rich text editing capability, accompanied by a toolbar (dijit.Toolbar). 20 // A plugin model is available to extend the editor's capabilities as well as the 21 // the options available in the toolbar. Content generation may vary across 22 // browsers, and clipboard operations may have different results, to name 23 // a few limitations. Note: this widget should not be used with the HTML 24 // <TEXTAREA> tag -- see dijit._editor.RichText for details. 15 25 16 26 // plugins: Array … … 85 95 // array at that index. No big magic, but a nice helper for 86 96 // passing in plugin names via markup. 87 // plugin: String, args object or plugin instance. Required. 88 // args: This object will be passed to the plugin constructor. 89 // index: 90 // Integer, optional. Used when creating an instance from 97 // 98 // plugin: String, args object or plugin instance 99 // 100 // args: This object will be passed to the plugin constructor 101 // 102 // index: Integer 103 // Used when creating an instance from 91 104 // something already in this.plugins. Ensures that the new 92 105 // instance is assigned to this.plugins at that index. -
dijit/trunk/tests/test_Editor.html
r13697 r13699 81 81 <button onclick="console.log(dijit.byId('editor1').getValue().length)">getValue</button> 82 82 <hr/> 83 84 <h2>Created from textarea,auto-expanding</h2>83 84 <h2>Created from div, auto-expanding</h2> 85 85 <div style="border: 1px dotted black;"> 86 <h3><label for="thud">thud - from textarea</label></h3>87 < textareadojoType="dijit.Editor" height=""86 <h3><label for="thud">thud - from div</label></h3> 87 <div dojoType="dijit.Editor" height="" 88 88 onChange="console.log('thud onChange handler: ' + arguments[0])" 89 89 extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']" 90 90 styleSheets="../../dojo/resources/dojo.css" id="thud"> 91 91 <p> 92 This editor is created from a textareawith AlwaysShowToolbar plugin (do not forget to set height="").92 This editor is created from a div with AlwaysShowToolbar plugin (do not forget to set height=""). 93 93 </p> 94 94 <p> … … 101 101 </p> 102 102 The following HTML should appear as source: <INPUT TYPE="IMAGE" SRC="javascript:alert('no scripting attacks')"> 103 </ textarea>103 </div> 104 104 <h3>..after</h3> 105 105 </div> … … 109 109 <div style="border: 1px dotted black;"> 110 110 <h3><label for="blah">blah entry</label></h3> 111 < textareadojoType="dijit.Editor"111 <div dojoType="dijit.Editor" 112 112 plugins="['bold','italic','|','createLink','foreColor','hiliteColor',{name:'dijit._editor.plugins.FontChoice', command:'fontName', generic:true},'fontSize','formatBlock','insertImage']" 113 113 styleSheets="../../dojo/resources/dojo.css" id="blah"> … … 126 126 <span style="font-family: fantasy">This is fantasy.</span> 127 127 <br> 128 </ textarea>128 </div> 129 129 <h3>..after</h3> 130 130 <button onclick="alert(dijit.byId('blah').getValue());">getValue</button> … … 135 135 <div style="border: 1px dotted black;"> 136 136 <h3><label for="blah2">Another blah entry</label></h3> 137 < textareadojoType="dijit.Editor"137 <div dojoType="dijit.Editor" 138 138 plugins="['bold','italic','|',{name:'dijit._editor.plugins.EnterKeyHandling'},{name:'dijit._editor.plugins.FontChoice', command:'fontName', custom:['Verdana','Myriad','Garamond','Apple Chancery','Hiragino Mincho Pro']}, {name:'dijit._editor.plugins.FontChoice', command:'fontSize', custom:[3,4,5]}]" 139 139 styleSheets="../../dojo/resources/dojo.css" id="blah2"> … … 143 143 <li>specify options for a plugin (see the last item in the plugins array)</li> 144 144 </ol> 145 </ textarea>145 </div> 146 146 <h3>..after</h3> 147 147 </div> -
dijit/trunk/_editor/RichText.js
r13415 r13699 231 231 } 232 232 if(!this.document.body){ 233 throw 'Error'; 233 throw 'Error'; //FIXME. A bit more info, if this code stays. 234 234 } 235 235 }catch(e){ … … 358 358 359 359 dojo.declare("dijit._editor.RichText", dijit._Widget, { 360 constructor: function(paras){ 361 // summary: 362 // dijit._editor.RichText is the core of the WYSIWYG editor in dojo, which 363 // provides the basic editing features. It also encapsulates the differences 364 // of different js engines for various browsers 360 constructor: function(params){ 361 // summary: 362 // dijit._editor.RichText is the core of dijit.Editor, which provides basic 363 // WYSIWYG editing features. 364 // 365 // description: 366 // dijit._editor.RichText is the core of dijit.Editor, which provides basic 367 // WYSIWYG editing features. It also encapsulates the differences 368 // of different js engines for various browsers. Do not use this widget 369 // with an HTML <TEXTAREA> tag, since the browser unescapes XML escape characters, 370 // like <. This can have unexpected behavior and lead to security issues 371 // such as scripting attacks. 365 372 // 366 373 // contentPreFilters: Array … … 406 413 this.onLoadDeferred = new dojo.Deferred(); 407 414 408 //in this constructor, mixin properties are not yet merged, so we have to check for para s here409 this.useIframe = (dojo.isFF && (dojo.isFF < 3)) || para s['useIframe'] || paras['styleSheets'];415 //in this constructor, mixin properties are not yet merged, so we have to check for params here 416 this.useIframe = (dojo.isFF && (dojo.isFF < 3)) || params['useIframe'] || params['styleSheets']; 410 417 411 418 if(this.useIframe){ … … 464 471 465 472 postCreate: function(){ 466 // summary: init 473 if("textarea" == this.domNode.tagName.toLowerCase()){ 474 console.warn("RichText should not be used with the TEXTAREA tag. See dijit._editor.RichText docs."); 475 } 467 476 dojo.publish(dijit._scopeName + "._editor.RichText::init", [this]); 468 477 this.open();