From 7adcb81e4f83f98c468889aaa5a85558ba88c770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 25 Jan 2016 17:45:33 +0100 Subject: Initial commit --- sources/plugins/pastefromword/filter/default.js | 1251 ++++++++++++++++++++ .../icons/hidpi/pastefromword-rtl.png | Bin 0 -> 2090 bytes .../pastefromword/icons/hidpi/pastefromword.png | Bin 0 -> 2105 bytes .../pastefromword/icons/pastefromword-rtl.png | Bin 0 -> 720 bytes .../plugins/pastefromword/icons/pastefromword.png | Bin 0 -> 723 bytes sources/plugins/pastefromword/lang/af.js | 10 + sources/plugins/pastefromword/lang/ar.js | 10 + sources/plugins/pastefromword/lang/bg.js | 10 + sources/plugins/pastefromword/lang/bn.js | 10 + sources/plugins/pastefromword/lang/bs.js | 10 + sources/plugins/pastefromword/lang/ca.js | 10 + sources/plugins/pastefromword/lang/cs.js | 10 + sources/plugins/pastefromword/lang/cy.js | 10 + sources/plugins/pastefromword/lang/da.js | 10 + sources/plugins/pastefromword/lang/de.js | 10 + sources/plugins/pastefromword/lang/el.js | 10 + sources/plugins/pastefromword/lang/en-au.js | 10 + sources/plugins/pastefromword/lang/en-ca.js | 10 + sources/plugins/pastefromword/lang/en-gb.js | 10 + sources/plugins/pastefromword/lang/en.js | 10 + sources/plugins/pastefromword/lang/eo.js | 10 + sources/plugins/pastefromword/lang/es.js | 10 + sources/plugins/pastefromword/lang/et.js | 10 + sources/plugins/pastefromword/lang/eu.js | 10 + sources/plugins/pastefromword/lang/fa.js | 10 + sources/plugins/pastefromword/lang/fi.js | 10 + sources/plugins/pastefromword/lang/fo.js | 10 + sources/plugins/pastefromword/lang/fr-ca.js | 10 + sources/plugins/pastefromword/lang/fr.js | 10 + sources/plugins/pastefromword/lang/gl.js | 10 + sources/plugins/pastefromword/lang/gu.js | 10 + sources/plugins/pastefromword/lang/he.js | 10 + sources/plugins/pastefromword/lang/hi.js | 10 + sources/plugins/pastefromword/lang/hr.js | 10 + sources/plugins/pastefromword/lang/hu.js | 10 + sources/plugins/pastefromword/lang/id.js | 10 + sources/plugins/pastefromword/lang/is.js | 10 + sources/plugins/pastefromword/lang/it.js | 10 + sources/plugins/pastefromword/lang/ja.js | 10 + sources/plugins/pastefromword/lang/ka.js | 10 + sources/plugins/pastefromword/lang/km.js | 10 + sources/plugins/pastefromword/lang/ko.js | 10 + sources/plugins/pastefromword/lang/ku.js | 10 + sources/plugins/pastefromword/lang/lt.js | 10 + sources/plugins/pastefromword/lang/lv.js | 10 + sources/plugins/pastefromword/lang/mk.js | 10 + sources/plugins/pastefromword/lang/mn.js | 10 + sources/plugins/pastefromword/lang/ms.js | 10 + sources/plugins/pastefromword/lang/nb.js | 10 + sources/plugins/pastefromword/lang/nl.js | 10 + sources/plugins/pastefromword/lang/no.js | 10 + sources/plugins/pastefromword/lang/pl.js | 10 + sources/plugins/pastefromword/lang/pt-br.js | 10 + sources/plugins/pastefromword/lang/pt.js | 10 + sources/plugins/pastefromword/lang/ro.js | 10 + sources/plugins/pastefromword/lang/ru.js | 10 + sources/plugins/pastefromword/lang/si.js | 10 + sources/plugins/pastefromword/lang/sk.js | 10 + sources/plugins/pastefromword/lang/sl.js | 10 + sources/plugins/pastefromword/lang/sq.js | 10 + sources/plugins/pastefromword/lang/sr-latn.js | 10 + sources/plugins/pastefromword/lang/sr.js | 10 + sources/plugins/pastefromword/lang/sv.js | 10 + sources/plugins/pastefromword/lang/th.js | 10 + sources/plugins/pastefromword/lang/tr.js | 10 + sources/plugins/pastefromword/lang/tt.js | 10 + sources/plugins/pastefromword/lang/ug.js | 10 + sources/plugins/pastefromword/lang/uk.js | 10 + sources/plugins/pastefromword/lang/vi.js | 10 + sources/plugins/pastefromword/lang/zh-cn.js | 10 + sources/plugins/pastefromword/lang/zh.js | 10 + sources/plugins/pastefromword/plugin.js | 149 +++ 72 files changed, 2060 insertions(+) create mode 100644 sources/plugins/pastefromword/filter/default.js create mode 100644 sources/plugins/pastefromword/icons/hidpi/pastefromword-rtl.png create mode 100644 sources/plugins/pastefromword/icons/hidpi/pastefromword.png create mode 100644 sources/plugins/pastefromword/icons/pastefromword-rtl.png create mode 100644 sources/plugins/pastefromword/icons/pastefromword.png create mode 100644 sources/plugins/pastefromword/lang/af.js create mode 100644 sources/plugins/pastefromword/lang/ar.js create mode 100644 sources/plugins/pastefromword/lang/bg.js create mode 100644 sources/plugins/pastefromword/lang/bn.js create mode 100644 sources/plugins/pastefromword/lang/bs.js create mode 100644 sources/plugins/pastefromword/lang/ca.js create mode 100644 sources/plugins/pastefromword/lang/cs.js create mode 100644 sources/plugins/pastefromword/lang/cy.js create mode 100644 sources/plugins/pastefromword/lang/da.js create mode 100644 sources/plugins/pastefromword/lang/de.js create mode 100644 sources/plugins/pastefromword/lang/el.js create mode 100644 sources/plugins/pastefromword/lang/en-au.js create mode 100644 sources/plugins/pastefromword/lang/en-ca.js create mode 100644 sources/plugins/pastefromword/lang/en-gb.js create mode 100644 sources/plugins/pastefromword/lang/en.js create mode 100644 sources/plugins/pastefromword/lang/eo.js create mode 100644 sources/plugins/pastefromword/lang/es.js create mode 100644 sources/plugins/pastefromword/lang/et.js create mode 100644 sources/plugins/pastefromword/lang/eu.js create mode 100644 sources/plugins/pastefromword/lang/fa.js create mode 100644 sources/plugins/pastefromword/lang/fi.js create mode 100644 sources/plugins/pastefromword/lang/fo.js create mode 100644 sources/plugins/pastefromword/lang/fr-ca.js create mode 100644 sources/plugins/pastefromword/lang/fr.js create mode 100644 sources/plugins/pastefromword/lang/gl.js create mode 100644 sources/plugins/pastefromword/lang/gu.js create mode 100644 sources/plugins/pastefromword/lang/he.js create mode 100644 sources/plugins/pastefromword/lang/hi.js create mode 100644 sources/plugins/pastefromword/lang/hr.js create mode 100644 sources/plugins/pastefromword/lang/hu.js create mode 100644 sources/plugins/pastefromword/lang/id.js create mode 100644 sources/plugins/pastefromword/lang/is.js create mode 100644 sources/plugins/pastefromword/lang/it.js create mode 100644 sources/plugins/pastefromword/lang/ja.js create mode 100644 sources/plugins/pastefromword/lang/ka.js create mode 100644 sources/plugins/pastefromword/lang/km.js create mode 100644 sources/plugins/pastefromword/lang/ko.js create mode 100644 sources/plugins/pastefromword/lang/ku.js create mode 100644 sources/plugins/pastefromword/lang/lt.js create mode 100644 sources/plugins/pastefromword/lang/lv.js create mode 100644 sources/plugins/pastefromword/lang/mk.js create mode 100644 sources/plugins/pastefromword/lang/mn.js create mode 100644 sources/plugins/pastefromword/lang/ms.js create mode 100644 sources/plugins/pastefromword/lang/nb.js create mode 100644 sources/plugins/pastefromword/lang/nl.js create mode 100644 sources/plugins/pastefromword/lang/no.js create mode 100644 sources/plugins/pastefromword/lang/pl.js create mode 100644 sources/plugins/pastefromword/lang/pt-br.js create mode 100644 sources/plugins/pastefromword/lang/pt.js create mode 100644 sources/plugins/pastefromword/lang/ro.js create mode 100644 sources/plugins/pastefromword/lang/ru.js create mode 100644 sources/plugins/pastefromword/lang/si.js create mode 100644 sources/plugins/pastefromword/lang/sk.js create mode 100644 sources/plugins/pastefromword/lang/sl.js create mode 100644 sources/plugins/pastefromword/lang/sq.js create mode 100644 sources/plugins/pastefromword/lang/sr-latn.js create mode 100644 sources/plugins/pastefromword/lang/sr.js create mode 100644 sources/plugins/pastefromword/lang/sv.js create mode 100644 sources/plugins/pastefromword/lang/th.js create mode 100644 sources/plugins/pastefromword/lang/tr.js create mode 100644 sources/plugins/pastefromword/lang/tt.js create mode 100644 sources/plugins/pastefromword/lang/ug.js create mode 100644 sources/plugins/pastefromword/lang/uk.js create mode 100644 sources/plugins/pastefromword/lang/vi.js create mode 100644 sources/plugins/pastefromword/lang/zh-cn.js create mode 100644 sources/plugins/pastefromword/lang/zh.js create mode 100644 sources/plugins/pastefromword/plugin.js (limited to 'sources/plugins/pastefromword') diff --git a/sources/plugins/pastefromword/filter/default.js b/sources/plugins/pastefromword/filter/default.js new file mode 100644 index 00000000..0c97ef52 --- /dev/null +++ b/sources/plugins/pastefromword/filter/default.js @@ -0,0 +1,1251 @@ +/** + * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ + +( function() { + var fragmentPrototype = CKEDITOR.htmlParser.fragment.prototype, + elementPrototype = CKEDITOR.htmlParser.element.prototype; + + fragmentPrototype.onlyChild = elementPrototype.onlyChild = function() { + var children = this.children, + count = children.length, + firstChild = ( count == 1 ) && children[ 0 ]; + return firstChild || null; + }; + + elementPrototype.removeAnyChildWithName = function( tagName ) { + var children = this.children, + childs = [], + child; + + for ( var i = 0; i < children.length; i++ ) { + child = children[ i ]; + if ( !child.name ) + continue; + + if ( child.name == tagName ) { + childs.push( child ); + children.splice( i--, 1 ); + } + childs = childs.concat( child.removeAnyChildWithName( tagName ) ); + } + return childs; + }; + + elementPrototype.getAncestor = function( tagNameRegex ) { + var parent = this.parent; + while ( parent && !( parent.name && parent.name.match( tagNameRegex ) ) ) + parent = parent.parent; + return parent; + }; + + fragmentPrototype.firstChild = elementPrototype.firstChild = function( evaluator ) { + var child; + + for ( var i = 0; i < this.children.length; i++ ) { + child = this.children[ i ]; + if ( evaluator( child ) ) + return child; + else if ( child.name ) { + child = child.firstChild( evaluator ); + if ( child ) + return child; + } + } + + return null; + }; + + // Adding a (set) of styles to the element's 'style' attributes. + elementPrototype.addStyle = function( name, value, isPrepend ) { + var styleText, + addingStyleText = ''; + // name/value pair. + if ( typeof value == 'string' ) + addingStyleText += name + ':' + value + ';'; + else { + // style literal. + if ( typeof name == 'object' ) { + for ( var style in name ) { + if ( name.hasOwnProperty( style ) ) + addingStyleText += style + ':' + name[ style ] + ';'; + } + } + // raw style text form. + else { + addingStyleText += name; + } + + isPrepend = value; + } + + if ( !this.attributes ) + this.attributes = {}; + + styleText = this.attributes.style || ''; + + styleText = ( isPrepend ? [ addingStyleText, styleText ] : [ styleText, addingStyleText ] ).join( ';' ); + + this.attributes.style = styleText.replace( /^;+|;(?=;)/g, '' ); + }; + + // Retrieve a style property value of the element. + elementPrototype.getStyle = function( name ) { + var styles = this.attributes.style; + if ( styles ) { + styles = CKEDITOR.tools.parseCssText( styles, 1 ); + return styles[ name ]; + } + }; + + /** + * Return the DTD-valid parent tag names of the specified one. + * + * @member CKEDITOR.dtd + * @param {String} tagName + * @returns {Object} + */ + CKEDITOR.dtd.parentOf = function( tagName ) { + var result = {}; + for ( var tag in this ) { + if ( tag.indexOf( '$' ) == -1 && this[ tag ][ tagName ] ) + result[ tag ] = 1; + } + return result; + }; + + // 1. move consistent list item styles up to list root. + // 2. clear out unnecessary list item numbering. + function postProcessList( list ) { + var children = list.children, + child, attrs, + count = list.children.length, + match, mergeStyle, + styleTypeRegexp = /list-style-type:(.*?)(?:;|$)/, + stylesFilter = CKEDITOR.plugins.pastefromword.filters.stylesFilter; + + attrs = list.attributes; + if ( styleTypeRegexp.exec( attrs.style ) ) + return; + + for ( var i = 0; i < count; i++ ) { + child = children[ i ]; + + if ( child.attributes.value && Number( child.attributes.value ) == i + 1 ) + delete child.attributes.value; + + match = styleTypeRegexp.exec( child.attributes.style ); + + if ( match ) { + if ( match[ 1 ] == mergeStyle || !mergeStyle ) + mergeStyle = match[ 1 ]; + else { + mergeStyle = null; + break; + } + } + } + + if ( mergeStyle ) { + for ( i = 0; i < count; i++ ) { + attrs = children[ i ].attributes; + attrs.style && ( attrs.style = stylesFilter( [ [ 'list-style-type' ] ] )( attrs.style ) || '' ); + } + + list.addStyle( 'list-style-type', mergeStyle ); + } + } + + 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 orderedPatterns = { 'decimal': /\d+/, 'lower-roman': lowerRomanLiteralRegex, 'upper-roman': upperRomanLiteralRegex, 'lower-alpha': /^[a-z]+$/, 'upper-alpha': /^[A-Z]+$/ }, + unorderedPatterns = { 'disc': /[l\u00B7\u2002]/, 'circle': /[\u006F\u00D8]/, 'square': /[\u006E\u25C6]/ }, + listMarkerPatterns = { 'ol': orderedPatterns, 'ul': unorderedPatterns }, + romans = [ [ 1000, 'M' ], [ 900, 'CM' ], [ 500, 'D' ], [ 400, 'CD' ], [ 100, 'C' ], [ 90, 'XC' ], [ 50, 'L' ], [ 40, 'XL' ], [ 10, 'X' ], [ 9, 'IX' ], [ 5, 'V' ], [ 4, 'IV' ], [ 1, 'I' ] ], + alpahbets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + // Convert roman numbering back to decimal. + function fromRoman( str ) { + str = str.toUpperCase(); + var l = romans.length, + retVal = 0; + for ( var i = 0; i < l; ++i ) { + for ( var j = romans[ i ], k = j[ 1 ].length; str.substr( 0, k ) == j[ 1 ]; str = str.substr( k ) ) + retVal += j[ 0 ]; + } + return retVal; + } + + // Convert alphabet numbering back to decimal. + function fromAlphabet( str ) { + str = str.toUpperCase(); + var l = alpahbets.length, + retVal = 1; + for ( var x = 1; str.length > 0; x *= l ) { + retVal += alpahbets.indexOf( str.charAt( str.length - 1 ) ) * x; + str = str.substr( 0, str.length - 1 ); + } + return retVal; + } + + var listBaseIndent = 0, + previousListItemMargin = null, + previousListId; + + var plugin = ( CKEDITOR.plugins.pastefromword = { + utils: { + // Create a which indicate an list item type. + createListBulletMarker: function( bullet, bulletText ) { + var marker = new CKEDITOR.htmlParser.element( 'cke:listbullet' ); + marker.attributes = { 'cke:listsymbol': bullet[ 0 ] }; + marker.add( new CKEDITOR.htmlParser.text( bulletText ) ); + return marker; + }, + + isListBulletIndicator: function( element ) { + var styleText = element.attributes && element.attributes.style; + if ( /mso-list\s*:\s*Ignore/i.test( styleText ) ) + return true; + }, + + isContainingOnlySpaces: function( element ) { + var text; + return ( ( text = element.onlyChild() ) && ( /^(:?\s| )+$/ ).test( text.value ) ); + }, + + resolveList: function( element ) { + // indicate a list item. + var attrs = element.attributes, + listMarker; + + if ( ( listMarker = element.removeAnyChildWithName( 'cke:listbullet' ) ) && listMarker.length && ( listMarker = listMarker[ 0 ] ) ) { + element.name = 'cke:li'; + + if ( attrs.style ) { + attrs.style = plugin.filters.stylesFilter( [ + // Text-indent is not representing list item level any more. + [ 'text-indent' ], + [ 'line-height' ], + // First attempt is to resolve indent level from on a constant margin increment. + [ ( /^margin(:?-left)?$/ ), null, function( margin ) { + // Deal with component/short-hand form. + var values = margin.split( ' ' ); + margin = CKEDITOR.tools.convertToPx( values[ 3 ] || values[ 1 ] || values[ 0 ] ); + + // Figure out the indent unit by checking the first time of incrementation. + if ( !listBaseIndent && previousListItemMargin !== null && margin > previousListItemMargin ) + listBaseIndent = margin - previousListItemMargin; + + previousListItemMargin = margin; + + attrs[ 'cke:indent' ] = listBaseIndent && ( Math.ceil( margin / listBaseIndent ) + 1 ) || 1; + } ], + // The best situation: "mso-list:l0 level1 lfo2" tells the belonged list root, list item indentation, etc. + [ ( /^mso-list$/ ), null, function( val ) { + val = val.split( ' ' ); + // Ignore values like "mso-list:Ignore". (FF #11976) + if ( val.length < 2 ) { + return; + } + + var listId = Number( val[ 0 ].match( /\d+/ ) ), + indent = Number( val[ 1 ].match( /\d+/ ) ); + + if ( indent == 1 ) { + listId !== previousListId && ( attrs[ 'cke:reset' ] = 1 ); + previousListId = listId; + } + attrs[ 'cke:indent' ] = indent; + } ] + ] )( attrs.style, element ) || ''; + } + + // First level list item might be presented without a margin. + + + // In case all above doesn't apply. + if ( !attrs[ 'cke:indent' ] ) { + previousListItemMargin = 0; + attrs[ 'cke:indent' ] = 1; + } + + // Inherit attributes from bullet. + CKEDITOR.tools.extend( attrs, listMarker.attributes ); + return true; + } + // Current list disconnected. + else { + previousListId = previousListItemMargin = listBaseIndent = null; + } + + return false; + }, + + // Providing a shorthand style then retrieve one or more style component values. + getStyleComponents: ( function() { + var calculator = CKEDITOR.dom.element.createFromHtml( '
', CKEDITOR.document ); + CKEDITOR.document.getBody().append( calculator ); + + return function( name, styleValue, fetchList ) { + calculator.setStyle( name, styleValue ); + var styles = {}, + count = fetchList.length; + for ( var i = 0; i < count; i++ ) + styles[ fetchList[ i ] ] = calculator.getStyle( fetchList[ i ] ); + + return styles; + }; + } )(), + + listDtdParents: CKEDITOR.dtd.parentOf( 'ol' ) + }, + + filters: { + // Transform a normal list into flat list items only presentation. + // E.g.
  • level1
    1. level2
  • => + // level1 + // level2 + flattenList: function( element, level ) { + level = typeof level == 'number' ? level : 1; + + var attrs = element.attributes, + listStyleType; + + // All list items are of the same type. + switch ( attrs.type ) { + case 'a': + listStyleType = 'lower-alpha'; + break; + case '1': + listStyleType = 'decimal'; + break; + // TODO: Support more list style type from MS-Word. + } + + var children = element.children, + child; + + for ( var i = 0; i < children.length; i++ ) { + child = children[ i ]; + + if ( child.name in CKEDITOR.dtd.$listItem ) { + var attributes = child.attributes, + listItemChildren = child.children, + count = listItemChildren.length, + first = listItemChildren[ 0 ], + last = listItemChildren[ count - 1 ]; + + // Converts
  • {...}

  • ->
  • {...}
  • . + // The above format is what we got when pasting from Word 2010 to IE11 and possibly some others. + // Existence of extra

    tag that can be later recognized as list item (see #getRules.return.elements.p) + // creates incorrect and problematic structures similar to {...}. (#11376) + if ( first.attributes && first.attributes.style && first.attributes.style.indexOf( 'mso-list' ) > -1 ) { + child.attributes.style = first.attributes.style; + first.replaceWithChildren(); + } + + // Move out nested list. + if ( last.name in CKEDITOR.dtd.$list ) { + element.add( last, i + 1 ); + + // Remove the parent list item if it's just a holder. + if ( !--listItemChildren.length ) + children.splice( i--, 1 ); + } + + child.name = 'cke:li'; + + // Inherit numbering from list root on the first list item. + attrs.start && !i && ( attributes.value = attrs.start ); + + plugin.filters.stylesFilter( [ + [ 'tab-stops', null, function( val ) { + // val = [left|center|right|decimal] Source: W3C, WD-tabs-970117. + // In some cases the first word is missing - hence the square brackets. + var margin = val.match( /0$|\d+\.?\d*\w+/ ); + margin && ( previousListItemMargin = CKEDITOR.tools.convertToPx( margin[ 0 ] ) ); + } ], + ( level == 1 ? [ 'mso-list', null, function( val ) { + val = val.split( ' ' ); + var listId = Number( val[ 0 ].match( /\d+/ ) ); + listId !== previousListId && ( attributes[ 'cke:reset' ] = 1 ); + previousListId = listId; + } ] : null ) + ] )( attributes.style ); + + attributes[ 'cke:indent' ] = level; + attributes[ 'cke:listtype' ] = element.name; + attributes[ 'cke:list-style-type' ] = listStyleType; + } + // Flatten sub list. + else if ( child.name in CKEDITOR.dtd.$list ) { + // Absorb sub list children. + arguments.callee.apply( this, [ child, level + 1 ] ); + children = children.slice( 0, i ).concat( child.children ).concat( children.slice( i + 1 ) ); + element.children = []; + for ( var j = 0, num = children.length; j < num; j++ ) + element.add( children[ j ] ); + + children = element.children; + } + } + + delete element.name; + + // We're loosing tag name here, signalize this element as a list. + attrs[ 'cke:list' ] = 1; + }, + + // Try to collect all list items among the children and establish one + // or more HTML list structures for them. + // @param element + assembleList: function( element ) { + var children = element.children, + child, listItem, // The current processing cke:li element. + listItemAttrs, listItemIndent, // Indent level of current list item. + lastIndent, lastListItem, // The previous one just been added to the list. + list, // Current staging list and it's parent list if any. + openedLists = [], + previousListStyleType, previousListType; + + // Properties of the list item are to be resolved from the list bullet. + var bullet, listType, listStyleType, itemNumeric; + + for ( var i = 0; i < children.length; i++ ) { + child = children[ i ]; + + if ( child.name == 'cke:li' ) { + child.name = 'li'; + listItem = child; + listItemAttrs = listItem.attributes; + bullet = listItemAttrs[ 'cke:listsymbol' ]; + bullet = bullet && bullet.match( /^(?:[(]?)([^\s]+?)([.)]?)$/ ); + listType = listStyleType = itemNumeric = null; + + if ( listItemAttrs[ 'cke:ignored' ] ) { + children.splice( i--, 1 ); + continue; + } + + + // This's from a new list root. + listItemAttrs[ 'cke:reset' ] && ( list = lastIndent = lastListItem = null ); + + // List item indent level might come from a real list indentation or + // been resolved from a pseudo list item's margin value, even get + // no indentation at all. + listItemIndent = Number( listItemAttrs[ 'cke:indent' ] ); + + // We're moving out of the current list, cleaning up. + if ( listItemIndent != lastIndent ) + previousListType = previousListStyleType = null; + + // List type and item style are already resolved. + if ( !bullet ) { + listType = listItemAttrs[ 'cke:listtype' ] || 'ol'; + listStyleType = listItemAttrs[ 'cke:list-style-type' ]; + } else { + // Probably share the same list style type with previous list item, + // give it priority to avoid ambiguous between C(Alpha) and C.(Roman). + if ( previousListType && listMarkerPatterns[ previousListType ][ previousListStyleType ].test( bullet[ 1 ] ) ) { + listType = previousListType; + listStyleType = previousListStyleType; + } else { + for ( var type in listMarkerPatterns ) { + for ( var style in listMarkerPatterns[ type ] ) { + if ( listMarkerPatterns[ type ][ style ].test( bullet[ 1 ] ) ) { + // Small numbering has higher priority, when dealing with ambiguous + // between C(Alpha) and C.(Roman). + if ( type == 'ol' && ( /alpha|roman/ ).test( style ) ) { + var num = /roman/.test( style ) ? fromRoman( bullet[ 1 ] ) : fromAlphabet( bullet[ 1 ] ); + if ( !itemNumeric || num < itemNumeric ) { + itemNumeric = num; + listType = type; + listStyleType = style; + } + } else { + listType = type; + listStyleType = style; + break; + } + } + } + } + } + + // Simply use decimal/disc for the rest forms of unrepresentable + // numerals, e.g. Chinese..., but as long as there a second part + // included, it has a bigger chance of being a order list ;) + !listType && ( listType = bullet[ 2 ] ? 'ol' : 'ul' ); + } + + previousListType = listType; + previousListStyleType = listStyleType || ( listType == 'ol' ? 'decimal' : 'disc' ); + if ( listStyleType && listStyleType != ( listType == 'ol' ? 'decimal' : 'disc' ) ) + listItem.addStyle( 'list-style-type', listStyleType ); + + // Figure out start numbering. + if ( listType == 'ol' && bullet ) { + switch ( listStyleType ) { + case 'decimal': + itemNumeric = Number( bullet[ 1 ] ); + break; + case 'lower-roman': + case 'upper-roman': + itemNumeric = fromRoman( bullet[ 1 ] ); + break; + case 'lower-alpha': + case 'upper-alpha': + itemNumeric = fromAlphabet( bullet[ 1 ] ); + break; + } + + // Always create the numbering, swipe out unnecessary ones later. + listItem.attributes.value = itemNumeric; + } + + // Start the list construction. + if ( !list ) { + openedLists.push( list = new CKEDITOR.htmlParser.element( listType ) ); + list.add( listItem ); + children[ i ] = list; + } else { + if ( listItemIndent > lastIndent ) { + openedLists.push( list = new CKEDITOR.htmlParser.element( listType ) ); + list.add( listItem ); + lastListItem.add( list ); + } else if ( listItemIndent < lastIndent ) { + // There might be a negative gap between two list levels. (#4944) + var diff = lastIndent - listItemIndent, + parent; + while ( diff-- && ( parent = list.parent ) ) + list = parent.parent; + + list.add( listItem ); + } else { + list.add( listItem ); + } + + children.splice( i--, 1 ); + } + + lastListItem = listItem; + lastIndent = listItemIndent; + } else if ( list ) { + list = lastIndent = lastListItem = null; + } + } + + for ( i = 0; i < openedLists.length; i++ ) + postProcessList( openedLists[ i ] ); + + list = lastIndent = lastListItem = previousListId = previousListItemMargin = listBaseIndent = null; + }, + + // A simple filter which always rejecting. + falsyFilter: function() { + return false; + }, + + // A filter dedicated on the 'style' attribute filtering, e.g. dropping/replacing style properties. + // @param styles {Array} in form of [ styleNameRegexp, styleValueRegexp, + // newStyleValue/newStyleGenerator, newStyleName ] where only the first + // parameter is mandatory. + // @param whitelist {Boolean} Whether the {@param styles} will be considered as a white-list. + stylesFilter: function( styles, whitelist ) { + return function( styleText, element ) { + var rules = []; + // html-encoded quote might be introduced by 'font-family' + // from MS-Word which confused the following regexp. e.g. + //'font-family: "Lucida, Console"' + ( styleText || '' ).replace( /"/g, '"' ).replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value ) { + name = name.toLowerCase(); + name == 'font-family' && ( value = value.replace( /["']/g, '' ) ); + + var namePattern, valuePattern, newValue, newName; + for ( var i = 0; i < styles.length; i++ ) { + if ( styles[ i ] ) { + namePattern = styles[ i ][ 0 ]; + valuePattern = styles[ i ][ 1 ]; + newValue = styles[ i ][ 2 ]; + newName = styles[ i ][ 3 ]; + + if ( name.match( namePattern ) && ( !valuePattern || value.match( valuePattern ) ) ) { + name = newName || name; + whitelist && ( newValue = newValue || value ); + + if ( typeof newValue == 'function' ) + newValue = newValue( value, element, name ); + + // Return an couple indicate both name and value + // changed. + if ( newValue && newValue.push ) + name = newValue[ 0 ], newValue = newValue[ 1 ]; + + if ( typeof newValue == 'string' ) + rules.push( [ name, newValue ] ); + return; + } + } + } + + !whitelist && rules.push( [ name, value ] ); + + } ); + + for ( var i = 0; i < rules.length; i++ ) + rules[ i ] = rules[ i ].join( ':' ); + return rules.length ? ( rules.join( ';' ) + ';' ) : false; + }; + }, + + // Migrate the element by decorate styles on it. + // @param styleDefinition + // @param variables + elementMigrateFilter: function( styleDefinition, variables ) { + return styleDefinition ? function( element ) { + var styleDef = variables ? new CKEDITOR.style( styleDefinition, variables )._.definition : styleDefinition; + element.name = styleDef.element; + CKEDITOR.tools.extend( element.attributes, CKEDITOR.tools.clone( styleDef.attributes ) ); + element.addStyle( CKEDITOR.style.getStyleText( styleDef ) ); + // Mark style classes as allowed so they will not be filtered out (#12256). + if ( styleDef.attributes && styleDef.attributes[ 'class' ] ) { + element.classWhiteList = ' ' + styleDef.attributes[ 'class' ] + ' '; + } + } : function() {}; + }, + + // Migrate styles by creating a new nested stylish element. + // @param styleDefinition + styleMigrateFilter: function( styleDefinition, variableName ) { + + var elementMigrateFilter = this.elementMigrateFilter; + return styleDefinition ? function( value, element ) { + // Build an stylish element first. + var styleElement = new CKEDITOR.htmlParser.element( null ), + variables = {}; + + variables[ variableName ] = value; + elementMigrateFilter( styleDefinition, variables )( styleElement ); + // Place the new element inside the existing span. + styleElement.children = element.children; + element.children = [ styleElement ]; + + // #10285 - later on styleElement will replace element if element won't have any attributes. + // However, in some cases styleElement is identical to element and therefore should not be filtered + // to avoid inf loop. Unfortunately calling element.filterChildren() does not prevent from that (#10327). + // However, we can assume that we don't need to filter styleElement at all, so it is safe to replace + // its filter method. + styleElement.filter = function() {}; + styleElement.parent = element; + } : function() {}; + }, + + // A filter which remove cke-namespaced-attribute on + // all none-cke-namespaced elements. + // @param value + // @param element + bogusAttrFilter: function( value, element ) { + if ( element.name.indexOf( 'cke:' ) == -1 ) + return false; + }, + + // A filter which will be used to apply inline css style according the stylesheet + // definition rules, is generated lazily when filtering. + applyStyleFilter: null + + }, + + getRules: function( editor, filter ) { + var dtd = CKEDITOR.dtd, + blockLike = CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent ), + config = editor.config, + filters = this.filters, + falsyFilter = filters.falsyFilter, + stylesFilter = filters.stylesFilter, + elementMigrateFilter = filters.elementMigrateFilter, + styleMigrateFilter = CKEDITOR.tools.bind( this.filters.styleMigrateFilter, this.filters ), + createListBulletMarker = this.utils.createListBulletMarker, + flattenList = filters.flattenList, + assembleList = filters.assembleList, + isListBulletIndicator = this.utils.isListBulletIndicator, + containsNothingButSpaces = this.utils.isContainingOnlySpaces, + resolveListItem = this.utils.resolveList, + convertToPx = function( value ) { + value = CKEDITOR.tools.convertToPx( value ); + return isNaN( value ) ? value : value + 'px'; + }, + getStyleComponents = this.utils.getStyleComponents, + listDtdParents = this.utils.listDtdParents, + removeFontStyles = config.pasteFromWordRemoveFontStyles !== false, + removeStyles = config.pasteFromWordRemoveStyles !== false; + + return { + + elementNames: [ + // Remove script, meta and link elements. + [ ( /meta|link|script/ ), '' ] + ], + + root: function( element ) { + element.filterChildren( filter ); + assembleList( element ); + }, + + elements: { + '^': function( element ) { + // Transform CSS style declaration to inline style. + var applyStyleFilter; + if ( CKEDITOR.env.gecko && ( applyStyleFilter = filters.applyStyleFilter ) ) + applyStyleFilter( element ); + }, + + $: function( element ) { + var tagName = element.name || '', + attrs = element.attributes; + + // Convert length unit of width/height on blocks to + // a more editor-friendly way (px). + if ( tagName in blockLike && attrs.style ) + attrs.style = stylesFilter( [ [ ( /^(:?width|height)$/ ), null, convertToPx ] ] )( attrs.style ) || ''; + + // Processing headings. + if ( tagName.match( /h\d/ ) ) { + element.filterChildren( filter ); + // Is the heading actually a list item? + if ( resolveListItem( element ) ) + return; + + // Adapt heading styles to editor's convention. + elementMigrateFilter( config[ 'format_' + tagName ] )( element ); + } + // Remove inline elements which contain only empty spaces. + else if ( tagName in dtd.$inline ) { + element.filterChildren( filter ); + if ( containsNothingButSpaces( element ) ) + delete element.name; + } + // Remove element with ms-office namespace, + // with it's content preserved, e.g. 'o:p'. + else if ( tagName.indexOf( ':' ) != -1 && tagName.indexOf( 'cke' ) == -1 ) { + element.filterChildren( filter ); + + // Restore image real link from vml. + if ( tagName == 'v:imagedata' ) { + var href = element.attributes[ 'o:href' ]; + if ( href ) + element.attributes.src = href; + element.name = 'img'; + return; + } + delete element.name; + } + + // Assembling list items into a whole list. + if ( tagName in listDtdParents ) { + element.filterChildren( filter ); + assembleList( element ); + } + }, + + // We'll drop any style sheet, but Firefox conclude + // certain styles in a single style element, which are + // required to be changed into inline ones. + 'style': function( element ) { + if ( CKEDITOR.env.gecko ) { + // Grab only the style definition section. + var styleDefSection = element.onlyChild().value.match( /\/\* Style Definitions \*\/([\s\S]*?)\/\*/ ), + styleDefText = styleDefSection && styleDefSection[ 1 ], + rules = {}; // Storing the parsed result. + + if ( styleDefText ) { + styleDefText + // Remove line-breaks. + .replace( /[\n\r]/g, '' ) + // Extract selectors and style properties. + .replace( /(.+?)\{(.+?)\}/g, function( rule, selectors, styleBlock ) { + selectors = selectors.split( ',' ); + var length = selectors.length; + for ( var i = 0; i < length; i++ ) { + // Assume MS-Word mostly generate only simple + // selector( [Type selector][Class selector]). + CKEDITOR.tools.trim( selectors[ i ] ).replace( /^(\w+)(\.[\w-]+)?$/g, function( match, tagName, className ) { + tagName = tagName || '*'; + className = className.substring( 1, className.length ); + + // Reject MS-Word Normal styles. + if ( className.match( /MsoNormal/ ) ) + return; + + if ( !rules[ tagName ] ) + rules[ tagName ] = {}; + if ( className ) + rules[ tagName ][ className ] = styleBlock; + else + rules[ tagName ] = styleBlock; + } ); + } + } ); + + filters.applyStyleFilter = function( element ) { + var name = rules[ '*' ] ? '*' : element.name, + className = element.attributes && element.attributes[ 'class' ], + style; + if ( name in rules ) { + style = rules[ name ]; + if ( typeof style == 'object' ) + style = style[ className ]; + // Maintain style rules priorities. + style && element.addStyle( style, true ); + } + }; + } + } + return false; + }, + + 'p': function( element ) { + // A a fall-back approach to resolve list item in browsers + // that doesn't include "mso-list:Ignore" on list bullets, + // note it's not perfect as not all list style (e.g. "heading list") is shipped + // with this pattern. (#6662) + if ( ( /MsoListParagraph/i ).exec( element.attributes[ 'class' ] ) || + ( element.getStyle( 'mso-list' ) && !element.getStyle( 'mso-list' ).match( /^(none|skip)$/i ) ) ) { + var bulletText = element.firstChild( function( node ) { + return node.type == CKEDITOR.NODE_TEXT && !containsNothingButSpaces( node.parent ); + } ); + + var bullet = bulletText && bulletText.parent; + if ( bullet ) + bullet.addStyle( 'mso-list', 'Ignore' ); + + } + + element.filterChildren( filter ); + + // Is the paragraph actually a list item? + if ( resolveListItem( element ) ) + return; + + // Adapt paragraph formatting to editor's convention + // according to enter-mode. + if ( config.enterMode == CKEDITOR.ENTER_BR ) { + // We suffer from attribute/style lost in this situation. + delete element.name; + element.add( new CKEDITOR.htmlParser.element( 'br' ) ); + } else { + elementMigrateFilter( config[ 'format_' + ( config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ] )( element ); + } + }, + + 'div': function( element ) { + // Aligned table with no text surrounded is represented by a wrapper div, from which + // table cells inherit as text-align styles, which is wrong. + // Instead we use a clear-float div after the table to properly achieve the same layout. + var singleChild = element.onlyChild(); + if ( singleChild && singleChild.name == 'table' ) { + var attrs = element.attributes; + singleChild.attributes = CKEDITOR.tools.extend( singleChild.attributes, attrs ); + attrs.style && singleChild.addStyle( attrs.style ); + + var clearFloatDiv = new CKEDITOR.htmlParser.element( 'div' ); + clearFloatDiv.addStyle( 'clear', 'both' ); + element.add( clearFloatDiv ); + delete element.name; + } + }, + + 'td': function( element ) { + // 'td' in 'thead' is actually . + if ( element.getAncestor( 'thead' ) ) + element.name = 'th'; + }, + + // MS-Word sometimes present list as a mixing of normal list + // and pseudo-list, normalize the previous ones into pseudo form. + 'ol': flattenList, + 'ul': flattenList, + 'dl': flattenList, + + 'font': function( element ) { + // Drop the font tag if it comes from list bullet text. + if ( isListBulletIndicator( element.parent ) ) { + delete element.name; + return; + } + + element.filterChildren( filter ); + + var attrs = element.attributes, + styleText = attrs.style, + parent = element.parent; + + if ( parent.name == 'font' ) { // Merge nested tags. + CKEDITOR.tools.extend( parent.attributes, element.attributes ); + styleText && parent.addStyle( styleText ); + delete element.name; + } + // Convert the merged into a span with all attributes preserved. + else { + // Use array to avoid string concatenation and get rid of problems with trailing ";" (#12243). + styleText = ( styleText || '' ).split( ';' ); + + // IE's having those deprecated attributes, normalize them. + if ( attrs.color ) { + if ( attrs.color != '#000000' ) + styleText.push( 'color:' + attrs.color ); + delete attrs.color; + } + if ( attrs.face ) { + styleText.push( 'font-family:' + attrs.face ); + delete attrs.face; + } + // TODO: Mapping size in ranges of xx-small, + // x-small, small, medium, large, x-large, xx-large. + if ( attrs.size ) { + styleText.push( 'font-size:' + + ( attrs.size > 3 ? 'large' : ( attrs.size < 3 ? 'small' : 'medium' ) ) ); + delete attrs.size; + } + + element.name = 'span'; + element.addStyle( styleText.join( ';' ) ); + } + }, + + 'span': function( element ) { + // Remove the span if it comes from list bullet text. + if ( isListBulletIndicator( element.parent ) ) + return false; + + element.filterChildren( filter ); + if ( containsNothingButSpaces( element ) ) { + delete element.name; + return null; + } + + // List item bullet type is supposed to be indicated by + // the text of a span with style 'mso-list : Ignore' or an image. + if ( isListBulletIndicator( element ) ) { + var listSymbolNode = element.firstChild( function( node ) { + return node.value || node.name == 'img'; + } ); + + var listSymbol = listSymbolNode && ( listSymbolNode.value || 'l.' ), + listType = listSymbol && listSymbol.match( /^(?:[(]?)([^\s]+?)([.)]?)$/ ); + + if ( listType ) { + var marker = createListBulletMarker( listType, listSymbol ); + // Some non-existed list items might be carried by an inconsequential list, indicate by "mso-hide:all/display:none", + // those are to be removed later, now mark it with "cke:ignored". + var ancestor = element.getAncestor( 'span' ); + if ( ancestor && ( / mso-hide:\s*all|display:\s*none / ).test( ancestor.attributes.style ) ) + marker.attributes[ 'cke:ignored' ] = 1; + return marker; + } + } + + // Update the src attribute of image element with href. + var attrs = element.attributes, + styleText = attrs && attrs.style; + + // Assume MS-Word mostly carry font related styles on , + // adapting them to editor's convention. + if ( styleText ) { + attrs.style = stylesFilter( [ + // Drop 'inline-height' style which make lines overlapping. + [ 'line-height' ], + [ ( /^font-family$/ ), null, !removeFontStyles ? styleMigrateFilter( config.font_style, 'family' ) : null ], + [ ( /^font-size$/ ), null, !removeFontStyles ? styleMigrateFilter( config.fontSize_style, 'size' ) : null ], + [ ( /^color$/ ), null, !removeFontStyles ? styleMigrateFilter( config.colorButton_foreStyle, 'color' ) : null ], + [ ( /^background-color$/ ), null, !removeFontStyles ? styleMigrateFilter( config.colorButton_backStyle, 'color' ) : null ] + ] )( styleText, element ) || ''; + } + + if ( !attrs.style ) + delete attrs.style; + + if ( CKEDITOR.tools.isEmpty( attrs ) ) + delete element.name; + + return null; + }, + + // Migrate basic style formats to editor configured ones. + b: elementMigrateFilter( config.coreStyles_bold ), + i: elementMigrateFilter( config.coreStyles_italic ), + u: elementMigrateFilter( config.coreStyles_underline ), + s: elementMigrateFilter( config.coreStyles_strike ), + sup: elementMigrateFilter( config.coreStyles_superscript ), + sub: elementMigrateFilter( config.coreStyles_subscript ), + + // Remove full paths from links to anchors. + a: function( element ) { + var attrs = element.attributes; + + if ( attrs.name && attrs.name.match( /ole_link\d+/i ) ) { + delete element.name; + return; + } + + if ( attrs.href && attrs.href.match( /^file:\/\/\/[\S]+#/i ) ) + attrs.href = attrs.href.replace( /^file:\/\/\/[^#]+/i, '' ); + }, + + 'cke:listbullet': function( element ) { + if ( element.getAncestor( /h\d/ ) && !config.pasteFromWordNumberedHeadingToList ) + delete element.name; + } + }, + + attributeNames: [ + // Remove onmouseover and onmouseout events (from MS Word comments effect) + [ ( /^onmouse(:?out|over)/ ), '' ], + // Onload on image element. + [ ( /^onload$/ ), '' ], + // Remove office and vml attribute from elements. + [ ( /(?:v|o):\w+/ ), '' ], + // Remove lang/language attributes. + [ ( /^lang/ ), '' ] + ], + + attributes: { + 'style': stylesFilter( removeStyles ? + // Provide a white-list of styles that we preserve, those should + // be the ones that could later be altered with editor tools. + [ + // Leave list-style-type + [ ( /^list-style-type$/ ), null ], + + // Preserve margin-left/right which used as default indent style in the editor. + [ ( /^margin$|^margin-(?!bottom|top)/ ), null, function( value, element, name ) { + if ( element.name in { p: 1, div: 1 } ) { + var indentStyleName = config.contentsLangDirection == 'ltr' ? 'margin-left' : 'margin-right'; + + // Extract component value from 'margin' shorthand. + if ( name == 'margin' ) + value = getStyleComponents( name, value, [ indentStyleName ] )[ indentStyleName ]; + else if ( name != indentStyleName ) + return null; + + if ( value && !emptyMarginRegex.test( value ) ) + return [ indentStyleName, value ]; + } + + return null; + } ], + + // Preserve clear float style. + [ ( /^clear$/ ) ], + + [ ( /^border.*|margin.*|vertical-align|float$/ ), null, function( value, element ) { + if ( element.name == 'img' ) + return value; + } ], + + [ ( /^width|height$/ ), null, function( value, element ) { + if ( element.name in { table: 1, td: 1, th: 1, img: 1 } ) + return value; + } ] + ] : + // Otherwise provide a black-list of styles that we remove. + [ + [ ( /^mso-/ ) ], + // Fixing color values. + [ ( /-color$/ ), null, function( value ) { + if ( value == 'transparent' ) + return false; + if ( CKEDITOR.env.gecko ) + return value.replace( /-moz-use-text-color/g, 'transparent' ); + } ], + // Remove empty margin values, e.g. 0.00001pt 0em 0pt + [ ( /^margin$/ ), emptyMarginRegex ], + [ 'text-indent', '0cm' ], + [ 'page-break-before' ], + [ 'tab-stops' ], + [ 'display', 'none' ], + removeFontStyles ? [ ( /font-?/ ) ] : null + ], removeStyles ), + + // Prefer width styles over 'width' attributes. + 'width': function( value, element ) { + if ( element.name in dtd.$tableContent ) + return false; + }, + // Prefer border styles over table 'border' attributes. + 'border': function( value, element ) { + if ( element.name in dtd.$tableContent ) + return false; + }, + + // Only Firefox carry style sheet from MS-Word, which + // will be applied by us manually. For other browsers + // the css className is useless. + // We need to keep classes added as a style (#12256). + 'class': function( value, element ) { + if ( element.classWhiteList && element.classWhiteList.indexOf( ' ' + value + ' ' ) != -1 ) { + return value; + } + return false; + }, + + // MS-Word always generate 'background-color' along with 'bgcolor', + // simply drop the deprecated attributes. + 'bgcolor': falsyFilter, + + // Deprecate 'valign' attribute in favor of 'vertical-align'. + 'valign': removeStyles ? falsyFilter : function( value, element ) { + element.addStyle( 'vertical-align', value ); + return false; + } + }, + + // Fore none-IE, some useful data might be buried under these IE-conditional + // comments where RegExp were the right approach to dig them out where usual approach + // is transform it into a fake element node which hold the desired data. + comment: !CKEDITOR.env.ie ? function( value, node ) { + var imageInfo = value.match( // ), + listInfo = value.match( /^\[if !supportLists\]([\s\S]*?)\[endif\]$/ ); + + // Seek for list bullet indicator. + if ( listInfo ) { + // Bullet symbol could be either text or an image. + var listSymbol = listInfo[ 1 ] || ( imageInfo && 'l.' ), + listType = listSymbol && listSymbol.match( />(?:[(]?)([^\s]+?)([.)]?) element in conditional comments for Firefox. + if ( CKEDITOR.env.gecko && imageInfo ) { + var img = CKEDITOR.htmlParser.fragment.fromHtml( imageInfo[ 0 ] ).children[ 0 ], + previousComment = node.previous, + // Try to dig the real image link from vml markup from previous comment text. + imgSrcInfo = previousComment && previousComment.value.match( /]*o:href=['"](.*?)['"]/ ), + imgSrc = imgSrcInfo && imgSrcInfo[ 1 ]; + + // Is there a real 'src' url to be used? + imgSrc && ( img.attributes.src = imgSrc ); + return img; + } + + return false; + } : falsyFilter + }; + } + } ); + + // The paste processor here is just a reduced copy of html data processor. + var pasteProcessor = function() { + this.dataFilter = new CKEDITOR.htmlParser.filter(); + }; + + pasteProcessor.prototype = { + toHtml: function( data ) { + var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data ), + writer = new CKEDITOR.htmlParser.basicWriter(); + + fragment.writeHtml( writer, this.dataFilter ); + return writer.getHtml( true ); + } + }; + + CKEDITOR.cleanWord = function( data, editor ) { + // We get and when we started using `dataTransfer` instead of pasteBin, so we need to + // change to and to . + data = data.replace( //g, '' ); + + // Firefox will be confused by those downlevel-revealed IE conditional + // comments, fixing them first( convert it to upperlevel-revealed one ). + // e.g. ... + if ( CKEDITOR.env.gecko ) + data = data.replace( /(([\S\s]*?))/gi, '$1$2$3' ); + + // #9456 - Webkit doesn't wrap list number with span, which is crucial for filter to recognize list. + // + //

    + // + // 3.       + // Test3 + //

    + // + // Transform to: + // + //

    + // + // + // 3.       + // + // Test3 + //

    + if ( CKEDITOR.env.webkit ) + data = data.replace( /(class="MsoListParagraph[^>]+>)([^<]+)()/gi, '$1$2$3' ); + + var dataProcessor = new pasteProcessor(), + dataFilter = dataProcessor.dataFilter; + + // These rules will have higher priorities than default ones. + dataFilter.addRules( CKEDITOR.plugins.pastefromword.getRules( editor, dataFilter ) ); + + // Allow extending data filter rules. + editor.fire( 'beforeCleanWord', { filter: dataFilter } ); + + try { + data = dataProcessor.toHtml( data ); + } catch ( e ) { + editor.showNotification( editor.lang.pastefromword.error ); + } + + // Below post processing those things that are unable to delivered by filter rules. + + // Remove 'cke' namespaced attribute used in filter rules as marker. + data = data.replace( /cke:.*?".*?"/g, '' ); + + // Remove empty style attribute. + data = data.replace( /style=""/g, '' ); + + // Remove the dummy spans ( having no inline style ). + data = data.replace( //g, '' ); + + return data; + }; +} )(); + +/** + * Whether to ignore all font related formatting styles, including: + * + * * font size; + * * font family; + * * font foreground/background color. + * + * config.pasteFromWordRemoveFontStyles = false; + * + * @since 3.1 + * @cfg {Boolean} [pasteFromWordRemoveFontStyles=true] + * @member CKEDITOR.config + */ + +/** + * Whether to transform MS Word outline numbered headings into lists. + * + * config.pasteFromWordNumberedHeadingToList = true; + * + * @since 3.1 + * @cfg {Boolean} [pasteFromWordNumberedHeadingToList=false] + * @member CKEDITOR.config + */ + +/** + * Whether to remove element styles that can't be managed with the editor. Note + * that this doesn't handle the font specific styles, which depends on the + * {@link #pasteFromWordRemoveFontStyles} setting instead. + * + * config.pasteFromWordRemoveStyles = false; + * + * @since 3.1 + * @cfg {Boolean} [pasteFromWordRemoveStyles=true] + * @member CKEDITOR.config + */ diff --git a/sources/plugins/pastefromword/icons/hidpi/pastefromword-rtl.png b/sources/plugins/pastefromword/icons/hidpi/pastefromword-rtl.png new file mode 100644 index 00000000..142bd569 Binary files /dev/null and b/sources/plugins/pastefromword/icons/hidpi/pastefromword-rtl.png differ diff --git a/sources/plugins/pastefromword/icons/hidpi/pastefromword.png b/sources/plugins/pastefromword/icons/hidpi/pastefromword.png new file mode 100644 index 00000000..ac043cdd Binary files /dev/null and b/sources/plugins/pastefromword/icons/hidpi/pastefromword.png differ diff --git a/sources/plugins/pastefromword/icons/pastefromword-rtl.png b/sources/plugins/pastefromword/icons/pastefromword-rtl.png new file mode 100644 index 00000000..7b69c555 Binary files /dev/null and b/sources/plugins/pastefromword/icons/pastefromword-rtl.png differ diff --git a/sources/plugins/pastefromword/icons/pastefromword.png b/sources/plugins/pastefromword/icons/pastefromword.png new file mode 100644 index 00000000..61a0ae43 Binary files /dev/null and b/sources/plugins/pastefromword/icons/pastefromword.png differ diff --git a/sources/plugins/pastefromword/lang/af.js b/sources/plugins/pastefromword/lang/af.js new file mode 100644 index 00000000..0e047b32 --- /dev/null +++ b/sources/plugins/pastefromword/lang/af.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'af', { + confirmCleanup: 'Die teks wat u wil plak lyk asof dit uit Word gekopiëer is. Wil u dit eers skoonmaak voordat dit geplak word?', + error: 'Die geplakte teks kon nie skoongemaak word nie, weens \'n interne fout', + title: 'Plak vanuit Word', + toolbar: 'Plak vanuit Word' +} ); diff --git a/sources/plugins/pastefromword/lang/ar.js b/sources/plugins/pastefromword/lang/ar.js new file mode 100644 index 00000000..37d6c35d --- /dev/null +++ b/sources/plugins/pastefromword/lang/ar.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ar', { + confirmCleanup: 'يبدو أن النص المراد لصقه منسوخ من برنامج وورد. هل تود تنظيفه قبل الشروع في عملية اللصق؟', + error: 'لم يتم مسح المعلومات الملصقة لخلل داخلي', + title: 'لصق من وورد', + toolbar: 'لصق من وورد' +} ); diff --git a/sources/plugins/pastefromword/lang/bg.js b/sources/plugins/pastefromword/lang/bg.js new file mode 100644 index 00000000..eb4a6fab --- /dev/null +++ b/sources/plugins/pastefromword/lang/bg.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'bg', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Вмъкни от MS Word', + toolbar: 'Вмъкни от MS Word' +} ); diff --git a/sources/plugins/pastefromword/lang/bn.js b/sources/plugins/pastefromword/lang/bn.js new file mode 100644 index 00000000..9fedb959 --- /dev/null +++ b/sources/plugins/pastefromword/lang/bn.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'bn', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'পেস্ট (শব্দ)', + toolbar: 'পেস্ট (শব্দ)' +} ); diff --git a/sources/plugins/pastefromword/lang/bs.js b/sources/plugins/pastefromword/lang/bs.js new file mode 100644 index 00000000..2b0528a7 --- /dev/null +++ b/sources/plugins/pastefromword/lang/bs.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'bs', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Zalijepi iz Word-a', + toolbar: 'Zalijepi iz Word-a' +} ); diff --git a/sources/plugins/pastefromword/lang/ca.js b/sources/plugins/pastefromword/lang/ca.js new file mode 100644 index 00000000..b2da5cd8 --- /dev/null +++ b/sources/plugins/pastefromword/lang/ca.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ca', { + confirmCleanup: 'El text que voleu enganxar sembla provenir de Word. Voleu netejar aquest text abans que sigui enganxat?', + error: 'No ha estat possible netejar les dades enganxades degut a un error intern', + title: 'Enganxa des del Word', + toolbar: 'Enganxa des del Word' +} ); diff --git a/sources/plugins/pastefromword/lang/cs.js b/sources/plugins/pastefromword/lang/cs.js new file mode 100644 index 00000000..5cb7c174 --- /dev/null +++ b/sources/plugins/pastefromword/lang/cs.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'cs', { + confirmCleanup: 'Jak je vidět, vkládaný text je kopírován z Wordu. Chcete jej před vložením vyčistit?', + error: 'Z důvodu vnitřní chyby nebylo možné provést vyčištění vkládaného textu.', + title: 'Vložit z Wordu', + toolbar: 'Vložit z Wordu' +} ); diff --git a/sources/plugins/pastefromword/lang/cy.js b/sources/plugins/pastefromword/lang/cy.js new file mode 100644 index 00000000..75fe3662 --- /dev/null +++ b/sources/plugins/pastefromword/lang/cy.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'cy', { + confirmCleanup: 'Mae\'r testun rydych chi am ludo wedi\'i gopïo o Word. Ydych chi am ei lanhau cyn ei ludo?', + error: 'Doedd dim modd glanhau y data a ludwyd oherwydd gwall mewnol', + title: 'Gludo o Word', + toolbar: 'Gludo o Word' +} ); diff --git a/sources/plugins/pastefromword/lang/da.js b/sources/plugins/pastefromword/lang/da.js new file mode 100644 index 00000000..81b26307 --- /dev/null +++ b/sources/plugins/pastefromword/lang/da.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'da', { + confirmCleanup: 'Den tekst du forsøger at indsætte ser ud til at komme fra Word. Vil du rense teksten før den indsættes?', + error: 'Det var ikke muligt at fjerne formatteringen på den indsatte tekst grundet en intern fejl', + title: 'Indsæt fra Word', + toolbar: 'Indsæt fra Word' +} ); diff --git a/sources/plugins/pastefromword/lang/de.js b/sources/plugins/pastefromword/lang/de.js new file mode 100644 index 00000000..836b7d74 --- /dev/null +++ b/sources/plugins/pastefromword/lang/de.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'de', { + confirmCleanup: 'Der Text, den Sie einfügen möchten, scheint aus MS-Word kopiert zu sein. Möchten Sie ihn zuvor bereinigen lassen?', + error: 'Aufgrund eines internen Fehlers war es nicht möglich die eingefügten Daten zu bereinigen', + title: 'Aus Word einfügen', + toolbar: 'Aus Word einfügen' +} ); diff --git a/sources/plugins/pastefromword/lang/el.js b/sources/plugins/pastefromword/lang/el.js new file mode 100644 index 00000000..96d1e878 --- /dev/null +++ b/sources/plugins/pastefromword/lang/el.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'el', { + confirmCleanup: 'Το κείμενο που επικολλάται φαίνεται να είναι αντιγραμμένο από το Word. Μήπως θα θέλατε να καθαριστεί προτού επικολληθεί;', + error: 'Δεν ήταν δυνατό να καθαριστούν τα δεδομένα λόγω ενός εσωτερικού σφάλματος', + title: 'Επικόλληση από το Word', + toolbar: 'Επικόλληση από το Word' +} ); diff --git a/sources/plugins/pastefromword/lang/en-au.js b/sources/plugins/pastefromword/lang/en-au.js new file mode 100644 index 00000000..0f677593 --- /dev/null +++ b/sources/plugins/pastefromword/lang/en-au.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'en-au', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Paste from Word', + toolbar: 'Paste from Word' +} ); diff --git a/sources/plugins/pastefromword/lang/en-ca.js b/sources/plugins/pastefromword/lang/en-ca.js new file mode 100644 index 00000000..c3386622 --- /dev/null +++ b/sources/plugins/pastefromword/lang/en-ca.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'en-ca', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Paste from Word', + toolbar: 'Paste from Word' +} ); diff --git a/sources/plugins/pastefromword/lang/en-gb.js b/sources/plugins/pastefromword/lang/en-gb.js new file mode 100644 index 00000000..085e6bce --- /dev/null +++ b/sources/plugins/pastefromword/lang/en-gb.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'en-gb', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', + error: 'It was not possible to clean up the pasted data due to an internal error', + title: 'Paste from Word', + toolbar: 'Paste from Word' +} ); diff --git a/sources/plugins/pastefromword/lang/en.js b/sources/plugins/pastefromword/lang/en.js new file mode 100644 index 00000000..396c85b8 --- /dev/null +++ b/sources/plugins/pastefromword/lang/en.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'en', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', + error: 'It was not possible to clean up the pasted data due to an internal error', + title: 'Paste from Word', + toolbar: 'Paste from Word' +} ); diff --git a/sources/plugins/pastefromword/lang/eo.js b/sources/plugins/pastefromword/lang/eo.js new file mode 100644 index 00000000..b9fc8e57 --- /dev/null +++ b/sources/plugins/pastefromword/lang/eo.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'eo', { + confirmCleanup: 'La teksto, kiun vi volas interglui, ŝajnas esti kopiita el Word. Ĉu vi deziras purigi ĝin antaŭ intergluo?', + error: 'Ne eblis purigi la intergluitajn datenojn pro interna eraro', + title: 'Interglui el Word', + toolbar: 'Interglui el Word' +} ); diff --git a/sources/plugins/pastefromword/lang/es.js b/sources/plugins/pastefromword/lang/es.js new file mode 100644 index 00000000..031de57f --- /dev/null +++ b/sources/plugins/pastefromword/lang/es.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'es', { + confirmCleanup: 'El texto que desea parece provenir de Word.\r\n¿Desea depurarlo antes de pegarlo?', + error: 'No ha sido posible limpiar los datos debido a un error interno', + title: 'Pegar desde Word', + toolbar: 'Pegar desde Word' +} ); diff --git a/sources/plugins/pastefromword/lang/et.js b/sources/plugins/pastefromword/lang/et.js new file mode 100644 index 00000000..f41c5ac9 --- /dev/null +++ b/sources/plugins/pastefromword/lang/et.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'et', { + confirmCleanup: 'Tekst, mida tahad asetada näib pärinevat Wordist. Kas tahad selle enne asetamist puhastada?', + error: 'Asetatud andmete puhastamine ei olnud sisemise vea tõttu võimalik', + title: 'Asetamine Wordist', + toolbar: 'Asetamine Wordist' +} ); diff --git a/sources/plugins/pastefromword/lang/eu.js b/sources/plugins/pastefromword/lang/eu.js new file mode 100644 index 00000000..3035a14c --- /dev/null +++ b/sources/plugins/pastefromword/lang/eu.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'eu', { + confirmCleanup: 'Itsatsi nahi duzun testua Word-etik kopiatua dela dirudi. Itsatsi baino lehen garbitu nahi duzu?', + error: 'Barne-errore bat dela eta ezin izan da itsatsitako testua garbitu', + title: 'Itsatsi Word-etik', + toolbar: 'Itsatsi Word-etik' +} ); diff --git a/sources/plugins/pastefromword/lang/fa.js b/sources/plugins/pastefromword/lang/fa.js new file mode 100644 index 00000000..029209ba --- /dev/null +++ b/sources/plugins/pastefromword/lang/fa.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'fa', { + confirmCleanup: 'متنی که میخواهید بچسبانید به نظر میرسد که از Word کپی شده است. آیا میخواهید قبل از چسباندن آن را پاکسازی کنید؟', + error: 'به دلیل بروز خطای داخلی امکان پاکسازی اطلاعات بازنشانی شده وجود ندارد.', + title: 'چسباندن از Word', + toolbar: 'چسباندن از Word' +} ); diff --git a/sources/plugins/pastefromword/lang/fi.js b/sources/plugins/pastefromword/lang/fi.js new file mode 100644 index 00000000..7b368fe7 --- /dev/null +++ b/sources/plugins/pastefromword/lang/fi.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'fi', { + confirmCleanup: 'Liittämäsi teksti näyttäisi olevan Word-dokumentista. Haluatko siivota sen ennen liittämistä? (Suositus: Kyllä)', + error: 'Liitetyn tiedon siivoaminen ei onnistunut sisäisen virheen takia', + title: 'Liitä Word-dokumentista', + toolbar: 'Liitä Word-dokumentista' +} ); diff --git a/sources/plugins/pastefromword/lang/fo.js b/sources/plugins/pastefromword/lang/fo.js new file mode 100644 index 00000000..dc994220 --- /dev/null +++ b/sources/plugins/pastefromword/lang/fo.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'fo', { + confirmCleanup: 'Teksturin, tú roynir at seta inn, sýnist at stava frá Word. Skal teksturin reinsast fyrst?', + error: 'Tað eydnaðist ikki at reinsa tekstin vegna ein internan feil', + title: 'Innrita frá Word', + toolbar: 'Innrita frá Word' +} ); diff --git a/sources/plugins/pastefromword/lang/fr-ca.js b/sources/plugins/pastefromword/lang/fr-ca.js new file mode 100644 index 00000000..4e27e997 --- /dev/null +++ b/sources/plugins/pastefromword/lang/fr-ca.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'fr-ca', { + confirmCleanup: 'Le texte que vous tentez de coller semble provenir de Word. Désirez vous le nettoyer avant de coller?', + error: 'Il n\'a pas été possible de nettoyer les données collées du à une erreur interne', + title: 'Coller de Word', + toolbar: 'Coller de Word' +} ); diff --git a/sources/plugins/pastefromword/lang/fr.js b/sources/plugins/pastefromword/lang/fr.js new file mode 100644 index 00000000..13126f7a --- /dev/null +++ b/sources/plugins/pastefromword/lang/fr.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'fr', { + confirmCleanup: 'Le texte à coller semble provenir de Word. Désirez-vous le nettoyer avant de coller?', + error: 'Il n\'a pas été possible de nettoyer les données collées à la suite d\'une erreur interne.', + title: 'Coller depuis Word', + toolbar: 'Coller depuis Word' +} ); diff --git a/sources/plugins/pastefromword/lang/gl.js b/sources/plugins/pastefromword/lang/gl.js new file mode 100644 index 00000000..655cc3d5 --- /dev/null +++ b/sources/plugins/pastefromword/lang/gl.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'gl', { + confirmCleanup: 'O texto que quere pegar semella ser copiado desde o Word. Quere depuralo antes de pegalo?', + error: 'Non foi posíbel depurar os datos pegados por mor dun erro interno', + title: 'Pegar desde Word', + toolbar: 'Pegar desde Word' +} ); diff --git a/sources/plugins/pastefromword/lang/gu.js b/sources/plugins/pastefromword/lang/gu.js new file mode 100644 index 00000000..6ea245d6 --- /dev/null +++ b/sources/plugins/pastefromword/lang/gu.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'gu', { + confirmCleanup: 'તમે જે ટેક્ષ્ત્ કોપી કરી રહ્યા છો ટે વર્ડ ની છે. કોપી કરતા પેહલા સાફ કરવી છે?', + error: 'પેસ્ટ કરેલો ડેટા ઇન્ટરનલ એરર ના લીથે સાફ કરી શકાયો નથી.', + title: 'પેસ્ટ (વડૅ ટેક્સ્ટ)', + toolbar: 'પેસ્ટ (વડૅ ટેક્સ્ટ)' +} ); diff --git a/sources/plugins/pastefromword/lang/he.js b/sources/plugins/pastefromword/lang/he.js new file mode 100644 index 00000000..80666c70 --- /dev/null +++ b/sources/plugins/pastefromword/lang/he.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'he', { + confirmCleanup: 'נראה הטקסט שבכוונתך להדביק מקורו בקובץ וורד. האם ברצונך לנקות אותו טרם ההדבקה?', + error: 'לא ניתן היה לנקות את המידע בשל תקלה פנימית.', + title: 'הדבקה מ-Word', + toolbar: 'הדבקה מ-Word' +} ); diff --git a/sources/plugins/pastefromword/lang/hi.js b/sources/plugins/pastefromword/lang/hi.js new file mode 100644 index 00000000..2e39fee2 --- /dev/null +++ b/sources/plugins/pastefromword/lang/hi.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'hi', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'पेस्ट (वर्ड से)', + toolbar: 'पेस्ट (वर्ड से)' +} ); diff --git a/sources/plugins/pastefromword/lang/hr.js b/sources/plugins/pastefromword/lang/hr.js new file mode 100644 index 00000000..2a765328 --- /dev/null +++ b/sources/plugins/pastefromword/lang/hr.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'hr', { + confirmCleanup: 'Tekst koji želite zalijepiti čini se da je kopiran iz Worda. Želite li prije očistiti tekst?', + error: 'Nije moguće očistiti podatke za ljepljenje zbog interne greške', + title: 'Zalijepi iz Worda', + toolbar: 'Zalijepi iz Worda' +} ); diff --git a/sources/plugins/pastefromword/lang/hu.js b/sources/plugins/pastefromword/lang/hu.js new file mode 100644 index 00000000..5f670e1e --- /dev/null +++ b/sources/plugins/pastefromword/lang/hu.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'hu', { + confirmCleanup: 'Úgy tűnik a beillesztett szöveget Word-ből másolt át. Meg szeretné tisztítani a szöveget? (ajánlott)', + error: 'Egy belső hiba miatt nem sikerült megtisztítani a szöveget', + title: 'Beillesztés Word-ből', + toolbar: 'Beillesztés Word-ből' +} ); diff --git a/sources/plugins/pastefromword/lang/id.js b/sources/plugins/pastefromword/lang/id.js new file mode 100644 index 00000000..be60dd24 --- /dev/null +++ b/sources/plugins/pastefromword/lang/id.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'id', { + confirmCleanup: 'Teks yang ingin anda tempel sepertinya di salin dari Word. Apakah anda mau membersihkannya sebelum menempel?', + error: 'Tidak mungkin membersihkan data yang ditempel dikerenakan kesalahan internal', + title: 'Tempel dari Word', + toolbar: 'Tempel dari Word' +} ); diff --git a/sources/plugins/pastefromword/lang/is.js b/sources/plugins/pastefromword/lang/is.js new file mode 100644 index 00000000..35dfe084 --- /dev/null +++ b/sources/plugins/pastefromword/lang/is.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'is', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Líma úr Word', + toolbar: 'Líma úr Word' +} ); diff --git a/sources/plugins/pastefromword/lang/it.js b/sources/plugins/pastefromword/lang/it.js new file mode 100644 index 00000000..68020681 --- /dev/null +++ b/sources/plugins/pastefromword/lang/it.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'it', { + confirmCleanup: 'Il testo da incollare sembra provenire da Word. Desideri pulirlo prima di incollare?', + error: 'Non è stato possibile eliminare il testo incollato a causa di un errore interno.', + title: 'Incolla da Word', + toolbar: 'Incolla da Word' +} ); diff --git a/sources/plugins/pastefromword/lang/ja.js b/sources/plugins/pastefromword/lang/ja.js new file mode 100644 index 00000000..a1269c98 --- /dev/null +++ b/sources/plugins/pastefromword/lang/ja.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ja', { + confirmCleanup: '貼り付けを行うテキストはワード文章からコピーされようとしています。貼り付ける前にクリーニングを行いますか?', + error: '内部エラーにより貼り付けたデータをクリアできませんでした', + title: 'ワード文章から貼り付け', + toolbar: 'ワード文章から貼り付け' +} ); diff --git a/sources/plugins/pastefromword/lang/ka.js b/sources/plugins/pastefromword/lang/ka.js new file mode 100644 index 00000000..472ff533 --- /dev/null +++ b/sources/plugins/pastefromword/lang/ka.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ka', { + confirmCleanup: 'ჩასასმელი ტექსტი ვორდიდან გადმოტანილს გავს - გინდათ მისი წინასწარ გაწმენდა?', + error: 'შიდა შეცდომის გამო ვერ მოხერხდა ტექსტის გაწმენდა', + title: 'ვორდიდან ჩასმა', + toolbar: 'ვორდიდან ჩასმა' +} ); diff --git a/sources/plugins/pastefromword/lang/km.js b/sources/plugins/pastefromword/lang/km.js new file mode 100644 index 00000000..cd5268dc --- /dev/null +++ b/sources/plugins/pastefromword/lang/km.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'km', { + confirmCleanup: 'អត្ថបទ​ដែល​អ្នក​ចង់​បិទ​ភ្ជាប់​នេះ ទំនង​ដូច​ជា​ចម្លង​មក​ពី Word។ តើ​អ្នក​ចង់​សម្អាត​វា​មុន​បិទ​ភ្ជាប់​ទេ?', + error: 'ដោយ​សារ​មាន​បញ្ហា​ផ្នែក​ក្នុង​ធ្វើ​ឲ្យ​មិន​អាច​សម្អាត​ទិន្នន័យ​ដែល​បាន​បិទ​ភ្ជាប់', + title: 'បិទ​ភ្ជាប់​ពី Word', + toolbar: 'បិទ​ភ្ជាប់​ពី Word' +} ); diff --git a/sources/plugins/pastefromword/lang/ko.js b/sources/plugins/pastefromword/lang/ko.js new file mode 100644 index 00000000..54870707 --- /dev/null +++ b/sources/plugins/pastefromword/lang/ko.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ko', { + confirmCleanup: '붙여 넣을 내용은 MS Word에서 복사 한 것입니다. 붙여 넣기 전에 정리 하시겠습니까?', + error: '내부 오류로 붙여 넣은 데이터를 정리 할 수 없습니다.', + title: 'MS Word 에서 붙여넣기', + toolbar: 'MS Word 에서 붙여넣기' +} ); diff --git a/sources/plugins/pastefromword/lang/ku.js b/sources/plugins/pastefromword/lang/ku.js new file mode 100644 index 00000000..7fa47dd7 --- /dev/null +++ b/sources/plugins/pastefromword/lang/ku.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ku', { + confirmCleanup: 'ئەم دەقەی بەتەمای بیلکێنی پێدەچێت له word هێنرابێت. دەتەوێت پاکی بکەیوه پێش ئەوەی بیلکێنی؟', + error: 'هیچ ڕێگەیەك نەبوو لەلکاندنی دەقەکه بەهۆی هەڵەیەکی ناوەخۆیی', + title: 'لکاندنی لەلایەن Word', + toolbar: 'لکاندنی لەڕێی Word' +} ); diff --git a/sources/plugins/pastefromword/lang/lt.js b/sources/plugins/pastefromword/lang/lt.js new file mode 100644 index 00000000..b46b34f4 --- /dev/null +++ b/sources/plugins/pastefromword/lang/lt.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'lt', { + confirmCleanup: 'Tekstas, kurį įkeliate yra kopijuojamas iš Word. Ar norite jį išvalyti prieš įkeliant?', + error: 'Dėl vidinių sutrikimų, nepavyko išvalyti įkeliamo teksto', + title: 'Įdėti iš Word', + toolbar: 'Įdėti iš Word' +} ); diff --git a/sources/plugins/pastefromword/lang/lv.js b/sources/plugins/pastefromword/lang/lv.js new file mode 100644 index 00000000..c82f2093 --- /dev/null +++ b/sources/plugins/pastefromword/lang/lv.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'lv', { + confirmCleanup: 'Teksts, kuru vēlaties ielīmēt, izskatās ir nokopēts no Word. Vai vēlaties to iztīrīt pirms ielīmēšanas?', + error: 'Iekšējas kļūdas dēļ, neizdevās iztīrīt ielīmētos datus.', + title: 'Ievietot no Worda', + toolbar: 'Ievietot no Worda' +} ); diff --git a/sources/plugins/pastefromword/lang/mk.js b/sources/plugins/pastefromword/lang/mk.js new file mode 100644 index 00000000..b856a05e --- /dev/null +++ b/sources/plugins/pastefromword/lang/mk.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'mk', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Paste from Word', // MISSING + toolbar: 'Paste from Word' // MISSING +} ); diff --git a/sources/plugins/pastefromword/lang/mn.js b/sources/plugins/pastefromword/lang/mn.js new file mode 100644 index 00000000..2e6fb128 --- /dev/null +++ b/sources/plugins/pastefromword/lang/mn.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'mn', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Word-оос буулгах', + toolbar: 'Word-оос буулгах' +} ); diff --git a/sources/plugins/pastefromword/lang/ms.js b/sources/plugins/pastefromword/lang/ms.js new file mode 100644 index 00000000..ce6ffe6e --- /dev/null +++ b/sources/plugins/pastefromword/lang/ms.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ms', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Tampal dari Word', + toolbar: 'Tampal dari Word' +} ); diff --git a/sources/plugins/pastefromword/lang/nb.js b/sources/plugins/pastefromword/lang/nb.js new file mode 100644 index 00000000..edd15bdd --- /dev/null +++ b/sources/plugins/pastefromword/lang/nb.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'nb', { + confirmCleanup: 'Teksten du limer inn ser ut til å være kopiert fra Word. Vil du renske den før du limer den inn?', + error: 'Det var ikke mulig å renske den innlimte teksten på grunn av en intern feil', + title: 'Lim inn fra Word', + toolbar: 'Lim inn fra Word' +} ); diff --git a/sources/plugins/pastefromword/lang/nl.js b/sources/plugins/pastefromword/lang/nl.js new file mode 100644 index 00000000..a699f3d0 --- /dev/null +++ b/sources/plugins/pastefromword/lang/nl.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'nl', { + confirmCleanup: 'De tekst die u wilt plakken lijkt gekopieerd te zijn vanuit Word. Wilt u de tekst opschonen voordat deze geplakt wordt?', + error: 'Het was niet mogelijk om de geplakte tekst op te schonen door een interne fout', + title: 'Plakken vanuit Word', + toolbar: 'Plakken vanuit Word' +} ); diff --git a/sources/plugins/pastefromword/lang/no.js b/sources/plugins/pastefromword/lang/no.js new file mode 100644 index 00000000..fbb970be --- /dev/null +++ b/sources/plugins/pastefromword/lang/no.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'no', { + confirmCleanup: 'Teksten du limer inn ser ut til å være kopiert fra Word. Vil du renske den før du limer den inn?', + error: 'Det var ikke mulig å renske den innlimte teksten på grunn av en intern feil', + title: 'Lim inn fra Word', + toolbar: 'Lim inn fra Word' +} ); diff --git a/sources/plugins/pastefromword/lang/pl.js b/sources/plugins/pastefromword/lang/pl.js new file mode 100644 index 00000000..245b7d05 --- /dev/null +++ b/sources/plugins/pastefromword/lang/pl.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'pl', { + confirmCleanup: 'Tekst, który chcesz wkleić, prawdopodobnie pochodzi z programu Microsoft Word. Czy chcesz go wyczyścić przed wklejeniem?', + error: 'Wyczyszczenie wklejonych danych nie było możliwe z powodu wystąpienia błędu.', + title: 'Wklej z programu MS Word', + toolbar: 'Wklej z programu MS Word' +} ); diff --git a/sources/plugins/pastefromword/lang/pt-br.js b/sources/plugins/pastefromword/lang/pt-br.js new file mode 100644 index 00000000..199b5a6b --- /dev/null +++ b/sources/plugins/pastefromword/lang/pt-br.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'pt-br', { + confirmCleanup: 'O texto que você deseja colar parece ter sido copiado do Word. Você gostaria de remover a formatação antes de colar?', + error: 'Não foi possível limpar os dados colados devido a um erro interno', + title: 'Colar do Word', + toolbar: 'Colar do Word' +} ); diff --git a/sources/plugins/pastefromword/lang/pt.js b/sources/plugins/pastefromword/lang/pt.js new file mode 100644 index 00000000..06cdee8a --- /dev/null +++ b/sources/plugins/pastefromword/lang/pt.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'pt', { + confirmCleanup: 'O texto que pretende colar parece ter sido copiado do Word. Deseja limpá-lo antes de colar?', + error: 'Não foi possivel limpar a informação colada decido a um erro interno.', + title: 'Colar do Word', + toolbar: 'Colar do Word' +} ); diff --git a/sources/plugins/pastefromword/lang/ro.js b/sources/plugins/pastefromword/lang/ro.js new file mode 100644 index 00000000..5871070c --- /dev/null +++ b/sources/plugins/pastefromword/lang/ro.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ro', { + confirmCleanup: 'Textul pe care doriți să-l lipiți este din Word. Doriți curățarea textului înante de a-l adăuga?', + error: 'Nu a fost posibilă curățarea datelor adăugate datorită unei erori interne', + title: 'Adaugă din Word', + toolbar: 'Adaugă din Word' +} ); diff --git a/sources/plugins/pastefromword/lang/ru.js b/sources/plugins/pastefromword/lang/ru.js new file mode 100644 index 00000000..1a8e159d --- /dev/null +++ b/sources/plugins/pastefromword/lang/ru.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ru', { + confirmCleanup: 'Текст, который вы желаете вставить, по всей видимости, был скопирован из Word. Следует ли очистить его перед вставкой?', + error: 'Невозможно очистить вставленные данные из-за внутренней ошибки', + title: 'Вставить из Word', + toolbar: 'Вставить из Word' +} ); diff --git a/sources/plugins/pastefromword/lang/si.js b/sources/plugins/pastefromword/lang/si.js new file mode 100644 index 00000000..e66b0cbd --- /dev/null +++ b/sources/plugins/pastefromword/lang/si.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'si', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'වචන වලින් අලවන්න', + toolbar: 'වචන වලින් අලවන්න' +} ); diff --git a/sources/plugins/pastefromword/lang/sk.js b/sources/plugins/pastefromword/lang/sk.js new file mode 100644 index 00000000..8386c681 --- /dev/null +++ b/sources/plugins/pastefromword/lang/sk.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'sk', { + confirmCleanup: 'Vkladaný text vyzerá byť skopírovaný z Wordu. Chcete ho automaticky vyčistiť pred vkladaním?', + error: 'Nebolo možné vyčistiť vložené dáta kvôli internej chybe', + title: 'Vložiť z Wordu', + toolbar: 'Vložiť z Wordu' +} ); diff --git a/sources/plugins/pastefromword/lang/sl.js b/sources/plugins/pastefromword/lang/sl.js new file mode 100644 index 00000000..b558ca8a --- /dev/null +++ b/sources/plugins/pastefromword/lang/sl.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'sl', { + confirmCleanup: 'Besedilo, ki ga želite prilepiti je kopirano iz Word-a. Ali ga želite očistiti, preden ga prilepite?', + error: 'Ni bilo mogoče očistiti prilepljenih podatkov zaradi notranje napake', + title: 'Prilepi iz Worda', + toolbar: 'Prilepi iz Worda' +} ); diff --git a/sources/plugins/pastefromword/lang/sq.js b/sources/plugins/pastefromword/lang/sq.js new file mode 100644 index 00000000..41c7c775 --- /dev/null +++ b/sources/plugins/pastefromword/lang/sq.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'sq', { + confirmCleanup: 'Teksti që dëshironi të e hidhni siç duket është kopjuar nga Word-i. Dëshironi të e pastroni para se të e hidhni?', + error: 'Nuk ishte e mundur të fshiheshin të dhënat e hedhura për shkak të një gabimi të brendshëm', + title: 'Hidhe nga Word-i', + toolbar: 'Hidhe nga Word-i' +} ); diff --git a/sources/plugins/pastefromword/lang/sr-latn.js b/sources/plugins/pastefromword/lang/sr-latn.js new file mode 100644 index 00000000..3774a3de --- /dev/null +++ b/sources/plugins/pastefromword/lang/sr-latn.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'sr-latn', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Zalepi iz Worda', + toolbar: 'Zalepi iz Worda' +} ); diff --git a/sources/plugins/pastefromword/lang/sr.js b/sources/plugins/pastefromword/lang/sr.js new file mode 100644 index 00000000..259715b3 --- /dev/null +++ b/sources/plugins/pastefromword/lang/sr.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'sr', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Залепи из Worda', + toolbar: 'Залепи из Worda' +} ); diff --git a/sources/plugins/pastefromword/lang/sv.js b/sources/plugins/pastefromword/lang/sv.js new file mode 100644 index 00000000..d5954b49 --- /dev/null +++ b/sources/plugins/pastefromword/lang/sv.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'sv', { + confirmCleanup: 'Texten du vill klistra in verkar vara kopierad från Word. Vill du rensa den innan du klistrar in den?', + error: 'Det var inte möjligt att städa upp den inklistrade data på grund av ett internt fel', + title: 'Klistra in från Word', + toolbar: 'Klistra in från Word' +} ); diff --git a/sources/plugins/pastefromword/lang/th.js b/sources/plugins/pastefromword/lang/th.js new file mode 100644 index 00000000..2ddcca55 --- /dev/null +++ b/sources/plugins/pastefromword/lang/th.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'th', { + confirmCleanup: 'ข้อความที่คุณต้องการวางลงไปเป็นข้อความที่คัดลอกมาจากโปรแกรมไมโครซอฟท์เวิร์ด คุณต้องการล้างค่าข้อความดังกล่าวก่อนวางลงไปหรือไม่?', + error: 'ไม่สามารถล้างข้อมูลที่ต้องการวางได้เนื่องจากเกิดข้อผิดพลาดภายในระบบ', + title: 'วางสำเนาจากตัวอักษรเวิร์ด', + toolbar: 'วางสำเนาจากตัวอักษรเวิร์ด' +} ); diff --git a/sources/plugins/pastefromword/lang/tr.js b/sources/plugins/pastefromword/lang/tr.js new file mode 100644 index 00000000..12331e38 --- /dev/null +++ b/sources/plugins/pastefromword/lang/tr.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'tr', { + confirmCleanup: 'Yapıştırmaya çalıştığınız metin Word\'den kopyalanmıştır. Yapıştırmadan önce silmek istermisiniz?', + error: 'Yapıştırmadaki veri bilgisi hata düzelene kadar silinmeyecektir', + title: 'Word\'den Yapıştır', + toolbar: 'Word\'den Yapıştır' +} ); diff --git a/sources/plugins/pastefromword/lang/tt.js b/sources/plugins/pastefromword/lang/tt.js new file mode 100644 index 00000000..a5876219 --- /dev/null +++ b/sources/plugins/pastefromword/lang/tt.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'tt', { + confirmCleanup: 'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?', // MISSING + error: 'It was not possible to clean up the pasted data due to an internal error', // MISSING + title: 'Word\'тан өстәү', + toolbar: 'Word\'тан өстәү' +} ); diff --git a/sources/plugins/pastefromword/lang/ug.js b/sources/plugins/pastefromword/lang/ug.js new file mode 100644 index 00000000..8285b371 --- /dev/null +++ b/sources/plugins/pastefromword/lang/ug.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'ug', { + confirmCleanup: 'سىز چاپلىماقچى بولغان مەزمۇن MS Word تىن كەلگەندەك قىلىدۇ، MS Word پىچىمىنى تازىلىۋەتكەندىن كېيىن ئاندىن چاپلامدۇ؟', + error: 'ئىچكى خاتالىق سەۋەبىدىن چاپلايدىغان سانلىق مەلۇماتنى تازىلىيالمايدۇ', + title: 'MS Word تىن چاپلا', + toolbar: 'MS Word تىن چاپلا' +} ); diff --git a/sources/plugins/pastefromword/lang/uk.js b/sources/plugins/pastefromword/lang/uk.js new file mode 100644 index 00000000..ff3fe230 --- /dev/null +++ b/sources/plugins/pastefromword/lang/uk.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'uk', { + confirmCleanup: 'Текст, що Ви намагаєтесь вставити, схожий на скопійований з Word. Бажаєте очистити його форматування перед вставлянням?', + error: 'Неможливо очистити форматування через внутрішню помилку.', + title: 'Вставити з Word', + toolbar: 'Вставити з Word' +} ); diff --git a/sources/plugins/pastefromword/lang/vi.js b/sources/plugins/pastefromword/lang/vi.js new file mode 100644 index 00000000..e967297f --- /dev/null +++ b/sources/plugins/pastefromword/lang/vi.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'vi', { + confirmCleanup: 'Văn bản bạn muốn dán có kèm định dạng của Word. Bạn có muốn loại bỏ định dạng Word trước khi dán?', + error: 'Không thể để làm sạch các dữ liệu dán do một lỗi nội bộ', + title: 'Dán với định dạng Word', + toolbar: 'Dán với định dạng Word' +} ); diff --git a/sources/plugins/pastefromword/lang/zh-cn.js b/sources/plugins/pastefromword/lang/zh-cn.js new file mode 100644 index 00000000..f9e1a952 --- /dev/null +++ b/sources/plugins/pastefromword/lang/zh-cn.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'zh-cn', { + confirmCleanup: '您要粘贴的内容好像是来自 MS Word,是否要清除 MS Word 格式后再粘贴?', + error: '由于内部错误无法清理要粘贴的数据', + title: '从 MS Word 粘贴', + toolbar: '从 MS Word 粘贴' +} ); diff --git a/sources/plugins/pastefromword/lang/zh.js b/sources/plugins/pastefromword/lang/zh.js new file mode 100644 index 00000000..fc460ba6 --- /dev/null +++ b/sources/plugins/pastefromword/lang/zh.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'pastefromword', 'zh', { + confirmCleanup: '您想貼上的文字似乎是自 Word 複製而來,請問您是否要先清除 Word 的格式後再行貼上?', + error: '由於發生內部錯誤,無法清除清除 Word 的格式。', + title: '自 Word 貼上', + toolbar: '自 Word 貼上' +} ); diff --git a/sources/plugins/pastefromword/plugin.js b/sources/plugins/pastefromword/plugin.js new file mode 100644 index 00000000..3bc93798 --- /dev/null +++ b/sources/plugins/pastefromword/plugin.js @@ -0,0 +1,149 @@ +/** + * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ + +( function() { + CKEDITOR.plugins.add( 'pastefromword', { + requires: 'clipboard', + // jscs:disable maximumLineLength + lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE% + // jscs:enable maximumLineLength + icons: 'pastefromword,pastefromword-rtl', // %REMOVE_LINE_CORE% + hidpi: true, // %REMOVE_LINE_CORE% + init: function( editor ) { + var commandName = 'pastefromword', + // Flag indicate this command is actually been asked instead of a generic pasting. + forceFromWord = 0, + path = this.path; + + editor.addCommand( commandName, { + // Snapshots are done manually by editable.insertXXX methods. + canUndo: false, + async: true, + + exec: function( editor ) { + var cmd = this; + + forceFromWord = 1; + // Force html mode for incomming paste events sequence. + editor.once( 'beforePaste', forceHtmlMode ); + + editor.getClipboardData( { title: editor.lang.pastefromword.title }, function( data ) { + // Do not use editor#paste, because it would start from beforePaste event. + data && editor.fire( 'paste', { + type: 'html', + dataValue: data.dataValue, + method: 'paste', + dataTransfer: CKEDITOR.plugins.clipboard.initPasteDataTransfer() + } ); + + editor.fire( 'afterCommandExec', { + name: commandName, + command: cmd, + returnValue: !!data + } ); + } ); + } + } ); + + // Register the toolbar button. + editor.ui.addButton && editor.ui.addButton( 'PasteFromWord', { + label: editor.lang.pastefromword.toolbar, + command: commandName, + toolbar: 'clipboard,50' + } ); + + editor.on( 'pasteState', function( evt ) { + editor.getCommand( commandName ).setState( evt.data ); + } ); + + // Features bring by this command beside the normal process: + // 1. No more bothering of user about the clean-up. + // 2. Perform the clean-up even if content is not from MS-Word. + // (e.g. from a MS-Word similar application.) + // 3. Listen with high priority (3), so clean up is done before content + // type sniffing (priority = 6). + editor.on( 'paste', function( evt ) { + var data = evt.data, + mswordHtml = data.dataValue; + + // MS-WORD format sniffing. + if ( mswordHtml && ( forceFromWord || ( /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/ ).test( mswordHtml ) ) ) { + // Do not apply paste filter to data filtered by the Word filter (#13093). + data.dontFilter = true; + + // If filter rules aren't loaded then cancel 'paste' event, + // load them and when they'll get loaded fire new paste event + // for which data will be filtered in second execution of + // this listener. + var isLazyLoad = loadFilterRules( editor, path, function() { + // Event continuation with the original data. + if ( isLazyLoad ) + editor.fire( 'paste', data ); + else if ( !editor.config.pasteFromWordPromptCleanup || ( forceFromWord || confirm( editor.lang.pastefromword.confirmCleanup ) ) ) // jshint ignore:line + data.dataValue = CKEDITOR.cleanWord( mswordHtml, editor ); + + // Reset forceFromWord. + forceFromWord = 0; + } ); + + // The cleanup rules are to be loaded, we should just cancel + // this event. + isLazyLoad && evt.cancel(); + } + }, null, null, 3 ); + } + + } ); + + function loadFilterRules( editor, path, callback ) { + var isLoaded = CKEDITOR.cleanWord; + + if ( isLoaded ) + callback(); + else { + var filterFilePath = CKEDITOR.getUrl( editor.config.pasteFromWordCleanupFile || ( path + 'filter/default.js' ) ); + + // Load with busy indicator. + CKEDITOR.scriptLoader.load( filterFilePath, callback, null, true ); + } + + return !isLoaded; + } + + function forceHtmlMode( evt ) { + evt.data.type = 'html'; + } +} )(); + + +/** + * Whether to prompt the user about the clean up of content being pasted from MS Word. + * + * config.pasteFromWordPromptCleanup = true; + * + * @since 3.1 + * @cfg {Boolean} [pasteFromWordPromptCleanup=false] + * @member CKEDITOR.config + */ + +/** + * The file that provides the MS Word cleanup function for pasting operations. + * + * **Note:** This is a global configuration shared by all editor instances present + * in the page. + * + * // Load from 'pastefromword' plugin 'filter' sub folder (custom.js file) using path relative to CKEditor installation folder. + * CKEDITOR.config.pasteFromWordCleanupFile = 'plugins/pastefromword/filter/custom.js'; + * + * // Load from 'pastefromword' plugin 'filter' sub folder (custom.js file) using full path (including CKEditor installation folder). + * CKEDITOR.config.pasteFromWordCleanupFile = '/ckeditor/plugins/pastefromword/filter/custom.js'; + * + * // Load custom.js file from 'customFilerts' folder (located in server's root) using full URL. + * CKEDITOR.config.pasteFromWordCleanupFile = 'http://my.example.com/customFilerts/custom.js'; + * + * @since 3.1 + * @cfg {String} [pasteFromWordCleanupFile= + 'filter/default.js'] + * @member CKEDITOR.config + */ -- cgit v1.2.3