{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-clipboard/src/utils/normalizeclipboarddata.js","webpack:///./node_modules/@ckeditor/ckeditor5-clipboard/src/utils/plaintexttohtml.js","webpack:///./node_modules/@ckeditor/ckeditor5-clipboard/src/utils/viewtoplaintext.js","webpack:///./node_modules/@ckeditor/ckeditor5-clipboard/src/pasteplaintext.js"],"names":["normalizeClipboardData","data","replace","fullMatch","spaces","length","plainTextToHtml","text","includes","concat","smallPaddingElements","viewToPlainText","viewItem","is","hasAttribute","getAttribute","_step","prev","_iterator","_createForOfIteratorHelper","getChildren","s","n","done","child","value","childText","name","err","e","f","PastePlainText","editor","this","model","view","editing","viewDocument","document","selection","shiftPressed","addObserver","ClipboardObserver","listenTo","evt","shiftKey","plugins","get","ClipboardPipeline","on","isPlainTextFragment","content","schema","change","writer","textAttributes","Array","from","getAttributes","filter","_ref","_ref2","Object","D_Projects_UA_repo_Source_Client_UA_User_Web_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__","key","getAttributeProperties","isFormatting","isCollapsed","deleteContent","doNotAutoparagraph","push","apply","D_Projects_UA_repo_Source_Client_UA_User_Web_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_5__","range","createRangeIn","getItems","item","setAttributes","Plugin","documentFragment","childCount","getChild","isObject","getAttributeKeys"],"mappings":";;;;;AAgBe,SAASA,EAAwBC,GAC/C,OAAOA,EACLC,QAAS,0DAA2D,SAAEC,EAAWC,GAGjF,OAAsB,GAAjBA,EAAOC,OACJ,IAGDD,IAGPF,QAAS,mBAAoB;;;;;ACbjB,SAASI,EAAiBC,GAuBxC,OAtBAA,EAAOA,EAELL,QAAS,KAAM,QACfA,QAAS,KAAM,QAEfA,QAAS,cAAe,WAExBA,QAAS,SAAU,QAEnBA,QAAS,MAAO,UAChBA,QAAS,MAAO,UAEhBA,QAAS,QAAS,YAEfK,EAAKC,SAAU,YAAeD,EAAKC,S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AA,KAAAD,CAAAF,EAAA,GAAII,EAAJH,EAAA,UAAe3B,EAAMkB,OAAOa,uBAAwBD,GAAME,eAE9D3B,EAAU4B,aACfjC,EAAMkC,cAAe7B,GAAa8B,oBAAoB,IAMvDd,EAAee,KAAfC,MAAAhB,EAAcO,OAAAU,EAAA,KAAAV,CAAUvB,EAAUmB,kBAElC,IAduB1C,EAcjByD,EAAQnB,EAAOoB,cAAezE,EAAKkD,SAdlBjC,EAAAC,EAgBHsD,EAAME,YAhBH,IAgBvB,IAAAzD,EAAAG,MAAAL,EAAAE,EAAAI,KAAAC,MAAuC,KAA3BqD,EAA2B5D,EAAAS,MACjCmD,EAAK/D,GAAI,eACbyC,EAAOuB,cAAetB,EAAgBqB,IAlBjB,MAAAhD,GAAAV,EAAAW,EAAAD,GAAA,QAAAV,EAAAY,mCApC1B,WACC,MAAO,uCAMR,WACC,OAASkB,eAZiC8B,QAuE5C,SAAS5B,EAAqB6B,EAAkB3B,GAC/C,GAAK2B,EAAiBC,WAAa,EAClC,OAAO,EAGR,IAAMxD,EAAQuD,EAAiBE,SAAU,GAEzC,OAAK7B,EAAO8B,SAAU1D,IAI2B,GAA1CsC,OAAAU,EAAA,KAAAV,CAAKtC,EAAM2D,oBAAqB9E","file":"js/chunk-c83d43f0.1d1bcaba.js","sourcesContent":["/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module clipboard/utils/normalizeclipboarddata\n */\n\n/**\n * Removes some popular browser quirks out of the clipboard data (HTML).\n * Removes all HTML comments. Comments are considered as an internal thing and it makes little sense if they leak to editor data.\n *\n * @param {String} data The HTML data to normalize.\n * @returns {String} Normalized HTML.\n */\nexport default function normalizeClipboardData( data ) {\n\treturn data\n\t\t.replace( /(\\s+)<\\/span>/g, ( fullMatch, spaces ) => {\n\t\t\t// Handle the most popular and problematic case when even a single space becomes an nbsp;.\n\t\t\t// Decode those to normal spaces. Read more in https://github.com/ckeditor/ckeditor5-clipboard/issues/2.\n\t\t\tif ( spaces.length == 1 ) {\n\t\t\t\treturn ' ';\n\t\t\t}\n\n\t\t\treturn spaces;\n\t\t} )\n\t\t// Remove all HTML comments.\n\t\t.replace( //g, '' );\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module clipboard/utils/plaintexttohtml\n */\n\n/**\n * Converts plain text to its HTML-ized version.\n *\n * @param {String} text The plain text to convert.\n * @returns {String} HTML generated from the plain text.\n */\nexport default function plainTextToHtml( text ) {\n\ttext = text\n\t\t// Encode <>.\n\t\t.replace( //g, '>' )\n\t\t// Creates a paragraph for each double line break.\n\t\t.replace( /\\r?\\n\\r?\\n/g, '

' )\n\t\t// Creates a line break for each single line break.\n\t\t.replace( /\\r?\\n/g, '
' )\n\t\t// Preserve trailing spaces (only the first and last one – the rest is handled below).\n\t\t.replace( /^\\s/, ' ' )\n\t\t.replace( /\\s$/, ' ' )\n\t\t// Preserve other subsequent spaces now.\n\t\t.replace( /\\s\\s/g, '  ' );\n\n\tif ( text.includes( '

' ) || text.includes( '
' ) ) {\n\t\t// If we created paragraphs above, add the trailing ones.\n\t\ttext = `

${ text }

`;\n\t}\n\n\t// TODO:\n\t// * What about '\\nfoo' vs ' foo'?\n\n\treturn text;\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module clipboard/utils/viewtoplaintext\n */\n\n// Elements which should not have empty-line padding.\n// Most `view.ContainerElement` want to be separate by new-line, but some are creating one structure\n// together (like `
  • `) so it is better to separate them by only one \"\\n\".\nconst smallPaddingElements = [ 'figcaption', 'li' ];\n\n/**\n * Converts {@link module:engine/view/item~Item view item} and all of its children to plain text.\n *\n * @param {module:engine/view/item~Item} viewItem View item to convert.\n * @returns {String} Plain text representation of `viewItem`.\n */\nexport default function viewToPlainText( viewItem ) {\n\tlet text = '';\n\n\tif ( viewItem.is( '$text' ) || viewItem.is( '$textProxy' ) ) {\n\t\t// If item is `Text` or `TextProxy` simple take its text data.\n\t\ttext = viewItem.data;\n\t} else if ( viewItem.is( 'element', 'img' ) && viewItem.hasAttribute( 'alt' ) ) {\n\t\t// Special case for images - use alt attribute if it is provided.\n\t\ttext = viewItem.getAttribute( 'alt' );\n\t} else if ( viewItem.is( 'element', 'br' ) ) {\n\t\t// A soft break should be converted into a single line break (#8045).\n\t\ttext = '\\n';\n\t} else {\n\t\t// Other elements are document fragments, attribute elements or container elements.\n\t\t// They don't have their own text value, so convert their children.\n\t\tlet prev = null;\n\n\t\tfor ( const child of viewItem.getChildren() ) {\n\t\t\tconst childText = viewToPlainText( child );\n\n\t\t\t// Separate container element children with one or more new-line characters.\n\t\t\tif ( prev && ( prev.is( 'containerElement' ) || child.is( 'containerElement' ) ) ) {\n\t\t\t\tif ( smallPaddingElements.includes( prev.name ) || smallPaddingElements.includes( child.name ) ) {\n\t\t\t\t\ttext += '\\n';\n\t\t\t\t} else {\n\t\t\t\t\ttext += '\\n\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttext += childText;\n\t\t\tprev = child;\n\t\t}\n\t}\n\n\treturn text;\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module clipboard/pasteplaintext\n */\n\nimport Plugin from '@ckeditor/ckeditor5-core/src/plugin';\n\nimport ClipboardObserver from './clipboardobserver';\nimport ClipboardPipeline from './clipboardpipeline';\n\n/**\n * The plugin detects the user's intention to paste plain text.\n *\n * For example, it detects the Ctrl/Cmd + Shift + V keystroke.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class PastePlainText extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'PastePlainText';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ClipboardPipeline ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\t\tconst view = editor.editing.view;\n\t\tconst viewDocument = view.document;\n\t\tconst selection = model.document.selection;\n\n\t\tlet shiftPressed = false;\n\n\t\tview.addObserver( ClipboardObserver );\n\n\t\tthis.listenTo( viewDocument, 'keydown', ( evt, data ) => {\n\t\t\tshiftPressed = data.shiftKey;\n\t\t} );\n\n\t\teditor.plugins.get( ClipboardPipeline ).on( 'contentInsertion', ( evt, data ) => {\n\t\t\t// Plain text can be determined based on the event flag (#7799) or auto-detection (#1006). If detected,\n\t\t\t// preserve selection attributes on pasted items.\n\t\t\tif ( !shiftPressed && !isPlainTextFragment( data.content, model.schema ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmodel.change( writer => {\n\t\t\t\t// Formatting attributes should be preserved.\n\t\t\t\tconst textAttributes = Array.from( selection.getAttributes() )\n\t\t\t\t\t.filter( ( [ key ] ) => model.schema.getAttributeProperties( key ).isFormatting );\n\n\t\t\t\tif ( !selection.isCollapsed ) {\n\t\t\t\t\tmodel.deleteContent( selection, { doNotAutoparagraph: true } );\n\t\t\t\t}\n\n\t\t\t\t// Also preserve other attributes if they survived the content deletion (because they were not fully selected).\n\t\t\t\t// For example linkHref is not a formatting attribute but it should be preserved if pasted text was in the middle\n\t\t\t\t// of a link.\n\t\t\t\ttextAttributes.push( ...selection.getAttributes() );\n\n\t\t\t\tconst range = writer.createRangeIn( data.content );\n\n\t\t\t\tfor ( const item of range.getItems() ) {\n\t\t\t\t\tif ( item.is( '$textProxy' ) ) {\n\t\t\t\t\t\twriter.setAttributes( textAttributes, item );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}\n}\n\n// Returns true if specified `documentFragment` represents a plain text.\n//\n// @param {module:engine/view/documentfragment~DocumentFragment} documentFragment\n// @param {module:engine/model/schema~Schema} schema\n// @returns {Boolean}\nfunction isPlainTextFragment( documentFragment, schema ) {\n\tif ( documentFragment.childCount > 1 ) {\n\t\treturn false;\n\t}\n\n\tconst child = documentFragment.getChild( 0 );\n\n\tif ( schema.isObject( child ) ) {\n\t\treturn false;\n\t}\n\n\treturn [ ...child.getAttributeKeys() ].length == 0;\n}\n"],"sourceRoot":""}