@ckeditor/ckeditor5-list 0.0.0-internal-20241017.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 +4 -0
- package/LICENSE.md +17 -0
- package/README.md +26 -0
- package/build/list.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/ast.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/jv.js +1 -0
- package/build/translations/km.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/si.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/ti.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/tt.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +193 -0
- package/dist/augmentation.d.ts +57 -0
- package/dist/documentlist.d.ts +36 -0
- package/dist/documentlistproperties.d.ts +36 -0
- package/dist/index-content.css +116 -0
- package/dist/index-editor.css +82 -0
- package/dist/index.css +238 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +7994 -0
- package/dist/index.js.map +1 -0
- package/dist/legacylist/legacyconverters.d.ts +200 -0
- package/dist/legacylist/legacyindentcommand.d.ts +41 -0
- package/dist/legacylist/legacylistcommand.d.ts +60 -0
- package/dist/legacylist/legacylistediting.d.ts +40 -0
- package/dist/legacylist/legacylistutils.d.ts +49 -0
- package/dist/legacylist/legacyutils.d.ts +105 -0
- package/dist/legacylist.d.ts +34 -0
- package/dist/legacylistproperties/legacylistpropertiesediting.d.ts +80 -0
- package/dist/legacylistproperties/legacylistreversedcommand.d.ts +42 -0
- package/dist/legacylistproperties/legacyliststartcommand.d.ts +41 -0
- package/dist/legacylistproperties/legacyliststylecommand.d.ts +71 -0
- package/dist/legacylistproperties.d.ts +35 -0
- package/dist/legacytodolist/legacychecktodolistcommand.d.ts +56 -0
- package/dist/legacytodolist/legacytodolistconverters.d.ts +87 -0
- package/dist/legacytodolist/legacytodolistediting.d.ts +54 -0
- package/dist/legacytodolist.d.ts +35 -0
- package/dist/list/adjacentlistssupport.d.ts +23 -0
- package/dist/list/converters.d.ts +69 -0
- package/dist/list/listcommand.d.ts +96 -0
- package/dist/list/listediting.d.ts +230 -0
- package/dist/list/listindentcommand.d.ts +66 -0
- package/dist/list/listmergecommand.d.ts +80 -0
- package/dist/list/listsplitcommand.d.ts +71 -0
- package/dist/list/listui.d.ts +27 -0
- package/dist/list/listutils.d.ts +60 -0
- package/dist/list/utils/listwalker.d.ts +146 -0
- package/dist/list/utils/model.d.ts +213 -0
- package/dist/list/utils/postfixers.d.ts +41 -0
- package/dist/list/utils/view.d.ts +86 -0
- package/dist/list/utils.d.ts +22 -0
- package/dist/list.d.ts +34 -0
- package/dist/listconfig.d.ts +164 -0
- package/dist/listproperties/converters.d.ts +23 -0
- package/dist/listproperties/listpropertiesediting.d.ts +96 -0
- package/dist/listproperties/listpropertiesui.d.ts +31 -0
- package/dist/listproperties/listpropertiesutils.d.ts +41 -0
- package/dist/listproperties/listreversedcommand.d.ts +40 -0
- package/dist/listproperties/liststartcommand.d.ts +42 -0
- package/dist/listproperties/liststylecommand.d.ts +76 -0
- package/dist/listproperties/ui/listpropertiesview.d.ts +160 -0
- package/dist/listproperties/utils/config.d.ts +39 -0
- package/dist/listproperties/utils/style.d.ts +24 -0
- package/dist/listproperties.d.ts +35 -0
- package/dist/tododocumentlist.d.ts +36 -0
- package/dist/todolist/checktodolistcommand.d.ts +53 -0
- package/dist/todolist/todocheckboxchangeobserver.d.ts +45 -0
- package/dist/todolist/todolistediting.d.ts +53 -0
- package/dist/todolist/todolistui.d.ts +27 -0
- package/dist/todolist.d.ts +35 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/ast.d.ts +8 -0
- package/dist/translations/ast.js +5 -0
- package/dist/translations/ast.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/eo.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/eu.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +5 -0
- package/dist/translations/jv.umd.js +11 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/km.umd.js +11 -0
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/kn.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/nb.umd.js +11 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/ne.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/si.d.ts +8 -0
- package/dist/translations/si.js +5 -0
- package/dist/translations/si.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/ti.d.ts +8 -0
- package/dist/translations/ti.js +5 -0
- package/dist/translations/ti.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +5 -0
- package/dist/translations/tt.umd.js +11 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/ug.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/lang/contexts.json +35 -0
- package/lang/translations/ar.po +150 -0
- package/lang/translations/ast.po +150 -0
- package/lang/translations/az.po +150 -0
- package/lang/translations/bg.po +150 -0
- package/lang/translations/bn.po +150 -0
- package/lang/translations/ca.po +150 -0
- package/lang/translations/cs.po +150 -0
- package/lang/translations/da.po +150 -0
- package/lang/translations/de-ch.po +150 -0
- package/lang/translations/de.po +150 -0
- package/lang/translations/el.po +150 -0
- package/lang/translations/en-au.po +150 -0
- package/lang/translations/en-gb.po +150 -0
- package/lang/translations/en.po +150 -0
- package/lang/translations/eo.po +150 -0
- package/lang/translations/es.po +150 -0
- package/lang/translations/et.po +150 -0
- package/lang/translations/eu.po +150 -0
- package/lang/translations/fa.po +150 -0
- package/lang/translations/fi.po +150 -0
- package/lang/translations/fr.po +150 -0
- package/lang/translations/gl.po +150 -0
- package/lang/translations/he.po +150 -0
- package/lang/translations/hi.po +150 -0
- package/lang/translations/hr.po +150 -0
- package/lang/translations/hu.po +150 -0
- package/lang/translations/id.po +150 -0
- package/lang/translations/it.po +150 -0
- package/lang/translations/ja.po +150 -0
- package/lang/translations/jv.po +150 -0
- package/lang/translations/km.po +150 -0
- package/lang/translations/kn.po +150 -0
- package/lang/translations/ko.po +150 -0
- package/lang/translations/ku.po +150 -0
- package/lang/translations/lt.po +150 -0
- package/lang/translations/lv.po +150 -0
- package/lang/translations/ms.po +150 -0
- package/lang/translations/nb.po +150 -0
- package/lang/translations/ne.po +150 -0
- package/lang/translations/nl.po +150 -0
- package/lang/translations/no.po +150 -0
- package/lang/translations/pl.po +150 -0
- package/lang/translations/pt-br.po +150 -0
- package/lang/translations/pt.po +150 -0
- package/lang/translations/ro.po +150 -0
- package/lang/translations/ru.po +150 -0
- package/lang/translations/si.po +150 -0
- package/lang/translations/sk.po +150 -0
- package/lang/translations/sq.po +150 -0
- package/lang/translations/sr-latn.po +150 -0
- package/lang/translations/sr.po +150 -0
- package/lang/translations/sv.po +150 -0
- package/lang/translations/th.po +150 -0
- package/lang/translations/ti.po +150 -0
- package/lang/translations/tk.po +150 -0
- package/lang/translations/tr.po +150 -0
- package/lang/translations/tt.po +150 -0
- package/lang/translations/ug.po +150 -0
- package/lang/translations/uk.po +150 -0
- package/lang/translations/ur.po +150 -0
- package/lang/translations/uz.po +150 -0
- package/lang/translations/vi.po +150 -0
- package/lang/translations/zh-cn.po +150 -0
- package/lang/translations/zh.po +150 -0
- package/package.json +45 -0
- package/src/augmentation.d.ts +53 -0
- package/src/augmentation.js +5 -0
- package/src/documentlist.d.ts +32 -0
- package/src/documentlist.js +47 -0
- package/src/documentlistproperties.d.ts +32 -0
- package/src/documentlistproperties.js +47 -0
- package/src/index.d.ts +45 -0
- package/src/index.js +39 -0
- package/src/legacylist/legacyconverters.d.ts +196 -0
- package/src/legacylist/legacyconverters.js +905 -0
- package/src/legacylist/legacyindentcommand.d.ts +37 -0
- package/src/legacylist/legacyindentcommand.js +107 -0
- package/src/legacylist/legacylistcommand.d.ts +56 -0
- package/src/legacylist/legacylistcommand.js +274 -0
- package/src/legacylist/legacylistediting.d.ts +36 -0
- package/src/legacylist/legacylistediting.js +167 -0
- package/src/legacylist/legacylistutils.d.ts +45 -0
- package/src/legacylist/legacylistutils.js +52 -0
- package/src/legacylist/legacyutils.d.ts +101 -0
- package/src/legacylist/legacyutils.js +347 -0
- package/src/legacylist.d.ts +30 -0
- package/src/legacylist.js +36 -0
- package/src/legacylistproperties/legacylistpropertiesediting.d.ts +76 -0
- package/src/legacylistproperties/legacylistpropertiesediting.js +702 -0
- package/src/legacylistproperties/legacylistreversedcommand.d.ts +38 -0
- package/src/legacylistproperties/legacylistreversedcommand.js +52 -0
- package/src/legacylistproperties/legacyliststartcommand.d.ts +37 -0
- package/src/legacylistproperties/legacyliststartcommand.js +51 -0
- package/src/legacylistproperties/legacyliststylecommand.d.ts +67 -0
- package/src/legacylistproperties/legacyliststylecommand.js +100 -0
- package/src/legacylistproperties.d.ts +31 -0
- package/src/legacylistproperties.js +37 -0
- package/src/legacytodolist/legacychecktodolistcommand.d.ts +52 -0
- package/src/legacytodolist/legacychecktodolistcommand.js +76 -0
- package/src/legacytodolist/legacytodolistconverters.d.ts +83 -0
- package/src/legacytodolist/legacytodolistconverters.js +261 -0
- package/src/legacytodolist/legacytodolistediting.d.ts +50 -0
- package/src/legacytodolist/legacytodolistediting.js +199 -0
- package/src/legacytodolist.d.ts +31 -0
- package/src/legacytodolist.js +37 -0
- package/src/list/adjacentlistssupport.d.ts +19 -0
- package/src/list/adjacentlistssupport.js +87 -0
- package/src/list/converters.d.ts +65 -0
- package/src/list/converters.js +491 -0
- package/src/list/listcommand.d.ts +92 -0
- package/src/list/listcommand.js +163 -0
- package/src/list/listediting.d.ts +226 -0
- package/src/list/listediting.js +678 -0
- package/src/list/listindentcommand.d.ts +62 -0
- package/src/list/listindentcommand.js +129 -0
- package/src/list/listmergecommand.d.ts +76 -0
- package/src/list/listmergecommand.js +174 -0
- package/src/list/listsplitcommand.d.ts +67 -0
- package/src/list/listsplitcommand.js +70 -0
- package/src/list/listui.d.ts +23 -0
- package/src/list/listui.js +41 -0
- package/src/list/listutils.d.ts +56 -0
- package/src/list/listutils.js +62 -0
- package/src/list/utils/listwalker.d.ts +142 -0
- package/src/list/utils/listwalker.js +182 -0
- package/src/list/utils/model.d.ts +209 -0
- package/src/list/utils/model.js +464 -0
- package/src/list/utils/postfixers.d.ts +37 -0
- package/src/list/utils/postfixers.js +126 -0
- package/src/list/utils/view.d.ts +82 -0
- package/src/list/utils/view.js +117 -0
- package/src/list/utils.d.ts +18 -0
- package/src/list/utils.js +51 -0
- package/src/list.d.ts +30 -0
- package/src/list.js +36 -0
- package/src/listconfig.d.ts +160 -0
- package/src/listconfig.js +5 -0
- package/src/listproperties/converters.d.ts +19 -0
- package/src/listproperties/converters.js +43 -0
- package/src/listproperties/listpropertiesediting.d.ts +92 -0
- package/src/listproperties/listpropertiesediting.js +275 -0
- package/src/listproperties/listpropertiesui.d.ts +27 -0
- package/src/listproperties/listpropertiesui.js +371 -0
- package/src/listproperties/listpropertiesutils.d.ts +37 -0
- package/src/listproperties/listpropertiesutils.js +50 -0
- package/src/listproperties/listreversedcommand.d.ts +36 -0
- package/src/listproperties/listreversedcommand.js +55 -0
- package/src/listproperties/liststartcommand.d.ts +38 -0
- package/src/listproperties/liststartcommand.js +60 -0
- package/src/listproperties/liststylecommand.d.ts +72 -0
- package/src/listproperties/liststylecommand.js +113 -0
- package/src/listproperties/ui/listpropertiesview.d.ts +156 -0
- package/src/listproperties/ui/listpropertiesview.js +301 -0
- package/src/listproperties/utils/config.d.ts +35 -0
- package/src/listproperties/utils/config.js +70 -0
- package/src/listproperties/utils/style.d.ts +20 -0
- package/src/listproperties/utils/style.js +54 -0
- package/src/listproperties.d.ts +31 -0
- package/src/listproperties.js +37 -0
- package/src/tododocumentlist.d.ts +32 -0
- package/src/tododocumentlist.js +47 -0
- package/src/todolist/checktodolistcommand.d.ts +49 -0
- package/src/todolist/checktodolistcommand.js +82 -0
- package/src/todolist/todocheckboxchangeobserver.d.ts +41 -0
- package/src/todolist/todocheckboxchangeobserver.js +37 -0
- package/src/todolist/todolistediting.d.ts +49 -0
- package/src/todolist/todolistediting.js +470 -0
- package/src/todolist/todolistui.d.ts +23 -0
- package/src/todolist/todolistui.js +34 -0
- package/src/todolist.d.ts +31 -0
- package/src/todolist.js +37 -0
- package/theme/documentlist.css +8 -0
- package/theme/icons/liststylecircle.svg +1 -0
- package/theme/icons/liststyledecimal.svg +1 -0
- package/theme/icons/liststyledecimalleadingzero.svg +1 -0
- package/theme/icons/liststyledisc.svg +1 -0
- package/theme/icons/liststylelowerlatin.svg +1 -0
- package/theme/icons/liststylelowerroman.svg +1 -0
- package/theme/icons/liststylesquare.svg +1 -0
- package/theme/icons/liststyleupperlatin.svg +1 -0
- package/theme/icons/liststyleupperroman.svg +1 -0
- package/theme/list.css +40 -0
- package/theme/listproperties.css +10 -0
- package/theme/liststyles.css +8 -0
- package/theme/todolist.css +140 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module list/listproperties/listpropertiesediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ListEditing from '../list/listediting.js';
|
|
10
|
+
import ListStartCommand from './liststartcommand.js';
|
|
11
|
+
import ListStyleCommand from './liststylecommand.js';
|
|
12
|
+
import ListReversedCommand from './listreversedcommand.js';
|
|
13
|
+
import { listPropertiesUpcastConverter } from './converters.js';
|
|
14
|
+
import { getAllSupportedStyleTypes, getListTypeFromListStyleType, getListStyleTypeFromTypeAttribute, getTypeAttributeFromListStyleType } from './utils/style.js';
|
|
15
|
+
import ListPropertiesUtils from './listpropertiesutils.js';
|
|
16
|
+
import { isNumberedListType } from '../list/utils/model.js';
|
|
17
|
+
import { getNormalizedConfig } from './utils/config.js';
|
|
18
|
+
const DEFAULT_LIST_TYPE = 'default';
|
|
19
|
+
/**
|
|
20
|
+
* The document list properties engine feature.
|
|
21
|
+
*
|
|
22
|
+
* It registers the `'listStyle'`, `'listReversed'` and `'listStart'` commands if they are enabled in the configuration.
|
|
23
|
+
* Read more in {@link module:list/listconfig~ListPropertiesConfig}.
|
|
24
|
+
*/
|
|
25
|
+
export default class ListPropertiesEditing extends Plugin {
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get requires() {
|
|
30
|
+
return [ListEditing, ListPropertiesUtils];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get pluginName() {
|
|
36
|
+
return 'ListPropertiesEditing';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
static get isOfficialPlugin() {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
constructor(editor) {
|
|
48
|
+
super(editor);
|
|
49
|
+
editor.config.define('list.properties', {
|
|
50
|
+
styles: true,
|
|
51
|
+
startIndex: false,
|
|
52
|
+
reversed: false
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
init() {
|
|
59
|
+
const editor = this.editor;
|
|
60
|
+
const model = editor.model;
|
|
61
|
+
const listEditing = editor.plugins.get(ListEditing);
|
|
62
|
+
const enabledProperties = editor.config.get('list.properties');
|
|
63
|
+
const strategies = createAttributeStrategies(enabledProperties);
|
|
64
|
+
for (const strategy of strategies) {
|
|
65
|
+
strategy.addCommand(editor);
|
|
66
|
+
model.schema.extend('$listItem', { allowAttributes: strategy.attributeName });
|
|
67
|
+
// Register downcast strategy.
|
|
68
|
+
listEditing.registerDowncastStrategy({
|
|
69
|
+
scope: 'list',
|
|
70
|
+
attributeName: strategy.attributeName,
|
|
71
|
+
setAttributeOnDowncast(writer, attributeValue, viewElement) {
|
|
72
|
+
strategy.setAttributeOnDowncast(writer, attributeValue, viewElement);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Set up conversion.
|
|
77
|
+
editor.conversion.for('upcast').add(dispatcher => {
|
|
78
|
+
for (const strategy of strategies) {
|
|
79
|
+
dispatcher.on('element:ol', listPropertiesUpcastConverter(strategy));
|
|
80
|
+
dispatcher.on('element:ul', listPropertiesUpcastConverter(strategy));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// Verify if the list view element (ul or ol) requires refreshing.
|
|
84
|
+
listEditing.on('checkAttributes:list', (evt, { viewElement, modelAttributes }) => {
|
|
85
|
+
for (const strategy of strategies) {
|
|
86
|
+
if (strategy.getAttributeOnUpcast(viewElement) != modelAttributes[strategy.attributeName]) {
|
|
87
|
+
evt.return = true;
|
|
88
|
+
evt.stop();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
// Reset list properties after indenting list items.
|
|
93
|
+
this.listenTo(editor.commands.get('indentList'), 'afterExecute', (evt, changedBlocks) => {
|
|
94
|
+
model.change(writer => {
|
|
95
|
+
for (const node of changedBlocks) {
|
|
96
|
+
for (const strategy of strategies) {
|
|
97
|
+
if (strategy.appliesToListItem(node)) {
|
|
98
|
+
// Just reset the attribute.
|
|
99
|
+
// If there is a previous indented list that this node should be merged into,
|
|
100
|
+
// the postfixer will unify all the attributes of both sub-lists.
|
|
101
|
+
writer.setAttribute(strategy.attributeName, strategy.defaultValue, node);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
// Add or remove list properties attributes depending on the list type.
|
|
108
|
+
listEditing.on('postFixer', (evt, { listNodes, writer }) => {
|
|
109
|
+
for (const { node } of listNodes) {
|
|
110
|
+
for (const strategy of strategies) {
|
|
111
|
+
// Check if attribute is valid.
|
|
112
|
+
if (strategy.hasValidAttribute(node)) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
// Add missing default property attributes...
|
|
116
|
+
if (strategy.appliesToListItem(node)) {
|
|
117
|
+
writer.setAttribute(strategy.attributeName, strategy.defaultValue, node);
|
|
118
|
+
}
|
|
119
|
+
// ...or remove invalid property attributes.
|
|
120
|
+
else {
|
|
121
|
+
writer.removeAttribute(strategy.attributeName, node);
|
|
122
|
+
}
|
|
123
|
+
evt.return = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
// Make sure that all items in a single list (items at the same level & listType) have the same properties.
|
|
128
|
+
listEditing.on('postFixer', (evt, { listNodes, writer }) => {
|
|
129
|
+
for (const { node, previousNodeInList } of listNodes) {
|
|
130
|
+
// This is a first item of a nested list.
|
|
131
|
+
if (!previousNodeInList) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// This is a first block of a list of a different type.
|
|
135
|
+
if (previousNodeInList.getAttribute('listType') != node.getAttribute('listType')) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
// Copy properties from the previous one.
|
|
139
|
+
for (const strategy of strategies) {
|
|
140
|
+
const { attributeName } = strategy;
|
|
141
|
+
if (!strategy.appliesToListItem(node)) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const value = previousNodeInList.getAttribute(attributeName);
|
|
145
|
+
if (node.getAttribute(attributeName) != value) {
|
|
146
|
+
writer.setAttribute(attributeName, value, node);
|
|
147
|
+
evt.return = true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Creates an array of strategies for dealing with enabled listItem attributes.
|
|
156
|
+
*/
|
|
157
|
+
function createAttributeStrategies(enabledProperties) {
|
|
158
|
+
const strategies = [];
|
|
159
|
+
const normalizedConfig = getNormalizedConfig(enabledProperties);
|
|
160
|
+
if (enabledProperties.styles) {
|
|
161
|
+
const useAttribute = normalizedConfig.styles.useAttribute;
|
|
162
|
+
strategies.push({
|
|
163
|
+
attributeName: 'listStyle',
|
|
164
|
+
defaultValue: DEFAULT_LIST_TYPE,
|
|
165
|
+
viewConsumables: { styles: 'list-style-type' },
|
|
166
|
+
addCommand(editor) {
|
|
167
|
+
let supportedTypes = getAllSupportedStyleTypes();
|
|
168
|
+
if (useAttribute) {
|
|
169
|
+
supportedTypes = supportedTypes.filter(styleType => !!getTypeAttributeFromListStyleType(styleType));
|
|
170
|
+
}
|
|
171
|
+
editor.commands.add('listStyle', new ListStyleCommand(editor, DEFAULT_LIST_TYPE, supportedTypes));
|
|
172
|
+
},
|
|
173
|
+
appliesToListItem(item) {
|
|
174
|
+
return item.getAttribute('listType') == 'numbered' || item.getAttribute('listType') == 'bulleted';
|
|
175
|
+
},
|
|
176
|
+
hasValidAttribute(item) {
|
|
177
|
+
if (!this.appliesToListItem(item)) {
|
|
178
|
+
return !item.hasAttribute('listStyle');
|
|
179
|
+
}
|
|
180
|
+
if (!item.hasAttribute('listStyle')) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
const value = item.getAttribute('listStyle');
|
|
184
|
+
if (value == DEFAULT_LIST_TYPE) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
return getListTypeFromListStyleType(value) == item.getAttribute('listType');
|
|
188
|
+
},
|
|
189
|
+
setAttributeOnDowncast(writer, listStyle, element) {
|
|
190
|
+
if (listStyle && listStyle !== DEFAULT_LIST_TYPE) {
|
|
191
|
+
if (useAttribute) {
|
|
192
|
+
const value = getTypeAttributeFromListStyleType(listStyle);
|
|
193
|
+
if (value) {
|
|
194
|
+
writer.setAttribute('type', value, element);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
writer.setStyle('list-style-type', listStyle, element);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
writer.removeStyle('list-style-type', element);
|
|
204
|
+
writer.removeAttribute('type', element);
|
|
205
|
+
},
|
|
206
|
+
getAttributeOnUpcast(listParent) {
|
|
207
|
+
const style = listParent.getStyle('list-style-type');
|
|
208
|
+
if (style) {
|
|
209
|
+
return style;
|
|
210
|
+
}
|
|
211
|
+
const attribute = listParent.getAttribute('type');
|
|
212
|
+
if (attribute) {
|
|
213
|
+
return getListStyleTypeFromTypeAttribute(attribute);
|
|
214
|
+
}
|
|
215
|
+
return DEFAULT_LIST_TYPE;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
if (enabledProperties.reversed) {
|
|
220
|
+
strategies.push({
|
|
221
|
+
attributeName: 'listReversed',
|
|
222
|
+
defaultValue: false,
|
|
223
|
+
viewConsumables: { attributes: 'reversed' },
|
|
224
|
+
addCommand(editor) {
|
|
225
|
+
editor.commands.add('listReversed', new ListReversedCommand(editor));
|
|
226
|
+
},
|
|
227
|
+
appliesToListItem(item) {
|
|
228
|
+
return item.getAttribute('listType') == 'numbered';
|
|
229
|
+
},
|
|
230
|
+
hasValidAttribute(item) {
|
|
231
|
+
return this.appliesToListItem(item) == item.hasAttribute('listReversed');
|
|
232
|
+
},
|
|
233
|
+
setAttributeOnDowncast(writer, listReversed, element) {
|
|
234
|
+
if (listReversed) {
|
|
235
|
+
writer.setAttribute('reversed', 'reversed', element);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
writer.removeAttribute('reversed', element);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
getAttributeOnUpcast(listParent) {
|
|
242
|
+
return listParent.hasAttribute('reversed');
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (enabledProperties.startIndex) {
|
|
247
|
+
strategies.push({
|
|
248
|
+
attributeName: 'listStart',
|
|
249
|
+
defaultValue: 1,
|
|
250
|
+
viewConsumables: { attributes: 'start' },
|
|
251
|
+
addCommand(editor) {
|
|
252
|
+
editor.commands.add('listStart', new ListStartCommand(editor));
|
|
253
|
+
},
|
|
254
|
+
appliesToListItem(item) {
|
|
255
|
+
return isNumberedListType(item.getAttribute('listType'));
|
|
256
|
+
},
|
|
257
|
+
hasValidAttribute(item) {
|
|
258
|
+
return this.appliesToListItem(item) == item.hasAttribute('listStart');
|
|
259
|
+
},
|
|
260
|
+
setAttributeOnDowncast(writer, listStart, element) {
|
|
261
|
+
if (listStart == 0 || listStart > 1) {
|
|
262
|
+
writer.setAttribute('start', listStart, element);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
writer.removeAttribute('start', element);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
getAttributeOnUpcast(listParent) {
|
|
269
|
+
const startAttributeValue = listParent.getAttribute('start');
|
|
270
|
+
return startAttributeValue >= 0 ? startAttributeValue : 1;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
return strategies;
|
|
275
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module list/listproperties/listpropertiesui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import '../../theme/liststyles.css';
|
|
10
|
+
/**
|
|
11
|
+
* The list properties UI plugin. It introduces the extended `'bulletedList'` and `'numberedList'` toolbar
|
|
12
|
+
* buttons that allow users to control such aspects of list as the marker, start index or order.
|
|
13
|
+
*
|
|
14
|
+
* **Note**: Buttons introduced by this plugin override implementations from the {@link module:list/list/listui~ListUI}
|
|
15
|
+
* (because they share the same names).
|
|
16
|
+
*/
|
|
17
|
+
export default class ListPropertiesUI extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): "ListPropertiesUI";
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get isOfficialPlugin(): true;
|
|
26
|
+
init(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module list/listproperties/listpropertiesui
|
|
7
|
+
*/
|
|
8
|
+
import { icons, Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ButtonView, SplitButtonView, createDropdown, focusChildOnDropdownOpen, MenuBarMenuView } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import ListPropertiesView from './ui/listpropertiesview.js';
|
|
11
|
+
import { getNormalizedConfig } from './utils/config.js';
|
|
12
|
+
import listStyleDiscIcon from '../../theme/icons/liststyledisc.svg';
|
|
13
|
+
import listStyleCircleIcon from '../../theme/icons/liststylecircle.svg';
|
|
14
|
+
import listStyleSquareIcon from '../../theme/icons/liststylesquare.svg';
|
|
15
|
+
import listStyleDecimalIcon from '../../theme/icons/liststyledecimal.svg';
|
|
16
|
+
import listStyleDecimalWithLeadingZeroIcon from '../../theme/icons/liststyledecimalleadingzero.svg';
|
|
17
|
+
import listStyleLowerRomanIcon from '../../theme/icons/liststylelowerroman.svg';
|
|
18
|
+
import listStyleUpperRomanIcon from '../../theme/icons/liststyleupperroman.svg';
|
|
19
|
+
import listStyleLowerLatinIcon from '../../theme/icons/liststylelowerlatin.svg';
|
|
20
|
+
import listStyleUpperLatinIcon from '../../theme/icons/liststyleupperlatin.svg';
|
|
21
|
+
import '../../theme/liststyles.css';
|
|
22
|
+
/**
|
|
23
|
+
* The list properties UI plugin. It introduces the extended `'bulletedList'` and `'numberedList'` toolbar
|
|
24
|
+
* buttons that allow users to control such aspects of list as the marker, start index or order.
|
|
25
|
+
*
|
|
26
|
+
* **Note**: Buttons introduced by this plugin override implementations from the {@link module:list/list/listui~ListUI}
|
|
27
|
+
* (because they share the same names).
|
|
28
|
+
*/
|
|
29
|
+
export default class ListPropertiesUI extends Plugin {
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
static get pluginName() {
|
|
34
|
+
return 'ListPropertiesUI';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
static get isOfficialPlugin() {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
init() {
|
|
43
|
+
const editor = this.editor;
|
|
44
|
+
const t = editor.locale.t;
|
|
45
|
+
const propertiesConfig = editor.config.get('list.properties');
|
|
46
|
+
const normalizedConfig = getNormalizedConfig(propertiesConfig);
|
|
47
|
+
const stylesListTypes = normalizedConfig.styles.listTypes;
|
|
48
|
+
// Note: When this plugin does not register the "bulletedList" dropdown due to properties configuration,
|
|
49
|
+
// a simple button will be still registered under the same name by ListUI as a fallback. This should happen
|
|
50
|
+
// in most editor configuration because the List plugin automatically requires ListUI.
|
|
51
|
+
if (stylesListTypes.includes('bulleted')) {
|
|
52
|
+
const styleDefinitions = [
|
|
53
|
+
{
|
|
54
|
+
label: t('Toggle the disc list style'),
|
|
55
|
+
tooltip: t('Disc'),
|
|
56
|
+
type: 'disc',
|
|
57
|
+
icon: listStyleDiscIcon
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: t('Toggle the circle list style'),
|
|
61
|
+
tooltip: t('Circle'),
|
|
62
|
+
type: 'circle',
|
|
63
|
+
icon: listStyleCircleIcon
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: t('Toggle the square list style'),
|
|
67
|
+
tooltip: t('Square'),
|
|
68
|
+
type: 'square',
|
|
69
|
+
icon: listStyleSquareIcon
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
const buttonLabel = t('Bulleted List');
|
|
73
|
+
const styleGridAriaLabel = t('Bulleted list styles toolbar');
|
|
74
|
+
const commandName = 'bulletedList';
|
|
75
|
+
editor.ui.componentFactory.add(commandName, getDropdownViewCreator({
|
|
76
|
+
editor,
|
|
77
|
+
normalizedConfig,
|
|
78
|
+
parentCommandName: commandName,
|
|
79
|
+
buttonLabel,
|
|
80
|
+
buttonIcon: icons.bulletedList,
|
|
81
|
+
styleGridAriaLabel,
|
|
82
|
+
styleDefinitions
|
|
83
|
+
}));
|
|
84
|
+
// Add the menu bar item for bulleted list.
|
|
85
|
+
editor.ui.componentFactory.add(`menuBar:${commandName}`, getMenuBarStylesMenuCreator({
|
|
86
|
+
editor,
|
|
87
|
+
normalizedConfig,
|
|
88
|
+
parentCommandName: commandName,
|
|
89
|
+
buttonLabel,
|
|
90
|
+
styleGridAriaLabel,
|
|
91
|
+
styleDefinitions
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
// Note: When this plugin does not register the "numberedList" dropdown due to properties configuration,
|
|
95
|
+
// a simple button will be still registered under the same name by ListUI as a fallback. This should happen
|
|
96
|
+
// in most editor configuration because the List plugin automatically requires ListUI.
|
|
97
|
+
if (stylesListTypes.includes('numbered') || propertiesConfig.startIndex || propertiesConfig.reversed) {
|
|
98
|
+
const styleDefinitions = [
|
|
99
|
+
{
|
|
100
|
+
label: t('Toggle the decimal list style'),
|
|
101
|
+
tooltip: t('Decimal'),
|
|
102
|
+
type: 'decimal',
|
|
103
|
+
icon: listStyleDecimalIcon
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: t('Toggle the decimal with leading zero list style'),
|
|
107
|
+
tooltip: t('Decimal with leading zero'),
|
|
108
|
+
type: 'decimal-leading-zero',
|
|
109
|
+
icon: listStyleDecimalWithLeadingZeroIcon
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: t('Toggle the lower–roman list style'),
|
|
113
|
+
tooltip: t('Lower–roman'),
|
|
114
|
+
type: 'lower-roman',
|
|
115
|
+
icon: listStyleLowerRomanIcon
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: t('Toggle the upper–roman list style'),
|
|
119
|
+
tooltip: t('Upper-roman'),
|
|
120
|
+
type: 'upper-roman',
|
|
121
|
+
icon: listStyleUpperRomanIcon
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: t('Toggle the lower–latin list style'),
|
|
125
|
+
tooltip: t('Lower-latin'),
|
|
126
|
+
type: 'lower-latin',
|
|
127
|
+
icon: listStyleLowerLatinIcon
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: t('Toggle the upper–latin list style'),
|
|
131
|
+
tooltip: t('Upper-latin'),
|
|
132
|
+
type: 'upper-latin',
|
|
133
|
+
icon: listStyleUpperLatinIcon
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
const buttonLabel = t('Numbered List');
|
|
137
|
+
const styleGridAriaLabel = t('Numbered list styles toolbar');
|
|
138
|
+
const commandName = 'numberedList';
|
|
139
|
+
editor.ui.componentFactory.add(commandName, getDropdownViewCreator({
|
|
140
|
+
editor,
|
|
141
|
+
normalizedConfig,
|
|
142
|
+
parentCommandName: commandName,
|
|
143
|
+
buttonLabel,
|
|
144
|
+
buttonIcon: icons.numberedList,
|
|
145
|
+
styleGridAriaLabel,
|
|
146
|
+
styleDefinitions
|
|
147
|
+
}));
|
|
148
|
+
// Menu bar menu does not display list start index or reverse UI. If there are no styles enabled,
|
|
149
|
+
// the menu makes no sense and should be omitted.
|
|
150
|
+
if (stylesListTypes.includes('numbered')) {
|
|
151
|
+
editor.ui.componentFactory.add(`menuBar:${commandName}`, getMenuBarStylesMenuCreator({
|
|
152
|
+
editor,
|
|
153
|
+
normalizedConfig,
|
|
154
|
+
parentCommandName: commandName,
|
|
155
|
+
buttonLabel,
|
|
156
|
+
styleGridAriaLabel,
|
|
157
|
+
styleDefinitions
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A helper that returns a function that creates a split button with a toolbar in the dropdown,
|
|
165
|
+
* which in turn contains buttons allowing users to change list styles in the context of the current selection.
|
|
166
|
+
*
|
|
167
|
+
* @param options.editor
|
|
168
|
+
* @param options.normalizedConfig List properties configuration.
|
|
169
|
+
* @param options.parentCommandName The name of the higher-order editor command associated with
|
|
170
|
+
* the set of particular list styles (e.g. "bulletedList" for "disc", "circle", and "square" styles).
|
|
171
|
+
* @param options.buttonLabel Label of the main part of the split button.
|
|
172
|
+
* @param options.buttonIcon The SVG string of an icon for the main part of the split button.
|
|
173
|
+
* @param options.styleGridAriaLabel The ARIA label for the styles grid in the split button dropdown.
|
|
174
|
+
* @param options.styleDefinitions Definitions of the style buttons.
|
|
175
|
+
* @returns A function that can be passed straight into {@link module:ui/componentfactory~ComponentFactory#add}.
|
|
176
|
+
*/
|
|
177
|
+
function getDropdownViewCreator({ editor, normalizedConfig, parentCommandName, buttonLabel, buttonIcon, styleGridAriaLabel, styleDefinitions }) {
|
|
178
|
+
const parentCommand = editor.commands.get(parentCommandName);
|
|
179
|
+
return (locale) => {
|
|
180
|
+
const dropdownView = createDropdown(locale, SplitButtonView);
|
|
181
|
+
const mainButtonView = dropdownView.buttonView;
|
|
182
|
+
dropdownView.bind('isEnabled').to(parentCommand);
|
|
183
|
+
dropdownView.class = 'ck-list-styles-dropdown';
|
|
184
|
+
// Main button was clicked.
|
|
185
|
+
mainButtonView.on('execute', () => {
|
|
186
|
+
editor.execute(parentCommandName);
|
|
187
|
+
editor.editing.view.focus();
|
|
188
|
+
});
|
|
189
|
+
mainButtonView.set({
|
|
190
|
+
label: buttonLabel,
|
|
191
|
+
icon: buttonIcon,
|
|
192
|
+
tooltip: true,
|
|
193
|
+
isToggleable: true
|
|
194
|
+
});
|
|
195
|
+
mainButtonView.bind('isOn').to(parentCommand, 'value', value => !!value);
|
|
196
|
+
dropdownView.once('change:isOpen', () => {
|
|
197
|
+
const listPropertiesView = createListPropertiesView({
|
|
198
|
+
editor,
|
|
199
|
+
normalizedConfig,
|
|
200
|
+
dropdownView,
|
|
201
|
+
parentCommandName,
|
|
202
|
+
styleGridAriaLabel,
|
|
203
|
+
styleDefinitions
|
|
204
|
+
});
|
|
205
|
+
dropdownView.panelView.children.add(listPropertiesView);
|
|
206
|
+
});
|
|
207
|
+
// Focus the editable after executing the command.
|
|
208
|
+
// Overrides a default behaviour where the focus is moved to the dropdown button (#12125).
|
|
209
|
+
dropdownView.on('execute', () => {
|
|
210
|
+
editor.editing.view.focus();
|
|
211
|
+
});
|
|
212
|
+
return dropdownView;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* A helper that returns a function (factory) that creates individual buttons used by users to change styles
|
|
217
|
+
* of lists.
|
|
218
|
+
*
|
|
219
|
+
* @param options.editor
|
|
220
|
+
* @param options.listStyleCommand The instance of the `ListStylesCommand` class.
|
|
221
|
+
* @param options.parentCommandName The name of the higher-order command associated with a
|
|
222
|
+
* particular list style (e.g. "bulletedList" is associated with "square" and "numberedList" is associated with "roman").
|
|
223
|
+
* @returns A function that can be passed straight into {@link module:ui/componentfactory~ComponentFactory#add}.
|
|
224
|
+
*/
|
|
225
|
+
function getStyleButtonCreator({ editor, listStyleCommand, parentCommandName }) {
|
|
226
|
+
const locale = editor.locale;
|
|
227
|
+
const parentCommand = editor.commands.get(parentCommandName);
|
|
228
|
+
return ({ label, type, icon, tooltip }) => {
|
|
229
|
+
const button = new ButtonView(locale);
|
|
230
|
+
button.set({ label, icon, tooltip });
|
|
231
|
+
listStyleCommand.on('change:value', () => {
|
|
232
|
+
button.isOn = listStyleCommand.value === type;
|
|
233
|
+
});
|
|
234
|
+
button.on('execute', () => {
|
|
235
|
+
// If the content the selection is anchored to is a list, let's change its style.
|
|
236
|
+
if (parentCommand.value) {
|
|
237
|
+
// Remove the list when the current list style is the same as the one that would normally be applied.
|
|
238
|
+
if (listStyleCommand.value === type) {
|
|
239
|
+
editor.execute(parentCommandName);
|
|
240
|
+
}
|
|
241
|
+
// If the current list style is not set in the model or the style is different than the
|
|
242
|
+
// one to be applied, simply apply the new style.
|
|
243
|
+
else if (listStyleCommand.value !== type) {
|
|
244
|
+
editor.execute('listStyle', { type });
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Otherwise, leave the creation of the styled list to the `ListStyleCommand`.
|
|
248
|
+
else {
|
|
249
|
+
editor.model.change(() => {
|
|
250
|
+
editor.execute('listStyle', { type });
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
return button;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* A helper that creates the properties view for the individual style dropdown.
|
|
259
|
+
*
|
|
260
|
+
* @param options.editor Editor instance.
|
|
261
|
+
* @param options.normalizedConfig List properties configuration.
|
|
262
|
+
* @param options.dropdownView Styles dropdown view that hosts the properties view.
|
|
263
|
+
* @param options.parentCommandName The name of the higher-order editor command associated with
|
|
264
|
+
* the set of particular list styles (e.g. "bulletedList" for "disc", "circle", and "square" styles).
|
|
265
|
+
* @param options.styleDefinitions Definitions of the style buttons.
|
|
266
|
+
* @param options.styleGridAriaLabel An assistive technologies label set on the grid of styles (if the grid is rendered).
|
|
267
|
+
*/
|
|
268
|
+
function createListPropertiesView({ editor, normalizedConfig, dropdownView, parentCommandName, styleDefinitions, styleGridAriaLabel }) {
|
|
269
|
+
const locale = editor.locale;
|
|
270
|
+
const enabledProperties = {
|
|
271
|
+
...normalizedConfig,
|
|
272
|
+
...(parentCommandName != 'numberedList' ? {
|
|
273
|
+
startIndex: false,
|
|
274
|
+
reversed: false
|
|
275
|
+
} : null)
|
|
276
|
+
};
|
|
277
|
+
const listType = parentCommandName.replace('List', '');
|
|
278
|
+
let styleButtonViews = null;
|
|
279
|
+
if (normalizedConfig.styles.listTypes.includes(listType)) {
|
|
280
|
+
const listStyleCommand = editor.commands.get('listStyle');
|
|
281
|
+
const styleButtonCreator = getStyleButtonCreator({
|
|
282
|
+
editor,
|
|
283
|
+
parentCommandName,
|
|
284
|
+
listStyleCommand
|
|
285
|
+
});
|
|
286
|
+
// The command can be ListStyleCommand or DocumentListStyleCommand.
|
|
287
|
+
const isStyleTypeSupported = getStyleTypeSupportChecker(listStyleCommand);
|
|
288
|
+
styleButtonViews = styleDefinitions.filter(isStyleTypeSupported).map(styleButtonCreator);
|
|
289
|
+
}
|
|
290
|
+
const listPropertiesView = new ListPropertiesView(locale, {
|
|
291
|
+
styleGridAriaLabel,
|
|
292
|
+
enabledProperties,
|
|
293
|
+
styleButtonViews
|
|
294
|
+
});
|
|
295
|
+
if (normalizedConfig.styles.listTypes.includes(listType)) {
|
|
296
|
+
// Accessibility: focus the first active style when opening the dropdown.
|
|
297
|
+
focusChildOnDropdownOpen(dropdownView, () => {
|
|
298
|
+
return listPropertiesView.stylesView.children.find((child) => child.isOn);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (enabledProperties.startIndex) {
|
|
302
|
+
const listStartCommand = editor.commands.get('listStart');
|
|
303
|
+
listPropertiesView.startIndexFieldView.bind('isEnabled').to(listStartCommand);
|
|
304
|
+
listPropertiesView.startIndexFieldView.fieldView.bind('value').to(listStartCommand);
|
|
305
|
+
listPropertiesView.on('listStart', (evt, data) => editor.execute('listStart', data));
|
|
306
|
+
}
|
|
307
|
+
if (enabledProperties.reversed) {
|
|
308
|
+
const listReversedCommand = editor.commands.get('listReversed');
|
|
309
|
+
listPropertiesView.reversedSwitchButtonView.bind('isEnabled').to(listReversedCommand);
|
|
310
|
+
listPropertiesView.reversedSwitchButtonView.bind('isOn').to(listReversedCommand, 'value', value => !!value);
|
|
311
|
+
listPropertiesView.on('listReversed', () => {
|
|
312
|
+
const isReversed = listReversedCommand.value;
|
|
313
|
+
editor.execute('listReversed', { reversed: !isReversed });
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
// Make sure applying styles closes the dropdown.
|
|
317
|
+
listPropertiesView.delegate('execute').to(dropdownView);
|
|
318
|
+
return listPropertiesView;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* A helper that creates the list style submenu for menu bar.
|
|
322
|
+
*
|
|
323
|
+
* @param editor Editor instance.
|
|
324
|
+
* @param normalizedConfig List properties configuration.
|
|
325
|
+
* @param parentCommandName Name of the list command.
|
|
326
|
+
* @param buttonLabel Label of the menu button.
|
|
327
|
+
* @param styleGridAriaLabel ARIA label of the styles grid.
|
|
328
|
+
*/
|
|
329
|
+
function getMenuBarStylesMenuCreator({ editor, normalizedConfig, parentCommandName, buttonLabel, styleGridAriaLabel, styleDefinitions }) {
|
|
330
|
+
return (locale) => {
|
|
331
|
+
const menuView = new MenuBarMenuView(locale);
|
|
332
|
+
const listCommand = editor.commands.get(parentCommandName);
|
|
333
|
+
const listStyleCommand = editor.commands.get('listStyle');
|
|
334
|
+
const isStyleTypeSupported = getStyleTypeSupportChecker(listStyleCommand);
|
|
335
|
+
const styleButtonCreator = getStyleButtonCreator({
|
|
336
|
+
editor,
|
|
337
|
+
parentCommandName,
|
|
338
|
+
listStyleCommand
|
|
339
|
+
});
|
|
340
|
+
const styleButtonViews = styleDefinitions.filter(isStyleTypeSupported).map(styleButtonCreator);
|
|
341
|
+
const listPropertiesView = new ListPropertiesView(locale, {
|
|
342
|
+
styleGridAriaLabel,
|
|
343
|
+
enabledProperties: {
|
|
344
|
+
...normalizedConfig,
|
|
345
|
+
// Disable list start index and reversed in the menu bar.
|
|
346
|
+
startIndex: false,
|
|
347
|
+
reversed: false
|
|
348
|
+
},
|
|
349
|
+
styleButtonViews
|
|
350
|
+
});
|
|
351
|
+
listPropertiesView.delegate('execute').to(menuView);
|
|
352
|
+
menuView.buttonView.set({
|
|
353
|
+
label: buttonLabel,
|
|
354
|
+
icon: icons[parentCommandName]
|
|
355
|
+
});
|
|
356
|
+
menuView.panelView.children.add(listPropertiesView);
|
|
357
|
+
menuView.bind('isEnabled').to(listCommand, 'isEnabled');
|
|
358
|
+
menuView.on('execute', () => {
|
|
359
|
+
editor.editing.view.focus();
|
|
360
|
+
});
|
|
361
|
+
return menuView;
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function getStyleTypeSupportChecker(listStyleCommand) {
|
|
365
|
+
if (typeof listStyleCommand.isStyleTypeSupported == 'function') {
|
|
366
|
+
return (styleDefinition) => listStyleCommand.isStyleTypeSupported(styleDefinition.type);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
return () => true;
|
|
370
|
+
}
|
|
371
|
+
}
|