X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpastefromword%2Ffilter%2Fdefault.js;h=13ff5bcfe5d850470d33611ac793896911677ce3;hb=614511639979907ceb0da3614122a4d8eb963ad4;hp=b042a33cedc03fe466d8e21513856b6ef950fbbd;hpb=c6e377a02b54abc07129d72b632763c727476a15;p=ckeditor.git diff --git a/_source/plugins/pastefromword/filter/default.js b/_source/plugins/pastefromword/filter/default.js index b042a33..13ff5bc 100644 --- a/_source/plugins/pastefromword/filter/default.js +++ b/_source/plugins/pastefromword/filter/default.js @@ -60,15 +60,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license child = child.firstChild( evaluator ); if ( child ) return child; - else - continue; } } return null; }; - // Adding a (set) of styles to the element's attributes. + // Adding a (set) of styles to the element's 'style' attributes. elementPrototype.addStyle = function( name, value, isPrepend ) { var styleText, addingStyleText = ''; @@ -120,8 +118,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license return result; }; - var cssLengthRelativeUnit = /^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz){1}?/i; - var emptyMarginRegex = /^(?:\b0[^\s]*\s*){1,4}$/; + var cssLengthRelativeUnit = /^([.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz){1}?/i; + var emptyMarginRegex = /^(?:\b0[^\s]*\s*){1,4}$/; // e.g. 0px 0pt 0px + var romanLiternalPattern = '^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$', + lowerRomanLiteralRegex = new RegExp( romanLiternalPattern ), + upperRomanLiteralRegex = new RegExp( romanLiternalPattern.toUpperCase() ); var listBaseIndent = 0, previousListItemMargin; @@ -146,8 +147,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { if ( !isNaN( bulletStyle[ 1 ] ) ) bulletStyle = 'decimal'; - // No way to distinguish between Roman numerals and Alphas, - // detect them as a whole. + else if ( lowerRomanLiteralRegex.test( bulletStyle[ 1 ] ) ) + bulletStyle = 'lower-roman'; + else if ( upperRomanLiteralRegex.test( bulletStyle[ 1 ] ) ) + bulletStyle = 'upper-roman'; else if ( /^[a-z]+$/.test( bulletStyle[ 1 ] ) ) bulletStyle = 'lower-alpha'; else if ( /^[A-Z]+$/.test( bulletStyle[ 1 ] ) ) @@ -161,11 +164,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } else { - if ( /[l\u00B7\u2002]/.test( bulletStyle[ 1 ] ) ) //l·• + if ( /[l\u00B7\u2002]/.test( bulletStyle[ 1 ] ) ) bulletStyle = 'disc'; - else if ( /[\u006F\u00D8]/.test( bulletStyle[ 1 ] ) ) //oØ + else if ( /[\u006F\u00D8]/.test( bulletStyle[ 1 ] ) ) bulletStyle = 'circle'; - else if ( /[\u006E\u25C6]/.test( bulletStyle[ 1 ] ) ) //n◆ + else if ( /[\u006E\u25C6]/.test( bulletStyle[ 1 ] ) ) bulletStyle = 'square'; else bulletStyle = 'disc'; @@ -200,8 +203,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license resolveList : function( element ) { // indicate a list item. - var children = element.children, - attrs = element.attributes, + var attrs = element.attributes, listMarker; if ( ( listMarker = element.removeAnyChildWithName( 'cke:listbullet' ) ) @@ -222,7 +224,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { // Be able to deal with component/short-hand form style. var values = margin.split( ' ' ); - margin = values[ 3 ] || values[ 1 ] || values [ 0 ]; + margin = CKEDITOR.plugins.pastefromword.utils.convertToPx( values[ 3 ] || values[ 1 ] || values [ 0 ] ); margin = parseInt( margin, 10 ); // Figure out the indent unit by looking at the first increament. @@ -589,7 +591,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license stylesFilter = filters.stylesFilter, elementMigrateFilter = filters.elementMigrateFilter, styleMigrateFilter = CKEDITOR.tools.bind( this.filters.styleMigrateFilter, this.filters ), - bogusAttrFilter = filters.bogusAttrFilter, createListBulletMarker = this.utils.createListBulletMarker, flattenList = filters.flattenList, assembleList = filters.assembleList, @@ -756,10 +757,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { element.filterChildren(); - var attrs = element.attributes, - parent = element.parent, - children = element.children; - // Is the paragraph actually a list item? if ( resolveListItem( element ) ) return; @@ -829,7 +826,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license element.attributes ); styleText && parent.addStyle( styleText ); delete element.name; - return; } // Convert the merged into a span with all attributes preserved. else