Changeset 13699

Show
Ignore:
Timestamp:
05/12/08 09:16:21 (6 months ago)
Author:
peller
Message:

Deprecate RichText? + TEXTAREA. Refs #2140 !strict Provide console warning and update docs and tests. Note: textarea is still mentioned in the code as a savearea.

Location:
dijit/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/Editor.js

    r13415 r13699  
    1212        dijit._editor.RichText, 
    1313        { 
    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. 
    1525 
    1626                // plugins: Array 
     
    8595                        //              array at that index. No big magic, but a nice helper for 
    8696                        //              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 
    91104                        //              something already in this.plugins. Ensures that the new 
    92105                        //              instance is assigned to this.plugins at that index. 
  • dijit/trunk/tests/test_Editor.html

    r13697 r13699  
    8181        <button onclick="console.log(dijit.byId('editor1').getValue().length)">getValue</button> 
    8282        <hr/> 
    83          
    84         <h2>Created from textarea,auto-expanding</h2> 
     83 
     84        <h2>Created from div, auto-expanding</h2> 
    8585        <div style="border: 1px dotted black;"> 
    86                 <h3><label for="thud">thud - from textarea</label></h3> 
    87                 <textarea dojoType="dijit.Editor" height="" 
     86                <h3><label for="thud">thud - from div</label></h3> 
     87                <div dojoType="dijit.Editor" height="" 
    8888                        onChange="console.log('thud onChange handler: ' + arguments[0])" 
    8989                        extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']" 
    9090                        styleSheets="../../dojo/resources/dojo.css" id="thud"> 
    9191                        <p> 
    92                                 This editor is created from a textarea with 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=""). 
    9393                        </p> 
    9494                        <p> 
     
    101101                        </p> 
    102102                        The following HTML should appear as source: &lt;INPUT TYPE="IMAGE" SRC="javascript:alert('no scripting attacks')"&gt; 
    103                 </textarea> 
     103                </div> 
    104104                <h3>..after</h3> 
    105105        </div> 
     
    109109        <div style="border: 1px dotted black;"> 
    110110                <h3><label for="blah">blah entry</label></h3> 
    111                 <textarea dojoType="dijit.Editor" 
     111                <div dojoType="dijit.Editor" 
    112112                        plugins="['bold','italic','|','createLink','foreColor','hiliteColor',{name:'dijit._editor.plugins.FontChoice', command:'fontName', generic:true},'fontSize','formatBlock','insertImage']" 
    113113                        styleSheets="../../dojo/resources/dojo.css" id="blah"> 
     
    126126                        <span style="font-family: fantasy">This is fantasy.</span> 
    127127                        <br> 
    128                 </textarea> 
     128                </div> 
    129129                <h3>..after</h3> 
    130130                <button onclick="alert(dijit.byId('blah').getValue());">getValue</button> 
     
    135135        <div style="border: 1px dotted black;"> 
    136136                <h3><label for="blah2">Another blah entry</label></h3> 
    137                 <textarea dojoType="dijit.Editor" 
     137                <div dojoType="dijit.Editor" 
    138138                        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]}]" 
    139139                        styleSheets="../../dojo/resources/dojo.css" id="blah2"> 
     
    143143                                <li>specify options for a plugin (see the last item in the plugins array)</li> 
    144144                        </ol> 
    145                 </textarea> 
     145                </div> 
    146146                <h3>..after</h3> 
    147147        </div> 
  • dijit/trunk/_editor/RichText.js

    r13415 r13699  
    231231                                        } 
    232232                                        if(!this.document.body){ 
    233                                                 throw 'Error'; 
     233                                                throw 'Error'; //FIXME.  A bit more info, if this code stays. 
    234234                                        } 
    235235                                }catch(e){ 
     
    358358 
    359359dojo.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 &lt;TEXTAREA&gt; tag, since the browser unescapes XML escape characters, 
     370                //              like &lt;.  This can have unexpected behavior and lead to security issues 
     371                //              such as scripting attacks. 
    365372                // 
    366373                // contentPreFilters: Array 
     
    406413                this.onLoadDeferred = new dojo.Deferred(); 
    407414 
    408                 //in this constructor, mixin properties are not yet merged, so we have to check for paras here 
    409                 this.useIframe = (dojo.isFF && (dojo.isFF < 3)) || paras['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']; 
    410417 
    411418                if(this.useIframe){ 
     
    464471 
    465472        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                } 
    467476                dojo.publish(dijit._scopeName + "._editor.RichText::init", [this]); 
    468477                this.open();