Changeset 6799
- Timestamp:
- 04/28/11 17:23:29 (2 years ago)
- Location:
- CKEditor/trunk
- Files:
-
- 5 edited
-
CHANGES.html (modified) (1 diff)
-
_source/plugins/clipboard/dialogs/paste.js (modified) (3 diffs)
-
_source/plugins/dialog/dialogDefinition.js (modified) (1 diff)
-
_source/plugins/dialog/plugin.js (modified) (2 diffs)
-
_source/plugins/pastetext/dialogs/pastetext.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/trunk/CHANGES.html
r6793 r6799 52 52 <li><a href="http://dev.ckeditor.com/ticket/5788">#5788</a> : Html parser trims empty spaces following <br> elements.</li> 53 53 <li><a href="http://dev.ckeditor.com/ticket/7513">#7513</a> : Invalid markup could lead the editor to hang.</li> 54 <li><a href="http://dev.ckeditor.com/ticket/6109">#6109</a> : Paste and Paste as Plain Text dialog windows now use the standart <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#commitContent">commitContent</a> and <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#setupContent">setupContent</a> methods.</li> 54 55 </ul> 55 56 <h3> -
CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js
r6647 r6799 67 67 this.parts.dialog.$.offsetHeight; 68 68 69 var htmlToLoad = 70 '<html dir="' + editor.config.contentsLangDirection + '"' + 71 ' lang="' + ( editor.config.contentsLanguage || editor.langCode ) + '">' + 72 '<head><style>body { margin: 3px; height: 95%; } </style></head><body>' + 73 '<script id="cke_actscrpt" type="text/javascript">' + 74 'window.parent.CKEDITOR.tools.callFunction( ' + CKEDITOR.tools.addFunction( onPasteFrameLoad, this ) + ', this );' + 75 '</script></body>' + 76 '</html>'; 77 78 var src = 79 CKEDITOR.env.air ? 80 'javascript:void(0)' : 81 isCustomDomain ? 82 'javascript:void((function(){' + 83 'document.open();' + 84 'document.domain=\'' + document.domain + '\';' + 85 'document.close();' + 86 '})())"' 87 : 88 ''; 89 90 var iframe = CKEDITOR.dom.element.createFromHtml( 91 '<iframe' + 92 ' class="cke_pasteframe"' + 93 ' frameborder="0" ' + 94 ' allowTransparency="true"' + 95 ' src="' + src + '"' + 96 ' role="region"' + 97 ' aria-label="' + lang.pasteArea + '"' + 98 ' aria-describedby="' + this.getContentElement( 'general', 'pasteMsg' ).domId + '"' + 99 ' aria-multiple="true"' + 100 '></iframe>' ); 101 102 iframe.on( 'load', function( e ) 103 { 104 e.removeListener(); 105 106 var doc = iframe.getFrameDocument(); 107 doc.write( htmlToLoad ); 108 109 if ( CKEDITOR.env.air ) 110 onPasteFrameLoad.call( this, doc.getWindow().$ ); 111 }, 112 this ); 113 114 iframe.setCustomData( 'dialog', this ); 115 116 var field = this.getContentElement( 'general', 'editing_area' ), 117 container = field.getElement(); 118 container.setHtml( '' ); 119 container.append( iframe ); 120 121 // IE need a redirect on focus to make 122 // the cursor blinking inside iframe. (#5461) 123 if ( CKEDITOR.env.ie ) 124 { 125 var focusGrabber = CKEDITOR.dom.element.createFromHtml( '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' ); 126 focusGrabber.on( 'focus', function() 127 { 128 iframe.$.contentWindow.focus(); 129 }); 130 container.append( focusGrabber ); 131 132 // Override focus handler on field. 133 field.focus = function() 134 { 135 focusGrabber.focus(); 136 this.fire( 'focus' ); 137 }; 138 } 139 140 field.getInputElement = function(){ return iframe; }; 141 142 // Force container to scale in IE. 143 if ( CKEDITOR.env.ie ) 144 { 145 container.setStyle( 'display', 'block' ); 146 container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' ); 147 } 69 this.setupContent(); 148 70 }, 149 71 … … 162 84 onOk : function() 163 85 { 164 var container = this.getContentElement( 'general', 'editing_area' ).getElement(), 165 iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ), 166 editor = this.getParentEditor(), 167 body = iframe.getFrameDocument().getBody(), 168 bogus = body.getBogus(), 169 html; 170 bogus && bogus.remove(); 171 // Saving the contents in variable so changes until paste is complete will not take place (#7500) 172 html = body.getHtml(); 173 174 setTimeout( function(){ 175 editor.fire( 'paste', { 'html' : html } ); 176 }, 0 ); 177 86 this.commitContent(); 178 87 }, 179 88 … … 209 118 win.focus(); 210 119 }, 500 ); 120 }, 121 setup : function() 122 { 123 var dialog = this.getDialog(); 124 var htmlToLoad = 125 '<html dir="' + editor.config.contentsLangDirection + '"' + 126 ' lang="' + ( editor.config.contentsLanguage || editor.langCode ) + '">' + 127 '<head><style>body { margin: 3px; height: 95%; } </style></head><body>' + 128 '<script id="cke_actscrpt" type="text/javascript">' + 129 'window.parent.CKEDITOR.tools.callFunction( ' + CKEDITOR.tools.addFunction( onPasteFrameLoad, dialog ) + ', this );' + 130 '</script></body>' + 131 '</html>'; 132 133 var src = 134 CKEDITOR.env.air ? 135 'javascript:void(0)' : 136 isCustomDomain ? 137 'javascript:void((function(){' + 138 'document.open();' + 139 'document.domain=\'' + document.domain + '\';' + 140 'document.close();' + 141 '})())"' 142 : 143 ''; 144 145 var iframe = CKEDITOR.dom.element.createFromHtml( 146 '<iframe' + 147 ' class="cke_pasteframe"' + 148 ' frameborder="0" ' + 149 ' allowTransparency="true"' + 150 ' src="' + src + '"' + 151 ' role="region"' + 152 ' aria-label="' + lang.pasteArea + '"' + 153 ' aria-describedby="' + dialog.getContentElement( 'general', 'pasteMsg' ).domId + '"' + 154 ' aria-multiple="true"' + 155 '></iframe>' ); 156 157 iframe.on( 'load', function( e ) 158 { 159 e.removeListener(); 160 161 var doc = iframe.getFrameDocument(); 162 doc.write( htmlToLoad ); 163 164 if ( CKEDITOR.env.air ) 165 onPasteFrameLoad.call( this, doc.getWindow().$ ); 166 }, dialog ); 167 168 iframe.setCustomData( 'dialog', dialog ); 169 170 var container = this.getElement(); 171 container.setHtml( '' ); 172 container.append( iframe ); 173 174 // IE need a redirect on focus to make 175 // the cursor blinking inside iframe. (#5461) 176 if ( CKEDITOR.env.ie ) 177 { 178 var focusGrabber = CKEDITOR.dom.element.createFromHtml( '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' ); 179 focusGrabber.on( 'focus', function() 180 { 181 iframe.$.contentWindow.focus(); 182 }); 183 container.append( focusGrabber ); 184 185 // Override focus handler on field. 186 this.focus = function() 187 { 188 focusGrabber.focus(); 189 this.fire( 'focus' ); 190 }; 191 } 192 193 this.getInputElement = function(){ return iframe; }; 194 195 // Force container to scale in IE. 196 if ( CKEDITOR.env.ie ) 197 { 198 container.setStyle( 'display', 'block' ); 199 container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' ); 200 } 201 }, 202 commit : function( data ) 203 { 204 var container = this.getElement(), 205 editor = this.getDialog().getParentEditor(), 206 body = this.getInputElement().getFrameDocument().getBody(), 207 bogus = body.getBogus(), 208 html; 209 bogus && bogus.remove(); 210 211 // Saving the contents so changes until paste is complete will not take place (#7500) 212 html = body.getHtml(); 213 214 setTimeout( function(){ 215 editor.fire( 'paste', { 'html' : html } ); 216 }, 0 ); 211 217 } 212 218 } -
CKEditor/trunk/_source/plugins/dialog/dialogDefinition.js
r6652 r6799 283 283 * Function to execute whenever the UI element's parent dialog is closed. 284 284 * @name CKEDITOR.dialog.definition.uiElement.prototype.onHide 285 * @field 286 * @type Function 287 * @example 288 */ 289 290 /** 291 * Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.setupContent} method is executed. 292 * It usually takes care of the respective UI element as a standalone element. 293 * @name CKEDITOR.dialog.definition.uiElement.prototype.setup 294 * @field 295 * @type Function 296 * @example 297 */ 298 299 /** 300 * Function to execute whenever the UI element's parent dialog's {@link CKEDITOR.dialog.definition.commitContent} method is executed. 301 * It usually takes care of the respective UI element as a standalone element. 302 * @name CKEDITOR.dialog.definition.uiElement.prototype.commit 285 303 * @field 286 304 * @type Function -
CKEditor/trunk/_source/plugins/dialog/plugin.js
r6676 r6799 860 860 })(), 861 861 862 863 /** 864 * Calls the {@link CKEDITOR.dialog.definition.uiElement#setup} method of each of the UI elements, with the arguments passed through it. 865 * It is usually being called when the dialog is opened, to put the initial value inside the field. 866 * @example 867 * dialogObj.setupContent(); 868 * @example 869 * var timestamp = ( new Date() ).valueOf(); 870 * dialogObj.setupContent( timestamp ); 871 */ 862 872 setupContent : function() 863 873 { … … 870 880 }, 871 881 882 /** 883 * Calls the {@link CKEDITOR.dialog.definition.uiElement#commit} method of each of the UI elements, with the arguments passed through it. 884 * It is usually being called when the user confirms the dialog, to process the values. 885 * @example 886 * dialogObj.commitContent(); 887 * @example 888 * var timestamp = ( new Date() ).valueOf(); 889 * dialogObj.commitContent( timestamp ); 890 */ 872 891 commitContent : function() 873 892 { -
CKEditor/trunk/_source/plugins/pastetext/dialogs/pastetext.js
r6348 r6799 14 14 minHeight : 240, 15 15 16 onShow : function() 17 { 18 // Reset the textarea value. 19 this.getContentElement( 'general', 'content' ).getInputElement().setValue( '' ); 20 }, 21 22 onOk : function() 23 { 24 // Get the textarea value. 25 var text = this.getContentElement( 'general', 'content' ).getInputElement().getValue(), 26 editor = this.getParentEditor(); 27 28 setTimeout( function() 29 { 30 editor.fire( 'paste', { 'text' : text } ); 31 }, 0 ); 32 }, 16 onShow : function(){ this.setupContent(); }, 17 onOk : function(){ this.commitContent(); }, 33 18 34 19 contents : … … 61 46 { 62 47 this.getElement().focus(); 48 }, 49 setup : function() 50 { 51 this.setValue( '' ); 52 }, 53 commit : function() 54 { 55 var value = this.getValue(); 56 setTimeout( function() 57 { 58 editor.fire( 'paste', { 'text' : value } ); 59 }, 0 ); 63 60 } 64 61 }
Note: See TracChangeset
for help on using the changeset viewer.
