{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-typing/src/deletecommand.js","webpack:///./node_modules/@ckeditor/ckeditor5-typing/src/deleteobserver.js","webpack:///./node_modules/@ckeditor/ckeditor5-typing/src/delete.js"],"names":["DeleteCommand","editor","direction","_this","Object","classCallCheck","this","_super","call","_buffer","ChangeBuffer","model","config","get","_this2","options","arguments","length","undefined","doc","document","enqueueChange","batch","writer","lock","selection","createSelection","sequence","doNotResetEntireContent","isCollapsed","modifySelection","unit","_shouldEntireContentBeReplacedWithParagraph","_replaceEntireContentWithParagraph","_shouldReplaceFirstBlockWithParagraph","execute","changeCount","getFirstRange","getMinimalFlatRanges","forEach","range","count","getWalker","singleCharacters","ignoreElementEnd","shallow","deleteContent","input","setSelection","unlock","limitElement","schema","getLimitElement","limitElementIsEmpty","containsEntireContent","checkChild","limitElementFirstChild","getChild","name","paragraph","createElement","remove","createRangeIn","insert","position","getFirstPosition","parent","Command","DeleteObserver","view","fireViewDeleteEvent","originalEvent","domEvent","deleteData","event","BubblingEventInfo","fire","DomEventData","stop","called","on","evt","data","keyCode","keyCodes","delete","backspace","hasWordModifier","env","isMac","altKey","ctrlKey","isAndroid","inputType","domSelection","domTarget","ownerDocument","defaultView","getSelection","anchorNode","focusNode","anchorOffset","focusOffset","selectionToRemove","domConverter","domSelectionToView","Observer","Delete","editing","viewDocument","addObserver","deleteForwardCommand","commands","add","listenTo","deleteCommandParams","_step","modelSelection","ranges","_iterator","_createForOfIteratorHelper","getRanges","s","n","done","viewRange","value","push","mapper","toModelRange","err","e","f","setTo","preventDefault","scrollToTheSelection","priority","domSelectionAfterDeletion","collapse","extend","Plugin"],"mappings":";;;;OAoBqBA,6CAQpB,SAAAA,EAAaC,EAAQC,GAAY,IAAAC,EAAA,OAAAC,OAAAC,EAAA,KAAAD,CAAAE,KAAAN,GAChCG,EAAAI,EAAAC,KAAAF,KAAOL,GASPE,EAAKD,UAAYA,EASjBC,EAAKM,QAAU,IAAIC,OAAcT,EAAO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B,kBAAoB,CAC7B,IAD6Ba,EACvBC,EAAiBpH,EAAOU,MAAMe,kBAC9B4F,KAFuBC,EAAAC,EAIJtC,EAAKqB,kBAAkBkB,aAJnB,IAI7B,IAAAF,EAAAG,MAAAN,EAAAG,EAAAI,KAAAC,MAA8D,KAAlDC,EAAkDT,EAAAU,MAC7DR,EAAOS,KAAM9H,EAAO2G,QAAQoB,OAAOC,aAAcJ,KALrB,MAAAK,GAAAX,EAAAY,EAAAD,GAAA,QAAAX,EAAAa,IAQ7Bf,EAAegB,MAAOf,GAEtBH,EAAoB1F,UAAY4F,EAGjCpH,EAAOkC,QAA2B,WAAlB+C,EAAKhF,UAAyB,gBAAkB,SAAUiH,GAE1EjC,EAAKoD,iBAELjE,EAAKkE,yBACDC,SAAU,QAUVhD,OAAII,UAAY,CACpB,IAAI6C,EAA4B,KAEhCnI,KAAK4G,SAAUL,EAAc,SAAU,SAAE5B,EAAKC,GAC7C,IAAMY,EAAeZ,EAAKa,UAAUC,cAAcC,YAAYC,eAE9DuC,GACCtC,WAAYL,EAAaK,WACzBE,aAAcP,EAAaO,aAC3BD,UAAWN,EAAaM,UACxBE,YAAaR,EAAaQ,eAEvBkC,SAAU,WAEflI,KAAK4G,SAAUL,EAAc,QAAS,SAAE5B,EAAKC,GAC5C,GAAKuD,EAA4B,CAChC,IAAM3C,EAAeZ,EAAKa,UAAUC,cAAcC,YAAYC,eAE9DJ,EAAa4C,SAAUD,EAA0BtC,WAAYsC,EAA0BpC,cACvFP,EAAa6C,OAAQF,EAA0BrC,UAAWqC,EAA0BnC,aAEpFmC,EAA4B,mCAxEhC,WACC,MAAO,gBAL2BG","file":"js/chunk-2d0ba689.188b0c68.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 typing/deletecommand\n */\n\nimport Command from '@ckeditor/ckeditor5-core/src/command';\nimport count from '@ckeditor/ckeditor5-utils/src/count';\n\nimport ChangeBuffer from './utils/changebuffer';\n\n/**\n * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the Delete and\n * Backspace keys.\n *\n * @extends module:core/command~Command\n */\nexport default class DeleteCommand extends Command {\n\t/**\n\t * Creates an instance of the command.\n\t *\n\t * @param {module:core/editor/editor~Editor} editor\n\t * @param {'forward'|'backward'} direction The directionality of the delete describing in what direction it\n\t * should consume the content when the selection is collapsed.\n\t */\n\tconstructor( editor, direction ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * The directionality of the delete describing in what direction it should\n\t\t * consume the content when the selection is collapsed.\n\t\t *\n\t\t * @readonly\n\t\t * @member {'forward'|'backward'} #direction\n\t\t */\n\t\tthis.direction = direction;\n\n\t\t/**\n\t\t * Delete's change buffer used to group subsequent changes into batches.\n\t\t *\n\t\t * @readonly\n\t\t * @private\n\t\t * @type {module:typing/utils/changebuffer~ChangeBuffer}\n\t\t */\n\t\tthis._buffer = new ChangeBuffer( editor.model, editor.config.get( 'typing.undoStep' ) );\n\t}\n\n\t/**\n\t * The current change buffer.\n\t *\n\t * @type {module:typing/utils/changebuffer~ChangeBuffer}\n\t */\n\tget buffer() {\n\t\treturn this._buffer;\n\t}\n\n\t/**\n\t * Executes the delete command. Depending on whether the selection is collapsed or not, deletes its content\n\t * or a piece of content in the {@link #direction defined direction}.\n\t *\n\t * @fires execute\n\t * @param {Object} [options] The command options.\n\t * @param {'character'} [options.unit='character'] See {@link module:engine/model/utils/modifyselection~modifySelection}'s options.\n\t * @param {Number} [options.sequence=1] A number describing which subsequent delete event it is without the key being released.\n\t * See the {@link module:engine/view/document~Document#event:delete} event data.\n\t * @param {module:engine/model/selection~Selection} [options.selection] Selection to remove. If not set, current model selection\n\t * will be used.\n\t */\n\texecute( options = {} ) {\n\t\tconst model = this.editor.model;\n\t\tconst doc = model.document;\n\n\t\tmodel.enqueueChange( this._buffer.batch, writer => {\n\t\t\tthis._buffer.lock();\n\n\t\t\tconst selection = writer.createSelection( options.selection || doc.selection );\n\t\t\tconst sequence = options.sequence || 1;\n\n\t\t\t// Do not replace the whole selected content if selection was collapsed.\n\t\t\t// This prevents such situation:\n\t\t\t//\n\t\t\t//
[]
\t-->]
\t\t--> \n\t\t\t// starting content\t\t--> after `modifySelection`\t--> after `deleteContent`.\n\t\t\tconst doNotResetEntireContent = selection.isCollapsed;\n\n\t\t\t// Try to extend the selection in the specified direction.\n\t\t\tif ( selection.isCollapsed ) {\n\t\t\t\tmodel.modifySelection( selection, { direction: this.direction, unit: options.unit } );\n\t\t\t}\n\n\t\t\t// Check if deleting in an empty editor. See #61.\n\t\t\tif ( this._shouldEntireContentBeReplacedWithParagraph( sequence ) ) {\n\t\t\t\tthis._replaceEntireContentWithParagraph( writer );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check if deleting in the first empty block.\n\t\t\t// See https://github.com/ckeditor/ckeditor5/issues/8137.\n\t\t\tif ( this._shouldReplaceFirstBlockWithParagraph( selection, sequence ) ) {\n\t\t\t\tthis.editor.execute( 'paragraph', { selection } );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If selection is still collapsed, then there's nothing to delete.\n\t\t\tif ( selection.isCollapsed ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet changeCount = 0;\n\n\t\t\tselection.getFirstRange().getMinimalFlatRanges().forEach( range => {\n\t\t\t\tchangeCount += count(\n\t\t\t\t\trange.getWalker( { singleCharacters: true, ignoreElementEnd: true, shallow: true } )\n\t\t\t\t);\n\t\t\t} );\n\n\t\t\tmodel.deleteContent( selection, {\n\t\t\t\tdoNotResetEntireContent,\n\t\t\t\tdirection: this.direction\n\t\t\t} );\n\n\t\t\tthis._buffer.input( changeCount );\n\n\t\t\twriter.setSelection( selection );\n\n\t\t\tthis._buffer.unlock();\n\t\t} );\n\t}\n\n\t/**\n\t * If the user keeps Backspace or Delete key pressed, the content of the current\n\t * editable will be cleared. However, this will not yet lead to resetting the remaining block to a paragraph\n\t * (which happens e.g. when the user does Ctrl + A, Backspace).\n\t *\n\t * But, if the user pressed the key in an empty editable for the first time,\n\t * we want to replace the entire content with a paragraph if:\n\t *\n\t * * the current limit element is empty,\n\t * * the paragraph is allowed in the limit element,\n\t * * the limit doesn't already have a paragraph inside.\n\t *\n\t * See https://github.com/ckeditor/ckeditor5-typing/issues/61.\n\t *\n\t * @private\n\t * @param {Number} sequence A number describing which subsequent delete event it is without the key being released.\n\t * @returns {Boolean}\n\t */\n\t_shouldEntireContentBeReplacedWithParagraph( sequence ) {\n\t\t// Does nothing if user pressed and held the \"Backspace\" or \"Delete\" key.\n\t\tif ( sequence > 1 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst model = this.editor.model;\n\t\tconst doc = model.document;\n\t\tconst selection = doc.selection;\n\t\tconst limitElement = model.schema.getLimitElement( selection );\n\n\t\t// If a collapsed selection contains the whole content it means that the content is empty\n\t\t// (from the user perspective).\n\t\tconst limitElementIsEmpty = selection.isCollapsed && selection.containsEntireContent( limitElement );\n\n\t\tif ( !limitElementIsEmpty ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( !model.schema.checkChild( limitElement, 'paragraph' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst limitElementFirstChild = limitElement.getChild( 0 );\n\n\t\t// Does nothing if the limit element already contains only a paragraph.\n\t\t// We ignore the case when paragraph might have some inline elements (