@jackuait/blok 0.4.1-beta.0 → 0.4.1-beta.11
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/README.md +138 -17
- package/codemod/README.md +45 -7
- package/codemod/migrate-editorjs-to-blok.js +960 -92
- package/codemod/test.js +780 -77
- package/dist/blok.mjs +5 -2
- package/dist/chunks/blok-oNSQ3HA6.mjs +13217 -0
- package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
- package/dist/chunks/i18next-loader-BdNRw4n4.mjs +43 -0
- package/dist/{index-OwEtDFlk.mjs → chunks/index-DHgXmfki.mjs} +2 -2
- package/dist/chunks/inline-tool-convert-CRqgjRim.mjs +1989 -0
- package/dist/chunks/messages-0tDXLuyH.mjs +48 -0
- package/dist/chunks/messages-2_xedlYw.mjs +48 -0
- package/dist/chunks/messages-AHESHJm_.mjs +48 -0
- package/dist/chunks/messages-B5hdXZwA.mjs +48 -0
- package/dist/chunks/messages-B5jGUnOy.mjs +48 -0
- package/dist/chunks/messages-B5puUm7R.mjs +48 -0
- package/dist/chunks/messages-B66ZSDCJ.mjs +48 -0
- package/dist/chunks/messages-B9Oba7sq.mjs +48 -0
- package/dist/chunks/messages-BA0rcTCY.mjs +48 -0
- package/dist/chunks/messages-BBJgd5jG.mjs +48 -0
- package/dist/chunks/messages-BPqWKx5Z.mjs +48 -0
- package/dist/chunks/messages-Bdv-IkfG.mjs +48 -0
- package/dist/chunks/messages-BeUhMpsr.mjs +48 -0
- package/dist/chunks/messages-Bf6Y3_GI.mjs +48 -0
- package/dist/chunks/messages-BiExzWJv.mjs +48 -0
- package/dist/chunks/messages-BlpqL8vG.mjs +48 -0
- package/dist/chunks/messages-BmKCChWZ.mjs +48 -0
- package/dist/chunks/messages-Bn253WWC.mjs +48 -0
- package/dist/chunks/messages-BrJHUxQL.mjs +48 -0
- package/dist/chunks/messages-C5b7hr_E.mjs +48 -0
- package/dist/chunks/messages-C7I_AVH2.mjs +48 -0
- package/dist/chunks/messages-CJoBtXU6.mjs +48 -0
- package/dist/chunks/messages-CQj2JU2j.mjs +48 -0
- package/dist/chunks/messages-CUZ1x1QD.mjs +48 -0
- package/dist/chunks/messages-CUy1vn-b.mjs +48 -0
- package/dist/chunks/messages-CVeWVKsV.mjs +48 -0
- package/dist/chunks/messages-CXHd9SUK.mjs +48 -0
- package/dist/chunks/messages-CbMyJSzS.mjs +48 -0
- package/dist/chunks/messages-CbhuIWRJ.mjs +48 -0
- package/dist/chunks/messages-CeCjVKMW.mjs +48 -0
- package/dist/chunks/messages-Cj-t1bdy.mjs +48 -0
- package/dist/chunks/messages-CkFT2gle.mjs +48 -0
- package/dist/chunks/messages-Cm9aLHeX.mjs +48 -0
- package/dist/chunks/messages-CnvW8Slp.mjs +48 -0
- package/dist/chunks/messages-Cr-RJ7YB.mjs +48 -0
- package/dist/chunks/messages-CrsJ1TEJ.mjs +48 -0
- package/dist/chunks/messages-Cu08aLS3.mjs +48 -0
- package/dist/chunks/messages-CvaqJFN-.mjs +48 -0
- package/dist/chunks/messages-CyDU5lz9.mjs +48 -0
- package/dist/chunks/messages-CySyfkMU.mjs +48 -0
- package/dist/chunks/messages-Cyi2AMmz.mjs +48 -0
- package/dist/chunks/messages-D00OjS2n.mjs +48 -0
- package/dist/chunks/messages-DDLgIPDF.mjs +48 -0
- package/dist/chunks/messages-DMQIHGRj.mjs +48 -0
- package/dist/chunks/messages-DOlC_Tty.mjs +48 -0
- package/dist/chunks/messages-DV6shA9b.mjs +48 -0
- package/dist/chunks/messages-DY94ykcE.mjs +48 -0
- package/dist/chunks/messages-DbVquYKN.mjs +48 -0
- package/dist/chunks/messages-DcKOuncK.mjs +48 -0
- package/dist/chunks/messages-Dg92dXZ5.mjs +48 -0
- package/dist/chunks/messages-DnbbyJT3.mjs +48 -0
- package/dist/chunks/messages-DteYq0rv.mjs +48 -0
- package/dist/chunks/messages-GC2PhgV3.mjs +48 -0
- package/dist/chunks/messages-JGsXAReJ.mjs +48 -0
- package/dist/chunks/messages-JZUhXTuV.mjs +48 -0
- package/dist/chunks/messages-LvFKBBPa.mjs +48 -0
- package/dist/chunks/messages-NP1myMGI.mjs +48 -0
- package/dist/chunks/messages-Q4kc_ZtL.mjs +48 -0
- package/dist/chunks/messages-RvMHb2Ht.mjs +48 -0
- package/dist/chunks/messages-ftMcCEuO.mjs +48 -0
- package/dist/chunks/messages-o24dK6CU.mjs +48 -0
- package/dist/chunks/messages-pA5TvcAj.mjs +48 -0
- package/dist/chunks/messages-rRSHQDCX.mjs +48 -0
- package/dist/chunks/messages-srxrv8Yh.mjs +48 -0
- package/dist/chunks/messages-wdqp4610.mjs +48 -0
- package/dist/chunks/messages-zS1AXZ0y.mjs +48 -0
- package/dist/chunks/messages-zSzDzXej.mjs +48 -0
- package/dist/full.mjs +50 -0
- package/dist/locales.mjs +228 -0
- package/dist/messages-0tDXLuyH.mjs +48 -0
- package/dist/messages-2_xedlYw.mjs +48 -0
- package/dist/messages-AHESHJm_.mjs +48 -0
- package/dist/messages-B5hdXZwA.mjs +48 -0
- package/dist/messages-B5jGUnOy.mjs +48 -0
- package/dist/messages-B5puUm7R.mjs +48 -0
- package/dist/messages-B66ZSDCJ.mjs +48 -0
- package/dist/messages-B9Oba7sq.mjs +48 -0
- package/dist/messages-BA0rcTCY.mjs +48 -0
- package/dist/messages-BBJgd5jG.mjs +48 -0
- package/dist/messages-BPqWKx5Z.mjs +48 -0
- package/dist/messages-Bdv-IkfG.mjs +48 -0
- package/dist/messages-BeUhMpsr.mjs +48 -0
- package/dist/messages-Bf6Y3_GI.mjs +48 -0
- package/dist/messages-BiExzWJv.mjs +48 -0
- package/dist/messages-BlpqL8vG.mjs +48 -0
- package/dist/messages-BmKCChWZ.mjs +48 -0
- package/dist/messages-Bn253WWC.mjs +48 -0
- package/dist/messages-BrJHUxQL.mjs +48 -0
- package/dist/messages-C5b7hr_E.mjs +48 -0
- package/dist/messages-C7I_AVH2.mjs +48 -0
- package/dist/messages-CJoBtXU6.mjs +48 -0
- package/dist/messages-CQj2JU2j.mjs +48 -0
- package/dist/messages-CUZ1x1QD.mjs +48 -0
- package/dist/messages-CUy1vn-b.mjs +48 -0
- package/dist/messages-CVeWVKsV.mjs +48 -0
- package/dist/messages-CXHd9SUK.mjs +48 -0
- package/dist/messages-CbMyJSzS.mjs +48 -0
- package/dist/messages-CbhuIWRJ.mjs +48 -0
- package/dist/messages-CeCjVKMW.mjs +48 -0
- package/dist/messages-Cj-t1bdy.mjs +48 -0
- package/dist/messages-CkFT2gle.mjs +48 -0
- package/dist/messages-Cm9aLHeX.mjs +48 -0
- package/dist/messages-CnvW8Slp.mjs +48 -0
- package/dist/messages-Cr-RJ7YB.mjs +48 -0
- package/dist/messages-CrsJ1TEJ.mjs +48 -0
- package/dist/messages-Cu08aLS3.mjs +48 -0
- package/dist/messages-CvaqJFN-.mjs +48 -0
- package/dist/messages-CyDU5lz9.mjs +48 -0
- package/dist/messages-CySyfkMU.mjs +48 -0
- package/dist/messages-Cyi2AMmz.mjs +48 -0
- package/dist/messages-D00OjS2n.mjs +48 -0
- package/dist/messages-DDLgIPDF.mjs +48 -0
- package/dist/messages-DMQIHGRj.mjs +48 -0
- package/dist/messages-DOlC_Tty.mjs +48 -0
- package/dist/messages-DV6shA9b.mjs +48 -0
- package/dist/messages-DY94ykcE.mjs +48 -0
- package/dist/messages-DbVquYKN.mjs +48 -0
- package/dist/messages-DcKOuncK.mjs +48 -0
- package/dist/messages-Dg92dXZ5.mjs +48 -0
- package/dist/messages-DnbbyJT3.mjs +48 -0
- package/dist/messages-DteYq0rv.mjs +48 -0
- package/dist/messages-GC2PhgV3.mjs +48 -0
- package/dist/messages-JGsXAReJ.mjs +48 -0
- package/dist/messages-JZUhXTuV.mjs +48 -0
- package/dist/messages-LvFKBBPa.mjs +48 -0
- package/dist/messages-NP1myMGI.mjs +48 -0
- package/dist/messages-Q4kc_ZtL.mjs +48 -0
- package/dist/messages-RvMHb2Ht.mjs +48 -0
- package/dist/messages-ftMcCEuO.mjs +48 -0
- package/dist/messages-o24dK6CU.mjs +48 -0
- package/dist/messages-pA5TvcAj.mjs +48 -0
- package/dist/messages-rRSHQDCX.mjs +48 -0
- package/dist/messages-srxrv8Yh.mjs +48 -0
- package/dist/messages-wdqp4610.mjs +48 -0
- package/dist/messages-zS1AXZ0y.mjs +48 -0
- package/dist/messages-zSzDzXej.mjs +48 -0
- package/dist/tools.mjs +3117 -0
- package/dist/vendor.LICENSE.txt +26 -225
- package/package.json +63 -24
- package/src/blok.ts +267 -0
- package/src/components/__module.ts +139 -0
- package/src/components/block/api.ts +155 -0
- package/src/components/block/index.ts +1428 -0
- package/src/components/block-tunes/block-tune-delete.ts +51 -0
- package/src/components/blocks.ts +352 -0
- package/src/components/constants/data-attributes.ts +344 -0
- package/src/components/constants.ts +76 -0
- package/src/components/core.ts +392 -0
- package/src/components/dom.ts +773 -0
- package/src/components/domIterator.ts +189 -0
- package/src/components/errors/critical.ts +5 -0
- package/src/components/events/BlockChanged.ts +16 -0
- package/src/components/events/BlockHovered.ts +21 -0
- package/src/components/events/BlockSettingsClosed.ts +12 -0
- package/src/components/events/BlockSettingsOpened.ts +12 -0
- package/src/components/events/BlokMobileLayoutToggled.ts +15 -0
- package/src/components/events/FakeCursorAboutToBeToggled.ts +17 -0
- package/src/components/events/FakeCursorHaveBeenSet.ts +17 -0
- package/src/components/events/HistoryStateChanged.ts +19 -0
- package/src/components/events/RedactorDomChanged.ts +14 -0
- package/src/components/events/index.ts +46 -0
- package/src/components/flipper.ts +497 -0
- package/src/components/i18n/i18next-loader.ts +84 -0
- package/src/components/i18n/lightweight-i18n.ts +86 -0
- package/src/components/i18n/locales/TRANSLATION_GUIDELINES.md +113 -0
- package/src/components/i18n/locales/am/messages.json +45 -0
- package/src/components/i18n/locales/ar/messages.json +45 -0
- package/src/components/i18n/locales/az/messages.json +45 -0
- package/src/components/i18n/locales/bg/messages.json +45 -0
- package/src/components/i18n/locales/bn/messages.json +45 -0
- package/src/components/i18n/locales/bs/messages.json +45 -0
- package/src/components/i18n/locales/cs/messages.json +45 -0
- package/src/components/i18n/locales/da/messages.json +45 -0
- package/src/components/i18n/locales/de/messages.json +45 -0
- package/src/components/i18n/locales/dv/messages.json +45 -0
- package/src/components/i18n/locales/el/messages.json +45 -0
- package/src/components/i18n/locales/en/messages.json +45 -0
- package/src/components/i18n/locales/es/messages.json +45 -0
- package/src/components/i18n/locales/et/messages.json +45 -0
- package/src/components/i18n/locales/fa/messages.json +45 -0
- package/src/components/i18n/locales/fi/messages.json +45 -0
- package/src/components/i18n/locales/fil/messages.json +45 -0
- package/src/components/i18n/locales/fr/messages.json +45 -0
- package/src/components/i18n/locales/gu/messages.json +45 -0
- package/src/components/i18n/locales/he/messages.json +45 -0
- package/src/components/i18n/locales/hi/messages.json +45 -0
- package/src/components/i18n/locales/hr/messages.json +45 -0
- package/src/components/i18n/locales/hu/messages.json +45 -0
- package/src/components/i18n/locales/hy/messages.json +45 -0
- package/src/components/i18n/locales/id/messages.json +45 -0
- package/src/components/i18n/locales/index.ts +231 -0
- package/src/components/i18n/locales/it/messages.json +45 -0
- package/src/components/i18n/locales/ja/messages.json +45 -0
- package/src/components/i18n/locales/ka/messages.json +45 -0
- package/src/components/i18n/locales/km/messages.json +45 -0
- package/src/components/i18n/locales/kn/messages.json +45 -0
- package/src/components/i18n/locales/ko/messages.json +45 -0
- package/src/components/i18n/locales/ku/messages.json +45 -0
- package/src/components/i18n/locales/lo/messages.json +45 -0
- package/src/components/i18n/locales/lt/messages.json +45 -0
- package/src/components/i18n/locales/lv/messages.json +45 -0
- package/src/components/i18n/locales/mk/messages.json +45 -0
- package/src/components/i18n/locales/ml/messages.json +45 -0
- package/src/components/i18n/locales/mn/messages.json +45 -0
- package/src/components/i18n/locales/mr/messages.json +45 -0
- package/src/components/i18n/locales/ms/messages.json +45 -0
- package/src/components/i18n/locales/my/messages.json +45 -0
- package/src/components/i18n/locales/ne/messages.json +45 -0
- package/src/components/i18n/locales/nl/messages.json +45 -0
- package/src/components/i18n/locales/no/messages.json +45 -0
- package/src/components/i18n/locales/pa/messages.json +45 -0
- package/src/components/i18n/locales/pl/messages.json +45 -0
- package/src/components/i18n/locales/ps/messages.json +45 -0
- package/src/components/i18n/locales/pt/messages.json +45 -0
- package/src/components/i18n/locales/ro/messages.json +45 -0
- package/src/components/i18n/locales/ru/messages.json +45 -0
- package/src/components/i18n/locales/sd/messages.json +45 -0
- package/src/components/i18n/locales/si/messages.json +45 -0
- package/src/components/i18n/locales/sk/messages.json +45 -0
- package/src/components/i18n/locales/sl/messages.json +45 -0
- package/src/components/i18n/locales/sq/messages.json +45 -0
- package/src/components/i18n/locales/sr/messages.json +45 -0
- package/src/components/i18n/locales/sv/messages.json +45 -0
- package/src/components/i18n/locales/sw/messages.json +45 -0
- package/src/components/i18n/locales/ta/messages.json +45 -0
- package/src/components/i18n/locales/te/messages.json +45 -0
- package/src/components/i18n/locales/th/messages.json +45 -0
- package/src/components/i18n/locales/tr/messages.json +45 -0
- package/src/components/i18n/locales/ug/messages.json +45 -0
- package/src/components/i18n/locales/uk/messages.json +45 -0
- package/src/components/i18n/locales/ur/messages.json +45 -0
- package/src/components/i18n/locales/vi/messages.json +45 -0
- package/src/components/i18n/locales/yi/messages.json +45 -0
- package/src/components/i18n/locales/zh/messages.json +45 -0
- package/src/components/icons/index.ts +242 -0
- package/src/components/inline-tools/inline-tool-bold.ts +2213 -0
- package/src/components/inline-tools/inline-tool-convert.ts +141 -0
- package/src/components/inline-tools/inline-tool-italic.ts +500 -0
- package/src/components/inline-tools/inline-tool-link.ts +539 -0
- package/src/components/modules/api/blocks.ts +377 -0
- package/src/components/modules/api/caret.ts +125 -0
- package/src/components/modules/api/events.ts +51 -0
- package/src/components/modules/api/history.ts +73 -0
- package/src/components/modules/api/i18n.ts +35 -0
- package/src/components/modules/api/index.ts +39 -0
- package/src/components/modules/api/inlineToolbar.ts +33 -0
- package/src/components/modules/api/listeners.ts +56 -0
- package/src/components/modules/api/notifier.ts +46 -0
- package/src/components/modules/api/readonly.ts +39 -0
- package/src/components/modules/api/sanitizer.ts +30 -0
- package/src/components/modules/api/saver.ts +52 -0
- package/src/components/modules/api/selection.ts +48 -0
- package/src/components/modules/api/styles.ts +72 -0
- package/src/components/modules/api/toolbar.ts +79 -0
- package/src/components/modules/api/tools.ts +16 -0
- package/src/components/modules/api/tooltip.ts +67 -0
- package/src/components/modules/api/ui.ts +36 -0
- package/src/components/modules/blockEvents.ts +1591 -0
- package/src/components/modules/blockManager.ts +1356 -0
- package/src/components/modules/blockSelection.ts +708 -0
- package/src/components/modules/caret.ts +853 -0
- package/src/components/modules/crossBlockSelection.ts +329 -0
- package/src/components/modules/dragManager.ts +1204 -0
- package/src/components/modules/history.ts +1098 -0
- package/src/components/modules/i18n.ts +332 -0
- package/src/components/modules/index.ts +139 -0
- package/src/components/modules/modificationsObserver.ts +147 -0
- package/src/components/modules/paste.ts +1092 -0
- package/src/components/modules/readonly.ts +136 -0
- package/src/components/modules/rectangleSelection.ts +711 -0
- package/src/components/modules/renderer.ts +155 -0
- package/src/components/modules/saver.ts +283 -0
- package/src/components/modules/toolbar/blockSettings.ts +781 -0
- package/src/components/modules/toolbar/index.ts +1315 -0
- package/src/components/modules/toolbar/inline.ts +956 -0
- package/src/components/modules/tools.ts +625 -0
- package/src/components/modules/ui.ts +1283 -0
- package/src/components/polyfills.ts +113 -0
- package/src/components/selection.ts +1179 -0
- package/src/components/tools/base.ts +301 -0
- package/src/components/tools/block.ts +339 -0
- package/src/components/tools/collection.ts +67 -0
- package/src/components/tools/factory.ts +138 -0
- package/src/components/tools/inline.ts +71 -0
- package/src/components/tools/tune.ts +33 -0
- package/src/components/ui/toolbox.ts +601 -0
- package/src/components/utils/announcer.ts +205 -0
- package/src/components/utils/api.ts +20 -0
- package/src/components/utils/bem.ts +26 -0
- package/src/components/utils/blocks.ts +284 -0
- package/src/components/utils/caret.ts +1067 -0
- package/src/components/utils/data-model-transform.ts +382 -0
- package/src/components/utils/events.ts +117 -0
- package/src/components/utils/keyboard.ts +60 -0
- package/src/components/utils/listeners.ts +296 -0
- package/src/components/utils/mutations.ts +39 -0
- package/src/components/utils/notifier/draw.ts +190 -0
- package/src/components/utils/notifier/index.ts +66 -0
- package/src/components/utils/notifier/types.ts +1 -0
- package/src/components/utils/notifier.ts +77 -0
- package/src/components/utils/placeholder.ts +140 -0
- package/src/components/utils/popover/components/hint/hint.const.ts +10 -0
- package/src/components/utils/popover/components/hint/hint.ts +46 -0
- package/src/components/utils/popover/components/hint/index.ts +6 -0
- package/src/components/utils/popover/components/popover-header/index.ts +2 -0
- package/src/components/utils/popover/components/popover-header/popover-header.const.ts +8 -0
- package/src/components/utils/popover/components/popover-header/popover-header.ts +80 -0
- package/src/components/utils/popover/components/popover-header/popover-header.types.ts +14 -0
- package/src/components/utils/popover/components/popover-item/index.ts +13 -0
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +50 -0
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +680 -0
- package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.const.ts +14 -0
- package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.ts +136 -0
- package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.const.ts +20 -0
- package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.ts +117 -0
- package/src/components/utils/popover/components/popover-item/popover-item.ts +186 -0
- package/src/components/utils/popover/components/search-input/index.ts +2 -0
- package/src/components/utils/popover/components/search-input/search-input.const.ts +8 -0
- package/src/components/utils/popover/components/search-input/search-input.ts +178 -0
- package/src/components/utils/popover/components/search-input/search-input.types.ts +59 -0
- package/src/components/utils/popover/index.ts +13 -0
- package/src/components/utils/popover/popover-abstract.ts +457 -0
- package/src/components/utils/popover/popover-desktop.ts +676 -0
- package/src/components/utils/popover/popover-inline.ts +338 -0
- package/src/components/utils/popover/popover-mobile.ts +201 -0
- package/src/components/utils/popover/popover.const.ts +81 -0
- package/src/components/utils/popover/utils/popover-states-history.ts +72 -0
- package/src/components/utils/promise-queue.ts +43 -0
- package/src/components/utils/sanitizer.ts +537 -0
- package/src/components/utils/scroll-locker.ts +87 -0
- package/src/components/utils/shortcut.ts +231 -0
- package/src/components/utils/shortcuts.ts +113 -0
- package/src/components/utils/tools.ts +110 -0
- package/src/components/utils/tooltip.ts +591 -0
- package/src/components/utils/tw.ts +241 -0
- package/src/components/utils.ts +1081 -0
- package/src/env.d.ts +13 -0
- package/src/full.ts +69 -0
- package/src/locales.ts +51 -0
- package/src/stories/Block.stories.ts +498 -0
- package/src/stories/EditorModes.stories.ts +505 -0
- package/src/stories/Header.stories.ts +137 -0
- package/src/stories/InlineToolbar.stories.ts +498 -0
- package/src/stories/List.stories.ts +259 -0
- package/src/stories/Notifier.stories.ts +340 -0
- package/src/stories/Paragraph.stories.ts +112 -0
- package/src/stories/Placeholder.stories.ts +319 -0
- package/src/stories/Popover.stories.ts +844 -0
- package/src/stories/Selection.stories.ts +250 -0
- package/src/stories/StubBlock.stories.ts +156 -0
- package/src/stories/Toolbar.stories.ts +223 -0
- package/src/stories/Toolbox.stories.ts +166 -0
- package/src/stories/Tooltip.stories.ts +198 -0
- package/src/stories/helpers.ts +463 -0
- package/src/styles/main.css +123 -0
- package/src/tools/header/index.ts +646 -0
- package/src/tools/index.ts +45 -0
- package/src/tools/list/index.ts +1819 -0
- package/src/tools/paragraph/index.ts +412 -0
- package/src/tools/stub/index.ts +107 -0
- package/src/types-internal/blok-modules.d.ts +87 -0
- package/src/types-internal/html-janitor.d.ts +28 -0
- package/src/types-internal/module-config.d.ts +11 -0
- package/src/variants/all-locales.ts +155 -0
- package/src/variants/blok-maximum.ts +20 -0
- package/src/variants/blok-minimum.ts +243 -0
- package/types/api/blocks.d.ts +9 -1
- package/types/api/history.d.ts +7 -0
- package/types/api/i18n.d.ts +22 -3
- package/types/api/selection.d.ts +6 -0
- package/types/api/styles.d.ts +23 -10
- package/types/configs/blok-config.d.ts +29 -0
- package/types/configs/i18n-config.d.ts +52 -2
- package/types/configs/i18n-dictionary.d.ts +16 -90
- package/types/data-attributes.d.ts +170 -0
- package/types/data-formats/output-data.d.ts +15 -0
- package/types/full.d.ts +80 -0
- package/types/index.d.ts +30 -13
- package/types/locales.d.ts +59 -0
- package/types/tools/adapters/inline-tool-adapter.d.ts +10 -0
- package/types/tools/block-tool.d.ts +9 -0
- package/types/tools/header.d.ts +18 -0
- package/types/tools/index.d.ts +1 -0
- package/types/tools/list.d.ts +91 -0
- package/types/tools/paragraph.d.ts +71 -0
- package/types/tools/tool-settings.d.ts +92 -6
- package/types/tools/tool.d.ts +6 -0
- package/types/tools-entry.d.ts +49 -0
- package/types/utils/popover/popover-item.d.ts +18 -5
- package/types/utils/popover/popover.d.ts +7 -0
- package/dist/blok-D_baBvTG.mjs +0 -25795
- package/dist/blok.umd.js +0 -181
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paragraph Tool for the Blok Editor
|
|
3
|
+
* Provides Text Block
|
|
4
|
+
*
|
|
5
|
+
* Based on @editorjs/paragraph by CodeX
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
import { IconText } from '../../components/icons';
|
|
9
|
+
import { twMerge } from '../../components/utils/tw';
|
|
10
|
+
import { DATA_ATTR } from '../../components/constants';
|
|
11
|
+
import { PLACEHOLDER_FOCUS_ONLY_CLASSES, setupPlaceholder } from '../../components/utils/placeholder';
|
|
12
|
+
import { stripFakeBackgroundElements } from '../../components/utils';
|
|
13
|
+
import type {
|
|
14
|
+
API,
|
|
15
|
+
BlockTool,
|
|
16
|
+
BlockToolConstructorOptions,
|
|
17
|
+
BlockToolData,
|
|
18
|
+
PasteEvent,
|
|
19
|
+
ToolboxConfig,
|
|
20
|
+
ConversionConfig,
|
|
21
|
+
SanitizerConfig,
|
|
22
|
+
PasteConfig,
|
|
23
|
+
} from '../../../types';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Tool's input and output data format
|
|
27
|
+
*/
|
|
28
|
+
export interface ParagraphData extends BlockToolData {
|
|
29
|
+
/** Paragraph's content. Can include HTML tags: <a><b><i> */
|
|
30
|
+
text: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Style overrides for paragraph customization
|
|
35
|
+
*/
|
|
36
|
+
export interface ParagraphStyleConfig {
|
|
37
|
+
/** Custom font size (e.g., '16px', '1rem') */
|
|
38
|
+
size?: string;
|
|
39
|
+
/** Custom line height (e.g., '1.6', '24px') */
|
|
40
|
+
lineHeight?: string;
|
|
41
|
+
/** Custom margin top (e.g., '10px', '0.5rem') */
|
|
42
|
+
marginTop?: string;
|
|
43
|
+
/** Custom margin bottom (e.g., '10px', '0.5rem') */
|
|
44
|
+
marginBottom?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Tool's config from Editor
|
|
49
|
+
*
|
|
50
|
+
* To customize the toolbox icon, use the `toolbox` property in the tool settings:
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* tools: {
|
|
54
|
+
* paragraph: {
|
|
55
|
+
* toolbox: {
|
|
56
|
+
* icon: '<svg>...</svg>',
|
|
57
|
+
* title: 'Custom Text'
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export interface ParagraphConfig {
|
|
64
|
+
/** Placeholder for the empty paragraph */
|
|
65
|
+
placeholder?: string;
|
|
66
|
+
/** Whether or not to keep blank paragraphs when saving editor data */
|
|
67
|
+
preserveBlank?: boolean;
|
|
68
|
+
/** Style overrides for paragraph customization */
|
|
69
|
+
styles?: ParagraphStyleConfig;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Helper function to parse HTML string into DocumentFragment
|
|
74
|
+
*
|
|
75
|
+
* @param html - HTML string to parse
|
|
76
|
+
* @returns DocumentFragment with parsed nodes
|
|
77
|
+
*/
|
|
78
|
+
const parseHtml = (html: string): DocumentFragment => {
|
|
79
|
+
const wrapper = document.createElement('div');
|
|
80
|
+
|
|
81
|
+
wrapper.innerHTML = html.trim();
|
|
82
|
+
|
|
83
|
+
const fragment = document.createDocumentFragment();
|
|
84
|
+
|
|
85
|
+
fragment.append(...Array.from(wrapper.childNodes));
|
|
86
|
+
|
|
87
|
+
return fragment;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Paragraph block for the Blok Editor.
|
|
92
|
+
* Represents a regular text block
|
|
93
|
+
*
|
|
94
|
+
* @author CodeX (team@codex.so)
|
|
95
|
+
* @copyright CodeX 2018
|
|
96
|
+
* @license MIT
|
|
97
|
+
*/
|
|
98
|
+
export class Paragraph implements BlockTool {
|
|
99
|
+
/**
|
|
100
|
+
* Default placeholder for Paragraph Tool
|
|
101
|
+
*
|
|
102
|
+
* @returns translation key for the default placeholder
|
|
103
|
+
*/
|
|
104
|
+
public static get DEFAULT_PLACEHOLDER(): string {
|
|
105
|
+
return 'tools.paragraph.placeholder';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Editor API
|
|
110
|
+
*/
|
|
111
|
+
private api: API;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Read-only mode flag
|
|
115
|
+
*/
|
|
116
|
+
private readOnly: boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Placeholder for Paragraph Tool
|
|
120
|
+
*/
|
|
121
|
+
private _placeholder: string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Paragraph's data
|
|
125
|
+
*/
|
|
126
|
+
private _data: ParagraphData;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Paragraph's main Element
|
|
130
|
+
*/
|
|
131
|
+
private _element: HTMLDivElement | null;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Whether or not to keep blank paragraphs when saving editor data
|
|
135
|
+
*/
|
|
136
|
+
private _preserveBlank: boolean;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Style configuration for paragraph customization
|
|
140
|
+
*/
|
|
141
|
+
private _styles: ParagraphStyleConfig;
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Render plugin's main Element and fill it with saved data
|
|
147
|
+
*
|
|
148
|
+
* @param options - constructor options
|
|
149
|
+
* @param options.data - previously saved data
|
|
150
|
+
* @param options.config - user config for Tool
|
|
151
|
+
* @param options.api - editor.js api
|
|
152
|
+
* @param options.readOnly - read only mode flag
|
|
153
|
+
*/
|
|
154
|
+
constructor({ data, config, api, readOnly }: BlockToolConstructorOptions<ParagraphData, ParagraphConfig>) {
|
|
155
|
+
this.api = api;
|
|
156
|
+
this.readOnly = readOnly;
|
|
157
|
+
|
|
158
|
+
if (!this.readOnly) {
|
|
159
|
+
this.onKeyUp = this.onKeyUp.bind(this);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
this._placeholder = config?.placeholder ?? Paragraph.DEFAULT_PLACEHOLDER;
|
|
163
|
+
this._data = data ?? { text: '' };
|
|
164
|
+
this._element = null;
|
|
165
|
+
this._preserveBlank = config?.preserveBlank ?? false;
|
|
166
|
+
this._styles = config?.styles ?? {};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Check if text content is empty and set empty string to inner html.
|
|
171
|
+
* We need this because some browsers (e.g. Safari) insert <br> into empty contenteditable elements
|
|
172
|
+
*
|
|
173
|
+
* @param e - key up event
|
|
174
|
+
*/
|
|
175
|
+
public onKeyUp(e: KeyboardEvent): void {
|
|
176
|
+
if (e.code !== 'Backspace' && e.code !== 'Delete') {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (!this._element) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const { textContent } = this._element;
|
|
185
|
+
|
|
186
|
+
if (textContent === '') {
|
|
187
|
+
this._element.innerHTML = '';
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Create Tool's view
|
|
193
|
+
*
|
|
194
|
+
* @returns HTMLDivElement
|
|
195
|
+
*/
|
|
196
|
+
/**
|
|
197
|
+
* Paragraph wrapper styling classes using Tailwind.
|
|
198
|
+
*/
|
|
199
|
+
private static readonly WRAPPER_CLASSES = [
|
|
200
|
+
'leading-[1.6em]',
|
|
201
|
+
'outline-none',
|
|
202
|
+
'mt-[2px]',
|
|
203
|
+
'mb-px',
|
|
204
|
+
'[&>p:first-of-type]:mt-0',
|
|
205
|
+
'[&>p:last-of-type]:mb-0',
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Build inline styles from style configuration
|
|
212
|
+
*
|
|
213
|
+
* @returns Partial CSSStyleDeclaration with custom styles
|
|
214
|
+
*/
|
|
215
|
+
private buildInlineStyles(): Partial<CSSStyleDeclaration> {
|
|
216
|
+
const inlineStyles: Partial<CSSStyleDeclaration> = {};
|
|
217
|
+
|
|
218
|
+
if (this._styles.size) {
|
|
219
|
+
inlineStyles.fontSize = this._styles.size;
|
|
220
|
+
}
|
|
221
|
+
if (this._styles.lineHeight) {
|
|
222
|
+
inlineStyles.lineHeight = this._styles.lineHeight;
|
|
223
|
+
}
|
|
224
|
+
if (this._styles.marginTop) {
|
|
225
|
+
inlineStyles.marginTop = this._styles.marginTop;
|
|
226
|
+
}
|
|
227
|
+
if (this._styles.marginBottom) {
|
|
228
|
+
inlineStyles.marginBottom = this._styles.marginBottom;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return inlineStyles;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private drawView(): HTMLDivElement {
|
|
235
|
+
const div = document.createElement('DIV') as HTMLDivElement;
|
|
236
|
+
|
|
237
|
+
div.className = twMerge(
|
|
238
|
+
this.api.styles.block,
|
|
239
|
+
Paragraph.WRAPPER_CLASSES,
|
|
240
|
+
PLACEHOLDER_FOCUS_ONLY_CLASSES
|
|
241
|
+
);
|
|
242
|
+
div.setAttribute(DATA_ATTR.tool, 'paragraph');
|
|
243
|
+
div.contentEditable = 'false';
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Apply inline styles for custom overrides (dynamic values from config)
|
|
247
|
+
*/
|
|
248
|
+
const inlineStyles = this.buildInlineStyles();
|
|
249
|
+
|
|
250
|
+
if (Object.keys(inlineStyles).length > 0) {
|
|
251
|
+
Object.assign(div.style, inlineStyles);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (this._data.text) {
|
|
255
|
+
div.innerHTML = this._data.text;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (!this.readOnly) {
|
|
259
|
+
div.contentEditable = 'true';
|
|
260
|
+
div.addEventListener('keyup', this.onKeyUp);
|
|
261
|
+
setupPlaceholder(div, this.api.i18n.t(this._placeholder), 'data-blok-placeholder-active');
|
|
262
|
+
} else {
|
|
263
|
+
div.setAttribute('data-blok-placeholder-active', this.api.i18n.t(this._placeholder));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return div;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Return Tool's view
|
|
271
|
+
*
|
|
272
|
+
* @returns HTMLDivElement
|
|
273
|
+
*/
|
|
274
|
+
public render(): HTMLDivElement {
|
|
275
|
+
this._element = this.drawView();
|
|
276
|
+
|
|
277
|
+
return this._element;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Method that specified how to merge two Text blocks.
|
|
282
|
+
* Called by Editor by backspace at the beginning of the Block
|
|
283
|
+
*
|
|
284
|
+
* @param data - saved data to merge with current block
|
|
285
|
+
*/
|
|
286
|
+
public merge(data: ParagraphData): void {
|
|
287
|
+
if (!this._element) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
this._data.text += data.text;
|
|
292
|
+
|
|
293
|
+
const fragment = parseHtml(data.text);
|
|
294
|
+
|
|
295
|
+
this._element.appendChild(fragment);
|
|
296
|
+
this._element.normalize();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Validate Paragraph block data:
|
|
301
|
+
* - check for emptiness
|
|
302
|
+
*
|
|
303
|
+
* @param savedData - data received after saving
|
|
304
|
+
* @returns false if saved data is not correct, otherwise true
|
|
305
|
+
*/
|
|
306
|
+
public validate(savedData: ParagraphData): boolean {
|
|
307
|
+
if (savedData.text.trim() === '' && !this._preserveBlank) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Extract Tool's data from the view
|
|
316
|
+
*
|
|
317
|
+
* @param toolsContent - Paragraph tools rendered view
|
|
318
|
+
* @returns saved data
|
|
319
|
+
*/
|
|
320
|
+
public save(toolsContent: HTMLDivElement): ParagraphData {
|
|
321
|
+
return {
|
|
322
|
+
text: stripFakeBackgroundElements(toolsContent.innerHTML),
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* On paste callback fired from Editor.
|
|
328
|
+
*
|
|
329
|
+
* @param event - event with pasted data
|
|
330
|
+
*/
|
|
331
|
+
public onPaste(event: PasteEvent): void {
|
|
332
|
+
const detail = event.detail;
|
|
333
|
+
|
|
334
|
+
if (!('data' in detail)) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const content = detail.data as HTMLElement;
|
|
339
|
+
|
|
340
|
+
const data: ParagraphData = {
|
|
341
|
+
text: content.innerHTML,
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
this._data = data;
|
|
345
|
+
|
|
346
|
+
window.requestAnimationFrame(() => {
|
|
347
|
+
if (this._element) {
|
|
348
|
+
this._element.innerHTML = this._data.text || '';
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Enable Conversion Toolbar. Paragraph can be converted to/from other tools
|
|
355
|
+
*
|
|
356
|
+
* @returns ConversionConfig
|
|
357
|
+
*/
|
|
358
|
+
public static get conversionConfig(): ConversionConfig {
|
|
359
|
+
return {
|
|
360
|
+
export: 'text', // to convert Paragraph to other block, use 'text' property of saved data
|
|
361
|
+
import: 'text', // to convert other block's exported string to Paragraph, fill 'text' property of tool data
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Sanitizer rules
|
|
367
|
+
*
|
|
368
|
+
* @returns SanitizerConfig
|
|
369
|
+
*/
|
|
370
|
+
public static get sanitize(): SanitizerConfig {
|
|
371
|
+
return {
|
|
372
|
+
text: {
|
|
373
|
+
br: true,
|
|
374
|
+
},
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Returns true to notify the core that read-only mode is supported
|
|
380
|
+
*
|
|
381
|
+
* @returns true
|
|
382
|
+
*/
|
|
383
|
+
public static get isReadOnlySupported(): boolean {
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Used by Editor paste handling API.
|
|
389
|
+
* Provides configuration to handle P tags.
|
|
390
|
+
*
|
|
391
|
+
* @returns PasteConfig
|
|
392
|
+
*/
|
|
393
|
+
public static get pasteConfig(): PasteConfig {
|
|
394
|
+
return {
|
|
395
|
+
tags: ['P'],
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Icon and title for displaying at the Toolbox
|
|
401
|
+
*
|
|
402
|
+
* @returns ToolboxConfig
|
|
403
|
+
*/
|
|
404
|
+
public static get toolbox(): ToolboxConfig {
|
|
405
|
+
return {
|
|
406
|
+
icon: IconText,
|
|
407
|
+
title: 'Text',
|
|
408
|
+
titleKey: 'text',
|
|
409
|
+
searchTerms: ['p', 'paragraph', 'plain'],
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Dom as $ } from '../../components/dom';
|
|
2
|
+
import type { API, BlockTool, BlockToolConstructorOptions, BlockToolData } from '../../../types';
|
|
3
|
+
import { IconWarning } from '../../components/icons';
|
|
4
|
+
import { DATA_ATTR } from '../../components/constants';
|
|
5
|
+
|
|
6
|
+
export interface StubData extends BlockToolData {
|
|
7
|
+
title: string;
|
|
8
|
+
savedData: BlockToolData;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This tool will be shown in place of a block without corresponding plugin
|
|
13
|
+
* It will store its data inside and pass it back with article saving
|
|
14
|
+
*/
|
|
15
|
+
export class Stub implements BlockTool {
|
|
16
|
+
/**
|
|
17
|
+
* Notify core that tool supports read-only mode
|
|
18
|
+
*/
|
|
19
|
+
public static isReadOnlySupported = true;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Main stub wrapper
|
|
23
|
+
*/
|
|
24
|
+
private readonly wrapper: HTMLElement;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Blok API
|
|
28
|
+
*/
|
|
29
|
+
private readonly api: API;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Stub title — tool name
|
|
33
|
+
*/
|
|
34
|
+
private readonly title: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Stub hint
|
|
38
|
+
*/
|
|
39
|
+
private readonly subtitle: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Original Tool data
|
|
43
|
+
*/
|
|
44
|
+
private readonly savedData: BlockToolData;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param options - constructor options
|
|
48
|
+
* @param options.data - stub tool data
|
|
49
|
+
* @param options.api - Blok API
|
|
50
|
+
*/
|
|
51
|
+
constructor({ data, api }: BlockToolConstructorOptions<StubData>) {
|
|
52
|
+
this.api = api;
|
|
53
|
+
this.title = data.title || this.api.i18n.t('tools.stub.error');
|
|
54
|
+
this.subtitle = this.api.i18n.t('tools.stub.blockCannotBeDisplayed');
|
|
55
|
+
this.savedData = data.savedData;
|
|
56
|
+
|
|
57
|
+
this.wrapper = this.make();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns stub holder
|
|
62
|
+
* @returns {HTMLElement}
|
|
63
|
+
*/
|
|
64
|
+
public render(): HTMLElement {
|
|
65
|
+
return this.wrapper;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Return original Tool data
|
|
70
|
+
* @returns {BlockToolData}
|
|
71
|
+
*/
|
|
72
|
+
public save(): BlockToolData {
|
|
73
|
+
return this.savedData;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Create Tool html markup
|
|
78
|
+
* @returns {HTMLElement}
|
|
79
|
+
*/
|
|
80
|
+
private make(): HTMLElement {
|
|
81
|
+
const wrapper = $.make('div', 'flex items-center py-3 px-[18px] my-2.5 rounded-[10px] bg-bg-light border border-line-gray text-gray-text text-sm [&_svg]:size-icon');
|
|
82
|
+
const icon = IconWarning;
|
|
83
|
+
const infoContainer = $.make('div', 'ml-3.5');
|
|
84
|
+
const title = $.make('div', 'font-medium capitalize', {
|
|
85
|
+
textContent: this.title,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const subtitle = $.make('div', '', {
|
|
89
|
+
textContent: this.subtitle,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
wrapper.setAttribute(DATA_ATTR.tool, 'stub');
|
|
93
|
+
wrapper.setAttribute(DATA_ATTR.stub, '');
|
|
94
|
+
infoContainer.setAttribute(DATA_ATTR.stubInfo, '');
|
|
95
|
+
title.setAttribute(DATA_ATTR.stubTitle, '');
|
|
96
|
+
subtitle.setAttribute(DATA_ATTR.stubSubtitle, '');
|
|
97
|
+
|
|
98
|
+
wrapper.innerHTML = icon;
|
|
99
|
+
|
|
100
|
+
infoContainer.appendChild(title);
|
|
101
|
+
infoContainer.appendChild(subtitle);
|
|
102
|
+
|
|
103
|
+
wrapper.appendChild(infoContainer);
|
|
104
|
+
|
|
105
|
+
return wrapper;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** ./api */
|
|
2
|
+
import { BlocksAPI } from '../components/modules/api/blocks';
|
|
3
|
+
import { CaretAPI } from '../components/modules/api/caret';
|
|
4
|
+
import { EventsAPI } from '../components/modules/api/events';
|
|
5
|
+
import { I18nAPI } from '../components/modules/api/i18n';
|
|
6
|
+
import { API } from '../components/modules/api/index';
|
|
7
|
+
import { InlineToolbarAPI } from '../components/modules/api/inlineToolbar';
|
|
8
|
+
import { ListenersAPI } from '../components/modules/api/listeners';
|
|
9
|
+
import { NotifierAPI } from '../components/modules/api/notifier';
|
|
10
|
+
import { ReadOnlyAPI } from '../components/modules/api/readonly';
|
|
11
|
+
import { SanitizerAPI } from '../components/modules/api/sanitizer';
|
|
12
|
+
import { SaverAPI } from '../components/modules/api/saver';
|
|
13
|
+
import { SelectionAPI } from '../components/modules/api/selection';
|
|
14
|
+
import { StylesAPI } from '../components/modules/api/styles';
|
|
15
|
+
import { ToolbarAPI } from '../components/modules/api/toolbar';
|
|
16
|
+
import { TooltipAPI } from '../components/modules/api/tooltip';
|
|
17
|
+
import { UiAPI } from '../components/modules/api/ui';
|
|
18
|
+
import { HistoryAPI } from '../components/modules/api/history';
|
|
19
|
+
|
|
20
|
+
/** ./toolbar */
|
|
21
|
+
import { BlockSettings } from '../components/modules/toolbar/blockSettings';
|
|
22
|
+
import { Toolbar } from '../components/modules/toolbar/index';
|
|
23
|
+
import { InlineToolbar } from '../components/modules/toolbar/inline';
|
|
24
|
+
|
|
25
|
+
/** . */
|
|
26
|
+
import { BlockEvents } from '../components/modules/blockEvents';
|
|
27
|
+
import { BlockManager } from '../components/modules/blockManager';
|
|
28
|
+
import { BlockSelection } from '../components/modules/blockSelection';
|
|
29
|
+
import { Caret } from '../components/modules/caret';
|
|
30
|
+
import { CrossBlockSelection } from '../components/modules/crossBlockSelection';
|
|
31
|
+
import { DragManager } from '../components/modules/dragManager';
|
|
32
|
+
import { ModificationsObserver } from '../components/modules/modificationsObserver';
|
|
33
|
+
import { Paste } from '../components/modules/paste';
|
|
34
|
+
import { ReadOnly } from '../components/modules/readonly';
|
|
35
|
+
import { RectangleSelection } from '../components/modules/rectangleSelection';
|
|
36
|
+
import { Renderer } from '../components/modules/renderer';
|
|
37
|
+
import { Saver } from '../components/modules/saver';
|
|
38
|
+
import { Tools } from '../components/modules/tools';
|
|
39
|
+
import { UI } from '../components/modules/ui';
|
|
40
|
+
import { ToolsAPI } from '../components/modules/api/tools';
|
|
41
|
+
import { History } from '../components/modules/history';
|
|
42
|
+
import { I18n } from '../components/modules/i18n';
|
|
43
|
+
|
|
44
|
+
export interface BlokModules {
|
|
45
|
+
// API Modules
|
|
46
|
+
BlocksAPI: BlocksAPI,
|
|
47
|
+
CaretAPI: CaretAPI,
|
|
48
|
+
ToolsAPI: ToolsAPI,
|
|
49
|
+
EventsAPI: EventsAPI,
|
|
50
|
+
I18nAPI: I18nAPI,
|
|
51
|
+
API: API,
|
|
52
|
+
InlineToolbarAPI: InlineToolbarAPI,
|
|
53
|
+
ListenersAPI: ListenersAPI,
|
|
54
|
+
NotifierAPI: NotifierAPI,
|
|
55
|
+
ReadOnlyAPI: ReadOnlyAPI,
|
|
56
|
+
SanitizerAPI: SanitizerAPI,
|
|
57
|
+
SaverAPI: SaverAPI,
|
|
58
|
+
SelectionAPI: SelectionAPI,
|
|
59
|
+
StylesAPI: StylesAPI,
|
|
60
|
+
ToolbarAPI: ToolbarAPI,
|
|
61
|
+
TooltipAPI: TooltipAPI,
|
|
62
|
+
UiAPI: UiAPI,
|
|
63
|
+
HistoryAPI: HistoryAPI,
|
|
64
|
+
|
|
65
|
+
// Toolbar Modules
|
|
66
|
+
BlockSettings: BlockSettings,
|
|
67
|
+
Toolbar: Toolbar,
|
|
68
|
+
InlineToolbar: InlineToolbar,
|
|
69
|
+
|
|
70
|
+
// Modules
|
|
71
|
+
I18n: I18n,
|
|
72
|
+
BlockEvents: BlockEvents,
|
|
73
|
+
BlockManager: BlockManager,
|
|
74
|
+
BlockSelection: BlockSelection,
|
|
75
|
+
Caret: Caret,
|
|
76
|
+
CrossBlockSelection: CrossBlockSelection,
|
|
77
|
+
DragManager: DragManager,
|
|
78
|
+
ModificationsObserver: ModificationsObserver,
|
|
79
|
+
Paste: Paste,
|
|
80
|
+
ReadOnly: ReadOnly,
|
|
81
|
+
RectangleSelection: RectangleSelection,
|
|
82
|
+
Renderer: Renderer,
|
|
83
|
+
Saver: Saver,
|
|
84
|
+
Tools: Tools,
|
|
85
|
+
UI: UI,
|
|
86
|
+
History: History,
|
|
87
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declaration for external JS module
|
|
3
|
+
* After that we can use it at the TS modules
|
|
4
|
+
*/
|
|
5
|
+
declare module 'html-janitor' {
|
|
6
|
+
/**
|
|
7
|
+
* Sanitizer config of each HTML element
|
|
8
|
+
* @see {@link https://github.com/guardian/html-janitor#options}
|
|
9
|
+
*/
|
|
10
|
+
type TagConfig = boolean | { [attr: string]: boolean | string };
|
|
11
|
+
|
|
12
|
+
interface Config {
|
|
13
|
+
tags: {
|
|
14
|
+
[key: string]: TagConfig | ((el: Element) => TagConfig)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class HTMLJanitor {
|
|
19
|
+
constructor(config: Config);
|
|
20
|
+
|
|
21
|
+
public clean(taintString: string): string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Default export
|
|
26
|
+
*/
|
|
27
|
+
export default HTMLJanitor;
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlokConfig } from '../../types/index';
|
|
2
|
+
import { BlokEventMap } from '../components/events';
|
|
3
|
+
import { EventsDispatcher } from '../components/utils/events';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Describes object passed to Blok modules constructor
|
|
7
|
+
*/
|
|
8
|
+
export interface ModuleConfig {
|
|
9
|
+
config: BlokConfig;
|
|
10
|
+
eventsDispatcher: EventsDispatcher<BlokEventMap>;
|
|
11
|
+
}
|