@ckeditor/ckeditor5-list 47.5.0 → 47.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -0
- package/build/list.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/dist/index.js +82 -16
- package/dist/index.js.map +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/contexts.json +2 -0
- package/lang/translations/af.po +8 -0
- package/lang/translations/ar.po +8 -0
- package/lang/translations/ast.po +8 -0
- package/lang/translations/az.po +8 -0
- package/lang/translations/be.po +8 -0
- package/lang/translations/bg.po +8 -0
- package/lang/translations/bn.po +8 -0
- package/lang/translations/bs.po +8 -0
- package/lang/translations/ca.po +8 -0
- package/lang/translations/cs.po +8 -0
- package/lang/translations/da.po +8 -0
- package/lang/translations/de-ch.po +8 -0
- package/lang/translations/de.po +8 -0
- package/lang/translations/el.po +8 -0
- package/lang/translations/en-au.po +8 -0
- package/lang/translations/en-gb.po +8 -0
- package/lang/translations/en.po +8 -0
- package/lang/translations/eo.po +8 -0
- package/lang/translations/es-co.po +8 -0
- package/lang/translations/es.po +8 -0
- package/lang/translations/et.po +8 -0
- package/lang/translations/eu.po +8 -0
- package/lang/translations/fa.po +8 -0
- package/lang/translations/fi.po +8 -0
- package/lang/translations/fr.po +8 -0
- package/lang/translations/gl.po +8 -0
- package/lang/translations/gu.po +8 -0
- package/lang/translations/he.po +8 -0
- package/lang/translations/hi.po +8 -0
- package/lang/translations/hr.po +8 -0
- package/lang/translations/hu.po +8 -0
- package/lang/translations/hy.po +8 -0
- package/lang/translations/id.po +8 -0
- package/lang/translations/it.po +8 -0
- package/lang/translations/ja.po +8 -0
- package/lang/translations/jv.po +8 -0
- package/lang/translations/kk.po +8 -0
- package/lang/translations/km.po +8 -0
- package/lang/translations/kn.po +8 -0
- package/lang/translations/ko.po +8 -0
- package/lang/translations/ku.po +8 -0
- package/lang/translations/lt.po +8 -0
- package/lang/translations/lv.po +8 -0
- package/lang/translations/ms.po +8 -0
- package/lang/translations/nb.po +8 -0
- package/lang/translations/ne.po +8 -0
- package/lang/translations/nl.po +8 -0
- package/lang/translations/no.po +8 -0
- package/lang/translations/oc.po +8 -0
- package/lang/translations/pl.po +8 -0
- package/lang/translations/pt-br.po +8 -0
- package/lang/translations/pt.po +8 -0
- package/lang/translations/ro.po +8 -0
- package/lang/translations/ru.po +8 -0
- package/lang/translations/si.po +8 -0
- package/lang/translations/sk.po +8 -0
- package/lang/translations/sl.po +8 -0
- package/lang/translations/sq.po +8 -0
- package/lang/translations/sr-latn.po +8 -0
- package/lang/translations/sr.po +8 -0
- package/lang/translations/sv.po +8 -0
- package/lang/translations/th.po +8 -0
- package/lang/translations/ti.po +8 -0
- package/lang/translations/tk.po +8 -0
- package/lang/translations/tr.po +8 -0
- package/lang/translations/tt.po +8 -0
- package/lang/translations/ug.po +8 -0
- package/lang/translations/uk.po +8 -0
- package/lang/translations/ur.po +8 -0
- package/lang/translations/uz.po +8 -0
- package/lang/translations/vi.po +8 -0
- package/lang/translations/zh-cn.po +8 -0
- package/lang/translations/zh.po +8 -0
- package/package.json +12 -11
- package/src/list/listcommand.d.ts +1 -1
- package/src/list/listcommand.js +3 -1
- package/src/list/listediting.js +1 -1
- package/src/list/listindentcommand.js +7 -4
- package/src/list/listmergecommand.js +6 -2
- package/src/list/listutils.d.ts +4 -0
- package/src/list/listutils.js +7 -1
- package/src/list/utils/model.d.ts +17 -3
- package/src/list/utils/model.js +23 -6
- package/src/listconfig.d.ts +1 -1
- package/src/listproperties/listpropertiesui.js +7 -1
- package/src/listproperties/utils/config.js +11 -1
- package/src/listproperties/utils/style.js +2 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,8 @@ import { toArray, first, uid, env, CKEditorError, FocusTracker, KeystrokeHandler
|
|
|
9
9
|
import { _normalizeFontSizeOptions } from '@ckeditor/ckeditor5-font/dist/index.js';
|
|
10
10
|
import { ClipboardPipeline } from '@ckeditor/ckeditor5-clipboard/dist/index.js';
|
|
11
11
|
import { ButtonView, MenuBarMenuListItemButtonView, View, ViewCollection, FocusCycler, addKeyboardHandlingForGrid, CollapsibleView, LabeledFieldView, createLabeledInputNumber, SwitchButtonView, createDropdown, SplitButtonView, MenuBarMenuView, focusChildOnDropdownOpen } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
12
|
-
import { IconNumberedList, IconBulletedList, IconListStyleDisc, IconListStyleCircle, IconListStyleSquare, IconListStyleDecimal, IconListStyleDecimalLeadingZero, IconListStyleLowerRoman, IconListStyleUpperRoman, IconListStyleLowerLatin, IconListStyleUpperLatin, IconTodoList } from '@ckeditor/ckeditor5-icons/dist/index.js';
|
|
12
|
+
import { IconNumberedList, IconBulletedList, IconListStyleDisc, IconListStyleCircle, IconListStyleSquare, IconListStyleDecimal, IconListStyleDecimalLeadingZero, IconListStyleLowerRoman, IconListStyleUpperRoman, IconListStyleLowerLatin, IconListStyleUpperLatin, IconListStyleArabicIndic, IconTodoList } from '@ckeditor/ckeditor5-icons/dist/index.js';
|
|
13
|
+
import { pick } from 'es-toolkit/compat';
|
|
13
14
|
import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -427,14 +428,15 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
427
428
|
* @param options Additional options.
|
|
428
429
|
* @param options.expand Whether should expand the list of blocks to include complete list items.
|
|
429
430
|
* @param options.indentBy The number of levels the indentation should change (could be negative).
|
|
430
|
-
|
|
431
|
+
* @param options.attributeNames List of attribute names to remove when a block leaves the list (when blockIndent < 0).
|
|
432
|
+
*/ function indentBlocks(blocks, writer, { expand, indentBy = 1, attributeNames }) {
|
|
431
433
|
blocks = toArray(blocks);
|
|
432
434
|
// Expand the selected blocks to contain the whole list items.
|
|
433
435
|
const allBlocks = expand ? expandListBlocksToCompleteItems(blocks) : blocks;
|
|
434
436
|
for (const block of allBlocks){
|
|
435
437
|
const blockIndent = block.getAttribute('listIndent') + indentBy;
|
|
436
438
|
if (blockIndent < 0) {
|
|
437
|
-
removeListAttributes(block, writer);
|
|
439
|
+
removeListAttributes(block, writer, attributeNames);
|
|
438
440
|
} else {
|
|
439
441
|
writer.setAttribute('listIndent', blockIndent, block);
|
|
440
442
|
}
|
|
@@ -448,7 +450,9 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
448
450
|
* @internal
|
|
449
451
|
* @param blocks The block or iterable of blocks.
|
|
450
452
|
* @param writer The model writer.
|
|
451
|
-
|
|
453
|
+
* @param options Additional options.
|
|
454
|
+
* @param options.attributeNames List of attribute names to remove when a block leaves the list (when blockIndent < 0).
|
|
455
|
+
*/ function outdentBlocksWithMerge(blocks, writer, { attributeNames }) {
|
|
452
456
|
blocks = toArray(blocks);
|
|
453
457
|
// Expand the selected blocks to contain the whole list items.
|
|
454
458
|
const allBlocks = expandListBlocksToCompleteItems(blocks);
|
|
@@ -468,7 +472,7 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
468
472
|
visited.add(block);
|
|
469
473
|
const blockIndent = block.getAttribute('listIndent') - 1;
|
|
470
474
|
if (blockIndent < 0) {
|
|
471
|
-
removeListAttributes(block, writer);
|
|
475
|
+
removeListAttributes(block, writer, attributeNames);
|
|
472
476
|
continue;
|
|
473
477
|
}
|
|
474
478
|
// Merge with parent list item while outdenting and indent matches reference indent.
|
|
@@ -493,8 +497,9 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
493
497
|
* @internal
|
|
494
498
|
* @param blocks The block or iterable of blocks.
|
|
495
499
|
* @param writer The model writer.
|
|
500
|
+
* @param attributeNames List of attribute names to remove.
|
|
496
501
|
* @returns Array of altered blocks.
|
|
497
|
-
*/ function removeListAttributes(blocks, writer) {
|
|
502
|
+
*/ function removeListAttributes(blocks, writer, attributeNames) {
|
|
498
503
|
blocks = toArray(blocks);
|
|
499
504
|
// Convert simple list items to plain paragraphs.
|
|
500
505
|
for (const block of blocks){
|
|
@@ -505,7 +510,7 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
505
510
|
// Remove list attributes.
|
|
506
511
|
for (const block of blocks){
|
|
507
512
|
for (const attributeKey of block.getAttributeKeys()){
|
|
508
|
-
if (
|
|
513
|
+
if (attributeNames.includes(attributeKey)) {
|
|
509
514
|
writer.removeAttribute(attributeKey, block);
|
|
510
515
|
}
|
|
511
516
|
}
|
|
@@ -649,6 +654,18 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
649
654
|
*/ function isNumberedListType(listType) {
|
|
650
655
|
return listType == 'numbered' || listType == 'customNumbered';
|
|
651
656
|
}
|
|
657
|
+
/**
|
|
658
|
+
* Checks if the given list item is the first item in the list.
|
|
659
|
+
*
|
|
660
|
+
* This function checks if there's any other list item before the given list item
|
|
661
|
+
* at the same indent level with the same list type.
|
|
662
|
+
*/ function isFirstListItemInList(listItem) {
|
|
663
|
+
const previousItem = ListWalker.first(listItem, {
|
|
664
|
+
sameIndent: true,
|
|
665
|
+
sameAttributes: 'listType'
|
|
666
|
+
});
|
|
667
|
+
return !previousItem;
|
|
668
|
+
}
|
|
652
669
|
/**
|
|
653
670
|
* Merges a given block to the given parent block if parent is a list item and there is no more blocks in the same item.
|
|
654
671
|
*/ function mergeListItemIfNotLast(block, parentBlock, writer) {
|
|
@@ -697,15 +714,20 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
697
714
|
* @fires execute
|
|
698
715
|
* @fires afterExecute
|
|
699
716
|
*/ execute() {
|
|
700
|
-
const
|
|
717
|
+
const editor = this.editor;
|
|
718
|
+
const model = editor.model;
|
|
701
719
|
const blocks = getSelectedListBlocks(model.document.selection);
|
|
720
|
+
const listEditing = editor.plugins.get('ListEditing');
|
|
721
|
+
const attributeNames = listEditing.getListAttributeNames();
|
|
702
722
|
model.change((writer)=>{
|
|
703
723
|
const changedBlocks = [];
|
|
704
724
|
// Handle selection contained in the single list item and starting in the following blocks.
|
|
705
725
|
if (isSingleListItem(blocks) && !isFirstBlockOfListItem(blocks[0])) {
|
|
706
726
|
// Allow increasing indent of following list item blocks.
|
|
707
727
|
if (this._direction == 'forward') {
|
|
708
|
-
changedBlocks.push(...indentBlocks(blocks, writer
|
|
728
|
+
changedBlocks.push(...indentBlocks(blocks, writer, {
|
|
729
|
+
attributeNames
|
|
730
|
+
}));
|
|
709
731
|
}
|
|
710
732
|
// For indent make sure that indented blocks have a new ID.
|
|
711
733
|
// For outdent just split blocks from the list item (give them a new IDs).
|
|
@@ -714,10 +736,13 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
714
736
|
// Now just update the attributes of blocks.
|
|
715
737
|
if (this._direction == 'forward') {
|
|
716
738
|
changedBlocks.push(...indentBlocks(blocks, writer, {
|
|
717
|
-
expand: true
|
|
739
|
+
expand: true,
|
|
740
|
+
attributeNames
|
|
718
741
|
}));
|
|
719
742
|
} else {
|
|
720
|
-
changedBlocks.push(...outdentBlocksWithMerge(blocks, writer
|
|
743
|
+
changedBlocks.push(...outdentBlocksWithMerge(blocks, writer, {
|
|
744
|
+
attributeNames
|
|
745
|
+
}));
|
|
721
746
|
}
|
|
722
747
|
}
|
|
723
748
|
// Align the list item type to match the previous list item (from the same list).
|
|
@@ -841,6 +866,8 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
841
866
|
model.change((writer)=>{
|
|
842
867
|
if (turnOff) {
|
|
843
868
|
const lastBlock = blocks[blocks.length - 1];
|
|
869
|
+
const listEditing = this.editor.plugins.get('ListEditing');
|
|
870
|
+
const attributeNames = listEditing.getListAttributeNames();
|
|
844
871
|
// Split the first block from the list item.
|
|
845
872
|
const itemBlocks = getListItemBlocks(lastBlock, {
|
|
846
873
|
direction: 'forward'
|
|
@@ -850,7 +877,7 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
850
877
|
changedBlocks.push(...splitListItemBefore(itemBlocks[1], writer));
|
|
851
878
|
}
|
|
852
879
|
// Strip list attributes.
|
|
853
|
-
changedBlocks.push(...removeListAttributes(blocks, writer));
|
|
880
|
+
changedBlocks.push(...removeListAttributes(blocks, writer, attributeNames));
|
|
854
881
|
// Outdent items following the selected list item.
|
|
855
882
|
changedBlocks.push(...outdentFollowingItems(lastBlock, writer));
|
|
856
883
|
this._fireAfterExecute(changedBlocks);
|
|
@@ -976,9 +1003,12 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
976
1003
|
* with {@link module:engine/model/model~Model#deleteContent} to get rid of the inline content in the selection or take advantage
|
|
977
1004
|
* of the heuristics in `deleteContent()` that helps convert lists into paragraphs in certain cases.
|
|
978
1005
|
*/ execute({ shouldMergeOnBlocksContentLevel = false } = {}) {
|
|
979
|
-
const
|
|
1006
|
+
const editor = this.editor;
|
|
1007
|
+
const model = editor.model;
|
|
980
1008
|
const selection = model.document.selection;
|
|
981
1009
|
const changedBlocks = [];
|
|
1010
|
+
const listEditing = editor.plugins.get('ListEditing');
|
|
1011
|
+
const attributeNames = listEditing.getListAttributeNames();
|
|
982
1012
|
model.change((writer)=>{
|
|
983
1013
|
const { firstElement, lastElement } = this._getMergeSubjectElements(selection, shouldMergeOnBlocksContentLevel);
|
|
984
1014
|
const firstIndent = firstElement.getAttribute('listIndent') || 0;
|
|
@@ -992,7 +1022,8 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
992
1022
|
], writer, {
|
|
993
1023
|
indentBy: firstIndent - lastIndent,
|
|
994
1024
|
// If outdenting, the entire sub-tree that follows must be included.
|
|
995
|
-
expand: firstIndent < lastIndent
|
|
1025
|
+
expand: firstIndent < lastIndent,
|
|
1026
|
+
attributeNames
|
|
996
1027
|
}));
|
|
997
1028
|
}
|
|
998
1029
|
if (shouldMergeOnBlocksContentLevel) {
|
|
@@ -1868,6 +1899,11 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
|
|
|
1868
1899
|
*/ isNumberedListType(listType) {
|
|
1869
1900
|
return isNumberedListType(listType);
|
|
1870
1901
|
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Returns true if the given list item is the first item in the list.
|
|
1904
|
+
*/ isFirstListItemInList(listItem) {
|
|
1905
|
+
return isFirstListItemInList(listItem);
|
|
1906
|
+
}
|
|
1871
1907
|
}
|
|
1872
1908
|
|
|
1873
1909
|
/**
|
|
@@ -3065,7 +3101,7 @@ function shouldUseBogusParagraph(item, attributeNames, blocks = getAllListItemBl
|
|
|
3065
3101
|
const allChildren = Array.from(data.content.getChildren());
|
|
3066
3102
|
const isSingleListItemSelected = isSingleListItem(allChildren);
|
|
3067
3103
|
if (isSingleListItemSelected) {
|
|
3068
|
-
removeListAttributes(allChildren, writer);
|
|
3104
|
+
removeListAttributes(allChildren, writer, this.getListAttributeNames());
|
|
3069
3105
|
}
|
|
3070
3106
|
}
|
|
3071
3107
|
});
|
|
@@ -3498,6 +3534,11 @@ const LIST_STYLE_TYPES = [
|
|
|
3498
3534
|
listStyle: 'upper-latin',
|
|
3499
3535
|
typeAttribute: 'A',
|
|
3500
3536
|
listType: 'numbered'
|
|
3537
|
+
},
|
|
3538
|
+
{
|
|
3539
|
+
listStyle: 'arabic-indic',
|
|
3540
|
+
typeAttribute: null,
|
|
3541
|
+
listType: 'numbered'
|
|
3501
3542
|
}
|
|
3502
3543
|
];
|
|
3503
3544
|
for (const { listStyle, typeAttribute, listType } of LIST_STYLE_TYPES){
|
|
@@ -3824,20 +3865,39 @@ for (const { listStyle, typeAttribute, listType } of LIST_STYLE_TYPES){
|
|
|
3824
3865
|
'bulleted',
|
|
3825
3866
|
'numbered'
|
|
3826
3867
|
],
|
|
3827
|
-
useAttribute: false
|
|
3868
|
+
useAttribute: false,
|
|
3869
|
+
listStyleTypes: {
|
|
3870
|
+
numbered: [
|
|
3871
|
+
'decimal',
|
|
3872
|
+
'decimal-leading-zero',
|
|
3873
|
+
'lower-roman',
|
|
3874
|
+
'upper-roman',
|
|
3875
|
+
'lower-latin',
|
|
3876
|
+
'upper-latin'
|
|
3877
|
+
],
|
|
3878
|
+
bulleted: [
|
|
3879
|
+
'disc',
|
|
3880
|
+
'circle',
|
|
3881
|
+
'square'
|
|
3882
|
+
]
|
|
3883
|
+
}
|
|
3828
3884
|
};
|
|
3829
3885
|
if (styles === true) {
|
|
3830
3886
|
return normalizedConfig;
|
|
3831
3887
|
}
|
|
3832
3888
|
if (!styles) {
|
|
3833
3889
|
normalizedConfig.listTypes = [];
|
|
3890
|
+
normalizedConfig.listStyleTypes = {};
|
|
3834
3891
|
} else if (Array.isArray(styles) || typeof styles == 'string') {
|
|
3835
3892
|
normalizedConfig.listTypes = toArray(styles);
|
|
3893
|
+
normalizedConfig.listStyleTypes = pick(normalizedConfig.listStyleTypes, normalizedConfig.listTypes);
|
|
3836
3894
|
} else {
|
|
3837
3895
|
normalizedConfig.listTypes = styles.listTypes ? toArray(styles.listTypes) : normalizedConfig.listTypes;
|
|
3838
3896
|
normalizedConfig.useAttribute = !!styles.useAttribute;
|
|
3839
3897
|
if (styles.listStyleTypes) {
|
|
3840
3898
|
normalizedConfig.listStyleTypes = styles.listStyleTypes;
|
|
3899
|
+
} else {
|
|
3900
|
+
normalizedConfig.listStyleTypes = pick(normalizedConfig.listStyleTypes, normalizedConfig.listTypes);
|
|
3841
3901
|
}
|
|
3842
3902
|
}
|
|
3843
3903
|
return normalizedConfig;
|
|
@@ -4509,6 +4569,12 @@ const DEFAULT_LIST_TYPE$1 = 'default';
|
|
|
4509
4569
|
tooltip: t('Upper-latin'),
|
|
4510
4570
|
type: 'upper-latin',
|
|
4511
4571
|
icon: IconListStyleUpperLatin
|
|
4572
|
+
},
|
|
4573
|
+
{
|
|
4574
|
+
label: t('Toggle the arabic-indic list style'),
|
|
4575
|
+
tooltip: t('Arabic-indic'),
|
|
4576
|
+
type: 'arabic-indic',
|
|
4577
|
+
icon: IconListStyleArabicIndic
|
|
4512
4578
|
}
|
|
4513
4579
|
];
|
|
4514
4580
|
const buttonLabel = t('Numbered List');
|