{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-list/src/liststylecommand.js","webpack:///./node_modules/@ckeditor/ckeditor5-list/src/liststyleediting.js","webpack:///./node_modules/@ckeditor/ckeditor5-list/src/liststyle.js"],"names":["ListStyleCommand","editor","defaultType","_this","Object","classCallCheck","this","_super","call","_defaultType","value","_getValue","isEnabled","_checkEnabled","_this2","options","arguments","length","undefined","model","document","listItems","toConsumableArray","selection","getSelectedBlocks","filter","element","is","map","position","change","writer","createPositionAt","concat","getSiblingNodes","flat","Set","_step","_iterator","_createForOfIteratorHelper","s","n","done","item","setAttribute","type","err","e","f","listItem","getFirstPosition","parent","getAttribute","numberedList","commands","get","bulletedList","Command","DEFAULT_LIST_TYPE","ListStyleEditing","schema","extend","allowAttributes","add","listenTo","fixListAfterIndentListCommand","fixListAfterOutdentListCommand","restoreDefaultListStyle","registerPostFixer","fixListStyleAttributeOnListItemElements","conversion","for","upcastListItemStyle","downcastListStyleAttribute","_mergeListStyleAttributeWhileMergingLists","removeListStyleAttributeFromTodoList","firstMostOuterItem","evt","_ref","_ref2","slicedToArray","firstPosition","lastPosition","getLastPosition","nextSibling","mostOuterItemList","getSiblingListItem","sameIndent","listIndent","priority","secondListMostOuterItem","direction","items","liststyleediting_createForOfIteratorHelper","ListEditing","Plugin","dispatcher","on","data","conversionApi","listParent","viewItem","listStyle","getStyle","modelRange","start","nodeAfter","end","nodeBefore","viewWriter","currentElement","previousElement","previousSibling","mapper","toViewElement","areRepresentingSameList","breakContainer","createPositionBefore","setListStyle","attributeNewValue","listItem1","listItem2","setStyle","removeStyle","changedItems","valueToSet","root","rootIndent","itemsToUpdate","_step2","_iterator2","reverse","indent","listType","_step3","_iterator3","wasFixed","insertedListItems","getChangedListItems","differ","getChanges","existingListItem","_step4","_iterator4","hasAttribute","shouldInheritListTypeFromPreviousItem","shouldInheritListType","baseItem","itemToChange","baseListStyle","previousItem","previousItemIndent","previousItemListStyle","todoListItems","_step5","_iterator5","removeAttribute","_step6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APyB,MAAAG,GAAAmH,EAAAlH,EAAAD,GAAA,QAAAmH,EAAAjH,IAWvC,OAAO4C,EAGR,SAASsE,EAAmBpI,GAC3B,MAAqB,cAAhBA,EAAOe,KACJf,EAAOsI,MAAM3D,MAAMC,UAGN,WAAhB5E,EAAOe,KACJf,EAAOD,SAAS6E,UAGjB;;;;OCloBa2D,kKAIpB,WACC,OAAS1G,EAAkB2G,gCAM5B,WACC,MAAO,mBAZ8BvE","file":"js/chunk-2d0b5db5.29844258.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 list/liststylecommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\nimport { getSiblingNodes } from './utils';\n\n/**\n * The list style command. It is used by the {@link module:list/liststyle~ListStyle list style feature}.\n *\n * @extends module:core/command~Command\n */\nexport default class ListStyleCommand extends Command {\n\t/**\n\t * Creates an instance of the command.\n\t *\n\t * @param {module:core/editor/editor~Editor} editor The editor instance.\n\t * @param {String} defaultType The list type that will be used by default if the value was not specified during\n\t * the command execution.\n\t */\n\tconstructor( editor, defaultType ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * The default type of the list style.\n\t\t *\n\t\t * @protected\n\t\t * @member {String}\n\t\t */\n\t\tthis._defaultType = defaultType;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.value = this._getValue();\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command.\n\t *\n\t * @param {Object} options\n\t * @param {String|null} options.type The type of the list style, e.g. `'disc'` or `'square'`. If `null` is specified, the default\n\t * style will be applied.\n\t * @protected\n\t */\n\texecute( options = {} ) {\n\t\tconst model = this.editor.model;\n\t\tconst document = model.document;\n\n\t\t// For all selected blocks find all list items that are being selected\n\t\t// and update the `listStyle` attribute in those lists.\n\t\tlet listItems = [ ...document.selection.getSelectedBlocks() ]\n\t\t\t.filter( element => element.is( 'element', 'listItem' ) )\n\t\t\t.map( element => {\n\t\t\t\tconst position = model.change( writer => writer.createPositionAt( element, 0 ) );\n\n\t\t\t\treturn [\n\t\t\t\t\t...getSiblingNodes( position, 'backward' ),\n\t\t\t\t\t...getSiblingNodes( position, 'forward' )\n\t\t\t\t];\n\t\t\t} )\n\t\t\t.flat();\n\n\t\t// Since `getSelectedBlocks()` can return items that belong to the same list, and\n\t\t// `getSiblingNodes()` returns the entire list, we need to remove duplicated items.\n\t\tlistItems = [ ...new Set( listItems ) ];\n\n\t\tif ( !listItems.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tmodel.change( writer => {\n\t\t\tfor ( const item of listItems ) {\n\t\t\t\twriter.setAttribute( 'listStyle', options.type || this._defaultType, item );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks the command's {@link #value}.\n\t *\n\t * @private\n\t * @returns {String|null} The current value.\n\t */\n\t_getValue() {\n\t\tconst listItem = this.editor.model.document.selection.getFirstPosition().parent;\n\n\t\tif ( listItem && listItem.is( 'element', 'listItem' ) ) {\n\t\t\treturn listItem.getAttribute( 'listStyle' );\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tconst editor = this.editor;\n\n\t\tconst numberedList = editor.commands.get( 'numberedList' );\n\t\tconst bulletedList = editor.commands.get( 'bulletedList' );\n\n\t\treturn numberedList.isEnabled || bulletedList.isEnabled;\n\t}\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 list/liststyleediting\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport ListEditing from './listediting';\nimport ListStyleCommand from './liststylecommand';\nimport { getSiblingListItem, getSiblingNodes } from './utils';\n\nconst DEFAULT_LIST_TYPE = 'default';\n\n/**\n * The list style engine feature.\n *\n * It sets the value for the `listItem` attribute of the {@link module:list/list~List ``} element that\n * allows modifying the list style type.\n *\n * It registers the `'listStyle'` command.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ListStyleEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ListEditing ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ListStyleEditing';\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\n\t\t// Extend schema.\n\t\tmodel.schema.extend( 'listItem', {\n\t\t\tallowAttributes: [ 'listStyle' ]\n\t\t} );\n\n\t\teditor.commands.add( 'listStyle', new ListStyleCommand( editor, DEFAULT_LIST_TYPE ) );\n\n\t\t// Fix list attributes when modifying their nesting levels (the `listIndent` attribute).\n\t\tthis.listenTo( editor.commands.get( 'indentList' ), '_executeCleanup', fixListAfterIndentListCommand( editor ) );\n\t\tthis.listenTo( editor.commands.get( 'outdentList' ), '_executeCleanup', fixListAfterOutdentListCommand( editor ) );\n\n\t\tthis.listenTo( editor.commands.get( 'bulletedList' ), '_executeCleanup', restoreDefaultListStyle( editor ) );\n\t\tthis.listenTo( editor.commands.get( 'numberedList' ), '_executeCleanup', restoreDefaultListStyle( editor ) );\n\n\t\t// Register a post-fixer that ensures that the `listStyle` attribute is specified in each `listItem` element.\n\t\tmodel.document.registerPostFixer( fixListStyleAttributeOnListItemElements( editor ) );\n\n\t\t// Set up conversion.\n\t\teditor.conversion.for( 'upcast' ).add( upcastListItemStyle() );\n\t\teditor.conversion.for( 'downcast' ).add( downcastListStyleAttribute() );\n\n\t\t// Handle merging two separated lists into the single one.\n\t\tthis._mergeListStyleAttributeWhileMergingLists();\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tafterInit() {\n\t\tconst editor = this.editor;\n\n\t\t// Enable post-fixer that removes the `listStyle` attribute from to-do list items only if the \"TodoList\" plugin is on.\n\t\t// We need to registry the hook here since the `TodoList` plugin can be added after the `ListStyleEditing`.\n\t\tif ( editor.commands.get( 'todoList' ) ) {\n\t\t\teditor.model.document.registerPostFixer( removeListStyleAttributeFromTodoList( editor ) );\n\t\t}\n\t}\n\n\t/**\n\t * Starts listening to {@link module:engine/model/model~Model#deleteContent} checks whether two lists will be merged into a single one\n\t * after deleting the content.\n\t *\n\t * The purpose of this action is to adjust the `listStyle` value for the list that was merged.\n\t *\n\t * Consider the following model's content:\n\t *\n\t * UL List item 1\n\t * UL List item 2\n\t * [A paragraph.]\n\t * UL List item 1\n\t * UL List item 2\n\t *\n\t * After removing the paragraph element, the second list will be merged into the first one.\n\t * We want to inherit the `listStyle` attribute for the second list from the first one.\n\t *\n\t * UL List item 1\n\t * UL List item 2\n\t * UL List item 1\n\t * UL List item 2\n\t *\n\t * See https://github.com/ckeditor/ckeditor5/issues/7879.\n\t *\n\t * @private\n\t */\n\t_mergeListStyleAttributeWhileMergingLists() {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\n\t\t// First the outer-most`listItem` in the first list reference.\n\t\t// If found, the lists should be merged and this `listItem` provides the `listStyle` attribute\n\t\t// and it is also a starting point when searching for items in the second list.\n\t\tlet firstMostOuterItem;\n\n\t\t// Check whether the removed content is between two lists.\n\t\tthis.listenTo( model, 'deleteContent', ( evt, [ selection ] ) => {\n\t\t\tconst firstPosition = selection.getFirstPosition();\n\t\t\tconst lastPosition = selection.getLastPosition();\n\n\t\t\t// Typing or removing content in a single item. Aborting.\n\t\t\tif ( firstPosition.parent === lastPosition.parent ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// An element before the content that will be removed is not a list.\n\t\t\tif ( !firstPosition.parent.is( 'element', 'listItem' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextSibling = lastPosition.parent.nextSibling;\n\n\t\t\t// An element after the content that will be removed is not a list.\n\t\t\tif ( !nextSibling || !nextSibling.is( 'element', 'listItem' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Find the outermost list item based on the `listIndent` attribute. We can't assume that `listIndent=0`\n\t\t\t// because the selection can be hooked in nested lists.\n\t\t\t//\n\t\t\t// UL List item 1\n\t\t\t// UL List [item 1.1\n\t\t\t// []UL List item 1.\n\t\t\t// UL List ]item 1.1\n\t\t\t//\n\t\t\t// After deleting the content, we would like to inherit the \"square\" attribute for the last element:\n\t\t\t//\n\t\t\t// UL List item 1\n\t\t\t// UL List []item 1.1\n\t\t\tconst mostOuterItemList = getSiblingListItem( firstPosition.parent, {\n\t\t\t\tsameIndent: true,\n\t\t\t\tlistIndent: nextSibling.getAttribute( 'listIndent' )\n\t\t\t} );\n\n\t\t\t// The outermost list item may not exist while removing elements between lists with different value\n\t\t\t// of the `listIndent` attribute. In such a case we don't want to update anything. See: #8073.\n\t\t\tif ( !mostOuterItemList ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( mostOuterItemList.getAttribute( 'listType' ) === nextSibling.getAttribute( 'listType' ) ) {\n\t\t\t\tfirstMostOuterItem = mostOuterItemList;\n\t\t\t}\n\t\t}, { priority: 'high' } );\n\n\t\t// If so, update the `listStyle` attribute for the second list.\n\t\tthis.listenTo( model, 'deleteContent', () => {\n\t\t\tif ( !firstMostOuterItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmodel.change( writer => {\n\t\t\t\t// Find the first most-outer item list in the merged list.\n\t\t\t\t// A case when the first list item in the second list was merged into the last item in the first list.\n\t\t\t\t//\n\t\t\t\t// UL List item 1\n\t\t\t\t// UL List item 2\n\t\t\t\t// []UL List item 1\n\t\t\t\t// UL List item 2\n\t\t\t\tconst secondListMostOuterItem = getSiblingListItem( firstMostOuterItem.nextSibling, {\n\t\t\t\t\tsameIndent: true,\n\t\t\t\t\tlistIndent: firstMostOuterItem.getAttribute( 'listIndent' ),\n\t\t\t\t\tdirection: 'forward'\n\t\t\t\t} );\n\n\t\t\t\tconst items = [\n\t\t\t\t\tsecondListMostOuterItem,\n\t\t\t\t\t...getSiblingNodes( writer.createPositionAt( secondListMostOuterItem, 0 ), 'forward' )\n\t\t\t\t];\n\n\t\t\t\tfor ( const listItem of items ) {\n\t\t\t\t\twriter.setAttribute( 'listStyle', firstMostOuterItem.getAttribute( 'listStyle' ), listItem );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tfirstMostOuterItem = null;\n\t\t}, { priority: 'low' } );\n\t}\n}\n\n// Returns a converter that consumes the `style` attribute and searches for the `list-style-type` definition.\n// If not found, the `\"default\"` value will be used.\n//\n// @returns {Function}\nfunction upcastListItemStyle() {\n\treturn dispatcher => {\n\t\tdispatcher.on( 'element:li', ( evt, data, conversionApi ) => {\n\t\t\tconst listParent = data.viewItem.parent;\n\n\t\t\t// It may happen that the native spell checker fixes a word inside a list item.\n\t\t\t// When the children mutation is fired, the `
  • ` does not have the parent element. See: #9325.\n\t\t\tif ( !listParent ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst listStyle = listParent.getStyle( 'list-style-type' ) || DEFAULT_LIST_TYPE;\n\t\t\tconst listItem = data.modelRange.start.nodeAfter || data.modelRange.end.nodeBefore;\n\n\t\t\tconversionApi.writer.setAttribute( 'listStyle', listStyle, listItem );\n\t\t}, { priority: 'low' } );\n\t};\n}\n\n// Returns a converter that adds the `list-style-type` definition as a value for the `style` attribute.\n// The `\"default\"` value is removed and not present in the view/data.\n//\n// @returns {Function}\nfunction downcastListStyleAttribute() {\n\treturn dispatcher => {\n\t\tdispatcher.on( 'attribute:listStyle:listItem', ( evt, data, conversionApi ) => {\n\t\t\tconst viewWriter = conversionApi.writer;\n\t\t\tconst currentElement = data.item;\n\n\t\t\tconst previousElement = getSiblingListItem( currentElement.previousSibling, {\n\t\t\t\tsameIndent: true,\n\t\t\t\tlistIndent: currentElement.getAttribute( 'listIndent' ),\n\t\t\t\tdirection: 'backward'\n\t\t\t} );\n\n\t\t\tconst viewItem = conversionApi.mapper.toViewElement( currentElement );\n\n\t\t\t// A case when elements represent different lists. We need to separate their container.\n\t\t\tif ( !areRepresentingSameList( currentElement, previousElement ) ) {\n\t\t\t\tviewWriter.breakContainer( viewWriter.createPositionBefore( viewItem ) );\n\t\t\t}\n\n\t\t\tsetListStyle( viewWriter, data.attributeNewValue, viewItem.parent );\n\t\t}, { priority: 'low' } );\n\t};\n\n\t// Checks whether specified list items belong to the same list.\n\t//\n\t// @param {module:engine/model/element~Element} `listItem1` The first list item to check.\n\t// @param {module:engine/model/element~Element|null} `listItem2` The second list item to check.\n\t// @returns {Boolean}\n\tfunction areRepresentingSameList( listItem1, listItem2 ) {\n\t\treturn listItem2 &&\n\t\t\tlistItem1.getAttribute( 'listType' ) === listItem2.getAttribute( 'listType' ) &&\n\t\t\tlistItem1.getAttribute( 'listIndent' ) === listItem2.getAttribute( 'listIndent' ) &&\n\t\t\tlistItem1.getAttribute( 'listStyle' ) === listItem2.getAttribute( 'listStyle' );\n\t}\n\n\t// Updates or removes the `list-style-type` from the `element`.\n\t//\n\t// @param {module:engine/view/downcastwriter~DowncastWriter} writer\n\t// @param {String} listStyle\n\t// @param {module:engine/view/element~Element} element\n\tfunction setListStyle( writer, listStyle, element ) {\n\t\tif ( listStyle && listStyle !== DEFAULT_LIST_TYPE ) {\n\t\t\twriter.setStyle( 'list-style-type', listStyle, element );\n\t\t} else {\n\t\t\twriter.removeStyle( 'list-style-type', element );\n\t\t}\n\t}\n}\n\n// When indenting list, nested list should clear its value for the `listStyle` attribute or inherit from nested lists.\n//\n// ■ List item 1.\n// ■ List item 2.[]\n// ■ List item 3.\n// editor.execute( 'indentList' );\n//\n// ■ List item 1.\n// ○ List item 2.[]\n// ■ List item 3.\n//\n// @param {module:core/editor/editor~Editor} editor\n// @returns {Function}\nfunction fixListAfterIndentListCommand( editor ) {\n\treturn ( evt, changedItems ) => {\n\t\tlet valueToSet;\n\n\t\tconst root = changedItems[ 0 ];\n\t\tconst rootIndent = root.getAttribute( 'listIndent' );\n\n\t\tconst itemsToUpdate = changedItems.filter( item => item.getAttribute( 'listIndent' ) === rootIndent );\n\n\t\t// A case where a few list items are indented must be checked separately\n\t\t// since `getSiblingListItem()` returns the first changed element.\n\t\t// ■ List item 1.\n\t\t// ○ [List item 2.\n\t\t// ○ List item 3.]\n\t\t// ■ List item 4.\n\t\t//\n\t\t// List items: `2` and `3` should be adjusted.\n\t\tif ( root.previousSibling.getAttribute( 'listIndent' ) + 1 === rootIndent ) {\n\t\t\t// valueToSet = root.previousSibling.getAttribute( 'listStyle' ) || DEFAULT_LIST_TYPE;\n\t\t\tvalueToSet = DEFAULT_LIST_TYPE;\n\t\t} else {\n\t\t\tconst previousSibling = getSiblingListItem( root.previousSibling, {\n\t\t\t\tsameIndent: true, direction: 'backward', listIndent: rootIndent\n\t\t\t} );\n\n\t\t\tvalueToSet = previousSibling.getAttribute( 'listStyle' );\n\t\t}\n\n\t\teditor.model.change( writer => {\n\t\t\tfor ( const item of itemsToUpdate ) {\n\t\t\t\twriter.setAttribute( 'listStyle', valueToSet, item );\n\t\t\t}\n\t\t} );\n\t};\n}\n\n// When outdenting a list, a nested list should copy its value for the `listStyle` attribute\n// from the previous sibling list item including the same value for the `listIndent` value.\n//\n// ■ List item 1.\n// ○ List item 2.[]\n// ■ List item 3.\n//\n// editor.execute( 'outdentList' );\n//\n// ■ List item 1.\n// ■ List item 2.[]\n// ■ List item 3.\n//\n// @param {module:core/editor/editor~Editor} editor\n// @returns {Function}\nfunction fixListAfterOutdentListCommand( editor ) {\n\treturn ( evt, changedItems ) => {\n\t\tchangedItems = changedItems.reverse().filter( item => item.is( 'element', 'listItem' ) );\n\n\t\tif ( !changedItems.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst indent = changedItems[ 0 ].getAttribute( 'listIndent' );\n\t\tconst listType = changedItems[ 0 ].getAttribute( 'listType' );\n\t\tlet listItem = changedItems[ 0 ].previousSibling;\n\n\t\t// ■ List item 1.\n\t\t// ○ List item 2.\n\t\t// ○ List item 3.[]\n\t\t// ■ List item 4.\n\t\t//\n\t\t// After outdenting a list, `List item 3` should inherit the `listStyle` attribute from `List item 1`.\n\t\t//\n\t\t// ■ List item 1.\n\t\t// ○ List item 2.\n\t\t// ■ List item 3.[]\n\t\t// ■ List item 4.\n\t\tif ( listItem.is( 'element', 'listItem' ) ) {\n\t\t\twhile ( listItem.getAttribute( 'listIndent' ) !== indent ) {\n\t\t\t\tlistItem = listItem.previousSibling;\n\t\t\t}\n\t\t} else {\n\t\t\tlistItem = null;\n\t\t}\n\n\t\t// Outdenting such a list should restore values based on `List item 4`.\n\t\t// ■ List item 1.[]\n\t\t// ○ List item 2.\n\t\t// ○ List item 3.\n\t\t// ■ List item 4.\n\t\tif ( !listItem ) {\n\t\t\tlistItem = changedItems[ changedItems.length - 1 ].nextSibling;\n\t\t}\n\n\t\t// And such a list should not modify anything.\n\t\t// However, `listItem` can indicate a node below the list. Be sure that we have the `listItem` element.\n\t\t// ■ List item 1.[]\n\t\t// ○ List item 2.\n\t\t// ○ List item 3.\n\t\t// The later if check.\n\t\tif ( !listItem || !listItem.is( 'element', 'listItem' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Do not modify the list if found `listItem` represents other type of list than outdented list items.\n\t\tif ( listItem.getAttribute( 'listType' ) !== listType ) {\n\t\t\treturn;\n\t\t}\n\n\t\teditor.model.change( writer => {\n\t\t\tconst itemsToUpdate = changedItems.filter( item => item.getAttribute( 'listIndent' ) === indent );\n\n\t\t\tfor ( const item of itemsToUpdate ) {\n\t\t\t\twriter.setAttribute( 'listStyle', listItem.getAttribute( 'listStyle' ), item );\n\t\t\t}\n\t\t} );\n\t};\n}\n\n// Each `listItem` element must have specified the `listStyle` attribute.\n// This post-fixer checks whether inserted elements `listItem` elements should inherit the `listStyle` value from\n// their sibling nodes or should use the default value.\n//\n// Paragraph[]\n// ■ List item 1. // [listStyle=\"square\", listType=\"bulleted\"]\n// ■ List item 2. // ...\n// ■ List item 3. // ...\n//\n// editor.execute( 'bulletedList' )\n//\n// ■ Paragraph[] // [listStyle=\"square\", listType=\"bulleted\"]\n// ■ List item 1. // [listStyle=\"square\", listType=\"bulleted\"]\n// ■ List item 2.\n// ■ List item 3.\n//\n// It also covers a such change:\n//\n// [Paragraph 1\n// Paragraph 2]\n// ■ List item 1. // [listStyle=\"square\", listType=\"bulleted\"]\n// ■ List item 2. // ...\n// ■ List item 3. // ...\n//\n// editor.execute( 'numberedList' )\n//\n// 1. [Paragraph 1 // [listStyle=\"default\", listType=\"numbered\"]\n// 2. Paragraph 2] // [listStyle=\"default\", listType=\"numbered\"]\n// ■ List item 1. // [listStyle=\"square\", listType=\"bulleted\"]\n// ■ List item 2. // ...\n// ■ List item 3. // ...\n//\n// @param {module:core/editor/editor~Editor} editor\n// @returns {Function}\nfunction fixListStyleAttributeOnListItemElements( editor ) {\n\treturn writer => {\n\t\tlet wasFixed = false;\n\n\t\tconst insertedListItems = getChangedListItems( editor.model.document.differ.getChanges() )\n\t\t\t.filter( item => {\n\t\t\t\t// Don't touch todo lists. They are handled in another post-fixer.\n\t\t\t\treturn item.getAttribute( 'listType' ) !== 'todo';\n\t\t\t} );\n\n\t\tif ( !insertedListItems.length ) {\n\t\t\treturn wasFixed;\n\t\t}\n\n\t\t// Check whether the last inserted element is next to the `listItem` element.\n\t\t//\n\t\t// ■ Paragraph[] // <-- The inserted item.\n\t\t// ■ List item 1.\n\t\tlet existingListItem = insertedListItems[ insertedListItems.length - 1 ].nextSibling;\n\n\t\t// If it doesn't, maybe the `listItem` was inserted at the end of the list.\n\t\t//\n\t\t// ■ List item 1.\n\t\t// ■ Paragraph[] // <-- The inserted item.\n\t\tif ( !existingListItem || !existingListItem.is( 'element', 'listItem' ) ) {\n\t\t\texistingListItem = insertedListItems[ insertedListItems.length - 1 ].previousSibling;\n\n\t\t\tif ( existingListItem ) {\n\t\t\t\tconst indent = insertedListItems[ 0 ].getAttribute( 'listIndent' );\n\n\t\t\t\t// But we need to find a `listItem` with the `listIndent=0` attribute.\n\t\t\t\t// If doesn't, maybe the `listItem` was inserted at the end of the list.\n\t\t\t\t//\n\t\t\t\t// ■ List item 1.\n\t\t\t\t// ○ List item 2.\n\t\t\t\t// ■ Paragraph[] // <-- The inserted item.\n\t\t\t\twhile ( existingListItem.is( 'element', 'listItem' ) && existingListItem.getAttribute( 'listIndent' ) !== indent ) {\n\t\t\t\t\texistingListItem = existingListItem.previousSibling;\n\n\t\t\t\t\t// If the item does not exist, most probably there is no other content in the editor. See: #8072.\n\t\t\t\t\tif ( !existingListItem ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor ( const item of insertedListItems ) {\n\t\t\tif ( !item.hasAttribute( 'listStyle' ) ) {\n\t\t\t\tif ( shouldInheritListType( existingListItem, item ) ) {\n\t\t\t\t\twriter.setAttribute( 'listStyle', existingListItem.getAttribute( 'listStyle' ), item );\n\t\t\t\t} else {\n\t\t\t\t\twriter.setAttribute( 'listStyle', DEFAULT_LIST_TYPE, item );\n\t\t\t\t}\n\t\t\t\twasFixed = true;\n\t\t\t} else {\n\t\t\t\t// Adjust the `listStyle` attribute for inserted (pasted) items. See #8160.\n\t\t\t\t//\n\t\t\t\t// ■ List item 1. // [listStyle=\"square\", listType=\"bulleted\"]\n\t\t\t\t// ○ List item 1.1. // [listStyle=\"circle\", listType=\"bulleted\"]\n\t\t\t\t// ○ [] (selection is here)\n\t\t\t\t//\n\t\t\t\t// Then, pasting a list with different attributes (listStyle, listType):\n\t\t\t\t//\n\t\t\t\t// 1. First. // [listStyle=\"decimal\", listType=\"numbered\"]\n\t\t\t\t// 2. Second // [listStyle=\"decimal\", listType=\"numbered\"]\n\t\t\t\t//\n\t\t\t\t// The `listType` attribute will be corrected by the `ListEditing` converters.\n\t\t\t\t// We need to adjust the `listStyle` attribute. Expected structure:\n\t\t\t\t//\n\t\t\t\t// ■ List item 1. // [listStyle=\"square\", listType=\"bulleted\"]\n\t\t\t\t// ○ List item 1.1. // [listStyle=\"circle\", listType=\"bulleted\"]\n\t\t\t\t// ○ First. // [listStyle=\"circle\", listType=\"bulleted\"]\n\t\t\t\t// ○ Second // [listStyle=\"circle\", listType=\"bulleted\"]\n\t\t\t\tconst previousSibling = item.previousSibling;\n\n\t\t\t\tif ( shouldInheritListTypeFromPreviousItem( previousSibling, item ) ) {\n\t\t\t\t\twriter.setAttribute( 'listStyle', previousSibling.getAttribute( 'listStyle' ), item );\n\n\t\t\t\t\twasFixed = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn wasFixed;\n\t};\n}\n\n// Checks whether the `listStyle` attribute should be copied from the `baseItem` element.\n//\n// The attribute should be copied if the inserted element does not have defined it and\n// the value for the element is other than default in the base element.\n//\n// @param {module:engine/model/element~Element|null} baseItem\n// @param {module:engine/model/element~Element} itemToChange\n// @returns {Boolean}\nfunction shouldInheritListType( baseItem, itemToChange ) {\n\tif ( !baseItem ) {\n\t\treturn false;\n\t}\n\n\tconst baseListStyle = baseItem.getAttribute( 'listStyle' );\n\n\tif ( !baseListStyle ) {\n\t\treturn false;\n\t}\n\n\tif ( baseListStyle === DEFAULT_LIST_TYPE ) {\n\t\treturn false;\n\t}\n\n\tif ( baseItem.getAttribute( 'listType' ) !== itemToChange.getAttribute( 'listType' ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n// Checks whether the `listStyle` attribute should be copied from previous list item.\n//\n// The attribute should be copied if there's a mismatch of styles of the pasted list into a nested list.\n// Top-level lists are not normalized as we allow side-by-side list of different types.\n//\n// @param {module:engine/model/element~Element|null} previousItem\n// @param {module:engine/model/element~Element} itemToChange\n// @returns {Boolean}\nfunction shouldInheritListTypeFromPreviousItem( previousItem, itemToChange ) {\n\tif ( !previousItem || !previousItem.is( 'element', 'listItem' ) ) {\n\t\treturn false;\n\t}\n\n\tif ( itemToChange.getAttribute( 'listType' ) !== previousItem.getAttribute( 'listType' ) ) {\n\t\treturn false;\n\t}\n\n\tconst previousItemIndent = previousItem.getAttribute( 'listIndent' );\n\n\tif ( previousItemIndent < 1 || previousItemIndent !== itemToChange.getAttribute( 'listIndent' ) ) {\n\t\treturn false;\n\t}\n\n\tconst previousItemListStyle = previousItem.getAttribute( 'listStyle' );\n\n\tif ( !previousItemListStyle || previousItemListStyle === itemToChange.getAttribute( 'listStyle' ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n// Removes the `listStyle` attribute from \"todo\" list items.\n//\n// @param {module:core/editor/editor~Editor} editor\n// @returns {Function}\nfunction removeListStyleAttributeFromTodoList( editor ) {\n\treturn writer => {\n\t\tconst todoListItems = getChangedListItems( editor.model.document.differ.getChanges() )\n\t\t\t.filter( item => {\n\t\t\t\t// Handle the todo lists only. The rest is handled in another post-fixer.\n\t\t\t\treturn item.getAttribute( 'listType' ) === 'todo' && item.hasAttribute( 'listStyle' );\n\t\t\t} );\n\n\t\tif ( !todoListItems.length ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor ( const item of todoListItems ) {\n\t\t\twriter.removeAttribute( 'listStyle', item );\n\t\t}\n\n\t\treturn true;\n\t};\n}\n\n// Restores the `listStyle` attribute after changing the list type.\n//\n// @param {module:core/editor/editor~Editor} editor\n// @returns {Function}\nfunction restoreDefaultListStyle( editor ) {\n\treturn ( evt, changedItems ) => {\n\t\tchangedItems = changedItems.filter( item => item.is( 'element', 'listItem' ) );\n\n\t\teditor.model.change( writer => {\n\t\t\tfor ( const item of changedItems ) {\n\t\t\t\t// Remove the attribute. Post-fixer will restore the proper value.\n\t\t\t\twriter.removeAttribute( 'listStyle', item );\n\t\t\t}\n\t\t} );\n\t};\n}\n\n// Returns the `listItem` that was inserted or changed.\n//\n// @param {Array.} changes The changes list returned by the differ.\n// @returns {Array.}\nfunction getChangedListItems( changes ) {\n\tconst items = [];\n\n\tfor ( const change of changes ) {\n\t\tconst item = getItemFromChange( change );\n\n\t\tif ( item && item.is( 'element', 'listItem' ) ) {\n\t\t\titems.push( item );\n\t\t}\n\t}\n\n\treturn items;\n}\n\nfunction getItemFromChange( change ) {\n\tif ( change.type === 'attribute' ) {\n\t\treturn change.range.start.nodeAfter;\n\t}\n\n\tif ( change.type === 'insert' ) {\n\t\treturn change.position.nodeAfter;\n\t}\n\n\treturn null;\n}\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 list/liststyle\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport ListStyleEditing from './liststyleediting';\nimport ListStyleUI from './liststyleui';\n\n/**\n * The list style feature.\n *\n * This is a \"glue\" plugin that loads the {@link module:list/liststyleediting~ListStyleEditing list style editing feature}\n * and the {@link module:list/liststyleui~ListStyleUI list style UI feature}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ListStyle extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ListStyleEditing, ListStyleUI ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ListStyle';\n\t}\n}\n"],"sourceRoot":""}