Ticket #3100: 3100.patch

File 3100.patch, 1.2 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    5555                                        if ( startPath.block )
    5656                                                range.splitBlock();
    5757                                }
    58 
     58                               
     59                                // Normalize text range
     60                                range.trim( false, true );
     61                                var insertingParent = range.startContainer,
     62                                        bm,
     63                                        insertingPoint,
     64                                        isValid = true;
     65                                // Figure out the if insertion point is of valid schema, if not, break the inserting parent.
     66                                while( insertingParent.getName() != 'body' &&
     67                                        !CKEDITOR.dtd[ insertingParent.getName() ][ clone.getName() ] )
     68                                {
     69                                        isValid = false;
     70                                        // Lazy creating position marker for the breaking.
     71                                        if( !bm )
     72                                        {
     73                                                bm  = range.createBookmark();
     74                                                insertingPoint = bm.startNode;
     75                                        }
     76                                        insertingParent = insertingParent.getParent();
     77                                }
     78                                if( !isValid )
     79                                {
     80                                        insertingPoint.breakParent( insertingParent.getFirst() );
     81                                        range.moveToBookmark( bm );
     82                                }
     83                               
    5984                                // Insert the new node.
    6085                                range.insertNode( clone );
    6186
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy