@ckeditor/ckeditor5-list 42.0.2 → 43.0.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/CHANGELOG.md +1 -269
- package/build/list.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/dist/index.js +101 -60
- package/dist/index.js.map +1 -1
- package/dist/list/converters.d.ts +0 -8
- package/dist/listconfig.d.ts +29 -1
- package/dist/listproperties/ui/listpropertiesview.d.ts +2 -2
- package/dist/listproperties/utils/config.d.ts +39 -0
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/lang/translations/sr-latn.po +6 -6
- package/package.json +9 -9
- package/src/list/converters.d.ts +0 -8
- package/src/list/converters.js +0 -24
- package/src/list/listediting.js +1 -3
- package/src/list/utils.js +8 -1
- package/src/listconfig.d.ts +29 -1
- package/src/listproperties/listpropertiesediting.js +3 -1
- package/src/listproperties/listpropertiesui.js +26 -23
- package/src/listproperties/ui/listpropertiesview.d.ts +2 -2
- package/src/listproperties/ui/listpropertiesview.js +2 -2
- package/src/listproperties/utils/config.d.ts +35 -0
- package/src/listproperties/utils/config.js +70 -0
- package/src/todolist/todolistediting.js +3 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){const i=e["sr-latn"]=e["sr-latn"]||{};i.dictionary=Object.assign(i.dictionary||{},{"Bulleted List":"Nabrajane liste","Bulleted list styles toolbar":"Traka sa alatkama za nabrajane liste",Circle:"Krug",Decimal:"Decimala","Decimal with leading zero":"Decimalni broj sa nulom na početku","Decrease list item indent":"",Disc:"Disk","Entering a to-do list":"","Increase list item indent":"","Invalid start index value.":"","Keystrokes that can be used in a list":"","Leaving a to-do list":"","List properties":"Navedite svojstva","Lower-latin":"Donji - latinski","Lower–roman":"Donji - rimski","Numbered List":"Lista sa brojevima","Numbered list styles toolbar":"Traka sa altakama za liste sa brojevima","Reversed order":"Obrnuti redosled",Square:"Kvadrat","Start at":"Početi u","Start index must be greater than 0.":"Početni indeks mora biti veći od 0.","To-do List":"Lista obaveza","Toggle the circle list style":"Uključite / isključite stil liste krugova","Toggle the decimal list style":"Uključi / isključi stil dekadne liste","Toggle the decimal with leading zero list style":"Prebaci decimalni znak sa vodećim stilom liste nula","Toggle the disc list style":"Uključite / isključite stil liste diskova","Toggle the lower–latin list style":"Uključite / isključite stil donje liste latinice","Toggle the lower–roman list style":"Uključite / isključite stil donje rimske liste","Toggle the square list style":"Uključite / isključite stil liste kvadrata","Toggle the upper–latin list style":"Uključite / isključite stil gornje liste latinice","Toggle the upper–roman list style":"Uključite / isključite stil gornje rimske liste","Upper-latin":"Gornji - latinski","Upper-roman":"Gornji - rimski"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
1
|
+
!function(e){const i=e["sr-latn"]=e["sr-latn"]||{};i.dictionary=Object.assign(i.dictionary||{},{"Bulleted List":"Nabrajane liste","Bulleted list styles toolbar":"Traka sa alatkama za nabrajane liste",Circle:"Krug",Decimal:"Decimala","Decimal with leading zero":"Decimalni broj sa nulom na početku","Decrease list item indent":"Smanji uvlačenje stavke liste",Disc:"Disk","Entering a to-do list":"Unošenje liste obaveza","Increase list item indent":"Povećaj uvlačenje stavke liste","Invalid start index value.":"Nevažeća vrednost početnog indeksa.","Keystrokes that can be used in a list":"Pritisci na tastere koji se mogu koristiti na listi","Leaving a to-do list":"Ostavljanje liste obaveza","List properties":"Navedite svojstva","Lower-latin":"Donji - latinski","Lower–roman":"Donji - rimski","Numbered List":"Lista sa brojevima","Numbered list styles toolbar":"Traka sa altakama za liste sa brojevima","Reversed order":"Obrnuti redosled",Square:"Kvadrat","Start at":"Početi u","Start index must be greater than 0.":"Početni indeks mora biti veći od 0.","To-do List":"Lista obaveza","Toggle the circle list style":"Uključite / isključite stil liste krugova","Toggle the decimal list style":"Uključi / isključi stil dekadne liste","Toggle the decimal with leading zero list style":"Prebaci decimalni znak sa vodećim stilom liste nula","Toggle the disc list style":"Uključite / isključite stil liste diskova","Toggle the lower–latin list style":"Uključite / isključite stil donje liste latinice","Toggle the lower–roman list style":"Uključite / isključite stil donje rimske liste","Toggle the square list style":"Uključite / isključite stil liste kvadrata","Toggle the upper–latin list style":"Uključite / isključite stil gornje liste latinice","Toggle the upper–roman list style":"Uključite / isključite stil gornje rimske liste","Upper-latin":"Gornji - latinski","Upper-roman":"Gornji - rimski"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { Command, Plugin, icons } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
|
6
6
|
import { Delete } from '@ckeditor/ckeditor5-typing/dist/index.js';
|
|
7
7
|
import { Enter } from '@ckeditor/ckeditor5-enter/dist/index.js';
|
|
8
8
|
import { toArray, first, uid, CKEditorError, FocusTracker, KeystrokeHandler, global, getCode, parseKeystroke, getLocalizedArrowKeyCodeDirection, createElement, logWarning } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
9
|
-
import { UpcastWriter, DomEventObserver, Matcher, TreeWalker, getFillerOffset } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
10
9
|
import { ClipboardPipeline } from '@ckeditor/ckeditor5-clipboard/dist/index.js';
|
|
11
10
|
import { ButtonView, MenuBarMenuListItemButtonView, View, ViewCollection, FocusCycler, addKeyboardHandlingForGrid, CollapsibleView, LabeledFieldView, createLabeledInputNumber, SwitchButtonView, createDropdown, SplitButtonView, focusChildOnDropdownOpen, MenuBarMenuView } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
11
|
+
import { DomEventObserver, Matcher, TreeWalker, getFillerOffset } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Document list blocks iterator.
|
|
@@ -1465,27 +1465,6 @@ import { ButtonView, MenuBarMenuListItemButtonView, View, ViewCollection, FocusC
|
|
|
1465
1465
|
}
|
|
1466
1466
|
};
|
|
1467
1467
|
}
|
|
1468
|
-
/**
|
|
1469
|
-
* Returns the upcast converter for the `<ul>` and `<ol>` view elements that cleans the input view of garbage.
|
|
1470
|
-
* This is mostly to clean whitespaces from between the `<li>` view elements inside the view list element. However,
|
|
1471
|
-
* incorrect data can also be cleared if the view was incorrect.
|
|
1472
|
-
*
|
|
1473
|
-
* @internal
|
|
1474
|
-
*/ function listUpcastCleanList() {
|
|
1475
|
-
return (evt, data, conversionApi)=>{
|
|
1476
|
-
if (!conversionApi.consumable.test(data.viewItem, {
|
|
1477
|
-
name: true
|
|
1478
|
-
})) {
|
|
1479
|
-
return;
|
|
1480
|
-
}
|
|
1481
|
-
const viewWriter = new UpcastWriter(data.viewItem.document);
|
|
1482
|
-
for (const child of Array.from(data.viewItem.getChildren())){
|
|
1483
|
-
if (!isListItemView(child) && !isListView(child)) {
|
|
1484
|
-
viewWriter.remove(child);
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
};
|
|
1488
|
-
}
|
|
1489
1468
|
/**
|
|
1490
1469
|
* Returns a model document change:data event listener that triggers conversion of related items if needed.
|
|
1491
1470
|
*
|
|
@@ -2226,12 +2205,6 @@ function shouldUseBogusParagraph(item, attributeNames, blocks = getAllListItemBl
|
|
|
2226
2205
|
converterPriority: 'high'
|
|
2227
2206
|
}).add((dispatcher)=>{
|
|
2228
2207
|
dispatcher.on('element:li', listItemUpcastConverter());
|
|
2229
|
-
dispatcher.on('element:ul', listUpcastCleanList(), {
|
|
2230
|
-
priority: 'high'
|
|
2231
|
-
});
|
|
2232
|
-
dispatcher.on('element:ol', listUpcastCleanList(), {
|
|
2233
|
-
priority: 'high'
|
|
2234
|
-
});
|
|
2235
2208
|
});
|
|
2236
2209
|
if (!multiBlock) {
|
|
2237
2210
|
editor.conversion.for('downcast').elementToElement({
|
|
@@ -2582,7 +2555,14 @@ function shouldUseBogusParagraph(item, attributeNames, blocks = getAllListItemBl
|
|
|
2582
2555
|
});
|
|
2583
2556
|
return buttonView;
|
|
2584
2557
|
});
|
|
2585
|
-
editor.ui.componentFactory.add(`menuBar:${commandName}`, ()=>
|
|
2558
|
+
editor.ui.componentFactory.add(`menuBar:${commandName}`, ()=>{
|
|
2559
|
+
const buttonView = _createButton(MenuBarMenuListItemButtonView, editor, commandName, label, icon);
|
|
2560
|
+
buttonView.set({
|
|
2561
|
+
role: 'menuitemcheckbox',
|
|
2562
|
+
isToggleable: true
|
|
2563
|
+
});
|
|
2564
|
+
return buttonView;
|
|
2565
|
+
});
|
|
2586
2566
|
}
|
|
2587
2567
|
/**
|
|
2588
2568
|
* Creates a button to use either in toolbar or in menu bar.
|
|
@@ -3001,6 +2981,66 @@ for (const { listStyle, typeAttribute, listType } of LIST_STYLE_TYPES){
|
|
|
3001
2981
|
}
|
|
3002
2982
|
}
|
|
3003
2983
|
|
|
2984
|
+
/**
|
|
2985
|
+
* Normalizes {@link module:list/listconfig~ListPropertiesConfig} in the configuration of the list properties feature.
|
|
2986
|
+
* The structure of normalized list properties options looks as follows:
|
|
2987
|
+
*
|
|
2988
|
+
* ```ts
|
|
2989
|
+
* {
|
|
2990
|
+
* styles: {
|
|
2991
|
+
* listTypes: [ 'bulleted', 'numbered' ],
|
|
2992
|
+
* useAttribute: false
|
|
2993
|
+
* },
|
|
2994
|
+
* startIndex: true,
|
|
2995
|
+
* reversed: true
|
|
2996
|
+
* }
|
|
2997
|
+
* ```
|
|
2998
|
+
*
|
|
2999
|
+
* @param config The list properties {@link module:list/listconfig~ListPropertiesConfig config}.
|
|
3000
|
+
* @returns An object with normalized list properties options.
|
|
3001
|
+
*/ function getNormalizedConfig(config) {
|
|
3002
|
+
const { startIndex, reversed, styles } = config;
|
|
3003
|
+
return {
|
|
3004
|
+
styles: getNormalizedStylesConfig(styles),
|
|
3005
|
+
startIndex: startIndex || false,
|
|
3006
|
+
reversed: reversed || false
|
|
3007
|
+
};
|
|
3008
|
+
}
|
|
3009
|
+
/**
|
|
3010
|
+
* Normalizes styles in the configuration of the list properties feature.
|
|
3011
|
+
* The structure of normalized list properties options looks as follows:
|
|
3012
|
+
*
|
|
3013
|
+
* ```ts
|
|
3014
|
+
* {
|
|
3015
|
+
* listTypes: [ 'bulleted', 'numbered' ],
|
|
3016
|
+
* useAttribute: false
|
|
3017
|
+
* }
|
|
3018
|
+
* ```
|
|
3019
|
+
*
|
|
3020
|
+
* @param styles The list properties styles.
|
|
3021
|
+
* @returns An object with normalized list properties styles.
|
|
3022
|
+
*/ function getNormalizedStylesConfig(styles) {
|
|
3023
|
+
const normalizedConfig = {
|
|
3024
|
+
listTypes: [
|
|
3025
|
+
'bulleted',
|
|
3026
|
+
'numbered'
|
|
3027
|
+
],
|
|
3028
|
+
useAttribute: false
|
|
3029
|
+
};
|
|
3030
|
+
if (styles === true) {
|
|
3031
|
+
return normalizedConfig;
|
|
3032
|
+
}
|
|
3033
|
+
if (!styles) {
|
|
3034
|
+
normalizedConfig.listTypes = [];
|
|
3035
|
+
} else if (Array.isArray(styles) || typeof styles == 'string') {
|
|
3036
|
+
normalizedConfig.listTypes = toArray(styles);
|
|
3037
|
+
} else {
|
|
3038
|
+
normalizedConfig.listTypes = styles.listTypes ? toArray(styles.listTypes) : normalizedConfig.listTypes;
|
|
3039
|
+
normalizedConfig.useAttribute = !!styles.useAttribute;
|
|
3040
|
+
}
|
|
3041
|
+
return normalizedConfig;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3004
3044
|
const DEFAULT_LIST_TYPE$1 = 'default';
|
|
3005
3045
|
/**
|
|
3006
3046
|
* The document list properties engine feature.
|
|
@@ -3133,8 +3173,9 @@ const DEFAULT_LIST_TYPE$1 = 'default';
|
|
|
3133
3173
|
* Creates an array of strategies for dealing with enabled listItem attributes.
|
|
3134
3174
|
*/ function createAttributeStrategies$1(enabledProperties) {
|
|
3135
3175
|
const strategies = [];
|
|
3176
|
+
const normalizedConfig = getNormalizedConfig(enabledProperties);
|
|
3136
3177
|
if (enabledProperties.styles) {
|
|
3137
|
-
const useAttribute =
|
|
3178
|
+
const useAttribute = normalizedConfig.styles.useAttribute;
|
|
3138
3179
|
strategies.push({
|
|
3139
3180
|
attributeName: 'listStyle',
|
|
3140
3181
|
defaultValue: DEFAULT_LIST_TYPE$1,
|
|
@@ -3333,7 +3374,7 @@ const DEFAULT_LIST_TYPE$1 = 'default';
|
|
|
3333
3374
|
});
|
|
3334
3375
|
// The rendering of the styles grid is conditional. When there is no styles grid, the view will render without collapsible
|
|
3335
3376
|
// for numbered list properties, hence simplifying the layout.
|
|
3336
|
-
if (
|
|
3377
|
+
if (styleButtonViews && styleButtonViews.length) {
|
|
3337
3378
|
this.stylesView = this._createStylesView(styleButtonViews, styleGridAriaLabel);
|
|
3338
3379
|
this.children.add(this.stylesView);
|
|
3339
3380
|
} else {
|
|
@@ -3461,7 +3502,7 @@ const DEFAULT_LIST_TYPE$1 = 'default';
|
|
|
3461
3502
|
numberedPropertyViews.push(this.reversedSwitchButtonView);
|
|
3462
3503
|
}
|
|
3463
3504
|
// When there are some style buttons, pack the numbered list properties into a collapsible to separate them.
|
|
3464
|
-
if (
|
|
3505
|
+
if (this.stylesView) {
|
|
3465
3506
|
this.additionalPropertiesCollapsibleView = new CollapsibleView(this.locale, numberedPropertyViews);
|
|
3466
3507
|
this.additionalPropertiesCollapsibleView.set({
|
|
3467
3508
|
label: t('List properties'),
|
|
@@ -3563,10 +3604,12 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3563
3604
|
const editor = this.editor;
|
|
3564
3605
|
const t = editor.locale.t;
|
|
3565
3606
|
const propertiesConfig = editor.config.get('list.properties');
|
|
3607
|
+
const normalizedConfig = getNormalizedConfig(propertiesConfig);
|
|
3608
|
+
const stylesListTypes = normalizedConfig.styles.listTypes;
|
|
3566
3609
|
// Note: When this plugin does not register the "bulletedList" dropdown due to properties configuration,
|
|
3567
3610
|
// a simple button will be still registered under the same name by ListUI as a fallback. This should happen
|
|
3568
3611
|
// in most editor configuration because the List plugin automatically requires ListUI.
|
|
3569
|
-
if (
|
|
3612
|
+
if (stylesListTypes.includes('bulleted')) {
|
|
3570
3613
|
const styleDefinitions = [
|
|
3571
3614
|
{
|
|
3572
3615
|
label: t('Toggle the disc list style'),
|
|
@@ -3592,7 +3635,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3592
3635
|
const commandName = 'bulletedList';
|
|
3593
3636
|
editor.ui.componentFactory.add(commandName, getDropdownViewCreator({
|
|
3594
3637
|
editor,
|
|
3595
|
-
|
|
3638
|
+
normalizedConfig,
|
|
3596
3639
|
parentCommandName: commandName,
|
|
3597
3640
|
buttonLabel,
|
|
3598
3641
|
buttonIcon: icons.bulletedList,
|
|
@@ -3602,7 +3645,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3602
3645
|
// Add the menu bar item for bulleted list.
|
|
3603
3646
|
editor.ui.componentFactory.add(`menuBar:${commandName}`, getMenuBarStylesMenuCreator({
|
|
3604
3647
|
editor,
|
|
3605
|
-
|
|
3648
|
+
normalizedConfig,
|
|
3606
3649
|
parentCommandName: commandName,
|
|
3607
3650
|
buttonLabel,
|
|
3608
3651
|
styleGridAriaLabel,
|
|
@@ -3612,7 +3655,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3612
3655
|
// Note: When this plugin does not register the "numberedList" dropdown due to properties configuration,
|
|
3613
3656
|
// a simple button will be still registered under the same name by ListUI as a fallback. This should happen
|
|
3614
3657
|
// in most editor configuration because the List plugin automatically requires ListUI.
|
|
3615
|
-
if (
|
|
3658
|
+
if (stylesListTypes.includes('numbered') || propertiesConfig.startIndex || propertiesConfig.reversed) {
|
|
3616
3659
|
const styleDefinitions = [
|
|
3617
3660
|
{
|
|
3618
3661
|
label: t('Toggle the decimal list style'),
|
|
@@ -3656,7 +3699,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3656
3699
|
const commandName = 'numberedList';
|
|
3657
3700
|
editor.ui.componentFactory.add(commandName, getDropdownViewCreator({
|
|
3658
3701
|
editor,
|
|
3659
|
-
|
|
3702
|
+
normalizedConfig,
|
|
3660
3703
|
parentCommandName: commandName,
|
|
3661
3704
|
buttonLabel,
|
|
3662
3705
|
buttonIcon: icons.numberedList,
|
|
@@ -3665,10 +3708,10 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3665
3708
|
}));
|
|
3666
3709
|
// Menu bar menu does not display list start index or reverse UI. If there are no styles enabled,
|
|
3667
3710
|
// the menu makes no sense and should be omitted.
|
|
3668
|
-
if (
|
|
3711
|
+
if (stylesListTypes.includes('numbered')) {
|
|
3669
3712
|
editor.ui.componentFactory.add(`menuBar:${commandName}`, getMenuBarStylesMenuCreator({
|
|
3670
3713
|
editor,
|
|
3671
|
-
|
|
3714
|
+
normalizedConfig,
|
|
3672
3715
|
parentCommandName: commandName,
|
|
3673
3716
|
buttonLabel,
|
|
3674
3717
|
styleGridAriaLabel,
|
|
@@ -3683,7 +3726,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3683
3726
|
* which in turn contains buttons allowing users to change list styles in the context of the current selection.
|
|
3684
3727
|
*
|
|
3685
3728
|
* @param options.editor
|
|
3686
|
-
* @param options.
|
|
3729
|
+
* @param options.normalizedConfig List properties configuration.
|
|
3687
3730
|
* @param options.parentCommandName The name of the higher-order editor command associated with
|
|
3688
3731
|
* the set of particular list styles (e.g. "bulletedList" for "disc", "circle", and "square" styles).
|
|
3689
3732
|
* @param options.buttonLabel Label of the main part of the split button.
|
|
@@ -3691,7 +3734,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3691
3734
|
* @param options.styleGridAriaLabel The ARIA label for the styles grid in the split button dropdown.
|
|
3692
3735
|
* @param options.styleDefinitions Definitions of the style buttons.
|
|
3693
3736
|
* @returns A function that can be passed straight into {@link module:ui/componentfactory~ComponentFactory#add}.
|
|
3694
|
-
*/ function getDropdownViewCreator({ editor,
|
|
3737
|
+
*/ function getDropdownViewCreator({ editor, normalizedConfig, parentCommandName, buttonLabel, buttonIcon, styleGridAriaLabel, styleDefinitions }) {
|
|
3695
3738
|
const parentCommand = editor.commands.get(parentCommandName);
|
|
3696
3739
|
return (locale)=>{
|
|
3697
3740
|
const dropdownView = createDropdown(locale, SplitButtonView);
|
|
@@ -3713,7 +3756,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3713
3756
|
dropdownView.once('change:isOpen', ()=>{
|
|
3714
3757
|
const listPropertiesView = createListPropertiesView({
|
|
3715
3758
|
editor,
|
|
3716
|
-
|
|
3759
|
+
normalizedConfig,
|
|
3717
3760
|
dropdownView,
|
|
3718
3761
|
parentCommandName,
|
|
3719
3762
|
styleGridAriaLabel,
|
|
@@ -3777,23 +3820,24 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3777
3820
|
* A helper that creates the properties view for the individual style dropdown.
|
|
3778
3821
|
*
|
|
3779
3822
|
* @param options.editor Editor instance.
|
|
3780
|
-
* @param options.
|
|
3823
|
+
* @param options.normalizedConfig List properties configuration.
|
|
3781
3824
|
* @param options.dropdownView Styles dropdown view that hosts the properties view.
|
|
3782
3825
|
* @param options.parentCommandName The name of the higher-order editor command associated with
|
|
3783
3826
|
* the set of particular list styles (e.g. "bulletedList" for "disc", "circle", and "square" styles).
|
|
3784
3827
|
* @param options.styleDefinitions Definitions of the style buttons.
|
|
3785
3828
|
* @param options.styleGridAriaLabel An assistive technologies label set on the grid of styles (if the grid is rendered).
|
|
3786
|
-
*/ function createListPropertiesView({ editor,
|
|
3829
|
+
*/ function createListPropertiesView({ editor, normalizedConfig, dropdownView, parentCommandName, styleDefinitions, styleGridAriaLabel }) {
|
|
3787
3830
|
const locale = editor.locale;
|
|
3788
3831
|
const enabledProperties = {
|
|
3789
|
-
...
|
|
3832
|
+
...normalizedConfig,
|
|
3833
|
+
...parentCommandName != 'numberedList' ? {
|
|
3834
|
+
startIndex: false,
|
|
3835
|
+
reversed: false
|
|
3836
|
+
} : null
|
|
3790
3837
|
};
|
|
3791
|
-
|
|
3792
|
-
enabledProperties.startIndex = false;
|
|
3793
|
-
enabledProperties.reversed = false;
|
|
3794
|
-
}
|
|
3838
|
+
const listType = parentCommandName.replace('List', '');
|
|
3795
3839
|
let styleButtonViews = null;
|
|
3796
|
-
if (
|
|
3840
|
+
if (normalizedConfig.styles.listTypes.includes(listType)) {
|
|
3797
3841
|
const listStyleCommand = editor.commands.get('listStyle');
|
|
3798
3842
|
const styleButtonCreator = getStyleButtonCreator({
|
|
3799
3843
|
editor,
|
|
@@ -3809,7 +3853,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3809
3853
|
enabledProperties,
|
|
3810
3854
|
styleButtonViews
|
|
3811
3855
|
});
|
|
3812
|
-
if (
|
|
3856
|
+
if (normalizedConfig.styles.listTypes.includes(listType)) {
|
|
3813
3857
|
// Accessibility: focus the first active style when opening the dropdown.
|
|
3814
3858
|
focusChildOnDropdownOpen(dropdownView, ()=>{
|
|
3815
3859
|
return listPropertiesView.stylesView.children.find((child)=>child.isOn);
|
|
@@ -3840,12 +3884,11 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3840
3884
|
* A helper that creates the list style submenu for menu bar.
|
|
3841
3885
|
*
|
|
3842
3886
|
* @param editor Editor instance.
|
|
3843
|
-
* @param
|
|
3887
|
+
* @param normalizedConfig List properties configuration.
|
|
3844
3888
|
* @param parentCommandName Name of the list command.
|
|
3845
3889
|
* @param buttonLabel Label of the menu button.
|
|
3846
3890
|
* @param styleGridAriaLabel ARIA label of the styles grid.
|
|
3847
|
-
|
|
3848
|
-
*/ function getMenuBarStylesMenuCreator({ editor, propertiesConfig, parentCommandName, buttonLabel, styleGridAriaLabel, styleDefinitions }) {
|
|
3891
|
+
*/ function getMenuBarStylesMenuCreator({ editor, normalizedConfig, parentCommandName, buttonLabel, styleGridAriaLabel, styleDefinitions }) {
|
|
3849
3892
|
return (locale)=>{
|
|
3850
3893
|
const menuView = new MenuBarMenuView(locale);
|
|
3851
3894
|
const listCommand = editor.commands.get(parentCommandName);
|
|
@@ -3860,7 +3903,7 @@ var listStyleUpperLatinIcon = "<svg viewBox=\"0 0 44 44\" xmlns=\"http://www.w3.
|
|
|
3860
3903
|
const listPropertiesView = new ListPropertiesView(locale, {
|
|
3861
3904
|
styleGridAriaLabel,
|
|
3862
3905
|
enabledProperties: {
|
|
3863
|
-
...
|
|
3906
|
+
...normalizedConfig,
|
|
3864
3907
|
// Disable list start index and reversed in the menu bar.
|
|
3865
3908
|
startIndex: false,
|
|
3866
3909
|
reversed: false
|
|
@@ -4043,15 +4086,13 @@ const ITEM_TOGGLE_KEYSTROKE$1 = /* #__PURE__ */ parseKeystroke('Ctrl+Enter');
|
|
|
4043
4086
|
model.schema.extend('$listItem', {
|
|
4044
4087
|
allowAttributes: 'todoListChecked'
|
|
4045
4088
|
});
|
|
4046
|
-
model.schema.addAttributeCheck((context
|
|
4089
|
+
model.schema.addAttributeCheck((context)=>{
|
|
4047
4090
|
const item = context.last;
|
|
4048
|
-
|
|
4049
|
-
return;
|
|
4050
|
-
}
|
|
4091
|
+
// Don't allow `todoListChecked` attribute on elements which are not todo list items.
|
|
4051
4092
|
if (!item.getAttribute('listItemId') || item.getAttribute('listType') != 'todo') {
|
|
4052
4093
|
return false;
|
|
4053
4094
|
}
|
|
4054
|
-
});
|
|
4095
|
+
}, 'todoListChecked');
|
|
4055
4096
|
editor.conversion.for('upcast').add((dispatcher)=>{
|
|
4056
4097
|
// Upcast of to-do list item is based on a checkbox at the beginning of a <li> to keep compatibility with markdown input.
|
|
4057
4098
|
dispatcher.on('element:input', todoItemInputConverter());
|