Changeset 13257

Show
Ignore:
Timestamp:
04/01/08 15:07:18 (8 months ago)
Author:
liucougar
Message:

fixes #6372: remove trailing br in LI elements in FF
minor cleanup in RichText?

Location:
dijit/trunk/_editor
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/_editor/plugins/EnterKeyHandling.js

    r12207 r13257  
    5555                                if(!dojo.withGlobal(this.editor.window, 'hasAncestorElement', dijit._editor.selection, ['LI'])){ 
    5656                                        //circulate the undo detection code by calling RichText::execCommand directly 
    57                                         dijit._editor.RichText.prototype.execCommand.apply(this.editor, ['formatblock',this.blockNodeForEnter]); 
     57                                        dijit._editor.RichText.prototype.execCommand.call(this.editor, 'formatblock',this.blockNodeForEnter); 
    5858                                        //set the innerHTML of the new block node 
    5959                                        var block = dojo.withGlobal(this.editor.window, 'getAncestorElement', dijit._editor.selection, [this.blockNodeForEnter]); 
     
    7878                        } 
    7979                        this._checkListLater = false; 
    80                 }else if(this._pressedEnterInBlock){ 
     80                } 
     81                if(this._pressedEnterInBlock){ 
    8182                        //the new created is the original current P, so we have previousSibling below 
    8283                        this.removeTrailingBr(this._pressedEnterInBlock.previousSibling); 
     
    135136 
    136137                if((this._checkListLater = (block.blockNode && block.blockNode.tagName == 'LI'))){ 
     138                    if(dojo.isMoz){ 
     139                                //press enter in middle of P may leave a trailing <br/>, let's remove it later 
     140                                this._pressedEnterInBlock = block.blockNode; 
     141                        } 
    137142                        return true; 
    138143                } 
  • dijit/trunk/_editor/RichText.js

    r13156 r13257  
    14191419        }, 
    14201420 
    1421         _srcInImgRegex  : /(?:(<img(?=\s).*?\ssrc=)("|')(.*?)\2)|(?:(<img\s.*?src=)([^"'][^ >]+))/gi , 
    1422         _hrefInARegex   : /(?:(<a(?=\s).*?\shref=)("|')(.*?)\2)|(?:(<a\s.*?href=)([^"'][^ >]+))/gi , 
    1423  
    14241421        _preFixUrlAttributes: function(/* String */ html){ 
    1425                 return html.replace(this._hrefInARegex, '$1$4$2$3$5$2 _djrealurl=$2$3$5$2') 
    1426                         .replace(this._srcInImgRegex, '$1$4$2$3$5$2 _djrealurl=$2$3$5$2'); // String 
     1422                return html.replace(/(?:(<img(?=\s).*?\ssrc=)("|')(.*?)\2)|(?:(<img\s.*?src=)([^"'][^ >]+))/gi,  
     1423                        '$1$4$2$3$5$2 _djrealurl=$2$3$5$2') 
     1424                        .replace(/(?:(<a(?=\s).*?\shref=)("|')(.*?)\2)|(?:(<a\s.*?href=)([^"'][^ >]+))/gi, 
     1425                            '$1$4$2$3$5$2 _djrealurl=$2$3$5$2'); // String 
    14271426        } 
    14281427});