@ncino/web-components 5.0.0-preview.2 → 5.0.0-preview.4
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/dist/_virtual/_commonjsHelpers.js +1 -1
- package/dist/_virtual/index_html.js +1 -1
- package/dist/_virtual/index_react.js +1 -1
- package/dist/_virtual/preload-helper.js +1 -1
- package/dist/assets/node_modules/.pnpm/ckeditor5@45.2.1/node_modules/ckeditor5/dist/ckeditor5.css +1 -1
- package/dist/components/accordion/gator/base/accordion.gator.js +6 -6
- package/dist/components/accordion/gator/group/accordion-group.gator.js +2 -2
- package/dist/components/alert/gator/base/alert.gator.js +2 -2
- package/dist/components/alert/gator/subtitle/alert-subtitle.gator.js +2 -2
- package/dist/components/alert/gator/title/alert-title.gator.js +2 -2
- package/dist/components/avatar/gator/avatar.gator.js +2 -2
- package/dist/components/badge/gator/badge.gator.js +2 -2
- package/dist/components/banner/gator/banner.gator.js +2 -2
- package/dist/components/boolean/boolean.gator.js +6 -6
- package/dist/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.js +2 -2
- package/dist/components/button/gator/button.gator.js +4 -4
- package/dist/components/button-group/gator/button-group.gator.js +2 -2
- package/dist/components/card/gator/footer/card-footer.gator.js +2 -2
- package/dist/components/card/gator/header/card-header.gator.js +2 -2
- package/dist/components/checkbox/checkbox.gator.js +5 -5
- package/dist/components/checkbox-group/checkbox-group.gator.js +8 -8
- package/dist/components/combobox/base/combobox.js +1 -1
- package/dist/components/combobox/base/combobox.slds.js +13 -13
- package/dist/components/date-picker/base/gator/datepicker.gator.js +18 -18
- package/dist/components/date-picker/year-month-selector/year-month-selector.gator.js +2 -2
- package/dist/components/headline-card/gator/headline-card.gator.js +2 -2
- package/dist/components/icon/gator/icon.gator.js +2 -2
- package/dist/components/illustration/gator/illustration.gator.js +2 -2
- package/dist/components/input/base/input-base.gator.js +1 -1
- package/dist/components/input/gator/dropdown/input-dropdown.gator.js +11 -11
- package/dist/components/input/gator/input-currency/input-currency.gator.js +2 -2
- package/dist/components/input/gator/input-date/input-date.gator.js +15 -15
- package/dist/components/input/gator/input-file/input-file.gator.js +3 -3
- package/dist/components/input/gator/input-masked/input-masked.gator.js +1 -1
- package/dist/components/input/gator/input-phone/input-phone.gator.js +2 -2
- package/dist/components/input/gator/input-search/input-search.gator.js +2 -2
- package/dist/components/input/gator/input-text/input-text.gator.js +1 -1
- package/dist/components/input/gator/input-time/input-time.gator.js +2 -2
- package/dist/components/list/gator/list/list.gator.js +2 -2
- package/dist/components/list/gator/list-item/list-item.gator.js +6 -6
- package/dist/components/menu/base/gator/menu.gator.js +3 -3
- package/dist/components/menu/base/slds/menu.slds.js +2 -2
- package/dist/components/menu/menu-item/gator/menu-item.gator.js +2 -2
- package/dist/components/menu/menu-submenu/menu-submenu.js +1 -1
- package/dist/components/modal/gator/modal.gator.js +38 -39
- package/dist/components/page-header/gator/page-header.gator.js +2 -2
- package/dist/components/panel/gator/panel.gator.js +13 -13
- package/dist/components/panel/gator/panel.storybook-test.js +1 -1
- package/dist/components/pill/pill.slds.js +3 -3
- package/dist/components/popover/gator/popover.gator.js +10 -10
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/radio/radio.gator.js +2 -2
- package/dist/components/radio-group/radio-group.gator.js +2 -2
- package/dist/components/selection-box-group/selection-box-group.gator.js +5 -5
- package/dist/components/selector/gator/selector.gator.js +2 -2
- package/dist/components/switch/gator/switch.gator.js +2 -2
- package/dist/components/tabs/gator/tabset/tabset.gator.js +3 -3
- package/dist/components/text-detail/gator/text-detail.gator.js +17 -18
- package/dist/components/time-picker/gator/time-picker.gator.js +19 -19
- package/dist/components/toast/gator/base/toast.gator.js +8 -9
- package/dist/components/toast/gator/subtitle/toast-subtitle.gator.js +2 -2
- package/dist/components/toast/gator/title/toast-title.gator.js +2 -2
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/toast-container/gator/toast-container.gator.js +18 -0
- package/dist/components/toast-container/index.js +1 -0
- package/dist/components/toaster/gator/toaster.gator.js +5 -0
- package/dist/components/toaster/index.js +1 -0
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/index.gator.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.services.js +1 -0
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-autosave@45.2.1/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-basic-styles@45.2.1/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@45.2.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +10 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-cloud-services@45.2.1/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-code-block@45.2.1/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +5 -5
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-editor-classic@45.2.1/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +12 -12
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-find-and-replace@45.2.1/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-font@45.2.1/node_modules/@ckeditor/ckeditor5-font/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-heading@45.2.1/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@45.2.1/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@45.2.1/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +6 -6
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@45.2.1/node_modules/@ckeditor/ckeditor5-image/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@45.2.1/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@45.2.1/node_modules/@ckeditor/ckeditor5-link/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@45.2.1/node_modules/@ckeditor/ckeditor5-list/dist/index.js +5 -5
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-markdown-gfm@45.2.1/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-media-embed@45.2.1/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paragraph@45.2.1/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@45.2.1/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +9 -9
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@45.2.1/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@45.2.1/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-style@45.2.1/node_modules/@ckeditor/ckeditor5-style/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@45.2.1/node_modules/@ckeditor/ckeditor5-table/dist/index.js +6 -6
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +10 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-undo@45.2.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-upload@45.2.1/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +38 -38
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-watchdog@45.2.1/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@deltablot_dropzone@7.3.1/node_modules/@deltablot/dropzone/dist/dropzone.js +1 -1
- package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/main.js +1 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.4/node_modules/@figma/code-connect/dist/common/fetch.js +1 -0
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.4/node_modules/@figma/code-connect/dist/connect/figma_rest_api.js +1 -0
- package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/connect/helpers.js +1 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.4/node_modules/@figma/code-connect/package.json.js +1 -0
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -1
- package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js +2 -2
- package/dist/node_modules/.pnpm/@storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/core/dist/channels/index.js +9 -9
- package/dist/node_modules/.pnpm/@storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/core/dist/csf/index.js +1 -1
- package/dist/node_modules/.pnpm/@storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/core/dist/preview-api/index.js +22 -22
- package/dist/node_modules/.pnpm/@storybook_instrumenter@8.6.14_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/instrumenter/dist/index.js +36 -36
- package/dist/node_modules/.pnpm/@storybook_test@8.6.14_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/test/dist/index.js +111 -111
- package/dist/node_modules/.pnpm/@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.0.10_typescript@5.8.3__playwright@1.53.2_77c47ac19cbe97978028e1e5ac862536/node_modules/@vitest/browser/context.js +1 -0
- package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.js +8 -8
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +5 -5
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +11 -11
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/diff.js +21 -21
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.js +2 -2
- package/dist/node_modules/.pnpm/axe-core@4.10.3/node_modules/axe-core/axe.js +4 -4
- package/dist/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.js +3 -3
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/get.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/unset.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/debounce.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/object/cloneDeepWith.js +1 -1
- package/dist/node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/async-directive.js +1 -1
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directive-helpers.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/class-map.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/repeat.js +5 -0
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js +3 -3
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/cache.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/cachestorage.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cookies/parse.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/constants.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/headers.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/index.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/request.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/response.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/util.js +2 -2
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/webidl.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/connection.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/events.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/frame.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/receiver.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/util.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/websocket.js +1 -1
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.10_@vitest_browser@3.2.4_@vitest_ui@3_8c34ee540b1f52c214debce201d1e515/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +1 -1
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.10_@vitest_browser@3.2.4_@vitest_ui@3_8c34ee540b1f52c214debce201d1e515/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +8 -8
- package/dist/packages/web-components/src/components/button/gator/button.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/modal/gator/modal.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/switch/gator/switch.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/text-detail/gator/text-detail.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/toast/gator/base/toast.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/toast-container/gator/toast-container.gator.scss.js +1 -0
- package/dist/packages/web-components/src/components/toaster/gator/toaster.gator.scss.js +1 -0
- package/dist/packages/web-components/src/index.slds.scss.js +1 -1
- package/dist/services/toaster-service.js +1 -0
- package/dist/types/components/modal/gator/modal.gator.d.ts +1 -1
- package/dist/types/components/text-detail/gator/text-detail.gator.d.ts +4 -2
- package/dist/types/components/toast/toast.d.ts +14 -0
- package/dist/types/components/toast-container/gator/toast-container.gator.d.ts +15 -0
- package/dist/types/components/toast-container/gator/toast-container.gator.test.d.ts +0 -0
- package/dist/types/components/toast-container/index.d.ts +1 -0
- package/dist/types/components/toaster/gator/toaster.gator.d.ts +32 -0
- package/dist/types/components/toaster/gator/toaster.gator.test.d.ts +0 -0
- package/dist/types/components/toaster/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.gator.d.ts +2 -0
- package/dist/types/index.services.d.ts +1 -0
- package/dist/types/services/toaster-service.d.ts +117 -0
- package/dist/types/services/toaster-service.test.d.ts +1 -0
- package/dist/utils/accessibility-utils.js +1 -1
- package/dist/utils/datatestid-utils.js +1 -1
- package/dist/utils/lightdom-utils.js +1 -1
- package/dist/utils/vitest-a11y-utils.js +1 -1
- package/dist/utils/vitest-utils.js +1 -1
- package/package.json +15 -11
- package/web-types.json +182 -110
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/common/fetch.js +0 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/connect/figma_rest_api.js +0 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/package.json.js +0 -1
- package/dist/node_modules/.pnpm/@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.0.10_typescript@5.8.3__playwright@1.53.1_5fd2997ee9a97429a51e07bc2023c338/node_modules/@vitest/browser/context.js +0 -1
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/client/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/client/figma_client.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/common/logging.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/common/updates.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/connect/external_types.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/connect/index_common.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/html/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/html/index_html.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/html/template_literal.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/react/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/react/index_react.js +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import{Plugin as f}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{logWarning as X,global as V,uid as H,priorities as S,CKEditorError as Q,toArray as k,isValidAttributeName as Y}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{UpcastWriter as R,HtmlDataProcessor as J,Matcher as M,StylesMap as Z}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ee,toWidget as K}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{Enter as te}from"../../../../../@ckeditor_ckeditor5-enter@45.2.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{isEqual as N}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js";import{mergeWith as re}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mergeWith.js";import{startCase as ie}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/startCase.js";import{isPlainObject as oe}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js";import{cloneDeep as le}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/function p(s,r,
|
|
4
|
+
*/function p(s,e,r,t){e&&ne(s,e,t),r&&w(s,r,t)}function w(s,e,r){if(e.attributes)for(const[t,i]of Object.entries(e.attributes))s.setAttribute(t,i,r);e.styles&&s.setStyle(e.styles,r),e.classes&&s.addClass(e.classes,r)}function ne(s,e,r){if(e.attributes)for(const[t]of Object.entries(e.attributes))s.removeAttribute(t,r);if(e.styles)for(const t of Object.keys(e.styles))s.removeStyle(t,r);e.classes&&s.removeClass(e.classes,r)}function se(s,e){const r=le(s);let t="attributes";for(t in e)t=="classes"?r[t]=Array.from(new Set([...s[t]||[],...e[t]])):r[t]={...s[t],...e[t]};return r}function v(s,e,r,t,i){const o=e.getAttribute(r),l={};for(const n of["attributes","styles","classes"]){if(n!=t){o&&o[n]&&(l[n]=o[n]);continue}if(t=="classes"){const a=new Set(o&&o.classes||[]);i(a),a.size&&(l[n]=Array.from(a));continue}const m=new Map(Object.entries(o&&o[n]||{}));i(m),m.size&&(l[n]=Object.fromEntries(m))}Object.keys(l).length?e.is("documentSelection")?s.setSelectionAttribute(r,l):s.setAttribute(r,l,e):o&&(e.is("documentSelection")?s.removeSelectionAttribute(r):s.removeAttribute(r,e))}function me(s){return ie(s).replace(/ /g,"")}function b(s){return`html${me(s)}Attributes`}function x({model:s}){return(e,r)=>r.writer.createElement(s,{htmlContent:e.getCustomProperty("$rawContent")})}function ae(s,{view:e,isInline:r}){const t=s.t;return(i,{writer:o})=>{const l=t("HTML object"),n=T(e,i,o),m=i.getAttribute(b(e));o.addClass("html-object-embed__content",n),m&&w(o,m,n);const a=o.createContainerElement(r?"span":"div",{class:"html-object-embed","data-html-object-embed-label":l},n);return K(a,o,{label:l})}}function T(s,e,r){return r.createRawElement(s,null,(t,i)=>{i.setContentOf(t,e.getAttribute("htmlContent"))})}function ue({view:s,model:e,allowEmpty:r},t){return o=>{o.on(`element:${s}`,(l,n,m)=>{let a=t.processViewAttributes(n.viewItem,m);if(!(!a&&!m.consumable.test(n.viewItem,{name:!0}))){if(a=a||{},m.consumable.consume(n.viewItem,{name:!0}),n.modelRange||(n=Object.assign(n,m.convertChildren(n.viewItem,n.modelCursor))),r&&n.modelRange.isCollapsed&&Object.keys(a).length){const u=m.writer.createElement("htmlEmptyElement");if(!m.safeInsert(u,n.modelCursor))return;const c=m.getSplitParts(u);n.modelRange=m.writer.createRange(n.modelRange.start,m.writer.createPositionAfter(c[c.length-1])),m.updateConversionResult(u,n),i(u,a,m);return}for(const u of n.modelRange.getItems())i(u,a,m)}},{priority:"low"})};function i(o,l,n){if(n.schema.checkAttribute(o,e)){const m=o.getAttribute(e),a=se(l,m||{});n.writer.setAttribute(e,a,o)}}}function L({model:s,view:e},r){return(t,{writer:i,consumable:o})=>{if(!t.hasAttribute(s))return null;const l=i.createContainerElement(e),n=t.getAttribute(s);return o.consume(t,`attribute:${s}`),w(i,n,l),l.getFillerOffset=()=>null,r?K(l,i):l}}function ce({priority:s,view:e}){return(r,t)=>{if(!r)return;const{writer:i}=t,o=i.createAttributeElement(e,null,{priority:s});return w(i,r,o),o}}function E({view:s},e){return r=>{r.on(`element:${s}`,(t,i,o)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const l=e.processViewAttributes(i.viewItem,o);l&&o.writer.setAttribute(b(i.viewItem.name),l,i.modelRange)},{priority:"low"})}}function F({view:s,model:e}){return r=>{r.on(`attribute:${b(s)}:${e}`,(t,i,o)=>{if(!o.consumable.consume(i.item,t.name))return;const{attributeOldValue:l,attributeNewValue:n}=i,m=o.writer,a=o.mapper.toViewElement(i.item);p(m,l,n,a)})}}/**
|
|
5
5
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
6
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
7
|
-
*/var W={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlHr",view:"hr",isEmpty:!0,modelSchema:{inheritAllFrom:"$blockObject"}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref"},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}]};class S extends g{constructor(){super(...arguments);v(this,"_definitions",[])}static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(const e of W.block)this.registerBlockElement(e);for(const e of W.inline)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,t=!1){const i=new Set;for(const o of this._getMatchingViewDefinitions(e)){if(t)for(const l of this._getReferences(o.model))i.add(l);i.add(o)}return i}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&ge(e,t.view))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(o=>o.model==e);for(const{modelSchema:o}of i)if(o)for(const l of t)for(const n of F(o[l]||[])){const m=this._definitions.filter(a=>a.model==n);for(const a of m)n!==e&&(yield*this._getReferences(a.model),yield a)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,i])=>i.model==e.model);if(t.length==0){this._definitions.push(e);return}for(const[i,o]of t)this._definitions[i]=le({},o,e,(l,n)=>Array.isArray(l)?l.concat(n):void 0)}}function ge(s,r){return typeof s=="string"?s===r:s instanceof RegExp?s.test(r):!1}class h extends g{constructor(e){super(e);v(this,"_dataSchema");v(this,"_allowedAttributes");v(this,"_disallowedAttributes");v(this,"_allowedElements");v(this,"_disallowedElements");v(this,"_dataInitialized");v(this,"_coupledAttributes");this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new N,this._disallowedAttributes=new N,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get isOfficialPlugin(){return!0}static get requires(){return[S,ie]}loadAllowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,o=z(t);this.allowElement(i),o.forEach(l=>this.allowAttributes(l))}}loadDisallowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,o=z(t);o.length==0?this.disallowElement(i):o.forEach(l=>this.disallowAttributes(l))}}loadAllowedEmptyElementsConfig(e){for(const t of e)this.allowEmptyElement(t)}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))t.isInline&&this._dataSchema.extendInlineElement({...t,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){const{consumable:i}=t;return q(e,this._disallowedAttributes,i),be(e,q(e,this._allowedAttributes,i))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:k.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:k.highest+1})}_registerElementHandlers(){this.on("register",(e,t)=>{const i=this.editor.model.schema;if(t.isObject&&!i.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else if(t.isInline)this._registerInlineElement(t);else throw new Z("data-filter-invalid-definition",null,t);e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,t=e.document.selection;e.document.registerPostFixer(i=>{const o=e.document.differ.getChanges();let l=!1;const n=this._getCoupledAttributesMap();for(const m of o){if(m.type!="attribute"||m.attributeNewValue!==null)continue;const a=n.get(m.attributeKey);if(a)for(const{item:u}of m.range.getWalker())for(const c of a)u.hasAttribute(c)&&(i.removeAttribute(c,u),l=!0)}return l}),this.listenTo(t,"change:attribute",(i,{attributeKeys:o})=>{const l=new Set,n=this._getCoupledAttributesMap();for(const m of o){if(t.hasAttribute(m))continue;const a=n.get(m);if(a)for(const u of a)t.hasAttribute(u)&&l.add(u)}l.size!=0&&e.change(m=>{for(const a of l)m.removeSelectionAttribute(a)})})}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let o=!1;for(const l of i)if(!(l.type!=="insert"||l.name==="$text"))for(const n of l.attributes.keys())!n.startsWith("html")||!n.endsWith("Attributes")||e.schema.checkAttribute(l.name,n)||(t.removeAttribute(n,l.position.nodeAfter),o=!0);return o})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,i=t.model.schema,o=t.conversion,{view:l,model:n}=e;i.register(n,e.modelSchema);/* istanbul ignore next: paranoid check -- @preserve */l&&(i.extend(e.model,{allowAttributes:[b(l),"htmlContent"]}),t.data.registerRawContentMatcher({name:l}),o.for("upcast").elementToElement({view:l,model:V(e),converterPriority:k.low+2}),o.for("upcast").add(C(e,this)),o.for("editingDowncast").elementToStructure({model:{name:n,attributes:[b(l)]},view:de(t,e)}),o.for("dataDowncast").elementToElement({model:n,view:(m,{writer:a})=>$(l,m,a)}),o.for("dataDowncast").add(O(e)))}_registerBlockElement(e){const t=this.editor,i=t.model.schema,o=t.conversion,{view:l,model:n}=e;if(!i.isRegistered(e.model)){if(!e.modelSchema||(i.register(e.model,e.modelSchema),!l))return;o.for("upcast").elementToElement({model:n,view:l,converterPriority:k.low+2}),o.for("downcast").elementToElement({model:n,view:(m,{writer:a})=>e.isEmpty?a.createEmptyElement(l):a.createContainerElement(l)})}l&&(i.extend(e.model,{allowAttributes:b(l)}),o.for("upcast").add(C(e,this)),o.for("downcast").add(O(e)))}_registerInlineElement(e){const t=this.editor,i=t.model.schema,o=t.conversion,l=e.model;if(!e.appliesToBlock&&(i.extend("$text",{allowAttributes:l}),e.attributeProperties&&i.setAttributeProperties(l,e.attributeProperties),o.for("upcast").add(he(e,this)),o.for("downcast").attributeToElement({model:l,view:fe(e)}),!!e.allowEmpty)){if(i.setAttributeProperties(l,{copyFromObject:!1}),!i.isRegistered("htmlEmptyElement")){i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});const n=m=>Array.from(m.getAttributeKeys()).some(a=>a.startsWith("html"));t.model.document.registerPostFixer(m=>{const a=t.model.document.differ.getChanges(),u=new Set;for(const c of a)if(c.type!=="remove"){if(c.type==="attribute"&&c.attributeNewValue===null)for(const{item:d}of c.range)d.is("element","htmlEmptyElement")&&!n(d)&&u.add(d);if(c.type==="insert"&&c.position.nodeAfter){const d=c.position.nodeAfter;for(const{item:f}of m.createRangeOn(d))f.is("element","htmlEmptyElement")&&!n(f)&&u.add(f)}}for(const c of u)m.remove(c);return u.size>0})}t.data.htmlProcessor.domConverter.registerInlineObjectMatcher(n=>n.name==e.view&&n.isEmpty&&Array.from(n.getAttributeKeys()).length?{name:!0}:null),o.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:j(e,!0)}),o.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:j(e)})}}}function q(s,r,e){const t=r.matchAll(s)||[],i=s.document.stylesProcessor;return t.reduce((o,{match:l})=>{for(const[n,m]of l.attributes||[])if(n=="style"){const a=m,u=i.getRelatedStyles(a).filter(c=>c.split("-").length>a.split("-").length).sort((c,d)=>d.split("-").length-c.split("-").length);for(const c of u)e.consume(s,{styles:[c]})&&o.styles.push(c);e.consume(s,{styles:[a]})&&o.styles.push(a)}else if(n=="class"){const a=m;e.consume(s,{classes:[a]})&&o.classes.push(a)}else e.consume(s,{attributes:[n]})&&o.attributes.push(n);return o},{attributes:[],classes:[],styles:[]})}function be(s,{attributes:r,classes:e,styles:t}){return!r.length&&!e.length&&!t.length?null:{...r.length&&{attributes:pe(s,r)},...t.length&&{styles:we(s,t)},...e.length&&{classes:e}}}function pe(s,r){const e={};for(const t of r){const i=s.getAttribute(t);i!==void 0&&ee(t)&&(e[t]=i)}return e}function we(s,r){const e=new re(s.document.stylesProcessor);for(const t of r){const i=s.getStyle(t);i!==void 0&&e.set(t,i)}return Object.fromEntries(e.getStylesEntries())}function B(s,r){const{name:e}=s,t=s[r];return se(t)?Object.entries(t).map(([i,o])=>({name:e,[r]:{[i]:o}})):Array.isArray(t)?t.map(i=>({name:e,[r]:[i]})):[s]}function z(s){const{name:r,attributes:e,classes:t,styles:i}=s,o=[];return e&&o.push(...B({name:r,attributes:e},"attributes")),t&&o.push(...B({name:r,classes:t},"classes")),i&&o.push(...B({name:r,styles:i},"styles")),o}class Ae extends g{static get requires(){return[h]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const r=this.editor.plugins.get(h);r.on("register:pre",(e,t)=>{if(t.model!=="codeBlock")return;const i=this.editor,o=i.model.schema,l=i.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),l.for("upcast").add(ve(r)),l.for("downcast").add(ye()),e.stop()})}}function ve(s){return r=>{r.on("element:code",(e,t,i)=>{const o=t.viewItem,l=o.parent;if(!l||!l.is("element","pre"))return;n(l,"htmlPreAttributes"),n(o,"htmlContentAttributes");function n(m,a){const u=s.processViewAttributes(m,i);u&&i.writer.setAttribute(a,u,t.modelRange)}},{priority:"low"})}}function ye(){return s=>{s.on("attribute:htmlPreAttributes:codeBlock",(r,e,t)=>{if(!t.consumable.consume(e.item,r.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,n=t.mapper.toViewElement(e.item).parent;p(t.writer,i,o,n)}),s.on("attribute:htmlContentAttributes:codeBlock",(r,e,t)=>{if(!t.consumable.consume(e.item,r.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,l=t.mapper.toViewElement(e.item);p(t.writer,i,o,l)})}}class Ee extends g{static get requires(){return[h]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(h).on("register",(e,t)=>{const i=t,o=this.editor,l=o.model.schema,n=o.conversion;if(!i.paragraphLikeModel||l.isRegistered(i.model)||l.isRegistered(i.paragraphLikeModel))return;const m={model:i.paragraphLikeModel,view:i.view};l.register(i.model,i.modelSchema),l.register(m.model,{inheritAllFrom:"$block"}),n.for("upcast").elementToElement({view:i.view,model:(a,{writer:u})=>this._hasBlockContent(a)?u.createElement(i.model):u.createElement(m.model),converterPriority:k.low+.5}),n.for("downcast").elementToElement({view:i.view,model:i.model}),this._addAttributeConversion(i),n.for("downcast").elementToElement({view:m.view,model:m.model}),this._addAttributeConversion(m),e.stop()})}_hasBlockContent(r){const e=this.editor.editing.view,t=e.domConverter.blockElements;for(const i of e.createRangeIn(r).getItems())if(i.is("element")&&t.includes(i.name))return!0;return!1}_addAttributeConversion(r){const e=this.editor,t=e.conversion,i=e.plugins.get(h);e.model.schema.extend(r.model,{allowAttributes:b(r.view)}),t.for("upcast").add(C(r,i)),t.for("downcast").add(O(r))}}class Ce extends g{static get requires(){return[S,oe]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor;if(!r.plugins.has("HeadingEditing"))return;const e=r.config.get("heading.options");this.registerHeadingElements(r,e)}registerHeadingElements(r,e){const t=r.plugins.get(S),i=[];for(const o of e)"model"in o&&"view"in o&&(t.registerBlockElement({view:o.view,model:o.model}),i.push(o.model));t.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}}),t.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:i}})}}/**
|
|
7
|
+
*/var j={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlHr",view:"hr",isEmpty:!0,modelSchema:{inheritAllFrom:"$blockObject"}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref"},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}]};class C extends f{_definitions=[];static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(const e of j.block)this.registerBlockElement(e);for(const e of j.inline)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,r=!1){const t=new Set;for(const i of this._getMatchingViewDefinitions(e)){if(r)for(const o of this._getReferences(i.model))t.add(o);t.add(i)}return t}getDefinitionsForModel(e){return this._definitions.filter(r=>r.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(r=>r.view&&de(e,r.view))}*_getReferences(e){const r=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],t=this._definitions.filter(i=>i.model==e);for(const{modelSchema:i}of t)if(i)for(const o of r)for(const l of k(i[o]||[])){const n=this._definitions.filter(m=>m.model==l);for(const m of n)l!==e&&(yield*this._getReferences(m.model),yield m)}}_extendDefinition(e){const r=Array.from(this._definitions.entries()).filter(([,t])=>t.model==e.model);if(r.length==0){this._definitions.push(e);return}for(const[t,i]of r)this._definitions[t]=re({},i,e,(o,l)=>Array.isArray(o)?o.concat(l):void 0)}}function de(s,e){return typeof s=="string"?s===e:s instanceof RegExp?s.test(e):!1}class h extends f{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new M,this._disallowedAttributes=new M,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get isOfficialPlugin(){return!0}static get requires(){return[C,ee]}loadAllowedConfig(e){for(const r of e){const t=r.name||/[\s\S]+/,i=q(r);this.allowElement(t),i.forEach(o=>this.allowAttributes(o))}}loadDisallowedConfig(e){for(const r of e){const t=r.name||/[\s\S]+/,i=q(r);i.length==0?this.disallowElement(t):i.forEach(o=>this.disallowAttributes(o))}}loadAllowedEmptyElementsConfig(e){for(const r of e)this.allowEmptyElement(r)}allowElement(e){for(const r of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(r),this._coupledAttributes=null}disallowElement(e){for(const r of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(r.view)}allowEmptyElement(e){for(const r of this._dataSchema.getDefinitionsForView(e,!0))r.isInline&&this._dataSchema.extendInlineElement({...r,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,r){const{consumable:t}=r;return W(e,this._disallowedAttributes,t),he(e,W(e,this._allowedAttributes,t))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const r of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))r.isBlock&&this._addAllowedElement(r);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:S.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:S.highest+1})}_registerElementHandlers(){this.on("register",(e,r)=>{const t=this.editor.model.schema;if(r.isObject&&!t.isRegistered(r.model))this._registerObjectElement(r);else if(r.isBlock)this._registerBlockElement(r);else if(r.isInline)this._registerInlineElement(r);else throw new Q("data-filter-invalid-definition",null,r);e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,r=e.document.selection;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let o=!1;const l=this._getCoupledAttributesMap();for(const n of i){if(n.type!="attribute"||n.attributeNewValue!==null)continue;const m=l.get(n.attributeKey);if(m)for(const{item:a}of n.range.getWalker())for(const u of m)a.hasAttribute(u)&&(t.removeAttribute(u,a),o=!0)}return o}),this.listenTo(r,"change:attribute",(t,{attributeKeys:i})=>{const o=new Set,l=this._getCoupledAttributesMap();for(const n of i){if(r.hasAttribute(n))continue;const m=l.get(n);if(m)for(const a of m)r.hasAttribute(a)&&o.add(a)}o.size!=0&&e.change(n=>{for(const m of o)n.removeSelectionAttribute(m)})})}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(r=>{const t=e.document.differ.getChanges();let i=!1;for(const o of t)if(!(o.type!=="insert"||o.name==="$text"))for(const l of o.attributes.keys())!l.startsWith("html")||!l.endsWith("Attributes")||e.schema.checkAttribute(o.name,l)||(r.removeAttribute(l,o.position.nodeAfter),i=!0);return i})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const r=this._coupledAttributes.get(e.coupledAttribute);r?r.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const r=this.editor,t=r.model.schema,i=r.conversion,{view:o,model:l}=e;t.register(l,e.modelSchema);/* istanbul ignore next: paranoid check -- @preserve */o&&(t.extend(e.model,{allowAttributes:[b(o),"htmlContent"]}),r.data.registerRawContentMatcher({name:o}),i.for("upcast").elementToElement({view:o,model:x(e),converterPriority:S.low+2}),i.for("upcast").add(E(e,this)),i.for("editingDowncast").elementToStructure({model:{name:l,attributes:[b(o)]},view:ae(r,e)}),i.for("dataDowncast").elementToElement({model:l,view:(n,{writer:m})=>T(o,n,m)}),i.for("dataDowncast").add(F(e)))}_registerBlockElement(e){const r=this.editor,t=r.model.schema,i=r.conversion,{view:o,model:l}=e;if(!t.isRegistered(e.model)){if(!e.modelSchema||(t.register(e.model,e.modelSchema),!o))return;i.for("upcast").elementToElement({model:l,view:o,converterPriority:S.low+2}),i.for("downcast").elementToElement({model:l,view:(n,{writer:m})=>e.isEmpty?m.createEmptyElement(o):m.createContainerElement(o)})}o&&(t.extend(e.model,{allowAttributes:b(o)}),i.for("upcast").add(E(e,this)),i.for("downcast").add(F(e)))}_registerInlineElement(e){const r=this.editor,t=r.model.schema,i=r.conversion,o=e.model;if(!e.appliesToBlock&&(t.extend("$text",{allowAttributes:o}),e.attributeProperties&&t.setAttributeProperties(o,e.attributeProperties),i.for("upcast").add(ue(e,this)),i.for("downcast").attributeToElement({model:o,view:ce(e)}),!!e.allowEmpty)){if(t.setAttributeProperties(o,{copyFromObject:!1}),!t.isRegistered("htmlEmptyElement")){t.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});const l=n=>Array.from(n.getAttributeKeys()).some(m=>m.startsWith("html"));r.model.document.registerPostFixer(n=>{const m=r.model.document.differ.getChanges(),a=new Set;for(const u of m)if(u.type!=="remove"){if(u.type==="attribute"&&u.attributeNewValue===null)for(const{item:c}of u.range)c.is("element","htmlEmptyElement")&&!l(c)&&a.add(c);if(u.type==="insert"&&u.position.nodeAfter){const c=u.position.nodeAfter;for(const{item:d}of n.createRangeOn(c))d.is("element","htmlEmptyElement")&&!l(d)&&a.add(d)}}for(const u of a)n.remove(u);return a.size>0})}r.data.htmlProcessor.domConverter.registerInlineObjectMatcher(l=>l.name==e.view&&l.isEmpty&&Array.from(l.getAttributeKeys()).length?{name:!0}:null),i.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:L(e,!0)}),i.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:L(e)})}}}function W(s,e,r){const t=e.matchAll(s)||[],i=s.document.stylesProcessor;return t.reduce((o,{match:l})=>{for(const[n,m]of l.attributes||[])if(n=="style"){const a=m,u=i.getRelatedStyles(a).filter(c=>c.split("-").length>a.split("-").length).sort((c,d)=>d.split("-").length-c.split("-").length);for(const c of u)r.consume(s,{styles:[c]})&&o.styles.push(c);r.consume(s,{styles:[a]})&&o.styles.push(a)}else if(n=="class"){const a=m;r.consume(s,{classes:[a]})&&o.classes.push(a)}else r.consume(s,{attributes:[n]})&&o.attributes.push(n);return o},{attributes:[],classes:[],styles:[]})}function he(s,{attributes:e,classes:r,styles:t}){return!e.length&&!r.length&&!t.length?null:{...e.length&&{attributes:fe(s,e)},...t.length&&{styles:ge(s,t)},...r.length&&{classes:r}}}function fe(s,e){const r={};for(const t of e){const i=s.getAttribute(t);i!==void 0&&Y(t)&&(r[t]=i)}return r}function ge(s,e){const r=new Z(s.document.stylesProcessor);for(const t of e){const i=s.getStyle(t);i!==void 0&&r.set(t,i)}return Object.fromEntries(r.getStylesEntries())}function _(s,e){const{name:r}=s,t=s[e];return oe(t)?Object.entries(t).map(([i,o])=>({name:r,[e]:{[i]:o}})):Array.isArray(t)?t.map(i=>({name:r,[e]:[i]})):[s]}function q(s){const{name:e,attributes:r,classes:t,styles:i}=s,o=[];return r&&o.push(..._({name:e,attributes:r},"attributes")),t&&o.push(..._({name:e,classes:t},"classes")),i&&o.push(..._({name:e,styles:i},"styles")),o}class be extends f{static get requires(){return[h]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(h);e.on("register:pre",(r,t)=>{if(t.model!=="codeBlock")return;const i=this.editor,o=i.model.schema,l=i.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),l.for("upcast").add(pe(e)),l.for("downcast").add(we()),r.stop()})}}function pe(s){return e=>{e.on("element:code",(r,t,i)=>{const o=t.viewItem,l=o.parent;if(!l||!l.is("element","pre"))return;n(l,"htmlPreAttributes"),n(o,"htmlContentAttributes");function n(m,a){const u=s.processViewAttributes(m,i);u&&i.writer.setAttribute(a,u,t.modelRange)}},{priority:"low"})}}function we(){return s=>{s.on("attribute:htmlPreAttributes:codeBlock",(e,r,t)=>{if(!t.consumable.consume(r.item,e.name))return;const{attributeOldValue:i,attributeNewValue:o}=r,n=t.mapper.toViewElement(r.item).parent;p(t.writer,i,o,n)}),s.on("attribute:htmlContentAttributes:codeBlock",(e,r,t)=>{if(!t.consumable.consume(r.item,e.name))return;const{attributeOldValue:i,attributeNewValue:o}=r,l=t.mapper.toViewElement(r.item);p(t.writer,i,o,l)})}}class Ae extends f{static get requires(){return[h]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(h).on("register",(r,t)=>{const i=t,o=this.editor,l=o.model.schema,n=o.conversion;if(!i.paragraphLikeModel||l.isRegistered(i.model)||l.isRegistered(i.paragraphLikeModel))return;const m={model:i.paragraphLikeModel,view:i.view};l.register(i.model,i.modelSchema),l.register(m.model,{inheritAllFrom:"$block"}),n.for("upcast").elementToElement({view:i.view,model:(a,{writer:u})=>this._hasBlockContent(a)?u.createElement(i.model):u.createElement(m.model),converterPriority:S.low+.5}),n.for("downcast").elementToElement({view:i.view,model:i.model}),this._addAttributeConversion(i),n.for("downcast").elementToElement({view:m.view,model:m.model}),this._addAttributeConversion(m),r.stop()})}_hasBlockContent(e){const r=this.editor.editing.view,t=r.domConverter.blockElements;for(const i of r.createRangeIn(e).getItems())if(i.is("element")&&t.includes(i.name))return!0;return!1}_addAttributeConversion(e){const r=this.editor,t=r.conversion,i=r.plugins.get(h);r.model.schema.extend(e.model,{allowAttributes:b(e.view)}),t.for("upcast").add(E(e,i)),t.for("downcast").add(F(e))}}class ve extends f{static get requires(){return[C,te]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const r=e.config.get("heading.options");this.registerHeadingElements(e,r)}registerHeadingElements(e,r){const t=e.plugins.get(C),i=[];for(const o of r)"model"in o&&"view"in o&&(t.registerBlockElement({view:o.view,model:o.model}),i.push(o.model));t.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}}),t.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:i}})}}/**
|
|
8
8
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
9
9
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
10
|
-
*/function P(s,r,e){const t=s.createRangeOn(r);for(const{item:i}of t.getWalker())if(i.is("element",e))return i}class Se extends g{static get requires(){return[h]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor;if(!r.plugins.has("ImageInlineEditing")&&!r.plugins.has("ImageBlockEditing"))return;const e=r.model.schema,t=r.conversion,i=r.plugins.get(h);i.on("register:figure",()=>{t.for("upcast").add(Oe(i))}),i.on("register:img",(o,l)=>{l.model!=="imageBlock"&&l.model!=="imageInline"||(e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),t.for("upcast").add(ke(i)),t.for("downcast").add(Pe()),r.plugins.has("LinkImage")&&t.for("upcast").add(Fe(i,r)),o.stop())})}}function ke(s){return r=>{r.on("element:img",(e,t,i)=>{if(!t.modelRange)return;const o=t.viewItem,l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlImgAttributes",l,t.modelRange)},{priority:"low"})}}function Fe(s,r){const e=r.plugins.get("ImageUtils");return t=>{t.on("element:a",(i,o,l)=>{const n=o.viewItem;if(!e.findViewImgElement(n))return;const a=o.modelCursor.parent;if(!a.is("element","imageBlock"))return;const u=s.processViewAttributes(n,l);u&&l.writer.setAttribute("htmlLinkAttributes",u,a)},{priority:"low"})}}function Oe(s){return r=>{r.on("element:figure",(e,t,i)=>{const o=t.viewItem;if(!t.modelRange||!o.hasClass("image"))return;const l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlFigureAttributes",l,t.modelRange)},{priority:"low"})}}function Pe(){return s=>{r("htmlImgAttributes"),e("img","htmlImgAttributes"),e("figure","htmlFigureAttributes"),e("a","htmlLinkAttributes");function r(t){s.on(`attribute:${t}:imageInline`,(i,o,l)=>{if(!l.consumable.consume(o.item,i.name))return;const{attributeOldValue:n,attributeNewValue:m}=o,a=l.mapper.toViewElement(o.item);p(l.writer,n,m,a)},{priority:"low"})}function e(t,i){s.on(`attribute:${i}:imageBlock`,(o,l,n)=>{if(!n.consumable.test(l.item,o.name))return;const{attributeOldValue:m,attributeNewValue:a}=l,u=n.mapper.toViewElement(l.item),c=P(n.writer,u,t);c&&(p(n.writer,m,a,c),n.consumable.consume(l.item,o.name))},{priority:"low"}),t==="a"&&s.on("attribute:linkHref:imageBlock",(o,l,n)=>{if(!n.consumable.consume(l.item,"attribute:htmlLinkAttributes:imageBlock"))return;const m=n.mapper.toViewElement(l.item),a=P(n.writer,m,"a");w(n.writer,l.item.getAttribute("htmlLinkAttributes"),a)},{priority:"low"})}}}class Te extends g{static get requires(){return[h]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor;if(!r.plugins.has("MediaEmbed")||r.config.get("mediaEmbed.previewsInData"))return;const e=r.model.schema,t=r.conversion,i=this.editor.plugins.get(h),o=this.editor.plugins.get(S),l=r.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:l}),i.on("register:figure",()=>{t.for("upcast").add(Ie(i))}),i.on(`register:${l}`,(n,m)=>{m.model==="media"&&(e.extend("media",{allowAttributes:[b(l),"htmlFigureAttributes"]}),t.for("upcast").add($e(i,l)),t.for("dataDowncast").add(De(l)),n.stop())})}}function $e(s,r){const e=(t,i,o)=>{const l=i.viewItem;n(l,b(r));function n(m,a){const u=s.processViewAttributes(m,o);u&&o.writer.setAttribute(a,u,i.modelRange)}};return t=>{t.on(`element:${r}`,e,{priority:"low"})}}function Ie(s){return r=>{r.on("element:figure",(e,t,i)=>{const o=t.viewItem;if(!t.modelRange||!o.hasClass("media"))return;const l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlFigureAttributes",l,t.modelRange)},{priority:"low"})}}function De(s){return r=>{e(s,b(s)),e("figure","htmlFigureAttributes");function e(t,i){r.on(`attribute:${i}:media`,(o,l,n)=>{if(!n.consumable.consume(l.item,o.name))return;const{attributeOldValue:m,attributeNewValue:a}=l,u=n.mapper.toViewElement(l.item),c=P(n.writer,u,t);p(n.writer,m,a,c)})}}}class _e extends g{static get requires(){return[h]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor.plugins.get(h);r.on("register:script",(e,t)=>{const i=this.editor,o=i.model.schema,l=i.conversion;o.register("htmlScript",t.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),l.for("upcast").elementToElement({view:"script",model:V(t)}),l.for("upcast").add(C(t,r)),l.for("downcast").elementToElement({model:"htmlScript",view:(n,{writer:m})=>$("script",n,m)}),l.for("downcast").add(O(t)),e.stop()})}}const Be=["width","max-width","min-width","height","min-height","max-height"];class Re extends g{static get requires(){return[h]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor;if(!r.plugins.has("TableEditing"))return;const e=r.model.schema,t=r.conversion,i=r.plugins.get(h),o=r.plugins.get("TableUtils");i.on("register:figure",()=>{t.for("upcast").add(He(i))}),i.on("register:table",(l,n)=>{n.model==="table"&&(e.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),t.for("upcast").add(Ve(i)),t.for("downcast").add(Me()),r.model.document.registerPostFixer(xe(r.model,o)),l.stop())})}}function xe(s,r){return e=>{const t=s.document.differ.getChanges();let i=!1;for(const o of t){if(o.type!="attribute"||o.attributeKey!="headingRows")continue;const l=o.range.start.nodeAfter,n=l.getAttribute("htmlTheadAttributes"),m=l.getAttribute("htmlTbodyAttributes");n&&!o.attributeNewValue?(e.removeAttribute("htmlTheadAttributes",l),i=!0):m&&o.attributeNewValue==r.getRows(l)&&(e.removeAttribute("htmlTbodyAttributes",l),i=!0)}return i}}function Ve(s){return r=>{r.on("element:table",(e,t,i)=>{if(!t.modelRange)return;const o=t.viewItem;l(o,"htmlTableAttributes");for(const n of o.getChildren())n.is("element","thead")&&l(n,"htmlTheadAttributes"),n.is("element","tbody")&&l(n,"htmlTbodyAttributes");function l(n,m){const a=s.processViewAttributes(n,i);a&&i.writer.setAttribute(m,a,t.modelRange)}},{priority:"low"})}}function He(s){return r=>{r.on("element:figure",(e,t,i)=>{const o=t.viewItem;if(!t.modelRange||!o.hasClass("table"))return;const l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlFigureAttributes",l,t.modelRange)},{priority:"low"})}}function Me(){return s=>{r("table","htmlTableAttributes"),r("figure","htmlFigureAttributes"),r("thead","htmlTheadAttributes"),r("tbody","htmlTbodyAttributes");function r(e,t){s.on(`attribute:${t}:table`,(i,o,l)=>{if(!l.consumable.test(o.item,i.name))return;const n=l.mapper.toViewElement(o.item),m=P(l.writer,n,e);if(m)if(l.consumable.consume(o.item,i.name),t==="htmlTableAttributes"&&n!==m){const a=U(o.attributeOldValue),u=U(o.attributeNewValue);p(l.writer,a.tableAttributes,u.tableAttributes,m),p(l.writer,a.figureAttributes,u.figureAttributes,n)}else p(l.writer,o.attributeOldValue,o.attributeNewValue,m)})}}}function U(s){const r={},e={...s};if(!s||!("styles"in s))return{figureAttributes:r,tableAttributes:e};e.styles={};for(const[t,i]of Object.entries(s.styles))Be.includes(t)?r.styles={...r.styles,[t]:i}:e.styles={...e.styles,[t]:i};return{figureAttributes:r,tableAttributes:e}}class Ne extends g{static get requires(){return[h]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor.plugins.get(h);r.on("register:style",(e,t)=>{const i=this.editor,o=i.model.schema,l=i.conversion;o.register("htmlStyle",t.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),l.for("upcast").elementToElement({view:"style",model:V(t)}),l.for("upcast").add(C(t,r)),l.for("downcast").elementToElement({model:"htmlStyle",view:(n,{writer:m})=>$("style",n,m)}),l.for("downcast").add(O(t)),e.stop()})}}class Le extends g{static get requires(){return[h]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor;if(!r.plugins.has("ListEditing"))return;const e=r.model.schema,t=r.conversion,i=r.plugins.get(h),o=r.plugins.get("ListEditing"),l=r.plugins.get("ListUtils"),n=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:w}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:w}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:w}),i.on("register",(m,a)=>{if(!n.includes(a.view)||(m.stop(),e.checkAttribute("$block","htmlLiAttributes")))return;const u=n.map(c=>b(c));e.extend("$listItem",{allowAttributes:u}),t.for("upcast").add(c=>{c.on("element:ul",R("htmlUlAttributes",i),{priority:"low"}),c.on("element:ol",R("htmlOlAttributes",i),{priority:"low"}),c.on("element:li",R("htmlLiAttributes",i),{priority:"low"})})}),o.on("postFixer",(m,{listNodes:a,writer:u})=>{for(const{node:c,previousNodeInList:d}of a)if(d){if(d.getAttribute("listType")==c.getAttribute("listType")){const f=G(d.getAttribute("listType")),A=d.getAttribute(f);!L(c.getAttribute(f),A)&&u.model.schema.checkAttribute(c,f)&&(u.setAttribute(f,A,c),m.return=!0)}if(d.getAttribute("listItemId")==c.getAttribute("listItemId")){const f=d.getAttribute("htmlLiAttributes");!L(c.getAttribute("htmlLiAttributes"),f)&&u.model.schema.checkAttribute(c,"htmlLiAttributes")&&(u.setAttribute("htmlLiAttributes",f,c),m.return=!0)}}}),o.on("postFixer",(m,{listNodes:a,writer:u})=>{for(const{node:c}of a){const d=c.getAttribute("listType");!l.isNumberedListType(d)&&c.getAttribute("htmlOlAttributes")&&(u.removeAttribute("htmlOlAttributes",c),m.return=!0),l.isNumberedListType(d)&&c.getAttribute("htmlUlAttributes")&&(u.removeAttribute("htmlUlAttributes",c),m.return=!0)}})}afterInit(){const r=this.editor;if(!r.commands.get("indentList"))return;const e=r.commands.get("indentList");this.listenTo(e,"afterExecute",(t,i)=>{r.model.change(o=>{for(const l of i){const n=G(l.getAttribute("listType"));r.model.schema.checkAttribute(l,n)&&o.setAttribute(n,{},l)}})})}}function R(s,r){return(e,t,i)=>{const o=t.viewItem;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));const l=r.processViewAttributes(o,i);for(const n of t.modelRange.getItems({shallow:!0}))n.hasAttribute("listItemId")&&(n.hasAttribute("htmlUlAttributes")||n.hasAttribute("htmlOlAttributes")||i.writer.model.schema.checkAttribute(n,s)&&i.writer.setAttribute(s,l||{},n))}}function G(s){return s==="numbered"||s=="customNumbered"?"htmlOlAttributes":"htmlUlAttributes"}class je extends g{static get requires(){return[h]}static get pluginName(){return"HorizontalLineElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor;if(!r.plugins.has("HorizontalLineEditing"))return;const e=r.model.schema,t=r.conversion,i=r.plugins.get(h);i.on("register:hr",(o,l)=>{l.model==="horizontalLine"&&(e.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),t.for("upcast").add(C(l,i)),t.for("downcast").add(We()),o.stop())})}}function We(){return s=>{s.on("attribute:htmlHrAttributes:horizontalLine",(r,e,t)=>{if(!t.consumable.test(e.item,r.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,l=t.mapper.toViewElement(e.item),n=P(t.writer,l,"hr");n&&(p(t.writer,i,o,n),t.consumable.consume(e.item,r.name))},{priority:"low"})}}class qe extends g{static get requires(){return[h,S]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){const r=this.editor.plugins.get(h),e=this.editor.plugins.get(S);r.on("register:$customElement",(t,i)=>{t.stop();const o=this.editor,l=o.model.schema,n=o.conversion,m=o.editing.view.domConverter.unsafeElements,a=o.data.htmlProcessor.domConverter.preElements;l.register(i.model,i.modelSchema),l.extend(i.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),o.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),n.for("upcast").elementToElement({view:/.*/,model:(u,c)=>{if(u.name=="$comment"||!ze(u.name)||e.getDefinitionsForView(u.name).size)return null;m.includes(u.name)||m.push(u.name),a.includes(u.name)||a.push(u.name);const d=c.writer.createElement(i.model,{htmlElementName:u.name}),f=r.processViewAttributes(u,c);f&&c.writer.setAttribute("htmlCustomElementAttributes",f,d);let A;if(u.is("element","template")&&u.getCustomProperty("$rawContent"))A=u.getCustomProperty("$rawContent");else{const I=new x(u.document).createDocumentFragment(u),D=o.data.htmlProcessor.domConverter.viewToDom(I),_=D.firstChild;for(;_.firstChild;)D.appendChild(_.firstChild);_.remove(),A=o.data.htmlProcessor.htmlWriter.getHtml(D)}c.writer.setAttribute("htmlContent",A,d);for(const{item:T}of o.editing.view.createRangeIn(u))c.consumable.consume(T,{name:!0});return d},converterPriority:"low"}),n.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:c})=>{const d=u.getAttribute("htmlElementName"),f=c.createRawElement(d);return u.hasAttribute("htmlCustomElementAttributes")&&w(c,u.getAttribute("htmlCustomElementAttributes"),f),f}}),n.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:c})=>{const d=u.getAttribute("htmlElementName"),f=u.getAttribute("htmlContent"),A=c.createRawElement(d,null,(T,I)=>{I.setContentOf(T,f)});return u.hasAttribute("htmlCustomElementAttributes")&&w(c,u.getAttribute("htmlCustomElementAttributes"),A),A}})})}}function ze(s){try{document.createElement(s)}catch{return!1}return!0}class lt extends g{static get pluginName(){return"GeneralHtmlSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[h,Ae,Ee,Ce,Se,Te,_e,Re,Ne,Le,je,qe]}init(){const r=this.editor,e=r.plugins.get(h);e.loadAllowedEmptyElementsConfig(r.config.get("htmlSupport.allowEmpty")||[]),e.loadAllowedConfig(r.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(r.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(r){const e=this.editor.plugins.get("DataSchema"),t=Array.from(e.getDefinitionsForView(r,!1)),i=t.find(o=>o.isInline&&!t[0].isObject);return i?i.model:b(r)}addModelHtmlClass(r,e,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(r);i.change(l=>{for(const n of E(i,t,o))y(l,n,o,"classes",m=>{for(const a of F(e))m.add(a)})})}removeModelHtmlClass(r,e,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(r);i.change(l=>{for(const n of E(i,t,o))y(l,n,o,"classes",m=>{for(const a of F(e))m.delete(a)})})}setModelHtmlAttributes(r,e,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(r);i.change(l=>{for(const n of E(i,t,o))y(l,n,o,"attributes",m=>{for(const[a,u]of Object.entries(e))m.set(a,u)})})}removeModelHtmlAttributes(r,e,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(r);i.change(l=>{for(const n of E(i,t,o))y(l,n,o,"attributes",m=>{for(const a of F(e))m.delete(a)})})}setModelHtmlStyles(r,e,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(r);i.change(l=>{for(const n of E(i,t,o))y(l,n,o,"styles",m=>{for(const[a,u]of Object.entries(e))m.set(a,u)})})}removeModelHtmlStyles(r,e,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(r);i.change(l=>{for(const n of E(i,t,o))y(l,n,o,"styles",m=>{for(const a of F(e))m.delete(a)})})}}function*E(s,r,e){if(r)if(!(Symbol.iterator in r)&&r.is("documentSelection")&&r.isCollapsed)s.schema.checkAttributeInSelection(r,e)&&(yield r);else for(const t of Ue(s,r,e))yield*t.getItems({shallow:!0})}function Ue(s,r,e){return!(Symbol.iterator in r)&&(r.is("node")||r.is("$text")||r.is("$textProxy"))?s.schema.checkAttribute(r,e)?[s.createRangeOn(r)]:[]:s.schema.getValidRanges(s.createSelection(r).getRanges(),e)}class nt extends g{static get pluginName(){return"HtmlComment"}static get isOfficialPlugin(){return!0}init(){const r=this.editor,e=new Map;r.data.processor.skipComments=!1,r.model.schema.addAttributeCheck((t,i)=>{if(t.endsWith("$root")&&i.startsWith("$comment"))return!0}),r.conversion.for("upcast").elementToMarker({view:"$comment",model:t=>{const o=`$comment:${M()}`,l=t.getCustomProperty("$rawContent");return e.set(o,l),o}}),r.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(t,{writer:i})=>{let o;for(const a of this.editor.model.document.getRootNames())if(o=this.editor.model.document.getRoot(a),o.hasAttribute(t.markerName))break;const l=t.markerName,n=o.getAttribute(l),m=i.createUIElement("$comment");return i.setCustomProperty("$rawContent",n,m),m}}),r.model.document.registerPostFixer(t=>{let i=!1;const o=r.model.document.differ.getChangedMarkers().filter(l=>l.name.startsWith("$comment:"));for(const l of o){const{oldRange:n,newRange:m}=l.data;if(!(n&&m&&n.root==m.root)){if(n){const a=n.root;a.hasAttribute(l.name)&&(t.removeAttribute(l.name,a),i=!0)}if(m){const a=m.root;a.rootName=="$graveyard"?(t.removeMarker(l.name),i=!0):a.hasAttribute(l.name)||(t.setAttribute(l.name,e.get(l.name)||"",a),i=!0)}}}return i}),r.data.on("set",()=>{for(const t of r.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(t.name)},{priority:"high"}),r.model.on("deleteContent",(t,[i])=>{for(const o of i.getRanges()){const l=r.model.schema.getLimitElement(o),n=r.model.createPositionAt(l,0),m=r.model.createPositionAt(l,"end");let a;n.isTouching(o.start)&&m.isTouching(o.end)?a=this.getHtmlCommentsInRange(r.model.createRange(n,m)):a=this.getHtmlCommentsInRange(o,{skipBoundaries:!0});for(const u of a)this.removeHtmlComment(u)}},{priority:"high"})}createHtmlComment(r,e){const t=M(),o=this.editor.model,l=o.document.getRoot(r.root.rootName),n=`$comment:${t}`;return o.change(m=>{const a=m.createRange(r);return m.addMarker(n,{usingOperation:!0,affectsData:!0,range:a}),m.setAttribute(n,e,l),n})}removeHtmlComment(r){const e=this.editor,t=e.model.markers.get(r);return t?(e.model.change(i=>{i.removeMarker(t)}),!0):!1}getHtmlCommentData(r){const t=this.editor.model.markers.get(r);if(!t)return null;let i="";for(const o of this.editor.model.document.getRoots())if(o.hasAttribute(r)){i=o.getAttribute(r);break}return{content:i,position:t.getStart()}}getHtmlCommentsInRange(r,{skipBoundaries:e=!1}={}){const t=!e;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter(o=>i(o,r)).map(o=>o.name);function i(o,l){const n=o.getRange().start;return(n.isAfter(l.start)||t&&n.isEqual(l.start))&&(n.isBefore(l.end)||t&&n.isEqual(l.end))}}}class Ge extends te{toView(r){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(r.trim().slice(0,1e4)))return super.toView(r);let e="",t="";r=r.trim().replace(/<\?xml\s[^?]*\?>/i,m=>(t=m,"")),r=r.trim().replace(/^<!DOCTYPE\s[^>]*?>/i,m=>(e=m,""));const i=this._toDom(r),o=this.domConverter.domToView(i,{skipComments:this.skipComments}),l=new x(o.document);l.setCustomProperty("$fullPageDocument",i.ownerDocument.documentElement.outerHTML,o);const n=Array.from(i.ownerDocument.querySelectorAll("head style"));return l.setCustomProperty("$fullPageHeadStyles",n,o),e&&l.setCustomProperty("$fullPageDocType",e,o),t&&l.setCustomProperty("$fullPageXmlDeclaration",t,o),o}toData(r){let e=super.toData(r);const t=r.getCustomProperty("$fullPageDocument"),i=r.getCustomProperty("$fullPageDocType"),o=r.getCustomProperty("$fullPageXmlDeclaration");return t&&(e=t.replace(/<\/body\s*>/,e+"$&"),i&&(e=i+`
|
|
11
|
-
`+
|
|
12
|
-
`+
|
|
10
|
+
*/function O(s,e,r){const t=s.createRangeOn(e);for(const{item:i}of t.getWalker())if(i.is("element",r))return i}class ye extends f{static get requires(){return[h]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const r=e.model.schema,t=e.conversion,i=e.plugins.get(h);i.on("register:figure",()=>{t.for("upcast").add(Se(i))}),i.on("register:img",(o,l)=>{l.model!=="imageBlock"&&l.model!=="imageInline"||(r.isRegistered("imageBlock")&&r.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),r.isRegistered("imageInline")&&r.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),t.for("upcast").add(Ee(i)),t.for("downcast").add(ke()),e.plugins.has("LinkImage")&&t.for("upcast").add(Ce(i,e)),o.stop())})}}function Ee(s){return e=>{e.on("element:img",(r,t,i)=>{if(!t.modelRange)return;const o=t.viewItem,l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlImgAttributes",l,t.modelRange)},{priority:"low"})}}function Ce(s,e){const r=e.plugins.get("ImageUtils");return t=>{t.on("element:a",(i,o,l)=>{const n=o.viewItem;if(!r.findViewImgElement(n))return;const a=o.modelCursor.parent;if(!a.is("element","imageBlock"))return;const u=s.processViewAttributes(n,l);u&&l.writer.setAttribute("htmlLinkAttributes",u,a)},{priority:"low"})}}function Se(s){return e=>{e.on("element:figure",(r,t,i)=>{const o=t.viewItem;if(!t.modelRange||!o.hasClass("image"))return;const l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlFigureAttributes",l,t.modelRange)},{priority:"low"})}}function ke(){return s=>{e("htmlImgAttributes"),r("img","htmlImgAttributes"),r("figure","htmlFigureAttributes"),r("a","htmlLinkAttributes");function e(t){s.on(`attribute:${t}:imageInline`,(i,o,l)=>{if(!l.consumable.consume(o.item,i.name))return;const{attributeOldValue:n,attributeNewValue:m}=o,a=l.mapper.toViewElement(o.item);p(l.writer,n,m,a)},{priority:"low"})}function r(t,i){s.on(`attribute:${i}:imageBlock`,(o,l,n)=>{if(!n.consumable.test(l.item,o.name))return;const{attributeOldValue:m,attributeNewValue:a}=l,u=n.mapper.toViewElement(l.item),c=O(n.writer,u,t);c&&(p(n.writer,m,a,c),n.consumable.consume(l.item,o.name))},{priority:"low"}),t==="a"&&s.on("attribute:linkHref:imageBlock",(o,l,n)=>{if(!n.consumable.consume(l.item,"attribute:htmlLinkAttributes:imageBlock"))return;const m=n.mapper.toViewElement(l.item),a=O(n.writer,m,"a");w(n.writer,l.item.getAttribute("htmlLinkAttributes"),a)},{priority:"low"})}}}class Fe extends f{static get requires(){return[h]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const r=e.model.schema,t=e.conversion,i=this.editor.plugins.get(h),o=this.editor.plugins.get(C),l=e.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:l}),i.on("register:figure",()=>{t.for("upcast").add(Pe(i))}),i.on(`register:${l}`,(n,m)=>{m.model==="media"&&(r.extend("media",{allowAttributes:[b(l),"htmlFigureAttributes"]}),t.for("upcast").add(Oe(i,l)),t.for("dataDowncast").add(Te(l)),n.stop())})}}function Oe(s,e){const r=(t,i,o)=>{const l=i.viewItem;n(l,b(e));function n(m,a){const u=s.processViewAttributes(m,o);u&&o.writer.setAttribute(a,u,i.modelRange)}};return t=>{t.on(`element:${e}`,r,{priority:"low"})}}function Pe(s){return e=>{e.on("element:figure",(r,t,i)=>{const o=t.viewItem;if(!t.modelRange||!o.hasClass("media"))return;const l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlFigureAttributes",l,t.modelRange)},{priority:"low"})}}function Te(s){return e=>{r(s,b(s)),r("figure","htmlFigureAttributes");function r(t,i){e.on(`attribute:${i}:media`,(o,l,n)=>{if(!n.consumable.consume(l.item,o.name))return;const{attributeOldValue:m,attributeNewValue:a}=l,u=n.mapper.toViewElement(l.item),c=O(n.writer,u,t);p(n.writer,m,a,c)})}}}class $e extends f{static get requires(){return[h]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(h);e.on("register:script",(r,t)=>{const i=this.editor,o=i.model.schema,l=i.conversion;o.register("htmlScript",t.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),l.for("upcast").elementToElement({view:"script",model:x(t)}),l.for("upcast").add(E(t,e)),l.for("downcast").elementToElement({model:"htmlScript",view:(n,{writer:m})=>T("script",n,m)}),l.for("downcast").add(F(t)),r.stop()})}}const Ie=["width","max-width","min-width","height","min-height","max-height"];class De extends f{static get requires(){return[h]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const r=e.model.schema,t=e.conversion,i=e.plugins.get(h),o=e.plugins.get("TableUtils");i.on("register:figure",()=>{t.for("upcast").add(Re(i))}),i.on("register:table",(l,n)=>{n.model==="table"&&(r.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),t.for("upcast").add(Be(i)),t.for("downcast").add(xe()),e.model.document.registerPostFixer(_e(e.model,o)),l.stop())})}}function _e(s,e){return r=>{const t=s.document.differ.getChanges();let i=!1;for(const o of t){if(o.type!="attribute"||o.attributeKey!="headingRows")continue;const l=o.range.start.nodeAfter,n=l.getAttribute("htmlTheadAttributes"),m=l.getAttribute("htmlTbodyAttributes");n&&!o.attributeNewValue?(r.removeAttribute("htmlTheadAttributes",l),i=!0):m&&o.attributeNewValue==e.getRows(l)&&(r.removeAttribute("htmlTbodyAttributes",l),i=!0)}return i}}function Be(s){return e=>{e.on("element:table",(r,t,i)=>{if(!t.modelRange)return;const o=t.viewItem;l(o,"htmlTableAttributes");for(const n of o.getChildren())n.is("element","thead")&&l(n,"htmlTheadAttributes"),n.is("element","tbody")&&l(n,"htmlTbodyAttributes");function l(n,m){const a=s.processViewAttributes(n,i);a&&i.writer.setAttribute(m,a,t.modelRange)}},{priority:"low"})}}function Re(s){return e=>{e.on("element:figure",(r,t,i)=>{const o=t.viewItem;if(!t.modelRange||!o.hasClass("table"))return;const l=s.processViewAttributes(o,i);l&&i.writer.setAttribute("htmlFigureAttributes",l,t.modelRange)},{priority:"low"})}}function xe(){return s=>{e("table","htmlTableAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes");function e(r,t){s.on(`attribute:${t}:table`,(i,o,l)=>{if(!l.consumable.test(o.item,i.name))return;const n=l.mapper.toViewElement(o.item),m=O(l.writer,n,r);if(m)if(l.consumable.consume(o.item,i.name),t==="htmlTableAttributes"&&n!==m){const a=z(o.attributeOldValue),u=z(o.attributeNewValue);p(l.writer,a.tableAttributes,u.tableAttributes,m),p(l.writer,a.figureAttributes,u.figureAttributes,n)}else p(l.writer,o.attributeOldValue,o.attributeNewValue,m)})}}}function z(s){const e={},r={...s};if(!s||!("styles"in s))return{figureAttributes:e,tableAttributes:r};r.styles={};for(const[t,i]of Object.entries(s.styles))Ie.includes(t)?e.styles={...e.styles,[t]:i}:r.styles={...r.styles,[t]:i};return{figureAttributes:e,tableAttributes:r}}class Ve extends f{static get requires(){return[h]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(h);e.on("register:style",(r,t)=>{const i=this.editor,o=i.model.schema,l=i.conversion;o.register("htmlStyle",t.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),l.for("upcast").elementToElement({view:"style",model:x(t)}),l.for("upcast").add(E(t,e)),l.for("downcast").elementToElement({model:"htmlStyle",view:(n,{writer:m})=>T("style",n,m)}),l.for("downcast").add(F(t)),r.stop()})}}class He extends f{static get requires(){return[h]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const r=e.model.schema,t=e.conversion,i=e.plugins.get(h),o=e.plugins.get("ListEditing"),l=e.plugins.get("ListUtils"),n=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:w}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:w}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:w}),i.on("register",(m,a)=>{if(!n.includes(a.view)||(m.stop(),r.checkAttribute("$block","htmlLiAttributes")))return;const u=n.map(c=>b(c));r.extend("$listItem",{allowAttributes:u}),t.for("upcast").add(c=>{c.on("element:ul",B("htmlUlAttributes",i),{priority:"low"}),c.on("element:ol",B("htmlOlAttributes",i),{priority:"low"}),c.on("element:li",B("htmlLiAttributes",i),{priority:"low"})})}),o.on("postFixer",(m,{listNodes:a,writer:u})=>{for(const{node:c,previousNodeInList:d}of a)if(d){if(d.getAttribute("listType")==c.getAttribute("listType")){const g=U(d.getAttribute("listType")),A=d.getAttribute(g);!N(c.getAttribute(g),A)&&u.model.schema.checkAttribute(c,g)&&(u.setAttribute(g,A,c),m.return=!0)}if(d.getAttribute("listItemId")==c.getAttribute("listItemId")){const g=d.getAttribute("htmlLiAttributes");!N(c.getAttribute("htmlLiAttributes"),g)&&u.model.schema.checkAttribute(c,"htmlLiAttributes")&&(u.setAttribute("htmlLiAttributes",g,c),m.return=!0)}}}),o.on("postFixer",(m,{listNodes:a,writer:u})=>{for(const{node:c}of a){const d=c.getAttribute("listType");!l.isNumberedListType(d)&&c.getAttribute("htmlOlAttributes")&&(u.removeAttribute("htmlOlAttributes",c),m.return=!0),l.isNumberedListType(d)&&c.getAttribute("htmlUlAttributes")&&(u.removeAttribute("htmlUlAttributes",c),m.return=!0)}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const r=e.commands.get("indentList");this.listenTo(r,"afterExecute",(t,i)=>{e.model.change(o=>{for(const l of i){const n=U(l.getAttribute("listType"));e.model.schema.checkAttribute(l,n)&&o.setAttribute(n,{},l)}})})}}function B(s,e){return(r,t,i)=>{const o=t.viewItem;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));const l=e.processViewAttributes(o,i);for(const n of t.modelRange.getItems({shallow:!0}))n.hasAttribute("listItemId")&&(n.hasAttribute("htmlUlAttributes")||n.hasAttribute("htmlOlAttributes")||i.writer.model.schema.checkAttribute(n,s)&&i.writer.setAttribute(s,l||{},n))}}function U(s){return s==="numbered"||s=="customNumbered"?"htmlOlAttributes":"htmlUlAttributes"}class Me extends f{static get requires(){return[h]}static get pluginName(){return"HorizontalLineElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;const r=e.model.schema,t=e.conversion,i=e.plugins.get(h);i.on("register:hr",(o,l)=>{l.model==="horizontalLine"&&(r.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),t.for("upcast").add(E(l,i)),t.for("downcast").add(Ne()),o.stop())})}}function Ne(){return s=>{s.on("attribute:htmlHrAttributes:horizontalLine",(e,r,t)=>{if(!t.consumable.test(r.item,e.name))return;const{attributeOldValue:i,attributeNewValue:o}=r,l=t.mapper.toViewElement(r.item),n=O(t.writer,l,"hr");n&&(p(t.writer,i,o,n),t.consumable.consume(r.item,e.name))},{priority:"low"})}}class Le extends f{static get requires(){return[h,C]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.plugins.get(h),r=this.editor.plugins.get(C);e.on("register:$customElement",(t,i)=>{t.stop();const o=this.editor,l=o.model.schema,n=o.conversion,m=o.editing.view.domConverter.unsafeElements,a=o.data.htmlProcessor.domConverter.preElements;l.register(i.model,i.modelSchema),l.extend(i.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),o.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),n.for("upcast").elementToElement({view:/.*/,model:(u,c)=>{if(u.name=="$comment"||!je(u.name)||r.getDefinitionsForView(u.name).size)return null;m.includes(u.name)||m.push(u.name),a.includes(u.name)||a.push(u.name);const d=c.writer.createElement(i.model,{htmlElementName:u.name}),g=e.processViewAttributes(u,c);g&&c.writer.setAttribute("htmlCustomElementAttributes",g,d);let A;if(u.is("element","template")&&u.getCustomProperty("$rawContent"))A=u.getCustomProperty("$rawContent");else{const $=new R(u.document).createDocumentFragment(u),I=o.data.htmlProcessor.domConverter.viewToDom($),D=I.firstChild;for(;D.firstChild;)I.appendChild(D.firstChild);D.remove(),A=o.data.htmlProcessor.htmlWriter.getHtml(I)}c.writer.setAttribute("htmlContent",A,d);for(const{item:P}of o.editing.view.createRangeIn(u))c.consumable.consume(P,{name:!0});return d},converterPriority:"low"}),n.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:c})=>{const d=u.getAttribute("htmlElementName"),g=c.createRawElement(d);return u.hasAttribute("htmlCustomElementAttributes")&&w(c,u.getAttribute("htmlCustomElementAttributes"),g),g}}),n.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:c})=>{const d=u.getAttribute("htmlElementName"),g=u.getAttribute("htmlContent"),A=c.createRawElement(d,null,(P,$)=>{$.setContentOf(P,g)});return u.hasAttribute("htmlCustomElementAttributes")&&w(c,u.getAttribute("htmlCustomElementAttributes"),A),A}})})}}function je(s){try{document.createElement(s)}catch{return!1}return!0}class tt extends f{static get pluginName(){return"GeneralHtmlSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[h,be,Ae,ve,ye,Fe,$e,De,Ve,He,Me,Le]}init(){const e=this.editor,r=e.plugins.get(h);r.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),r.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),r.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(e){const r=this.editor.plugins.get("DataSchema"),t=Array.from(r.getDefinitionsForView(e,!1)),i=t.find(o=>o.isInline&&!t[0].isObject);return i?i.model:b(e)}addModelHtmlClass(e,r,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(e);i.change(l=>{for(const n of y(i,t,o))v(l,n,o,"classes",m=>{for(const a of k(r))m.add(a)})})}removeModelHtmlClass(e,r,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(e);i.change(l=>{for(const n of y(i,t,o))v(l,n,o,"classes",m=>{for(const a of k(r))m.delete(a)})})}setModelHtmlAttributes(e,r,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(e);i.change(l=>{for(const n of y(i,t,o))v(l,n,o,"attributes",m=>{for(const[a,u]of Object.entries(r))m.set(a,u)})})}removeModelHtmlAttributes(e,r,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(e);i.change(l=>{for(const n of y(i,t,o))v(l,n,o,"attributes",m=>{for(const a of k(r))m.delete(a)})})}setModelHtmlStyles(e,r,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(e);i.change(l=>{for(const n of y(i,t,o))v(l,n,o,"styles",m=>{for(const[a,u]of Object.entries(r))m.set(a,u)})})}removeModelHtmlStyles(e,r,t){const i=this.editor.model,o=this.getGhsAttributeNameForElement(e);i.change(l=>{for(const n of y(i,t,o))v(l,n,o,"styles",m=>{for(const a of k(r))m.delete(a)})})}}function*y(s,e,r){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)s.schema.checkAttributeInSelection(e,r)&&(yield e);else for(const t of We(s,e,r))yield*t.getItems({shallow:!0})}function We(s,e,r){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?s.schema.checkAttribute(e,r)?[s.createRangeOn(e)]:[]:s.schema.getValidRanges(s.createSelection(e).getRanges(),r)}class rt extends f{static get pluginName(){return"HtmlComment"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,r=new Map;e.data.processor.skipComments=!1,e.model.schema.addAttributeCheck((t,i)=>{if(t.endsWith("$root")&&i.startsWith("$comment"))return!0}),e.conversion.for("upcast").elementToMarker({view:"$comment",model:t=>{const o=`$comment:${H()}`,l=t.getCustomProperty("$rawContent");return r.set(o,l),o}}),e.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(t,{writer:i})=>{let o;for(const a of this.editor.model.document.getRootNames())if(o=this.editor.model.document.getRoot(a),o.hasAttribute(t.markerName))break;const l=t.markerName,n=o.getAttribute(l),m=i.createUIElement("$comment");return i.setCustomProperty("$rawContent",n,m),m}}),e.model.document.registerPostFixer(t=>{let i=!1;const o=e.model.document.differ.getChangedMarkers().filter(l=>l.name.startsWith("$comment:"));for(const l of o){const{oldRange:n,newRange:m}=l.data;if(!(n&&m&&n.root==m.root)){if(n){const a=n.root;a.hasAttribute(l.name)&&(t.removeAttribute(l.name,a),i=!0)}if(m){const a=m.root;a.rootName=="$graveyard"?(t.removeMarker(l.name),i=!0):a.hasAttribute(l.name)||(t.setAttribute(l.name,r.get(l.name)||"",a),i=!0)}}}return i}),e.data.on("set",()=>{for(const t of e.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(t.name)},{priority:"high"}),e.model.on("deleteContent",(t,[i])=>{for(const o of i.getRanges()){const l=e.model.schema.getLimitElement(o),n=e.model.createPositionAt(l,0),m=e.model.createPositionAt(l,"end");let a;n.isTouching(o.start)&&m.isTouching(o.end)?a=this.getHtmlCommentsInRange(e.model.createRange(n,m)):a=this.getHtmlCommentsInRange(o,{skipBoundaries:!0});for(const u of a)this.removeHtmlComment(u)}},{priority:"high"})}createHtmlComment(e,r){const t=H(),o=this.editor.model,l=o.document.getRoot(e.root.rootName),n=`$comment:${t}`;return o.change(m=>{const a=m.createRange(e);return m.addMarker(n,{usingOperation:!0,affectsData:!0,range:a}),m.setAttribute(n,r,l),n})}removeHtmlComment(e){const r=this.editor,t=r.model.markers.get(e);return t?(r.model.change(i=>{i.removeMarker(t)}),!0):!1}getHtmlCommentData(e){const t=this.editor.model.markers.get(e);if(!t)return null;let i="";for(const o of this.editor.model.document.getRoots())if(o.hasAttribute(e)){i=o.getAttribute(e);break}return{content:i,position:t.getStart()}}getHtmlCommentsInRange(e,{skipBoundaries:r=!1}={}){const t=!r;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter(o=>i(o,e)).map(o=>o.name);function i(o,l){const n=o.getRange().start;return(n.isAfter(l.start)||t&&n.isEqual(l.start))&&(n.isBefore(l.end)||t&&n.isEqual(l.end))}}}class qe extends J{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let r="",t="";e=e.trim().replace(/<\?xml\s[^?]*\?>/i,m=>(t=m,"")),e=e.trim().replace(/^<!DOCTYPE\s[^>]*?>/i,m=>(r=m,""));const i=this._toDom(e),o=this.domConverter.domToView(i,{skipComments:this.skipComments}),l=new R(o.document);l.setCustomProperty("$fullPageDocument",i.ownerDocument.documentElement.outerHTML,o);const n=Array.from(i.ownerDocument.querySelectorAll("head style"));return l.setCustomProperty("$fullPageHeadStyles",n,o),r&&l.setCustomProperty("$fullPageDocType",r,o),t&&l.setCustomProperty("$fullPageXmlDeclaration",t,o),o}toData(e){let r=super.toData(e);const t=e.getCustomProperty("$fullPageDocument"),i=e.getCustomProperty("$fullPageDocType"),o=e.getCustomProperty("$fullPageXmlDeclaration");return t&&(r=t.replace(/<\/body\s*>/,r+"$&"),i&&(r=i+`
|
|
11
|
+
`+r),o&&(r=o+`
|
|
12
|
+
`+r)),r}}class it extends f{static get pluginName(){return"FullPage"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("htmlSupport.fullPage",{allowRenderStylesFromHead:!1,sanitizeCss:r=>(X("css-full-page-provide-sanitize-function"),{css:r,hasChanged:!1})}),e.data.processor=new qe(e.data.viewDocument)}init(){const e=this.editor,r=["$fullPageDocument","$fullPageDocType","$fullPageXmlDeclaration","$fullPageHeadStyles"];e.model.schema.extend("$root",{allowAttributes:r}),e.data.on("toModel",(t,[i])=>{const o=e.model.document.getRoot();e.model.change(l=>{for(const n of r){const m=i.getCustomProperty(n);m&&l.setAttribute(n,m,o)}}),G(e)&&this._renderStylesFromHead(o)},{priority:"low"}),e.data.on("toView",(t,[i])=>{if(!i.is("rootElement"))return;const o=i,l=t.return;if(!o.hasAttribute("$fullPageDocument"))return;const n=new R(l.document);for(const m of r){const a=o.getAttribute(m);a&&n.setCustomProperty(m,a,l)}},{priority:"low"}),e.data.on("set",()=>{const t=e.model.document.getRoot();e.model.change(i=>{for(const o of r)t.hasAttribute(o)&&i.removeAttribute(o,t)})},{priority:"high"}),e.data.on("get",(t,i)=>{i[0]||(i[0]={}),i[0].trim=!1},{priority:"high"})}destroy(){super.destroy(),G(this.editor)&&this._removeStyleElementsFromDom()}_removeStyleElementsFromDom(){const e=Array.from(V.document.querySelectorAll(`[data-full-page-style-id="${this.editor.id}"]`));for(const r of e)r.remove()}_renderStyleElementsInDom(e){const r=this.editor,t=e.getAttribute("$fullPageHeadStyles");if(!t)return;const i=r.config.get("htmlSupport.fullPage.sanitizeCss");for(const o of t){o.setAttribute("data-full-page-style-id",r.id);const l=i(o.innerText);l.hasChanged&&(o.innerText=l.css),V.document.head.append(o)}}_renderStylesFromHead(e){this._removeStyleElementsFromDom(),this._renderStyleElementsInDom(e)}}function G(s){return s.config.get("htmlSupport.fullPage.allowRenderStylesFromHead")}export{h as DataFilter,C as DataSchema,it as FullPage,tt as GeneralHtmlSupport,rt as HtmlComment,qe as HtmlPageDataProcessor};
|