JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5
[ckeditor.git] / _source / plugins / pastetext / plugin.js
index 2d03974..d7b1b34 100644 (file)
@@ -37,20 +37,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                }\r
        };\r
 \r
-       function doInsertText( doc, text )\r
-       {\r
-               // Native text insertion.\r
-               if ( CKEDITOR.env.ie )\r
-               {\r
-                       var selection = doc.selection;\r
-                       if ( selection.type == 'Control' )\r
-                               selection.clear();\r
-                       selection.createRange().pasteHTML( text );\r
-               }\r
-               else\r
-                       doc.execCommand( 'inserthtml', false, text );\r
-       }\r
-\r
        // Register the plugin.\r
        CKEDITOR.plugins.add( 'pastetext',\r
        {\r
@@ -84,52 +70,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                requires : [ 'clipboard' ]\r
        });\r
 \r
-       function doEnter( editor, mode, times, forceMode )\r
-       {\r
-               while ( times-- )\r
-               {\r
-                       CKEDITOR.plugins.enterkey[ mode == CKEDITOR.ENTER_BR ? 'enterBr' : 'enterBlock' ]\r
-                                       ( editor, mode, null, forceMode );\r
-               }\r
-       }\r
-\r
-       CKEDITOR.editor.prototype.insertText = function( text )\r
-       {\r
-               this.focus();\r
-               this.fire( 'saveSnapshot' );\r
-\r
-               var mode = this.getSelection().getStartElement().hasAscendant( 'pre', true ) ? CKEDITOR.ENTER_BR : this.config.enterMode,\r
-                       isEnterBrMode = mode == CKEDITOR.ENTER_BR,\r
-                       doc = this.document.$,\r
-                       self = this,\r
-                       line;\r
-\r
-               text = CKEDITOR.tools.htmlEncode( text.replace( /\r\n|\r/g, '\n' ) );\r
-\r
-               var startIndex = 0;\r
-               text.replace( /\n+/g, function( match, lastIndex )\r
-                {\r
-                       line = text.substring( startIndex, lastIndex );\r
-                       startIndex = lastIndex + match.length;\r
-                       line.length && doInsertText( doc, line );\r
-\r
-                       var lineBreakNums = match.length,\r
-                               // Duo consequence line-break as a enter block.\r
-                               enterBlockTimes = isEnterBrMode ? 0 : Math.floor( lineBreakNums / 2 ),\r
-                               // Per link-break as a enter br.\r
-                               enterBrTimes = isEnterBrMode ? lineBreakNums : lineBreakNums % 2;\r
-\r
-                       // Line-breaks are converted to editor enter key strokes.\r
-                       doEnter( self, mode, enterBlockTimes );\r
-                       doEnter( self, CKEDITOR.ENTER_BR, enterBrTimes, isEnterBrMode ? false : true );\r
-                });\r
-\r
-               // Insert the last text line of text.\r
-               line = text.substring( startIndex, text.length );\r
-               line.length && doInsertText( doc, line );\r
-\r
-               this.fire( 'saveSnapshot' );\r
-       };\r
 })();\r
 \r
 \r