IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Writes write the CDATA with no special manipulations. |
36 | | * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. |
| 36 | * @param {CKEDITOR.htmlWriter} [writer] The writer to which write the HTML. |
37 | 37 | */ |
38 | 38 | writeHtml : function( writer ) |
39 | 39 | { |
40 | | writer.write( this.value ); |
| 40 | writer && writer.write( this.value ); |
41 | 41 | } |
42 | 42 | }; |
43 | 43 | })(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
513 | 513 | { |
514 | 514 | for ( var i = 0 ; i < this.children.length ; i++ ) |
515 | 515 | this.children[i].writeHtml( writer, filter ); |
| 516 | }, |
| 517 | |
| 518 | /** |
| 519 | * Dry-run the specified filter on this node and its children without outputting. |
| 520 | * @see {#writeHtml} |
| 521 | * @param filter {CKEDITOR.htmlParser.filter} |
| 522 | */ |
| 523 | filterHtml : function( filter ) |
| 524 | { |
| 525 | this.writeHtml( null, filter ); |
516 | 526 | } |
517 | 527 | }; |
| 528 | |
| 529 | |
518 | 530 | })(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Writes the HTML representation of this comment to a CKEDITOR.htmlWriter. |
38 | | * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. |
| 38 | * @param {CKEDITOR.htmlWriter} [writer] The writer to which write the HTML. |
39 | 39 | * @example |
40 | 40 | */ |
41 | 41 | writeHtml : function( writer, filter ) |
… |
… |
|
53 | 53 | comment.writeHtml( writer, filter ); |
54 | 54 | return; |
55 | 55 | } |
| 56 | |
| 57 | // Update node in case of filter dry-run. |
| 58 | this.value = comment; |
56 | 59 | } |
57 | 60 | |
58 | | writer.comment( comment ); |
| 61 | writer && writer.comment( comment ); |
59 | 62 | } |
60 | 63 | }; |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
191 | 191 | { |
192 | 192 | while ( true ) |
193 | 193 | { |
194 | | if ( !( writeName = filter.onElementName( writeName ) ) ) |
195 | | return; |
| 194 | if ( writeName ) |
| 195 | { |
| 196 | if ( !( writeName = filter.onElementName( writeName ) ) ) |
| 197 | return; |
196 | 198 | |
197 | | element.name = writeName; |
| 199 | element.name = writeName; |
198 | 200 | |
199 | | if ( !( element = filter.onElement( element ) ) ) |
200 | | return; |
| 201 | if ( !( element = filter.onElement( element ) ) ) |
| 202 | return; |
201 | 203 | |
202 | | element.parent = this.parent; |
| 204 | element.parent = this.parent; |
203 | 205 | |
204 | | if ( element.name == writeName ) |
205 | | break; |
| 206 | if ( element.name == writeName ) |
| 207 | break; |
206 | 208 | |
207 | | // If the element has been replaced with something of a |
208 | | // different type, then make the replacement write itself. |
209 | | if ( element.type != CKEDITOR.NODE_ELEMENT ) |
210 | | { |
211 | | element.writeHtml( writer, filter ); |
212 | | return; |
213 | | } |
| 209 | // If the element has been replaced with something of a |
| 210 | // different type, then make the replacement write itself. |
| 211 | if ( element.type != CKEDITOR.NODE_ELEMENT ) |
| 212 | { |
| 213 | element.writeHtml( writer, filter ); |
| 214 | return; |
| 215 | } |
| 216 | } |
214 | 217 | |
215 | 218 | writeName = element.name; |
216 | 219 | |
… |
… |
|
233 | 236 | } |
234 | 237 | |
235 | 238 | // Open element tag. |
236 | | writer.openTag( writeName, attributes ); |
| 239 | writer && writer.openTag( writeName, attributes ); |
237 | 240 | |
238 | 241 | // Copy all attributes to an array. |
239 | 242 | var attribsArray = []; |
… |
… |
|
275 | 278 | } |
276 | 279 | } |
277 | 280 | } |
278 | | // Sort the attributes by name. |
279 | | if ( writer.sortAttributes ) |
280 | | attribsArray.sort( sortAttribs ); |
| 281 | |
| 282 | if ( writer ) |
| 283 | { |
| 284 | // Sort the attributes by name. |
| 285 | if ( writer.sortAttributes ) |
| 286 | attribsArray.sort( sortAttribs ); |
281 | 287 | |
282 | | // Send the attributes. |
283 | | var len = attribsArray.length; |
284 | | for ( i = 0 ; i < len ; i++ ) |
285 | | { |
286 | | var attrib = attribsArray[ i ]; |
287 | | writer.attribute( attrib[0], attrib[1] ); |
288 | | } |
| 288 | // Send the attributes. |
| 289 | var len = attribsArray.length; |
| 290 | for ( i = 0; i < len; i++ ) |
| 291 | { |
| 292 | var attrib = attribsArray[ i ]; |
| 293 | writer.attribute( attrib[0], attrib[1] ); |
| 294 | } |
289 | 295 | |
290 | | // Close the tag. |
291 | | writer.openTagClose( writeName, element.isEmpty ); |
| 296 | // Close the tag. |
| 297 | writer.openTagClose( writeName, element.isEmpty ); |
| 298 | } |
292 | 299 | |
293 | 300 | if ( !element.isEmpty ) |
294 | 301 | { |
295 | 302 | this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter ); |
296 | 303 | // Close the element. |
297 | | writer.closeTag( writeName ); |
| 304 | writer && writer.closeTag( writeName ); |
298 | 305 | } |
299 | 306 | }, |
300 | 307 | |
… |
… |
|
303 | 310 | // Send children. |
304 | 311 | CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments ); |
305 | 312 | |
306 | | } |
| 313 | }, |
| 314 | |
| 315 | /** |
| 316 | * @see CKEDITOR.htmlParser.fragment.prototype.filterHtml |
| 317 | */ |
| 318 | filterHtml : CKEDITOR.htmlParser.fragment.prototype.filterHtml |
307 | 319 | }; |
308 | 320 | })(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
487 | 487 | { |
488 | 488 | toHtml : function( data, fixForBody ) |
489 | 489 | { |
| 490 | // Fire "beforeProcessData" so data manipulation may happen. |
| 491 | var eventData = { data : data }; |
| 492 | this.editor.fire( 'beforeProcessData', eventData ); |
| 493 | data = eventData.data; |
| 494 | |
490 | 495 | // The source data is already HTML, but we need to clean |
491 | 496 | // it up and apply the filter. |
492 | 497 | |
… |
… |
|
539 | 544 | |
540 | 545 | // Now use our parser to make further fixes to the structure, as |
541 | 546 | // well as apply the filter. |
542 | | var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data, fixForBody ), |
543 | | writer = new CKEDITOR.htmlParser.basicWriter(); |
| 547 | var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data, fixForBody ); |
544 | 548 | |
| 549 | // Fire "beforeFilterData" to allow pre-filtering with custom rules. |
| 550 | this.editor.fire( 'beforeFilterData', { fragment : fragment } ); |
| 551 | |
| 552 | // Run through the default filters. |
| 553 | var writer = new CKEDITOR.htmlParser.basicWriter(); |
545 | 554 | fragment.writeHtml( writer, this.dataFilter ); |
546 | 555 | data = writer.getHtml( true ); |
547 | 556 | |
… |
… |
|
553 | 562 | |
554 | 563 | toDataFormat : function( html, fixForBody ) |
555 | 564 | { |
| 565 | // Fire "beforeProcessHtml" so data manipulation may happen. |
| 566 | var eventData = { html : html }; |
| 567 | this.editor.fire( 'beforeProcessHtml', eventData ); |
| 568 | html = eventData.html; |
| 569 | |
556 | 570 | var writer = this.writer, |
557 | 571 | fragment = CKEDITOR.htmlParser.fragment.fromHtml( html, fixForBody ); |
| 572 | |
| 573 | // Fire "beforeFilterHtml" to allow pre-filtering with custom rules. |
| 574 | this.editor.fire( 'beforeFilterHtml', { fragment : fragment } ); |
558 | 575 | |
559 | 576 | writer.reset(); |
560 | 577 | |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
1272 | 1272 | } |
1273 | 1273 | }); |
1274 | 1274 | |
1275 | | // The paste processor here is just a reduced copy of html data processor. |
1276 | | var pasteProcessor = function() |
| 1275 | // These are instance-irrelevant rules for post cleanup which are applied afterward. |
| 1276 | var cleanupFilter = new CKEDITOR.htmlParser.filter(); |
| 1277 | cleanupFilter.addRules( |
1277 | 1278 | { |
1278 | | this.dataFilter = new CKEDITOR.htmlParser.filter(); |
1279 | | }; |
1280 | | |
1281 | | pasteProcessor.prototype = |
1282 | | { |
1283 | | toHtml : function( data ) |
1284 | | { |
1285 | | var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data, false ), |
1286 | | writer = new CKEDITOR.htmlParser.basicWriter(); |
1287 | | |
1288 | | fragment.writeHtml( writer, this.dataFilter ); |
1289 | | return writer.getHtml( true ); |
1290 | | } |
1291 | | }; |
| 1279 | attributeNames : |
| 1280 | [ |
| 1281 | // Remove onmouseover and onmouseout events (from MS Word comments effect) |
| 1282 | [ ( /^cke:.*/ ), '' ] |
| 1283 | ], |
| 1284 | attributes : |
| 1285 | { |
| 1286 | 'style' : function( value ) |
| 1287 | { |
| 1288 | if ( !value ) |
| 1289 | return false; |
| 1290 | } |
| 1291 | }, |
| 1292 | elements : |
| 1293 | { |
| 1294 | 'span' : function( element ) |
| 1295 | { |
| 1296 | // Remove dummy spans (attribute-less). |
| 1297 | if ( CKEDITOR.tools.isEmpty( element.attributes ) ) |
| 1298 | element.name = ''; |
| 1299 | } |
| 1300 | } |
| 1301 | }); |
1292 | 1302 | |
1293 | 1303 | CKEDITOR.cleanWord = function( data, editor ) |
1294 | 1304 | { |
1295 | | // Firefox will be confused by those downlevel-revealed IE conditional |
1296 | | // comments, fixing them first( convert it to upperlevel-revealed one ). |
1297 | | // e.g. <![if !vml]>...<![endif]> |
1298 | | if ( CKEDITOR.env.gecko ) |
1299 | | data = data.replace( /(<!--\[if[^<]*?\])-->([\S\s]*?)<!--(\[endif\]-->)/gi, '$1$2$3' ); |
| 1305 | // These rules are instance related logic that converting MS-HTML to html. |
| 1306 | var defaultFilter = new CKEDITOR.htmlParser.filter(); |
| 1307 | defaultFilter.addRules( CKEDITOR.plugins.pastefromword.getRules( editor ) ); |
1300 | 1308 | |
1301 | | var dataProcessor = new pasteProcessor(), |
1302 | | dataFilter = dataProcessor.dataFilter; |
| 1309 | editor.on( 'beforeFilterData', function( evt ) |
| 1310 | { |
| 1311 | // Just for this run. |
| 1312 | evt.removeListener(); |
1303 | 1313 | |
1304 | | // These rules will have higher priorities than default ones. |
1305 | | dataFilter.addRules( CKEDITOR.plugins.pastefromword.getRules( editor ) ); |
| 1314 | var fragment = evt.data.fragment; |
1306 | 1315 | |
1307 | | // Allow extending data filter rules. |
1308 | | editor.fire( 'beforeCleanWord', { filter : dataFilter } ); |
| 1316 | // Allow extending data filter rules. |
| 1317 | editor.fire( 'beforeCleanWord', { filter : defaultFilter } ); |
1309 | 1318 | |
1310 | | try |
1311 | | { |
1312 | | data = dataProcessor.toHtml( data, false ); |
1313 | | } |
1314 | | catch ( e ) |
1315 | | { |
1316 | | alert( editor.lang.pastefromword.error ); |
1317 | | } |
| 1319 | fragment.filterHtml( defaultFilter ); |
| 1320 | fragment.filterHtml( cleanupFilter ); |
| 1321 | } ); |
1318 | 1322 | |
1319 | | /* Below post processing those things that are unable to delivered by filter rules. */ |
1320 | | |
1321 | | // Remove 'cke' namespaced attribute used in filter rules as marker. |
1322 | | data = data.replace( /cke:.*?".*?"/g, '' ); |
1323 | | |
1324 | | // Remove empty style attribute. |
1325 | | data = data.replace( /style=""/g, '' ); |
1326 | | |
1327 | | // Remove the dummy spans ( having no inline style ). |
1328 | | data = data.replace( /<span>/g, '' ); |
| 1323 | // Firefox will be confused by those downlevel-revealed IE conditional |
| 1324 | // comments, fixing them first( convert it to upperlevel-revealed one ). |
| 1325 | // e.g. <![if !vml]>...<![endif]> |
| 1326 | if ( CKEDITOR.env.gecko ) |
| 1327 | data = data.replace( /(<!--\[if[^<]*?\])-->([\S\s]*?)<!--(\[endif\]-->)/gi, '$1$2$3' ); |
1329 | 1328 | |
1330 | 1329 | return data; |
1331 | 1330 | }; |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
44 | 44 | { |
45 | 45 | var text = this.value; |
46 | 46 | |
47 | | if ( filter && !( text = filter.onText( text, this ) ) ) |
48 | | return; |
| 47 | if ( filter ) |
| 48 | { |
| 49 | if ( !( text = filter.onText( text, this ) ) ) |
| 50 | return; |
49 | 51 | |
50 | | writer.text( text ); |
| 52 | // Update node in case of filter dry-run. |
| 53 | this.value = text; |
| 54 | } |
| 55 | |
| 56 | writer && writer.text( text ); |
51 | 57 | } |
52 | 58 | }; |
53 | 59 | })(); |