@ncino/web-components 8.0.0 → 8.1.0-preview.8
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/index5.js +1 -1
- package/dist/_virtual/index6.js +1 -1
- package/dist/_virtual/index_html.js +1 -1
- package/dist/_virtual/index_react.js +1 -1
- package/dist/assets/node_modules/.pnpm/ckeditor5@46.1.1/node_modules/ckeditor5/dist/ckeditor5.css +1 -4
- package/dist/components/accordion/gator/base/accordion.gator.js +1 -1
- package/dist/components/accordion/gator/group/accordion-group.gator.js +1 -1
- package/dist/components/alert/gator/base/alert.gator.js +1 -1
- package/dist/components/alert/gator/subtitle/alert-subtitle.gator.js +1 -1
- package/dist/components/alert/gator/title/alert-title.gator.js +1 -1
- package/dist/components/avatar/gator/avatar.gator.js +1 -1
- package/dist/components/badge/gator/badge.gator.js +1 -1
- package/dist/components/banner/gator/banner.gator.js +1 -1
- package/dist/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.js +10 -4
- package/dist/components/button/gator/button.gator.js +1 -1
- package/dist/components/button-card/gator/button-card.gator.js +1 -1
- package/dist/components/card/card.js +1 -1
- package/dist/components/card/gator/base/card.gator.js +1 -1
- package/dist/components/card/gator/content/card-content.gator.js +1 -1
- package/dist/components/card/gator/footer/card-footer.gator.js +1 -1
- package/dist/components/card/gator/header/card-header.gator.js +1 -1
- package/dist/components/checkbox/checkbox.gator.js +1 -1
- package/dist/components/chip/gator/chip.gator.js +1 -1
- package/dist/components/date-picker/base/gator/datepicker.gator.js +1 -1
- package/dist/components/date-picker/year-month-selector/year-month-selector.gator.js +1 -1
- package/dist/components/display-card/gator/display-card.gator.js +1 -1
- package/dist/components/divider/gator/divider.gator.js +2 -2
- package/dist/components/fab/gator/fab.gator.js +1 -1
- package/dist/components/icon-button/gator/icon-button.gator.js +1 -1
- package/dist/components/illustration/gator/illustration.gator.js +1 -1
- package/dist/components/image-card/gator/image-card.gator.js +23 -19
- package/dist/components/input/base/input-base.gator.js +1 -1
- package/dist/components/input/gator/dropdown/input-dropdown.gator.js +15 -15
- package/dist/components/input/gator/help-text/help-text.gator.js +1 -1
- package/dist/components/input/gator/input-date/input-date.gator.js +14 -17
- package/dist/components/input/gator/input-label/input-label.gator.js +3 -3
- package/dist/components/input/gator/input-phone/input-phone.gator.js +1 -1
- package/dist/components/loading-spinner/gator/loading-spinner.gator.js +1 -1
- package/dist/components/menu/base/gator/menu.gator.js +1 -1
- package/dist/components/modal/gator/modal.gator.js +54 -50
- package/dist/components/page-header/gator/page-header.gator.js +3 -3
- package/dist/components/panel/gator/panel.storybook-test.js +1 -1
- package/dist/components/popover/gator/popover.gator.js +1 -1
- package/dist/components/progress-bar/gator/progress-bar.gator.js +18 -12
- package/dist/components/progress-ring/gator/progress-ring.gator.js +1 -1
- package/dist/components/selection-box/selection-box.gator.js +1 -1
- package/dist/components/selector/gator/selector.gator.js +1 -1
- package/dist/components/skeleton-loader/gator/skeleton-loader.gator.js +1 -1
- package/dist/components/switch/gator/switch.gator.js +1 -1
- package/dist/components/table/gator/table.gator.js +1 -1
- package/dist/components/tabs/gator/tabset/tabset.gator.js +1 -1
- package/dist/components/text-detail/gator/text-detail.gator.js +1 -1
- package/dist/components/text-link/gator/text-link.gator.js +1 -1
- package/dist/components/toast/gator/base/toast.gator.js +1 -1
- package/dist/components/toast/gator/subtitle/toast-subtitle.gator.js +1 -1
- package/dist/components/toast/gator/title/toast-title.gator.js +1 -1
- package/dist/components/toast-container/gator/toast-container.gator.js +1 -1
- package/dist/components/toaster/gator/toaster.gator.js +1 -1
- package/dist/components/tooltip/gator/tooltip.gator.js +1 -1
- package/dist/design-tokens.source.json +1 -1
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-alignment@46.1.1/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-autoformat@46.1.1/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -7
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-autosave@46.1.1/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-basic-styles@46.1.1/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-block-quote@46.1.1/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +2 -14
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-cloud-services@46.1.1/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-code-block@46.1.1/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-editor-classic@46.1.1/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +2 -29
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-enter@46.1.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -7
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-essentials@46.1.1/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-find-and-replace@46.1.1/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +2 -5
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-font@46.1.1/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -7
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-heading@46.1.1/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -7
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-highlight@46.1.1/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-horizontal-line@46.1.1/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@46.1.1/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@46.1.1/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +1 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@46.1.1/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@46.1.1/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-language@46.1.1/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@46.1.1/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@46.1.1/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -13
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-markdown-gfm@46.1.1/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +2 -5
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-media-embed@46.1.1/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -7
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-mention@46.1.1/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-page-break@46.1.1/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paragraph@46.1.1/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@46.1.1/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -31
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-remove-format@46.1.1/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-select-all@46.1.1/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-show-blocks@46.1.1/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@46.1.1/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@46.1.1/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-style@46.1.1/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@46.1.1/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -16
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +1 -13
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -25
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-undo@46.1.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-upload@46.1.1/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +3 -108
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-watchdog@46.1.1/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +1 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -4
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/package.json.js +1 -0
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/runtime.js +1 -5
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/default-msg.js +1 -5
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/deferred.js +1 -5
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/fnv1a64.js +1 -5
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/locale-status-event.js +1 -5
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-controller.js +1 -5
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-decorator.js +1 -5
- package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/str-tag.js +1 -5
- package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js +1 -5
- package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/custom-element.js +1 -5
- package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js +1 -5
- package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js +1 -5
- package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js +1 -5
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +1 -17
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +1 -7
- package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +1 -1
- package/dist/node_modules/.pnpm/axe-core@4.11.0/node_modules/axe-core/axe.js +1 -11
- package/dist/node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js +1 -6
- package/dist/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.js +1 -217
- package/dist/node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/conversions.js +1 -0
- package/dist/node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/index.js +1 -0
- package/dist/node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/route.js +1 -0
- package/dist/node_modules/.pnpm/color-string@2.1.4/node_modules/color-string/index.js +1 -0
- package/dist/node_modules/.pnpm/{color@5.0.2 → color@5.0.3}/node_modules/color/index.js +1 -1
- package/dist/node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js +1 -1
- package/dist/node_modules/.pnpm/libphonenumber-js@1.12.26/node_modules/libphonenumber-js/metadata.min.json.js +1 -0
- package/dist/node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/async-directive.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/if-defined.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/ref.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/repeat.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.js +1 -5
- package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js +1 -5
- package/dist/node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react.production.js +1 -9
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-JVSKG4YS.js +48 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-MM7DTO55.js +1 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-OPCDBBL3.js +6 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-SN4J4IQ3.js +1 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-VUAFL5XK.js +1 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/client-logger/index.js +1 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/core-events/index.js +1 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/instrumenter/index.js +1 -0
- package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/test/index.js +152 -0
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/index.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/body.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/frame.js +1 -1
- package/dist/packages/{web-components/src/tokens/semantic.tokens.scss.js → styles/src/gator/tokens/semantic.tokens.css.js} +1 -1
- package/dist/packages/web-components/src/components/alert/gator/title/alert-title.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/badge/gator/badge.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/button-card/gator/button-card.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/card/gator/base/card.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/card/gator/content/card-content.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/card/gator/footer/card-footer.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/card/gator/header/card-header.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/checkbox-group/checkbox-group.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/chip/gator/chip.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/date-picker/base/gator/datepicker.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/date-picker/year-month-selector/year-month-selector.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/display-card/gator/display-card.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/divider/gator/divider.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/fab/gator/fab.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/guided-nav/gator/guided-nav-substep/guided-nav-substep.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/headline-card/gator/headline-card.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/icon/gator/icon.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/illustration/gator/illustration.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/image-card/gator/image-card.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/dropdown/input-dropdown.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/help-text/help-text.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-date/input-date.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-file/input-file.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-label/input-label.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-search/input-search.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/input.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/list/gator/list-item/list-item.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/menu/base/gator/menu.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/page-header/gator/page-header.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/panel/gator/panel.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/popover/gator/popover.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/progress-bar/gator/progress-bar.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/selection-box/selection-box.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/skip-link/gator/base/skip-link.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/skip-link/gator/list-item/skip-link-list-item.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/table/gator/table-bulk-controls/table-bulk-controls.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/table/gator/table-controls/table-controls.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/table/gator/table-pagination/table-pagination.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/table/gator/table.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/tabs/gator/tabs.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/text-link/gator/text-link.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/time-picker/gator/time-picker.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/gator/title/toast-title.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/toaster/gator/toaster.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/tooltip/gator/tooltip.gator.scss.js +1 -1
- package/dist/packages/web-components/src/index.slds.scss.js +1 -1
- package/dist/types/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.d.ts +3 -5
- package/dist/types/components/image-card/gator/image-card.gator.d.ts +5 -1
- package/dist/types/components/input/gator/input-date/input-date.gator.d.ts +7 -0
- package/dist/types/components/modal/gator/modal.gator.d.ts +16 -3
- package/dist/types/components/page-header/gator/page-header.gator.d.ts +0 -1
- package/dist/types/components/progress-bar/gator/progress-bar.gator.d.ts +8 -0
- package/dist/types/generated/locale-codes.d.ts +10 -0
- package/dist/types/generated/locales/es-419.d.ts +6 -1
- package/dist/types/generated/locales/fr-CA.d.ts +6 -1
- package/dist/types/generated/locales/zh-Hans.d.ts +6 -1
- package/dist/utils/brand-color-utils.js +1 -1
- package/dist/utils/components/ngc-component.js +1 -1
- package/dist/utils/vitest-a11y-utils.js +1 -1
- package/package.json +21 -21
- package/web-types.json +15 -5
- package/dist/generated/locale-codes.d.js +0 -1
- package/dist/generated/locales/es-419.d.js +0 -1
- package/dist/generated/locales/fr-CA.d.js +0 -1
- package/dist/generated/locales/zh-Hans.d.js +0 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.7/node_modules/@figma/code-connect/package.json.js +0 -1
- package/dist/node_modules/.pnpm/color-string@2.0.1/node_modules/color-string/index.js +0 -1
- package/dist/node_modules/.pnpm/libphonenumber-js@1.12.24/node_modules/libphonenumber-js/metadata.min.json.js +0 -1
- package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.9.1_typescript@5._a0e195139f137e7eecc50e9c6275adcc/node_modules/storybook/dist/client-logger/index.js +0 -1
- package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.9.1_typescript@5._a0e195139f137e7eecc50e9c6275adcc/node_modules/storybook/dist/core-events/index.js +0 -1
- package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.9.1_typescript@5._a0e195139f137e7eecc50e9c6275adcc/node_modules/storybook/dist/instrumenter/index.js +0 -48
- package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.9.1_typescript@5._a0e195139f137e7eecc50e9c6275adcc/node_modules/storybook/dist/test/index.js +0 -217
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/client/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/client/figma_client.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/common/fetch.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/common/logging.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/common/updates.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/external_types.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/figma_rest_api.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/helpers.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/index_common.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/html/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/html/index_html.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/html/template_literal.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/react/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/react/index_react.js +0 -0
- /package/dist/node_modules/.pnpm/{@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.9.1_typescript@5.9.3__playwright@1.56.1__f267599ff27ed4cacb9e62a386256df6 → @vitest_browser@3.2.4_msw@2.7.3_@types_node@24.10.0_typescript@5.9.3__playwright@1.56.1_fa5be4b0345b48b65ec4b7072214c2b3}/node_modules/@vitest/browser/context.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/ParseError.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/PhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/constants.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/format.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/isObject.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/isPossible.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/isValid.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/metadata.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/normalizeArguments.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parse.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/tools/semver-compare.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.9.1_@vitest_browser@3.2.4_@vitest_ui@3._1eebb5b0859be5c5eee8a8981f7b0151 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.9.1_@vitest_browser@3.2.4_@vitest_ui@3._1eebb5b0859be5c5eee8a8981f7b0151 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.9.1_@vitest_browser@3.2.4_@vitest_ui@3._1eebb5b0859be5c5eee8a8981f7b0151 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.9.1_@vitest_browser@3.2.4_@vitest_ui@3._1eebb5b0859be5c5eee8a8981f7b0151 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +0 -0
- /package/dist/packages/{web-components/src/tokens/primitive.tokens.scss.js → styles/src/gator/tokens/primitive.tokens.css.js} +0 -0
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import{Plugin as m,Command as E}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Observer as b,BubblingEventInfo as v,ViewDocumentDomEventData as k}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{env as S}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js"
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*//**
|
|
5
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
7
|
-
*/function*p(s,e){for(const t of e)t&&s.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}class y extends E{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,n=t.document.selection,i=t.schema,o=n.isCollapsed,r=n.getFirstRange(),a=r.start.parent,c=r.end.parent;if(i.isLimit(a)||i.isLimit(c))return!o&&a==c&&t.deleteContent(n),!1;if(o){const l=p(e.model.schema,n.getAttributes());return f(e,r.start),e.setSelectionAttribute(l),!0}else{const l=!(r.start.isAtStart&&r.end.isAtEnd),g=a==c;if(t.deleteContent(n,{leaveUnmerged:l}),l){if(g)return f(e,n.focus),!0;e.setSelection(c,0)}}return!1}}function f(s,e){s.split(e),s.setSelection(e.parent.nextSibling,0)}const C={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class h extends b{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",(i,o)=>{n=o.shiftKey}),t.on("beforeinput",(i,o)=>{if(!this.isEnabled)return;let r=o.inputType;S.isSafari&&n&&r=="insertParagraph"&&(r="insertLineBreak");const a=o.domEvent,c=C[r];if(!c)return;const l=new v(t,"enter",o.targetRanges[0]);t.fire(l,new k(e,a,{isSoft:c.isSoft})),l.stop.called&&i.stop()})}observe(){}stopObserving(){}}class D extends m{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,i=this.editor.t;t.addObserver(h),e.commands.add("enter",new y(e)),this.listenTo(n,"enter",(o,r)=>{n.isComposing||r.preventDefault(),!r.isSoft&&(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class T extends E{execute(){const e=this.editor.model,t=e.document;e.change(n=>{A(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=x(e.schema,t.selection)}}function x(s,e){if(e.rangeCount>1)return!1;const t=e.anchor;if(!t||!s.checkChild(t,"softBreak"))return!1;const n=e.getFirstRange(),i=n.start.parent,o=n.end.parent;return!((d(i,s)||d(o,s))&&i!==o)}function A(s,e,t){const n=t.isCollapsed,i=t.getFirstRange(),o=i.start.parent,r=i.end.parent,a=o==r;if(n){const c=p(s.schema,t.getAttributes());u(s,e,i.end),e.removeSelectionAttribute(t.getAttributeKeys()),e.setSelectionAttribute(c)}else{const c=!(i.start.isAtStart&&i.end.isAtEnd);s.deleteContent(t,{leaveUnmerged:c}),a?u(s,e,t.focus):c&&e.setSelection(r,0)}}function u(s,e,t){const n=e.createElement("softBreak");s.insertContent(n,t),e.setSelection(n,"after")}function d(s,e){return s.is("rootElement")?!1:e.isLimit(s)||d(s.parent,e)}class I extends m{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.conversion,i=e.editing.view,o=i.document,r=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(a,{writer:c})=>c.createEmptyElement("br")}),i.addObserver(h),e.commands.add("shiftEnter",new T(e)),this.listenTo(o,"enter",(a,c)=>{o.isComposing||c.preventDefault(),c.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r("Insert a soft break (a <code><br></code> element)"),keystroke:"Shift+Enter"}]})}}export{D as Enter,y as EnterCommand,h as EnterObserver,I as ShiftEnter,T as ShiftEnterCommand,p as _getCopyOnEnterAttributes};
|
|
1
|
+
import{Plugin as m,Command as E}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Observer as b,BubblingEventInfo as v,ViewDocumentDomEventData as k}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{env as S}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";function*p(s,e){for(const t of e)t&&s.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}class y extends E{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,n=t.document.selection,i=t.schema,o=n.isCollapsed,r=n.getFirstRange(),a=r.start.parent,c=r.end.parent;if(i.isLimit(a)||i.isLimit(c))return!o&&a==c&&t.deleteContent(n),!1;if(o){const l=p(e.model.schema,n.getAttributes());return f(e,r.start),e.setSelectionAttribute(l),!0}else{const l=!(r.start.isAtStart&&r.end.isAtEnd),g=a==c;if(t.deleteContent(n,{leaveUnmerged:l}),l){if(g)return f(e,n.focus),!0;e.setSelection(c,0)}}return!1}}function f(s,e){s.split(e),s.setSelection(e.parent.nextSibling,0)}const C={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class h extends b{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",(i,o)=>{n=o.shiftKey}),t.on("beforeinput",(i,o)=>{if(!this.isEnabled)return;let r=o.inputType;S.isSafari&&n&&r=="insertParagraph"&&(r="insertLineBreak");const a=o.domEvent,c=C[r];if(!c)return;const l=new v(t,"enter",o.targetRanges[0]);t.fire(l,new k(e,a,{isSoft:c.isSoft})),l.stop.called&&i.stop()})}observe(){}stopObserving(){}}class D extends m{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,i=this.editor.t;t.addObserver(h),e.commands.add("enter",new y(e)),this.listenTo(n,"enter",(o,r)=>{n.isComposing||r.preventDefault(),!r.isSoft&&(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class T extends E{execute(){const e=this.editor.model,t=e.document;e.change(n=>{A(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=x(e.schema,t.selection)}}function x(s,e){if(e.rangeCount>1)return!1;const t=e.anchor;if(!t||!s.checkChild(t,"softBreak"))return!1;const n=e.getFirstRange(),i=n.start.parent,o=n.end.parent;return!((d(i,s)||d(o,s))&&i!==o)}function A(s,e,t){const n=t.isCollapsed,i=t.getFirstRange(),o=i.start.parent,r=i.end.parent,a=o==r;if(n){const c=p(s.schema,t.getAttributes());u(s,e,i.end),e.removeSelectionAttribute(t.getAttributeKeys()),e.setSelectionAttribute(c)}else{const c=!(i.start.isAtStart&&i.end.isAtEnd);s.deleteContent(t,{leaveUnmerged:c}),a?u(s,e,t.focus):c&&e.setSelection(r,0)}}function u(s,e,t){const n=e.createElement("softBreak");s.insertContent(n,t),e.setSelection(n,"after")}function d(s,e){return s.is("rootElement")?!1:e.isLimit(s)||d(s.parent,e)}class I extends m{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.conversion,i=e.editing.view,o=i.document,r=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(a,{writer:c})=>c.createEmptyElement("br")}),i.addObserver(h),e.commands.add("shiftEnter",new T(e)),this.listenTo(o,"enter",(a,c)=>{o.isComposing||c.preventDefault(),c.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r("Insert a soft break (a <code><br></code> element)"),keystroke:"Shift+Enter"}]})}}export{D as Enter,y as EnterCommand,h as EnterObserver,I as ShiftEnter,T as ShiftEnterCommand,p as _getCopyOnEnterAttributes};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import{Plugin as t}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Clipboard as r}from"../../../../../@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Enter as i,ShiftEnter as e}from"../../../../../@ckeditor_ckeditor5-enter@46.1.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{SelectAll as o}from"../../../../../@ckeditor_ckeditor5-select-all@46.1.1/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js";import{Typing as s}from"../../../../../@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Undo as m}from"../../../../../@ckeditor_ckeditor5-undo@46.1.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";import{AccessibilityHelp as l}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js"
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class d extends t{static get requires(){return[l,r,i,o,e,s,m]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}export{d as Essentials};
|
|
1
|
+
import{Plugin as t}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Clipboard as r}from"../../../../../@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Enter as i,ShiftEnter as e}from"../../../../../@ckeditor_ckeditor5-enter@46.1.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{SelectAll as o}from"../../../../../@ckeditor_ckeditor5-select-all@46.1.1/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js";import{Typing as s}from"../../../../../@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Undo as m}from"../../../../../@ckeditor_ckeditor5-undo@46.1.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";import{AccessibilityHelp as l}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class d extends t{static get requires(){return[l,r,i,o,e,s,m]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}export{d as Essentials};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import{Plugin as p,Command as _}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconFindReplace as w,IconPreviousArrow as x}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{Dialog as T,DropdownView as F,createDropdown as v,FormHeaderView as B,ButtonView as V,MenuBarMenuListItemButtonView as A,DialogViewPosition as I,CssTransitionDisablerMixin as E,View as g,ViewCollection as D,FocusCycler as O,submitHandler as S,CollapsibleView as P,SwitchButtonView as b,LabeledFieldView as M,createLabeledInputText as N}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{scrollViewportToShowTarget as H,Collection as m,uid as W,ObservableMixin as $,FocusTracker as L,KeystrokeHandler as U,isVisible as q,Rect as G}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{debounce as K}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/debounce.js";import{escapeRegExp as j}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js";/**
|
|
2
|
-
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class z extends g{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(t){super(t);const e=t.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(i,s)=>i>0&&!s),this._findInputView=this._createInputField(e("Find in text…")),this._findPrevButtonView=this._createButton({label:e("Previous result"),class:"ck-button-prev",icon:x,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:e("Next result"),class:"ck-button-next",icon:x,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(e("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:e("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:e("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:e("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new L,this._keystrokes=new U,this._focusables=new D,this.focusCycler=new O({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),S({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(t){t===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const t=this.locale,e=t.t,i=new g(t);return this._findInputView.fieldView.on("input",()=>{this.isDirty=!0}),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:s})=>s),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:s})=>s),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:s},n)=>s&&n),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(s,n)=>s||!n?"":e("Tip: Find some text first in order to replace it.")),i.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),i}_onFindButtonExecute(){if(!this._textToFind){const t=this.t;this._findInputView.errorText=t("Text to find must not be empty.");return}this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly})}_injectFindResultsCounter(){const t=this.locale,e=t.t,i=this.bindTemplate,s=new g(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(o,r)=>e("%0 of %1",[o,r])),s.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});const n=()=>{const o=this._findInputView.fieldView.element;if(!o||!q(o))return;const r=new G(s.element).width,h=t.uiLanguageDirection==="ltr"?"paddingRight":"paddingLeft";r?o.style[h]=`calc( 2 * var(--ck-spacing-standard) + ${r}px )`:o.style[h]=""};this.on("change:_resultsCounterText",n,{priority:"low"}),this.on("change:isDirty",n,{priority:"low"}),this._findInputView.template.children[0].children.push(s)}_createAdvancedOptionsCollapsible(){const t=this.locale.t,e=new P(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return e.set({label:t("Advanced options"),isCollapsed:!0}),e}_createActionButtonsDiv(){const t=new g(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},i)=>e&&i),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:e},i)=>e&&i),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),t.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),t}_createMatchCaseSwitch(){const t=this.locale.t,e=new b(this.locale);return e.set({label:t("Match case"),withText:!0}),e.bind("isOn").to(this,"_matchCase"),e.on("execute",()=>{this._matchCase=!this._matchCase,this.isDirty=!0}),e}_createWholeWordsOnlySwitch(){const t=this.locale.t,e=new b(this.locale);return e.set({label:t("Whole words only"),withText:!0}),e.bind("isOn").to(this,"_wholeWordsOnly"),e.on("execute",()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),e}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}_initKeystrokeHandling(){const t=i=>i.stopPropagation(),e=i=>{i.stopPropagation(),i.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",i=>{e(i),this._findNextButtonView.fire("execute")}),this._keystrokes.set("shift+f3",i=>{e(i),this._findPrevButtonView.fire("execute")}),this._keystrokes.set("enter",i=>{const s=i.target;s===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i)):s===this._replaceInputView.fieldView.element&&!this.isDirty&&(this._replaceButtonView.fire("execute"),e(i))}),this._keystrokes.set("shift+enter",i=>{i.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i))}),this._keystrokes.set("arrowright",t),this._keystrokes.set("arrowleft",t),this._keystrokes.set("arrowup",t),this._keystrokes.set("arrowdown",t)}_createButton(t){const e=new V(this.locale);return e.set(t),e}_createInputField(t,e){const i=new M(this.locale,N);return i.label=t,i.class=e,i}}class Q extends p{static get requires(){return[T]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}formView;constructor(t){super(t),t.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){const t=this.editor,e=t.config.get("findAndReplace.uiType")==="dropdown",i=t.commands.get("find"),s=this.editor.t;t.ui.componentFactory.add("findAndReplace",()=>{let n;return e?(n=this._createDropdown(),n.bind("isEnabled").to(i)):n=this._createDialogButtonForToolbar(),t.keystrokes.set("Ctrl+F",(o,r)=>{if(i.isEnabled){if(n instanceof F){const h=n.buttonView;h.isOn||h.fire("execute")}else n.isOn?t.plugins.get("Dialog").view.focus():n.fire("execute");r()}}),n}),e||t.ui.componentFactory.add("menuBar:findAndReplace",()=>this._createDialogButtonForMenuBar()),t.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const t=this.editor,e=t.locale.t,i=v(t.locale);return i.once("change:isOpen",()=>{this.formView=this._createFormView(),this.formView.children.add(new B(t.locale,{label:e("Find and replace")}),0),i.panelView.children.add(this.formView)}),i.on("change:isOpen",(s,n,o)=>{o?this._setupFormView():this.fire("searchReseted")},{priority:"low"}),i.buttonView.set({icon:w,label:e("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),i}_createDialogButtonForToolbar(){const t=this.editor,e=this._createButton(V),i=t.plugins.get("Dialog");return e.set({tooltip:!0}),e.bind("isOn").to(i,"id",s=>s==="findAndReplace"),e.on("execute",()=>{e.isOn?i.hide():this._showDialog()}),e}_createDialogButtonForMenuBar(){const t=this._createButton(A),e=this.editor.plugins.get("Dialog"),i=this.editor.plugins.get("Dialog");return t.set({role:"menuitemcheckbox",isToggleable:!0}),t.bind("isOn").to(i,"id",s=>s==="findAndReplace"),t.on("execute",()=>{if(e.id==="findAndReplace"){e.hide();return}this._showDialog()}),t}_createButton(t){const e=this.editor,i=e.commands.get("find"),s=new t(e.locale),n=e.locale.t;return s.bind("isEnabled").to(i),s.set({icon:w,label:n("Find and replace"),keystroke:"CTRL+F"}),s}_showDialog(){const t=this.editor,e=t.plugins.get("Dialog"),i=t.locale.t;this.formView||(this.formView=this._createFormView()),e.show({id:"findAndReplace",title:i("Find and replace"),content:this.formView,position:I.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const t=this.editor,e=new(E(z))(t.locale),i=t.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state;e.bind("highlightOffset").to(n,"highlightedOffset"),e.listenTo(n.results,"change",()=>{e.matchCount=n.results.length});const o=i.get("findNext"),r=i.get("findPrevious"),h=i.get("replace"),a=i.get("replaceAll");return e.bind("_areCommandsEnabled").to(o,"isEnabled",r,"isEnabled",h,"isEnabled",a,"isEnabled",(l,d,u,f)=>({findNext:l,findPrevious:d,replace:u,replaceAll:f})),e.delegate("findNext","findPrevious","replace","replaceAll").to(this),e.on("change:isDirty",(l,d,u)=>{u&&this.fire("searchReseted")}),e}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}}class Z extends _{_state;constructor(t,e){super(t),this.isEnabled=!0,this.affectsData=!1,this._state=e}execute(t,{matchCase:e,wholeWords:i}={}){const{editor:s}=this,{model:n}=s,o=s.plugins.get("FindAndReplaceUtils");let r,h="";typeof t=="string"?r=(...d)=>({results:o.findByTextCallback(t,{matchCase:e,wholeWords:i})(...d),searchText:t}):r=t;const a=r;r=(...d)=>{const u=a(...d);return u&&"searchText"in u&&(h=u.searchText),u};const l=n.document.getRootNames().reduce((d,u)=>o.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(u)),n,r,d),null);return this._state.clear(n),this._state.results.addMany(l),this._state.highlightedResult=l.get(0),this._state.searchText=h,r&&(this._state.lastSearchCallback=r),this._state.matchCase=!!e,this._state.matchWholeWords=!!i,{results:l,findCallback:r}}}class J extends $(){constructor(t){super(),this.set("results",new m),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",(e,{removed:i,index:s})=>{if(Array.from(i).length){let n=!1;if(t.change(o=>{for(const r of i)this.highlightedResult===r&&(n=!0),t.markers.has(r.marker.name)&&o.removeMarker(r.marker)}),n){const o=s>=this.results.length?0:s;this.highlightedResult=this.results.get(o)}}}),this.on("change:highlightedResult",()=>{this.refreshHighlightOffset(t)})}clear(t){this.searchText="",t.change(e=>{if(this.highlightedResult){const i=this.highlightedResult.marker.name.split(":")[1],s=t.markers.get(`findResultHighlighted:${i}`);s&&e.removeMarker(s)}[...this.results].forEach(({marker:i})=>{e.removeMarker(i)})}),this.results.clear()}refreshHighlightOffset(t){const{highlightedResult:e,results:i}=this;e?this.highlightedOffset=R(t,[...i]).indexOf(e)+1:this.highlightedOffset=0}}function R(c,t){const e={before:-1,same:0,after:1,different:1};return c.document.getRootNames().flatMap(i=>t.filter(s=>s.marker.getStart().root.rootName===i).sort((s,n)=>e[s.marker.getStart().compareWith(n.marker.getStart())]))}class k extends _{_state;constructor(t,e){super(t),this.isEnabled=!0,this._state=e,this._isEnabledBasedOnSelection=!1}_replace(t,e){const{model:i}=this.editor,s=e.marker.getRange();i.canEditAt(s)&&i.change(n=>{if(s.root.rootName==="$graveyard"){this._state.results.remove(e);return}let o={};for(const r of s.getItems())if(r.is("$text")||r.is("$textProxy")){o=r.getAttributes();break}i.insertContent(n.createText(t,o),s),this._state.results.has(e)&&this._state.results.remove(e)})}}class X extends k{execute(t,e){const i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(t,e),this._state.results.length){const s=R(this.editor.model,[...this._state.results]);this._state.highlightedResult=s[i%s.length]}}}class Y extends k{execute(t,e){const{editor:i}=this,{model:s}=i,n=i.plugins.get("FindAndReplaceUtils"),o=e instanceof m?e:s.document.getRootNames().reduce((r,h)=>n.updateFindResultFromRange(s.createRangeIn(s.document.getRoot(h)),s,n.findByTextCallback(e,this._state),r),null);o.length&&s.change(()=>{[...o].forEach(r=>{this._replace(t,r)})})}}class C extends _{_state;constructor(t,e){super(t),this.affectsData=!1,this._state=e,this.isEnabled=!1,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1})}refresh(){this.isEnabled=this._state.results.length>1}execute(){const t=this._state.results,e=t.getIndex(this._state.highlightedResult),i=e+1>=t.length?0:e+1;this._state.highlightedResult=this._state.results.get(i)}}class ee extends C{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),i=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(i)}}class te extends p{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(t,e,i,s){const n=s||new m,o=r=>n.find(h=>{const{marker:a}=h,l=a.getRange(),d=r.getRange();return l.isEqual(d)});return e.change(r=>{[...t].forEach(({type:h,item:a})=>{if(h==="elementStart"&&e.schema.checkChild(a,"$text")){let l=i({item:a,text:this.rangeToText(e.createRangeIn(a))});if(!l)return;"results"in l&&(l=l.results),l.forEach(d=>{const u=`findResult:${W()}`,f=r.addMarker(u,{usingOperation:!1,affectsData:!1,range:r.createRange(r.createPositionAt(a,d.start),r.createPositionAt(a,d.end))}),y=ie(n,f);o(f)||n.add({id:u,label:d.label,marker:f},y)})}})}),n}rangeToText(t){return Array.from(t.getItems({shallow:!0})).reduce((e,i)=>i.is("$text")||i.is("$textProxy")?e+i.data:`${e}
|
|
5
|
-
`,"")}findByTextCallback(t,e){let i="gu";e.matchCase||(i+="i");let s=`(${j(t)})`;if(e.wholeWords){const r="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+r).test(t)||(s=`(^|${r}|_)${s}`),new RegExp(r+"$").test(t)||(s=`${s}(?=_|${r}|$)`)}const n=new RegExp(s,i);function o({text:r}){return[...r.matchAll(n)].map(se)}return o}}function ie(c,t){const e=c.find(({marker:i})=>t.getStart().isBefore(i.getStart()));return e?c.getIndex(e):c.length}function se(c){const t=c.length-1;let e=c.index;return c.length===3&&(e+=c[1].length),{label:c[t],start:e,end:e+c[t].length}}const ne="ck-find-result_selected";class re extends p{static get requires(){return[te]}static get pluginName(){return"FindAndReplaceEditing"}static get isOfficialPlugin(){return!0}state;init(){this.state=new J(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",(i,s,n,o)=>{const{model:r}=this.editor;r.change(h=>{if(o){const a=o.marker.name.split(":")[1],l=r.markers.get(`findResultHighlighted:${a}`);l&&h.removeMarker(l)}if(n){const a=n.marker.name.split(":")[1];h.addMarker(`findResultHighlighted:${a}`,{usingOperation:!1,affectsData:!1,range:n.marker.getRange()})}})});/* istanbul ignore next -- @preserve */const e=K(((i,s,n)=>{if(n){const o=this.editor.editing.view.domConverter,r=this.editor.editing.mapper.toViewRange(n.marker.getRange());H({target:o.viewRangeToDom(r),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",e,{priority:"low"}),this.listenTo(this.editor,"destroy",e.cancel),this.on("change:_isSearchActive",(i,s,n)=>{n?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange)})}find(t,e){return this._isSearchActive=!0,this.editor.execute("find",t,e),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add("find",new Z(this.editor,this.state)),this.editor.commands.add("findNext",new C(this.editor,this.state)),this.editor.commands.add("findPrevious",new ee(this.editor,this.state)),this.editor.commands.add("replace",new X(this.editor,this.state)),this.editor.commands.add("replaceAll",new Y(this.editor,this.state))}_defineConverters(){const{editor:t}=this;t.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:e})=>{const[,i]=e.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":i}}}}),t.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:e})=>{const[,i]=e.split(":");return{name:"span",classes:[ne],attributes:{"data-find-result":i}}}})}_onDocumentChange=()=>{const t=new Set,e=new Set,i=this.editor.model,{results:s}=this.state,n=i.document.differ.getChanges(),o=i.document.differ.getChangedMarkers();n.forEach(a=>{a.position&&(a.name==="$text"||a.position.nodeAfter&&i.schema.isInline(a.position.nodeAfter)?(t.add(a.position.parent),[...i.markers.getMarkersAtPosition(a.position)].forEach(l=>{e.add(l.name)})):a.type==="insert"&&a.position.nodeAfter&&t.add(a.position.nodeAfter))}),o.forEach(({name:a,data:{newRange:l}})=>{l&&l.start.root.rootName==="$graveyard"&&e.add(a)}),t.forEach(a=>{[...i.markers.getMarkersIntersectingRange(i.createRangeIn(a))].forEach(d=>e.add(d.name))}),e.forEach(a=>{s.has(a)&&(s.get(a)===this.state.highlightedResult&&(this.state.highlightedResult=null),s.remove(a))});const r=[],h=this.editor.plugins.get("FindAndReplaceUtils");t.forEach(a=>{const l=h.updateFindResultFromRange(i.createRangeOn(a),i,this.state.lastSearchCallback,s);r.push(...l)}),o.forEach(a=>{if(a.data.newRange){const l=h.updateFindResultFromRange(a.data.newRange,i,this.state.lastSearchCallback,s);r.push(...l)}}),!this.state.highlightedResult&&r.length?this.state.highlightedResult=r[0]:this.state.refreshHighlightOffset(i)}}class ue extends p{static get requires(){return[re,Q]}static get pluginName(){return"FindAndReplace"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.plugins.get("FindAndReplaceUI"),e=this.editor.plugins.get("FindAndReplaceEditing"),i=e.state;t.on("findNext",(s,n)=>{n?(i.searchText=n.searchText,e.find(n.searchText,n)):this.editor.execute("findNext")}),t.on("findPrevious",(s,n)=>{n&&i.searchText!==n.searchText?e.find(n.searchText):this.editor.execute("findPrevious")}),t.on("replace",(s,n)=>{i.searchText!==n.searchText&&e.find(n.searchText);const o=i.highlightedResult;o&&this.editor.execute("replace",n.replaceText,o)}),t.on("replaceAll",(s,n)=>{i.searchText!==n.searchText&&e.find(n.searchText),this.editor.execute("replaceAll",n.replaceText,i.results)}),t.on("searchReseted",()=>{i.clear(this.editor.model),e.stop()})}}export{ue as FindAndReplace,re as FindAndReplaceEditing,z as FindAndReplaceFormView,J as FindAndReplaceState,Q as FindAndReplaceUI,te as FindAndReplaceUtils,Z as FindCommand,C as FindNextCommand,ee as FindPreviousCommand,k as FindReplaceCommandBase,Y as ReplaceAllCommand,X as ReplaceCommand,R as _sortFindResultsByMarkerPositions};
|
|
1
|
+
import{Plugin as p,Command as _}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconFindReplace as w,IconPreviousArrow as x}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{Dialog as T,DropdownView as F,createDropdown as v,FormHeaderView as B,ButtonView as V,MenuBarMenuListItemButtonView as A,DialogViewPosition as I,CssTransitionDisablerMixin as E,View as g,ViewCollection as D,FocusCycler as O,submitHandler as S,CollapsibleView as P,SwitchButtonView as b,LabeledFieldView as M,createLabeledInputText as N}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{scrollViewportToShowTarget as H,Collection as m,uid as W,ObservableMixin as $,FocusTracker as L,KeystrokeHandler as U,isVisible as q,Rect as G}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{debounce as K}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/debounce.js";import{escapeRegExp as j}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js";class z extends g{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(t){super(t);const e=t.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(i,s)=>i>0&&!s),this._findInputView=this._createInputField(e("Find in text…")),this._findPrevButtonView=this._createButton({label:e("Previous result"),class:"ck-button-prev",icon:x,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:e("Next result"),class:"ck-button-next",icon:x,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(e("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:e("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:e("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:e("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new L,this._keystrokes=new U,this._focusables=new D,this.focusCycler=new O({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),S({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(t){t===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const t=this.locale,e=t.t,i=new g(t);return this._findInputView.fieldView.on("input",()=>{this.isDirty=!0}),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:s})=>s),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:s})=>s),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:s},n)=>s&&n),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(s,n)=>s||!n?"":e("Tip: Find some text first in order to replace it.")),i.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),i}_onFindButtonExecute(){if(!this._textToFind){const t=this.t;this._findInputView.errorText=t("Text to find must not be empty.");return}this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly})}_injectFindResultsCounter(){const t=this.locale,e=t.t,i=this.bindTemplate,s=new g(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(o,r)=>e("%0 of %1",[o,r])),s.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});const n=()=>{const o=this._findInputView.fieldView.element;if(!o||!q(o))return;const r=new G(s.element).width,h=t.uiLanguageDirection==="ltr"?"paddingRight":"paddingLeft";r?o.style[h]=`calc( 2 * var(--ck-spacing-standard) + ${r}px )`:o.style[h]=""};this.on("change:_resultsCounterText",n,{priority:"low"}),this.on("change:isDirty",n,{priority:"low"}),this._findInputView.template.children[0].children.push(s)}_createAdvancedOptionsCollapsible(){const t=this.locale.t,e=new P(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return e.set({label:t("Advanced options"),isCollapsed:!0}),e}_createActionButtonsDiv(){const t=new g(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},i)=>e&&i),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:e},i)=>e&&i),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),t.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),t}_createMatchCaseSwitch(){const t=this.locale.t,e=new b(this.locale);return e.set({label:t("Match case"),withText:!0}),e.bind("isOn").to(this,"_matchCase"),e.on("execute",()=>{this._matchCase=!this._matchCase,this.isDirty=!0}),e}_createWholeWordsOnlySwitch(){const t=this.locale.t,e=new b(this.locale);return e.set({label:t("Whole words only"),withText:!0}),e.bind("isOn").to(this,"_wholeWordsOnly"),e.on("execute",()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),e}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}_initKeystrokeHandling(){const t=i=>i.stopPropagation(),e=i=>{i.stopPropagation(),i.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",i=>{e(i),this._findNextButtonView.fire("execute")}),this._keystrokes.set("shift+f3",i=>{e(i),this._findPrevButtonView.fire("execute")}),this._keystrokes.set("enter",i=>{const s=i.target;s===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i)):s===this._replaceInputView.fieldView.element&&!this.isDirty&&(this._replaceButtonView.fire("execute"),e(i))}),this._keystrokes.set("shift+enter",i=>{i.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i))}),this._keystrokes.set("arrowright",t),this._keystrokes.set("arrowleft",t),this._keystrokes.set("arrowup",t),this._keystrokes.set("arrowdown",t)}_createButton(t){const e=new V(this.locale);return e.set(t),e}_createInputField(t,e){const i=new M(this.locale,N);return i.label=t,i.class=e,i}}class Q extends p{static get requires(){return[T]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}formView;constructor(t){super(t),t.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){const t=this.editor,e=t.config.get("findAndReplace.uiType")==="dropdown",i=t.commands.get("find"),s=this.editor.t;t.ui.componentFactory.add("findAndReplace",()=>{let n;return e?(n=this._createDropdown(),n.bind("isEnabled").to(i)):n=this._createDialogButtonForToolbar(),t.keystrokes.set("Ctrl+F",(o,r)=>{if(i.isEnabled){if(n instanceof F){const h=n.buttonView;h.isOn||h.fire("execute")}else n.isOn?t.plugins.get("Dialog").view.focus():n.fire("execute");r()}}),n}),e||t.ui.componentFactory.add("menuBar:findAndReplace",()=>this._createDialogButtonForMenuBar()),t.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const t=this.editor,e=t.locale.t,i=v(t.locale);return i.once("change:isOpen",()=>{this.formView=this._createFormView(),this.formView.children.add(new B(t.locale,{label:e("Find and replace")}),0),i.panelView.children.add(this.formView)}),i.on("change:isOpen",(s,n,o)=>{o?this._setupFormView():this.fire("searchReseted")},{priority:"low"}),i.buttonView.set({icon:w,label:e("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),i}_createDialogButtonForToolbar(){const t=this.editor,e=this._createButton(V),i=t.plugins.get("Dialog");return e.set({tooltip:!0}),e.bind("isOn").to(i,"id",s=>s==="findAndReplace"),e.on("execute",()=>{e.isOn?i.hide():this._showDialog()}),e}_createDialogButtonForMenuBar(){const t=this._createButton(A),e=this.editor.plugins.get("Dialog"),i=this.editor.plugins.get("Dialog");return t.set({role:"menuitemcheckbox",isToggleable:!0}),t.bind("isOn").to(i,"id",s=>s==="findAndReplace"),t.on("execute",()=>{if(e.id==="findAndReplace"){e.hide();return}this._showDialog()}),t}_createButton(t){const e=this.editor,i=e.commands.get("find"),s=new t(e.locale),n=e.locale.t;return s.bind("isEnabled").to(i),s.set({icon:w,label:n("Find and replace"),keystroke:"CTRL+F"}),s}_showDialog(){const t=this.editor,e=t.plugins.get("Dialog"),i=t.locale.t;this.formView||(this.formView=this._createFormView()),e.show({id:"findAndReplace",title:i("Find and replace"),content:this.formView,position:I.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const t=this.editor,e=new(E(z))(t.locale),i=t.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state;e.bind("highlightOffset").to(n,"highlightedOffset"),e.listenTo(n.results,"change",()=>{e.matchCount=n.results.length});const o=i.get("findNext"),r=i.get("findPrevious"),h=i.get("replace"),a=i.get("replaceAll");return e.bind("_areCommandsEnabled").to(o,"isEnabled",r,"isEnabled",h,"isEnabled",a,"isEnabled",(l,d,u,f)=>({findNext:l,findPrevious:d,replace:u,replaceAll:f})),e.delegate("findNext","findPrevious","replace","replaceAll").to(this),e.on("change:isDirty",(l,d,u)=>{u&&this.fire("searchReseted")}),e}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}}class Z extends _{_state;constructor(t,e){super(t),this.isEnabled=!0,this.affectsData=!1,this._state=e}execute(t,{matchCase:e,wholeWords:i}={}){const{editor:s}=this,{model:n}=s,o=s.plugins.get("FindAndReplaceUtils");let r,h="";typeof t=="string"?r=(...d)=>({results:o.findByTextCallback(t,{matchCase:e,wholeWords:i})(...d),searchText:t}):r=t;const a=r;r=(...d)=>{const u=a(...d);return u&&"searchText"in u&&(h=u.searchText),u};const l=n.document.getRootNames().reduce((d,u)=>o.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(u)),n,r,d),null);return this._state.clear(n),this._state.results.addMany(l),this._state.highlightedResult=l.get(0),this._state.searchText=h,r&&(this._state.lastSearchCallback=r),this._state.matchCase=!!e,this._state.matchWholeWords=!!i,{results:l,findCallback:r}}}class J extends $(){constructor(t){super(),this.set("results",new m),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",(e,{removed:i,index:s})=>{if(Array.from(i).length){let n=!1;if(t.change(o=>{for(const r of i)this.highlightedResult===r&&(n=!0),t.markers.has(r.marker.name)&&o.removeMarker(r.marker)}),n){const o=s>=this.results.length?0:s;this.highlightedResult=this.results.get(o)}}}),this.on("change:highlightedResult",()=>{this.refreshHighlightOffset(t)})}clear(t){this.searchText="",t.change(e=>{if(this.highlightedResult){const i=this.highlightedResult.marker.name.split(":")[1],s=t.markers.get(`findResultHighlighted:${i}`);s&&e.removeMarker(s)}[...this.results].forEach(({marker:i})=>{e.removeMarker(i)})}),this.results.clear()}refreshHighlightOffset(t){const{highlightedResult:e,results:i}=this;e?this.highlightedOffset=R(t,[...i]).indexOf(e)+1:this.highlightedOffset=0}}function R(c,t){const e={before:-1,same:0,after:1,different:1};return c.document.getRootNames().flatMap(i=>t.filter(s=>s.marker.getStart().root.rootName===i).sort((s,n)=>e[s.marker.getStart().compareWith(n.marker.getStart())]))}class k extends _{_state;constructor(t,e){super(t),this.isEnabled=!0,this._state=e,this._isEnabledBasedOnSelection=!1}_replace(t,e){const{model:i}=this.editor,s=e.marker.getRange();i.canEditAt(s)&&i.change(n=>{if(s.root.rootName==="$graveyard"){this._state.results.remove(e);return}let o={};for(const r of s.getItems())if(r.is("$text")||r.is("$textProxy")){o=r.getAttributes();break}i.insertContent(n.createText(t,o),s),this._state.results.has(e)&&this._state.results.remove(e)})}}class X extends k{execute(t,e){const i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(t,e),this._state.results.length){const s=R(this.editor.model,[...this._state.results]);this._state.highlightedResult=s[i%s.length]}}}class Y extends k{execute(t,e){const{editor:i}=this,{model:s}=i,n=i.plugins.get("FindAndReplaceUtils"),o=e instanceof m?e:s.document.getRootNames().reduce((r,h)=>n.updateFindResultFromRange(s.createRangeIn(s.document.getRoot(h)),s,n.findByTextCallback(e,this._state),r),null);o.length&&s.change(()=>{[...o].forEach(r=>{this._replace(t,r)})})}}class C extends _{_state;constructor(t,e){super(t),this.affectsData=!1,this._state=e,this.isEnabled=!1,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1})}refresh(){this.isEnabled=this._state.results.length>1}execute(){const t=this._state.results,e=t.getIndex(this._state.highlightedResult),i=e+1>=t.length?0:e+1;this._state.highlightedResult=this._state.results.get(i)}}class ee extends C{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),i=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(i)}}class te extends p{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(t,e,i,s){const n=s||new m,o=r=>n.find(h=>{const{marker:a}=h,l=a.getRange(),d=r.getRange();return l.isEqual(d)});return e.change(r=>{[...t].forEach(({type:h,item:a})=>{if(h==="elementStart"&&e.schema.checkChild(a,"$text")){let l=i({item:a,text:this.rangeToText(e.createRangeIn(a))});if(!l)return;"results"in l&&(l=l.results),l.forEach(d=>{const u=`findResult:${W()}`,f=r.addMarker(u,{usingOperation:!1,affectsData:!1,range:r.createRange(r.createPositionAt(a,d.start),r.createPositionAt(a,d.end))}),y=ie(n,f);o(f)||n.add({id:u,label:d.label,marker:f},y)})}})}),n}rangeToText(t){return Array.from(t.getItems({shallow:!0})).reduce((e,i)=>i.is("$text")||i.is("$textProxy")?e+i.data:`${e}
|
|
2
|
+
`,"")}findByTextCallback(t,e){let i="gu";e.matchCase||(i+="i");let s=`(${j(t)})`;if(e.wholeWords){const r="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+r).test(t)||(s=`(^|${r}|_)${s}`),new RegExp(r+"$").test(t)||(s=`${s}(?=_|${r}|$)`)}const n=new RegExp(s,i);function o({text:r}){return[...r.matchAll(n)].map(se)}return o}}function ie(c,t){const e=c.find(({marker:i})=>t.getStart().isBefore(i.getStart()));return e?c.getIndex(e):c.length}function se(c){const t=c.length-1;let e=c.index;return c.length===3&&(e+=c[1].length),{label:c[t],start:e,end:e+c[t].length}}const ne="ck-find-result_selected";class re extends p{static get requires(){return[te]}static get pluginName(){return"FindAndReplaceEditing"}static get isOfficialPlugin(){return!0}state;init(){this.state=new J(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",(i,s,n,o)=>{const{model:r}=this.editor;r.change(h=>{if(o){const a=o.marker.name.split(":")[1],l=r.markers.get(`findResultHighlighted:${a}`);l&&h.removeMarker(l)}if(n){const a=n.marker.name.split(":")[1];h.addMarker(`findResultHighlighted:${a}`,{usingOperation:!1,affectsData:!1,range:n.marker.getRange()})}})});const e=K(((i,s,n)=>{if(n){const o=this.editor.editing.view.domConverter,r=this.editor.editing.mapper.toViewRange(n.marker.getRange());H({target:o.viewRangeToDom(r),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",e,{priority:"low"}),this.listenTo(this.editor,"destroy",e.cancel),this.on("change:_isSearchActive",(i,s,n)=>{n?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange)})}find(t,e){return this._isSearchActive=!0,this.editor.execute("find",t,e),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add("find",new Z(this.editor,this.state)),this.editor.commands.add("findNext",new C(this.editor,this.state)),this.editor.commands.add("findPrevious",new ee(this.editor,this.state)),this.editor.commands.add("replace",new X(this.editor,this.state)),this.editor.commands.add("replaceAll",new Y(this.editor,this.state))}_defineConverters(){const{editor:t}=this;t.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:e})=>{const[,i]=e.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":i}}}}),t.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:e})=>{const[,i]=e.split(":");return{name:"span",classes:[ne],attributes:{"data-find-result":i}}}})}_onDocumentChange=()=>{const t=new Set,e=new Set,i=this.editor.model,{results:s}=this.state,n=i.document.differ.getChanges(),o=i.document.differ.getChangedMarkers();n.forEach(a=>{a.position&&(a.name==="$text"||a.position.nodeAfter&&i.schema.isInline(a.position.nodeAfter)?(t.add(a.position.parent),[...i.markers.getMarkersAtPosition(a.position)].forEach(l=>{e.add(l.name)})):a.type==="insert"&&a.position.nodeAfter&&t.add(a.position.nodeAfter))}),o.forEach(({name:a,data:{newRange:l}})=>{l&&l.start.root.rootName==="$graveyard"&&e.add(a)}),t.forEach(a=>{[...i.markers.getMarkersIntersectingRange(i.createRangeIn(a))].forEach(d=>e.add(d.name))}),e.forEach(a=>{s.has(a)&&(s.get(a)===this.state.highlightedResult&&(this.state.highlightedResult=null),s.remove(a))});const r=[],h=this.editor.plugins.get("FindAndReplaceUtils");t.forEach(a=>{const l=h.updateFindResultFromRange(i.createRangeOn(a),i,this.state.lastSearchCallback,s);r.push(...l)}),o.forEach(a=>{if(a.data.newRange){const l=h.updateFindResultFromRange(a.data.newRange,i,this.state.lastSearchCallback,s);r.push(...l)}}),!this.state.highlightedResult&&r.length?this.state.highlightedResult=r[0]:this.state.refreshHighlightOffset(i)}}class ue extends p{static get requires(){return[re,Q]}static get pluginName(){return"FindAndReplace"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.plugins.get("FindAndReplaceUI"),e=this.editor.plugins.get("FindAndReplaceEditing"),i=e.state;t.on("findNext",(s,n)=>{n?(i.searchText=n.searchText,e.find(n.searchText,n)):this.editor.execute("findNext")}),t.on("findPrevious",(s,n)=>{n&&i.searchText!==n.searchText?e.find(n.searchText):this.editor.execute("findPrevious")}),t.on("replace",(s,n)=>{i.searchText!==n.searchText&&e.find(n.searchText);const o=i.highlightedResult;o&&this.editor.execute("replace",n.replaceText,o)}),t.on("replaceAll",(s,n)=>{i.searchText!==n.searchText&&e.find(n.searchText),this.editor.execute("replaceAll",n.replaceText,i.results)}),t.on("searchReseted",()=>{i.clear(this.editor.model),e.stop()})}}export{ue as FindAndReplace,re as FindAndReplaceEditing,z as FindAndReplaceFormView,J as FindAndReplaceState,Q as FindAndReplaceUI,te as FindAndReplaceUtils,Z as FindCommand,C as FindNextCommand,ee as FindPreviousCommand,k as FindReplaceCommandBase,Y as ReplaceAllCommand,X as ReplaceCommand,R as _sortFindResultsByMarkerPositions};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import{Plugin as h,Command as q}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{createDropdown as O,addListToDropdown as P,MenuBarMenuView as z,MenuBarMenuListView as L,MenuBarMenuListItemView as T,MenuBarMenuListItemButtonView as E,normalizeColorOptions as j,getLocalizedColorOptions as H,focusChildOnDropdownOpen as Y,ColorSelectorView as _,UIModel as D}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{CKEditorError as I,Collection as $}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconFontBackground as W,IconFontColor as Z,IconFontFamily as V,IconFontSize as N}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addBackgroundStylesRules as J,isLengthStyleValue as Q,isPercentageStyleValue as X}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class F extends q{attributeKey;constructor(e,o){super(e),this.attributeKey=o}refresh(){const e=this.editor.model,o=e.document;this.value=o.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(o.selection,this.attributeKey)}execute(e={}){const o=this.editor.model,i=o.document.selection,s=e.value,c=e.batch,l=r=>{if(i.isCollapsed)s?r.setSelectionAttribute(this.attributeKey,s):r.removeSelectionAttribute(this.attributeKey);else{const u=o.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const m of u)s?r.setAttribute(this.attributeKey,s,m):r.removeAttribute(this.attributeKey,m)}};c?o.enqueueChange(c,r=>{l(r)}):o.change(r=>{l(r)})}}const p="fontSize",g="fontFamily",w="fontColor",y="fontBackgroundColor";function U(t,e){const o={model:{key:t,values:[]},view:{},upcastAlso:{}};for(const n of e)o.model.values.push(n.model),o.view[n.model]=n.view,n.upcastAlso&&(o.upcastAlso[n.model]=n.upcastAlso);return o}function R(t){return e=>te(e.getStyle(t))}function G(t){return(e,{writer:o})=>o.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}function ee({dropdownView:t,colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:s,documentColorsCount:c,colorPickerViewConfig:l}){const r=t.locale,u=new _(r,{colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:s,documentColorsCount:c,colorPickerViewConfig:l});return t.colorSelectorView=u,t.panelView.children.add(u),u}function te(t){return t.replace(/\s/g,"")}class oe extends F{constructor(e){super(e,g)}}/**
|
|
5
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
7
|
-
*/function M(t){return t.map(ne).filter(e=>e!==void 0)}function x(t){return t.replace(/["']/g,"").split(",").map(e=>e.trim())}function ne(t){if(typeof t=="object")return t;if(t==="default")return{title:"Default",model:void 0};if(typeof t=="string")return ie(t)}function ie(t){const e=x(t),o=e[0],n=e.map(re).join(", ");return{title:o,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}function re(t){return t=t.trim(),t.indexOf(" ")>0&&(t=`'${t}'`),t}class se extends h{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(g,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:g}),e.model.schema.setAttributeProperties(g,{isFormatting:!0,copyOnEnter:!0});const o=M(e.config.get("fontFamily.options")).filter(i=>i.model),n=U(g,o);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(g,new oe(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:g,view:(o,{writer:n})=>n.createAttributeElement("span",{style:"font-family:"+o},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:g,value:o=>o.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:g,value:o=>o.getAttribute("face")}})}}class le extends h{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t,n=this._getLocalizedOptions(),i=e.commands.get(g),s=o("Font Family"),c=ae(n,i);e.ui.componentFactory.add(g,l=>{const r=O(l);return P(r,c,{role:"menu",ariaLabel:s}),r.buttonView.set({label:s,icon:V,tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",u=>{e.execute(u.source.commandName,{value:u.source.commandParam}),e.editing.view.focus()}),r}),e.ui.componentFactory.add(`menuBar:${g}`,l=>{const r=new z(l);r.buttonView.set({label:s,icon:V}),r.bind("isEnabled").to(i);const u=new L(l);for(const m of c){const a=new T(l,r),d=new E(l);d.set({role:"menuitemradio",isToggleable:!0}),d.bind(...Object.keys(m.model)).to(m.model),d.delegate("execute").to(r),d.on("execute",()=>{e.execute(m.model.commandName,{value:m.model.commandParam}),e.editing.view.focus()}),a.children.add(d),u.items.add(a)}return r.panelView.children.add(u),r})}_getLocalizedOptions(){const e=this.editor,o=e.t;return M(e.config.get(g).options).map(i=>(i.title==="Default"&&(i.title=o("Default")),i))}}function ae(t,e){const o=new $;for(const n of t){const i={type:"button",model:new D({commandName:g,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};i.model.bind("isOn").to(e,"value",s=>{if(s===n.model)return!0;if(!s||!n.model)return!1;const c=x(s)[0].toLowerCase(),l=x(n.model)[0].toLowerCase();return c===l}),n.view&&typeof n.view!="string"&&n.view.styles&&i.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),o.add(i)}return o}class Ne extends h{static get requires(){return[se,le]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}class ce extends F{constructor(e){super(e,p)}}function A(t){return t.map(e=>ue(e)).filter(e=>e!==void 0)}const k={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function ue(t){if(typeof t=="number"&&(t=String(t)),typeof t=="object"&&fe(t))return S(t);const e=de(t);if(e)return S(e);if(t==="default")return{model:void 0,title:"Default"};if(!pe(t))return me(t)}function me(t){return typeof t=="string"&&(t={title:t,model:`${parseFloat(t)}px`}),t.view={name:"span",styles:{"font-size":t.model}},S(t)}function S(t){return t.view&&typeof t.view!="string"&&!t.view.priority&&(t.view.priority=7),t}function de(t){return typeof t=="string"?k[t]:k[t.model]}function fe(t){return t.title&&t.model&&t.view}function pe(t){let e;if(typeof t=="object")if(t.model)e=parseFloat(t.model);else throw new I("font-size-invalid-definition",null,t);else e=parseFloat(t);return isNaN(e)}const B=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class ge extends h{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(p,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:p}),e.model.schema.setAttributeProperties(p,{isFormatting:!0,copyOnEnter:!0});const o=e.config.get("fontSize.supportAllValues"),n=A(this.editor.config.get("fontSize.options")).filter(s=>s.model),i=U(p,n);o?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(p,new ce(e))}_prepareAnyValueConverters(e){const o=this.editor,n=e.model.values.filter(i=>!Q(String(i))&&!X(String(i)));if(n.length)throw new I("font-size-invalid-use-of-named-presets",null,{presets:n});o.conversion.for("downcast").attributeToElement({model:p,view:(i,{writer:s})=>{if(i)return s.createAttributeElement("span",{style:"font-size:"+i},{priority:7})}}),o.conversion.for("upcast").elementToAttribute({model:{key:p,value:i=>i.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:p,value:o=>{const n=o.getAttribute("size"),i=n[0]==="-"||n[0]==="+";let s=parseInt(n,10);i&&(s=3+s);const c=B.length-1,l=Math.min(Math.max(s,0),c);return B[l]}}})}}class be extends h{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t,n=this._getLocalizedOptions(),i=e.commands.get(p),s=o("Font Size"),c=he(n,i);e.ui.componentFactory.add(p,l=>{const r=O(l);return P(r,c,{role:"menu",ariaLabel:s}),r.buttonView.set({label:s,icon:N,tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",u=>{e.execute(u.source.commandName,{value:u.source.commandParam}),e.editing.view.focus()}),r}),e.ui.componentFactory.add(`menuBar:${p}`,l=>{const r=new z(l);r.buttonView.set({label:s,icon:N}),r.bind("isEnabled").to(i);const u=new L(l);for(const m of c){const a=new T(l,r),d=new E(l);d.set({role:"menuitemradio",isToggleable:!0}),d.bind(...Object.keys(m.model)).to(m.model),d.delegate("execute").to(r),d.on("execute",()=>{e.execute(m.model.commandName,{value:m.model.commandParam}),e.editing.view.focus()}),a.children.add(d),u.items.add(a)}return r.panelView.children.add(u),r})}_getLocalizedOptions(){const e=this.editor,o=e.t,n={Default:o("Default"),Tiny:o("Tiny"),Small:o("Small"),Big:o("Big"),Huge:o("Huge")};return A(e.config.get(p).options).map(s=>{const c=n[s.title];return c&&c!=s.title&&(s=Object.assign({},s,{title:c})),s})}}function he(t,e){const o=new $;for(const n of t){const i={type:"button",model:new D({commandName:p,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&typeof n.view!="string"&&(n.view.styles&&i.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&i.model.set("class",`${i.model.class} ${n.view.classes}`)),i.model.bind("isOn").to(e,"value",s=>s===n.model),o.add(i)}return o}class ke extends h{static get requires(){return[ge,be]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return A(e)}}class we extends F{constructor(e){super(e,w)}}class ye extends h{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(w,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:w,value:R("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:w,value:o=>o.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:w,view:G("color")}),e.commands.add(w,new we(e)),e.model.schema.extend("$text",{allowAttributes:w}),e.model.schema.setAttributeProperties(w,{isFormatting:!0,copyOnEnter:!0})}}class K extends h{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:o,componentName:n,icon:i,dropdownLabel:s}){super(e),this.commandName=o,this.componentName=n,this.icon=i,this.dropdownLabel=s,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,o=e.locale,n=o.t,i=e.commands.get(this.commandName),s=e.config.get(this.componentName),c=j(s.colors),l=H(o,c),r=s.documentColors,u=s.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,m=>{const a=O(m);let d=!1;const f=ee({dropdownView:a,colors:l.map(b=>({label:b.label,color:b.model,options:{hasBorder:b.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:r!==0?n("Document colors"):"",documentColorsCount:r===void 0?this.columns:r,colorPickerViewConfig:u?s.colorPicker||{}:!1});return f.bind("selectedColor").to(i,"value"),a.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),a.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),a.bind("isEnabled").to(i),f.on("execute",(b,v)=>{a.isOpen&&e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),v.source!=="colorPicker"&&e.editing.view.focus(),v.source==="colorPickerSaveButton"&&(a.isOpen=!1)}),f.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),f.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(a.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),a.on("change:isOpen",(b,v,C)=>{d||(d=!0,a.colorSelectorView.appendUI()),C&&(r!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),Y(a,()=>a.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(b=>b.isOn)),a}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,m=>{const a=new z(m);a.buttonView.set({label:this.dropdownLabel,icon:this.icon}),a.bind("isEnabled").to(i);let d=!1;const f=new _(m,{colors:l.map(b=>({label:b.label,color:b.model,options:{hasBorder:b.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:r!==0?n("Document colors"):"",documentColorsCount:r===void 0?this.columns:r,colorPickerViewConfig:!1});return f.bind("selectedColor").to(i,"value"),f.delegate("execute").to(a),f.on("execute",(b,v)=>{e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),e.editing.view.focus()}),a.on("change:isOpen",(b,v,C)=>{d||(d=!0,f.appendUI()),C&&(r!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),a.panelView.children.add(f),a})}}class ve extends K{constructor(e){const o=e.locale.t;super(e,{commandName:w,componentName:w,icon:Z,dropdownLabel:o("Font Color")})}static get pluginName(){return"FontColorUI"}}class Be extends h{static get requires(){return[ye,ve]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}class Fe extends F{constructor(e){super(e,y)}}class Ce extends h{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(y,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(J),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:y,value:R("background-color")}}),e.conversion.for("downcast").attributeToElement({model:y,view:G("background-color")}),e.commands.add(y,new Fe(e)),e.model.schema.extend("$text",{allowAttributes:y}),e.model.schema.setAttributeProperties(y,{isFormatting:!0,copyOnEnter:!0})}}class xe extends K{constructor(e){const o=e.locale.t;super(e,{commandName:y,componentName:y,icon:W,dropdownLabel:o("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class Pe extends h{static get requires(){return[Ce,xe]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}export{Pe as FontBackgroundColor,Fe as FontBackgroundColorCommand,Ce as FontBackgroundColorEditing,xe as FontBackgroundColorUI,Be as FontColor,we as FontColorCommand,ye as FontColorEditing,ve as FontColorUI,K as FontColorUIBase,F as FontCommand,Ne as FontFamily,oe as FontFamilyCommand,se as FontFamilyEditing,le as FontFamilyUI,ke as FontSize,ce as FontSizeCommand,ge as FontSizeEditing,be as FontSizeUI,ee as _addFontColorSelectorToDropdown,U as _buildFontDefinition,M as _normalizeFontFamilyOptions,A as _normalizeFontSizeOptions,G as _renderDowncastFontElement,R as _renderUpcastFontColorAttribute};
|
|
1
|
+
import{Plugin as h,Command as q}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{createDropdown as O,addListToDropdown as P,MenuBarMenuView as z,MenuBarMenuListView as L,MenuBarMenuListItemView as T,MenuBarMenuListItemButtonView as E,normalizeColorOptions as j,getLocalizedColorOptions as H,focusChildOnDropdownOpen as Y,ColorSelectorView as _,UIModel as D}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{CKEditorError as I,Collection as $}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconFontBackground as W,IconFontColor as Z,IconFontFamily as V,IconFontSize as N}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addBackgroundStylesRules as J,isLengthStyleValue as Q,isPercentageStyleValue as X}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";class F extends q{attributeKey;constructor(e,o){super(e),this.attributeKey=o}refresh(){const e=this.editor.model,o=e.document;this.value=o.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(o.selection,this.attributeKey)}execute(e={}){const o=this.editor.model,i=o.document.selection,s=e.value,c=e.batch,l=r=>{if(i.isCollapsed)s?r.setSelectionAttribute(this.attributeKey,s):r.removeSelectionAttribute(this.attributeKey);else{const u=o.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const m of u)s?r.setAttribute(this.attributeKey,s,m):r.removeAttribute(this.attributeKey,m)}};c?o.enqueueChange(c,r=>{l(r)}):o.change(r=>{l(r)})}}const p="fontSize",g="fontFamily",w="fontColor",y="fontBackgroundColor";function U(t,e){const o={model:{key:t,values:[]},view:{},upcastAlso:{}};for(const n of e)o.model.values.push(n.model),o.view[n.model]=n.view,n.upcastAlso&&(o.upcastAlso[n.model]=n.upcastAlso);return o}function R(t){return e=>te(e.getStyle(t))}function G(t){return(e,{writer:o})=>o.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}function ee({dropdownView:t,colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:s,documentColorsCount:c,colorPickerViewConfig:l}){const r=t.locale,u=new _(r,{colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:s,documentColorsCount:c,colorPickerViewConfig:l});return t.colorSelectorView=u,t.panelView.children.add(u),u}function te(t){return t.replace(/\s/g,"")}class oe extends F{constructor(e){super(e,g)}}function M(t){return t.map(ne).filter(e=>e!==void 0)}function x(t){return t.replace(/["']/g,"").split(",").map(e=>e.trim())}function ne(t){if(typeof t=="object")return t;if(t==="default")return{title:"Default",model:void 0};if(typeof t=="string")return ie(t)}function ie(t){const e=x(t),o=e[0],n=e.map(re).join(", ");return{title:o,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}function re(t){return t=t.trim(),t.indexOf(" ")>0&&(t=`'${t}'`),t}class se extends h{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(g,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:g}),e.model.schema.setAttributeProperties(g,{isFormatting:!0,copyOnEnter:!0});const o=M(e.config.get("fontFamily.options")).filter(i=>i.model),n=U(g,o);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(g,new oe(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:g,view:(o,{writer:n})=>n.createAttributeElement("span",{style:"font-family:"+o},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:g,value:o=>o.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:g,value:o=>o.getAttribute("face")}})}}class le extends h{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t,n=this._getLocalizedOptions(),i=e.commands.get(g),s=o("Font Family"),c=ae(n,i);e.ui.componentFactory.add(g,l=>{const r=O(l);return P(r,c,{role:"menu",ariaLabel:s}),r.buttonView.set({label:s,icon:V,tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",u=>{e.execute(u.source.commandName,{value:u.source.commandParam}),e.editing.view.focus()}),r}),e.ui.componentFactory.add(`menuBar:${g}`,l=>{const r=new z(l);r.buttonView.set({label:s,icon:V}),r.bind("isEnabled").to(i);const u=new L(l);for(const m of c){const a=new T(l,r),d=new E(l);d.set({role:"menuitemradio",isToggleable:!0}),d.bind(...Object.keys(m.model)).to(m.model),d.delegate("execute").to(r),d.on("execute",()=>{e.execute(m.model.commandName,{value:m.model.commandParam}),e.editing.view.focus()}),a.children.add(d),u.items.add(a)}return r.panelView.children.add(u),r})}_getLocalizedOptions(){const e=this.editor,o=e.t;return M(e.config.get(g).options).map(i=>(i.title==="Default"&&(i.title=o("Default")),i))}}function ae(t,e){const o=new $;for(const n of t){const i={type:"button",model:new D({commandName:g,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};i.model.bind("isOn").to(e,"value",s=>{if(s===n.model)return!0;if(!s||!n.model)return!1;const c=x(s)[0].toLowerCase(),l=x(n.model)[0].toLowerCase();return c===l}),n.view&&typeof n.view!="string"&&n.view.styles&&i.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),o.add(i)}return o}class Ne extends h{static get requires(){return[se,le]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}class ce extends F{constructor(e){super(e,p)}}function A(t){return t.map(e=>ue(e)).filter(e=>e!==void 0)}const k={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function ue(t){if(typeof t=="number"&&(t=String(t)),typeof t=="object"&&fe(t))return S(t);const e=de(t);if(e)return S(e);if(t==="default")return{model:void 0,title:"Default"};if(!pe(t))return me(t)}function me(t){return typeof t=="string"&&(t={title:t,model:`${parseFloat(t)}px`}),t.view={name:"span",styles:{"font-size":t.model}},S(t)}function S(t){return t.view&&typeof t.view!="string"&&!t.view.priority&&(t.view.priority=7),t}function de(t){return typeof t=="string"?k[t]:k[t.model]}function fe(t){return t.title&&t.model&&t.view}function pe(t){let e;if(typeof t=="object")if(t.model)e=parseFloat(t.model);else throw new I("font-size-invalid-definition",null,t);else e=parseFloat(t);return isNaN(e)}const B=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class ge extends h{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(p,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:p}),e.model.schema.setAttributeProperties(p,{isFormatting:!0,copyOnEnter:!0});const o=e.config.get("fontSize.supportAllValues"),n=A(this.editor.config.get("fontSize.options")).filter(s=>s.model),i=U(p,n);o?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(p,new ce(e))}_prepareAnyValueConverters(e){const o=this.editor,n=e.model.values.filter(i=>!Q(String(i))&&!X(String(i)));if(n.length)throw new I("font-size-invalid-use-of-named-presets",null,{presets:n});o.conversion.for("downcast").attributeToElement({model:p,view:(i,{writer:s})=>{if(i)return s.createAttributeElement("span",{style:"font-size:"+i},{priority:7})}}),o.conversion.for("upcast").elementToAttribute({model:{key:p,value:i=>i.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:p,value:o=>{const n=o.getAttribute("size"),i=n[0]==="-"||n[0]==="+";let s=parseInt(n,10);i&&(s=3+s);const c=B.length-1,l=Math.min(Math.max(s,0),c);return B[l]}}})}}class be extends h{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t,n=this._getLocalizedOptions(),i=e.commands.get(p),s=o("Font Size"),c=he(n,i);e.ui.componentFactory.add(p,l=>{const r=O(l);return P(r,c,{role:"menu",ariaLabel:s}),r.buttonView.set({label:s,icon:N,tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",u=>{e.execute(u.source.commandName,{value:u.source.commandParam}),e.editing.view.focus()}),r}),e.ui.componentFactory.add(`menuBar:${p}`,l=>{const r=new z(l);r.buttonView.set({label:s,icon:N}),r.bind("isEnabled").to(i);const u=new L(l);for(const m of c){const a=new T(l,r),d=new E(l);d.set({role:"menuitemradio",isToggleable:!0}),d.bind(...Object.keys(m.model)).to(m.model),d.delegate("execute").to(r),d.on("execute",()=>{e.execute(m.model.commandName,{value:m.model.commandParam}),e.editing.view.focus()}),a.children.add(d),u.items.add(a)}return r.panelView.children.add(u),r})}_getLocalizedOptions(){const e=this.editor,o=e.t,n={Default:o("Default"),Tiny:o("Tiny"),Small:o("Small"),Big:o("Big"),Huge:o("Huge")};return A(e.config.get(p).options).map(s=>{const c=n[s.title];return c&&c!=s.title&&(s=Object.assign({},s,{title:c})),s})}}function he(t,e){const o=new $;for(const n of t){const i={type:"button",model:new D({commandName:p,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&typeof n.view!="string"&&(n.view.styles&&i.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&i.model.set("class",`${i.model.class} ${n.view.classes}`)),i.model.bind("isOn").to(e,"value",s=>s===n.model),o.add(i)}return o}class ke extends h{static get requires(){return[ge,be]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return A(e)}}class we extends F{constructor(e){super(e,w)}}class ye extends h{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(w,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:w,value:R("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:w,value:o=>o.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:w,view:G("color")}),e.commands.add(w,new we(e)),e.model.schema.extend("$text",{allowAttributes:w}),e.model.schema.setAttributeProperties(w,{isFormatting:!0,copyOnEnter:!0})}}class K extends h{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:o,componentName:n,icon:i,dropdownLabel:s}){super(e),this.commandName=o,this.componentName=n,this.icon=i,this.dropdownLabel=s,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,o=e.locale,n=o.t,i=e.commands.get(this.commandName),s=e.config.get(this.componentName),c=j(s.colors),l=H(o,c),r=s.documentColors,u=s.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,m=>{const a=O(m);let d=!1;const f=ee({dropdownView:a,colors:l.map(b=>({label:b.label,color:b.model,options:{hasBorder:b.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:r!==0?n("Document colors"):"",documentColorsCount:r===void 0?this.columns:r,colorPickerViewConfig:u?s.colorPicker||{}:!1});return f.bind("selectedColor").to(i,"value"),a.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),a.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),a.bind("isEnabled").to(i),f.on("execute",(b,v)=>{a.isOpen&&e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),v.source!=="colorPicker"&&e.editing.view.focus(),v.source==="colorPickerSaveButton"&&(a.isOpen=!1)}),f.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),f.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(a.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),a.on("change:isOpen",(b,v,C)=>{d||(d=!0,a.colorSelectorView.appendUI()),C&&(r!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),Y(a,()=>a.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(b=>b.isOn)),a}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,m=>{const a=new z(m);a.buttonView.set({label:this.dropdownLabel,icon:this.icon}),a.bind("isEnabled").to(i);let d=!1;const f=new _(m,{colors:l.map(b=>({label:b.label,color:b.model,options:{hasBorder:b.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:r!==0?n("Document colors"):"",documentColorsCount:r===void 0?this.columns:r,colorPickerViewConfig:!1});return f.bind("selectedColor").to(i,"value"),f.delegate("execute").to(a),f.on("execute",(b,v)=>{e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),e.editing.view.focus()}),a.on("change:isOpen",(b,v,C)=>{d||(d=!0,f.appendUI()),C&&(r!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),a.panelView.children.add(f),a})}}class ve extends K{constructor(e){const o=e.locale.t;super(e,{commandName:w,componentName:w,icon:Z,dropdownLabel:o("Font Color")})}static get pluginName(){return"FontColorUI"}}class Be extends h{static get requires(){return[ye,ve]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}class Fe extends F{constructor(e){super(e,y)}}class Ce extends h{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(y,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(J),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:y,value:R("background-color")}}),e.conversion.for("downcast").attributeToElement({model:y,view:G("background-color")}),e.commands.add(y,new Fe(e)),e.model.schema.extend("$text",{allowAttributes:y}),e.model.schema.setAttributeProperties(y,{isFormatting:!0,copyOnEnter:!0})}}class xe extends K{constructor(e){const o=e.locale.t;super(e,{commandName:y,componentName:y,icon:W,dropdownLabel:o("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class Pe extends h{static get requires(){return[Ce,xe]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}export{Pe as FontBackgroundColor,Fe as FontBackgroundColorCommand,Ce as FontBackgroundColorEditing,xe as FontBackgroundColorUI,Be as FontColor,we as FontColorCommand,ye as FontColorEditing,ve as FontColorUI,K as FontColorUIBase,F as FontCommand,Ne as FontFamily,oe as FontFamilyCommand,se as FontFamilyEditing,le as FontFamilyUI,ke as FontSize,ce as FontSizeCommand,ge as FontSizeEditing,be as FontSizeUI,ee as _addFontColorSelectorToDropdown,U as _buildFontDefinition,M as _normalizeFontFamilyOptions,A as _normalizeFontSizeOptions,G as _renderDowncastFontElement,R as _renderUpcastFontColorAttribute};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import{Plugin as f,Command as H}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Paragraph as v}from"../../../../../@ckeditor_ckeditor5-paragraph@46.1.1/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js";import{priorities as E,Collection as V,first as x}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{UIModel as C,createDropdown as M,addListToDropdown as k,MenuBarMenuView as L,MenuBarMenuListView as O,MenuBarMenuListItemView as P,MenuBarMenuListItemButtonView as T}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js"
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class y extends H{modelElements;constructor(e,t){super(e),this.modelElements=t}refresh(){const e=x(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>b(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,r=t.document,s=e.value;t.change(c=>{const l=Array.from(r.selection.getSelectedBlocks()).filter(a=>b(a,s,t.schema));for(const a of l)a.is("element",s)||c.rename(a,s)})}}function b(m,e,t){return t.checkChild(m.parent,e)&&!t.isObject(m)}const w="paragraph";class B extends f{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[v]}init(){const e=this.editor,t=e.config.get("heading.options"),r=[];for(const s of t)s.model!=="paragraph"&&(e.model.schema.register(s.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(s),r.push(s.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new y(e,r))}afterInit(){const e=this.editor,t=e.commands.get("enter"),r=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(s,c)=>{const l=e.model.document.selection.getFirstPosition().parent;r.some(g=>l.is("element",g.model))&&!l.is("element",w)&&l.childCount===0&&c.writer.rename(l,w)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:E.low+1})}}/**
|
|
5
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
7
|
-
*/function I(m){const e=m.t,t={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return m.config.get("heading.options").map(r=>{const s=t[r.title];return s&&s!=r.title&&(r.title=s),r})}class N extends f{static get pluginName(){return"HeadingUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,r=I(e),s=t("Choose heading"),c=t("Heading");e.ui.componentFactory.add("heading",l=>{const a={},g=new V,u=e.commands.get("heading"),h=e.commands.get("paragraph"),p=[u];for(const n of r){const i={type:"button",model:new C({label:n.title,class:n.class,role:"menuitemradio",withText:!0})};n.model==="paragraph"?(i.model.bind("isOn").to(h,"value"),i.model.set("commandName","paragraph"),p.push(h)):(i.model.bind("isOn").to(u,"value",d=>d===n.model),i.model.set({commandName:"heading",commandValue:n.model})),g.add(i),a[n.model]=n.title}const o=M(l);return k(o,g,{ariaLabel:c,role:"menu"}),o.buttonView.set({ariaLabel:c,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:c}),o.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),o.bind("isEnabled").toMany(p,"isEnabled",(...n)=>n.some(i=>i)),o.buttonView.bind("label").to(u,"value",h,"value",(n,i)=>{const d=i?"paragraph":n;return typeof d=="boolean"||!a[d]?s:a[d]}),o.buttonView.bind("ariaLabel").to(u,"value",h,"value",(n,i)=>{const d=i?"paragraph":n;return typeof d=="boolean"||!a[d]?c:`${a[d]}, ${c}`}),this.listenTo(o,"execute",n=>{const{commandName:i,commandValue:d}=n.source;e.execute(i,d?{value:d}:void 0),e.editing.view.focus()}),o}),e.ui.componentFactory.add("menuBar:heading",l=>{const a=new L(l),g=e.commands.get("heading"),u=e.commands.get("paragraph"),h=[g],p=new O(l);a.set({class:"ck-heading-dropdown"}),p.set({ariaLabel:t("Heading"),role:"menu"}),a.buttonView.set({label:t("Heading")}),a.panelView.children.add(p);for(const o of r){const n=new P(l,a),i=new T(l);n.children.add(i),p.items.add(n),i.set({isToggleable:!0,label:o.title,role:"menuitemradio",class:o.class}),i.delegate("execute").to(a),i.on("execute",()=>{const d=o.model==="paragraph"?"paragraph":"heading";e.execute(d,{value:o.model}),e.editing.view.focus()}),o.model==="paragraph"?(i.bind("isOn").to(u,"value"),h.push(u)):i.bind("isOn").to(g,"value",d=>d===o.model)}return a.bind("isEnabled").toMany(h,"isEnabled",(...o)=>o.some(n=>n)),a})}}class $ extends f{static get requires(){return[B,N]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}}export{$ as Heading,y as HeadingCommand,B as HeadingEditing,N as HeadingUI,I as _getLocalizedHeadingOptions};
|
|
1
|
+
import{Plugin as f,Command as H}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Paragraph as v}from"../../../../../@ckeditor_ckeditor5-paragraph@46.1.1/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js";import{priorities as E,Collection as V,first as x}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{UIModel as C,createDropdown as M,addListToDropdown as k,MenuBarMenuView as L,MenuBarMenuListView as O,MenuBarMenuListItemView as P,MenuBarMenuListItemButtonView as T}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";class y extends H{modelElements;constructor(e,t){super(e),this.modelElements=t}refresh(){const e=x(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>b(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,r=t.document,s=e.value;t.change(c=>{const l=Array.from(r.selection.getSelectedBlocks()).filter(a=>b(a,s,t.schema));for(const a of l)a.is("element",s)||c.rename(a,s)})}}function b(m,e,t){return t.checkChild(m.parent,e)&&!t.isObject(m)}const w="paragraph";class B extends f{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[v]}init(){const e=this.editor,t=e.config.get("heading.options"),r=[];for(const s of t)s.model!=="paragraph"&&(e.model.schema.register(s.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(s),r.push(s.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new y(e,r))}afterInit(){const e=this.editor,t=e.commands.get("enter"),r=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(s,c)=>{const l=e.model.document.selection.getFirstPosition().parent;r.some(g=>l.is("element",g.model))&&!l.is("element",w)&&l.childCount===0&&c.writer.rename(l,w)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:E.low+1})}}function I(m){const e=m.t,t={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return m.config.get("heading.options").map(r=>{const s=t[r.title];return s&&s!=r.title&&(r.title=s),r})}class N extends f{static get pluginName(){return"HeadingUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,r=I(e),s=t("Choose heading"),c=t("Heading");e.ui.componentFactory.add("heading",l=>{const a={},g=new V,u=e.commands.get("heading"),h=e.commands.get("paragraph"),p=[u];for(const n of r){const i={type:"button",model:new C({label:n.title,class:n.class,role:"menuitemradio",withText:!0})};n.model==="paragraph"?(i.model.bind("isOn").to(h,"value"),i.model.set("commandName","paragraph"),p.push(h)):(i.model.bind("isOn").to(u,"value",d=>d===n.model),i.model.set({commandName:"heading",commandValue:n.model})),g.add(i),a[n.model]=n.title}const o=M(l);return k(o,g,{ariaLabel:c,role:"menu"}),o.buttonView.set({ariaLabel:c,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:c}),o.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),o.bind("isEnabled").toMany(p,"isEnabled",(...n)=>n.some(i=>i)),o.buttonView.bind("label").to(u,"value",h,"value",(n,i)=>{const d=i?"paragraph":n;return typeof d=="boolean"||!a[d]?s:a[d]}),o.buttonView.bind("ariaLabel").to(u,"value",h,"value",(n,i)=>{const d=i?"paragraph":n;return typeof d=="boolean"||!a[d]?c:`${a[d]}, ${c}`}),this.listenTo(o,"execute",n=>{const{commandName:i,commandValue:d}=n.source;e.execute(i,d?{value:d}:void 0),e.editing.view.focus()}),o}),e.ui.componentFactory.add("menuBar:heading",l=>{const a=new L(l),g=e.commands.get("heading"),u=e.commands.get("paragraph"),h=[g],p=new O(l);a.set({class:"ck-heading-dropdown"}),p.set({ariaLabel:t("Heading"),role:"menu"}),a.buttonView.set({label:t("Heading")}),a.panelView.children.add(p);for(const o of r){const n=new P(l,a),i=new T(l);n.children.add(i),p.items.add(n),i.set({isToggleable:!0,label:o.title,role:"menuitemradio",class:o.class}),i.delegate("execute").to(a),i.on("execute",()=>{const d=o.model==="paragraph"?"paragraph":"heading";e.execute(d,{value:o.model}),e.editing.view.focus()}),o.model==="paragraph"?(i.bind("isOn").to(u,"value"),h.push(u)):i.bind("isOn").to(g,"value",d=>d===o.model)}return a.bind("isEnabled").toMany(h,"isEnabled",(...o)=>o.some(n=>n)),a})}}class $ extends f{static get requires(){return[B,N]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}}export{$ as Heading,y as HeadingCommand,B as HeadingEditing,N as HeadingUI,I as _getLocalizedHeadingOptions};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import{Plugin as w,Command as V}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconEraser as k,IconMarker as x,IconPen as B}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as y,createDropdown as E,addToolbarToDropdown as H,MenuBarMenuView as M,MenuBarMenuListView as A,MenuBarMenuListItemView as f,MenuBarMenuListItemButtonView as v,ListSeparatorView as T,SplitButtonView as I,ToolbarSeparatorView as P}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js"
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class O extends V{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,r=t.document.selection,o=e.value;t.change(i=>{if(r.isCollapsed){const s=r.getFirstPosition();if(r.hasAttribute("highlight")){const n=c=>c.item.hasAttribute("highlight")&&c.item.getAttribute("highlight")===this.value,h=s.getLastMatchingPosition(n,{direction:"backward"}),l=s.getLastMatchingPosition(n),u=i.createRange(h,l);!o||this.value===o?(s.isEqual(l)||i.removeAttribute("highlight",u),i.removeSelectionAttribute("highlight")):(s.isEqual(l)||i.setAttribute("highlight",o,u),i.setSelectionAttribute("highlight",o))}else o&&i.setSelectionAttribute("highlight",o)}else{const s=t.schema.getValidRanges(r.getRanges(),"highlight");for(const n of s)o?i.setAttribute("highlight",o,n):i.removeAttribute("highlight",n)}})}}class _ extends w{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-content-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-content-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-content-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-content-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-content-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-content-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(R(t)),e.commands.add("highlight",new O(e))}}function R(d){const e={model:{key:"highlight",values:[]},view:{}};for(const t of d)e.model.values.push(t.model),e.view[t.model]={name:"mark",classes:t.class};return e}class S extends w{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),k,null,g=>{g.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,b(e.type),e.model,g);function g(r){r.bind("isEnabled").to(t,"isEnabled"),r.bind("isOn").to(t,"value",o=>o===e.model),r.iconView.fillColor=e.color,r.isToggleable=!0}}_addButton(e,t,g,r,o){const i=this.editor;i.ui.componentFactory.add(e,s=>{const n=new y(s),h=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return n.set({label:h,icon:g,tooltip:!0}),n.on("execute",()=>{i.execute("highlight",{value:r}),i.editing.view.focus()}),o(n),n})}_addDropdown(e){const t=this.editor,g=t.t,r=t.ui.componentFactory,o=e[0],i=e.reduce((s,n)=>(s[n.model]=n,s),{});r.add("highlight",s=>{const n=t.commands.get("highlight"),h=E(s,I),l=h.buttonView;l.set({label:g("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),l.bind("icon").to(n,"value",a=>b(c(a,"type"))),l.bind("color").to(n,"value",a=>c(a,"color")),l.bind("commandValue").to(n,"value",a=>c(a,"model")),l.bind("isOn").to(n,"value",a=>!!a),l.delegate("execute").to(h);const u=()=>{const a=e.map(m=>{const p=r.create("highlight:"+m.model);return this.listenTo(p,"execute",()=>{h.buttonView.set({lastExecuted:m.model})}),p});return a.push(new P),a.push(r.create("removeHighlight")),a};h.bind("isEnabled").to(n,"isEnabled"),H(h,u,{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:g("Text highlight toolbar")}),C(h),l.on("execute",()=>{t.execute("highlight",{value:l.commandValue})}),this.listenTo(h,"execute",()=>{t.editing.view.focus()});function c(a,m){const p=!a||a===l.lastExecuted?l.lastExecuted:a;return i[p][m]}return h})}_addMenuBarButton(e){const t=this.editor,g=t.t,r=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",o=>{const i=new M(o);i.buttonView.set({label:g("Highlight"),icon:b("marker")}),i.bind("isEnabled").to(r),i.buttonView.iconView.fillColor="transparent";const s=new A(o);for(const l of e){const u=new f(o,i),c=new v(o);c.set({label:l.title,icon:b(l.type),role:"menuitemradio",isToggleable:!0}),c.iconView.fillColor=l.color,c.delegate("execute").to(i),c.bind("isOn").to(r,"value",a=>a===l.model),c.on("execute",()=>{t.execute("highlight",{value:l.model}),t.editing.view.focus()}),u.children.add(c),s.items.add(u)}s.items.add(new T(o));const n=new f(o,i),h=new v(o);return h.set({label:g("Remove highlight"),icon:k}),h.delegate("execute").to(i),h.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),n.children.add(h),s.items.add(n),i.panelView.children.add(s),i})}}function C(d){d.buttonView.actionView.iconView.bind("fillColor").to(d.buttonView,"color")}function b(d){return d==="marker"?x:B}class G extends w{static get requires(){return[_,S]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}export{G as Highlight,O as HighlightCommand,_ as HighlightEditing,S as HighlightUI};
|
|
1
|
+
import{Plugin as w,Command as V}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconEraser as k,IconMarker as x,IconPen as B}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as y,createDropdown as E,addToolbarToDropdown as H,MenuBarMenuView as M,MenuBarMenuListView as A,MenuBarMenuListItemView as f,MenuBarMenuListItemButtonView as v,ListSeparatorView as T,SplitButtonView as I,ToolbarSeparatorView as P}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class O extends V{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,r=t.document.selection,o=e.value;t.change(i=>{if(r.isCollapsed){const s=r.getFirstPosition();if(r.hasAttribute("highlight")){const n=c=>c.item.hasAttribute("highlight")&&c.item.getAttribute("highlight")===this.value,h=s.getLastMatchingPosition(n,{direction:"backward"}),l=s.getLastMatchingPosition(n),u=i.createRange(h,l);!o||this.value===o?(s.isEqual(l)||i.removeAttribute("highlight",u),i.removeSelectionAttribute("highlight")):(s.isEqual(l)||i.setAttribute("highlight",o,u),i.setSelectionAttribute("highlight",o))}else o&&i.setSelectionAttribute("highlight",o)}else{const s=t.schema.getValidRanges(r.getRanges(),"highlight");for(const n of s)o?i.setAttribute("highlight",o,n):i.removeAttribute("highlight",n)}})}}class _ extends w{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-content-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-content-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-content-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-content-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-content-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-content-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(R(t)),e.commands.add("highlight",new O(e))}}function R(d){const e={model:{key:"highlight",values:[]},view:{}};for(const t of d)e.model.values.push(t.model),e.view[t.model]={name:"mark",classes:t.class};return e}class S extends w{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),k,null,g=>{g.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,b(e.type),e.model,g);function g(r){r.bind("isEnabled").to(t,"isEnabled"),r.bind("isOn").to(t,"value",o=>o===e.model),r.iconView.fillColor=e.color,r.isToggleable=!0}}_addButton(e,t,g,r,o){const i=this.editor;i.ui.componentFactory.add(e,s=>{const n=new y(s),h=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return n.set({label:h,icon:g,tooltip:!0}),n.on("execute",()=>{i.execute("highlight",{value:r}),i.editing.view.focus()}),o(n),n})}_addDropdown(e){const t=this.editor,g=t.t,r=t.ui.componentFactory,o=e[0],i=e.reduce((s,n)=>(s[n.model]=n,s),{});r.add("highlight",s=>{const n=t.commands.get("highlight"),h=E(s,I),l=h.buttonView;l.set({label:g("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),l.bind("icon").to(n,"value",a=>b(c(a,"type"))),l.bind("color").to(n,"value",a=>c(a,"color")),l.bind("commandValue").to(n,"value",a=>c(a,"model")),l.bind("isOn").to(n,"value",a=>!!a),l.delegate("execute").to(h);const u=()=>{const a=e.map(m=>{const p=r.create("highlight:"+m.model);return this.listenTo(p,"execute",()=>{h.buttonView.set({lastExecuted:m.model})}),p});return a.push(new P),a.push(r.create("removeHighlight")),a};h.bind("isEnabled").to(n,"isEnabled"),H(h,u,{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:g("Text highlight toolbar")}),C(h),l.on("execute",()=>{t.execute("highlight",{value:l.commandValue})}),this.listenTo(h,"execute",()=>{t.editing.view.focus()});function c(a,m){const p=!a||a===l.lastExecuted?l.lastExecuted:a;return i[p][m]}return h})}_addMenuBarButton(e){const t=this.editor,g=t.t,r=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",o=>{const i=new M(o);i.buttonView.set({label:g("Highlight"),icon:b("marker")}),i.bind("isEnabled").to(r),i.buttonView.iconView.fillColor="transparent";const s=new A(o);for(const l of e){const u=new f(o,i),c=new v(o);c.set({label:l.title,icon:b(l.type),role:"menuitemradio",isToggleable:!0}),c.iconView.fillColor=l.color,c.delegate("execute").to(i),c.bind("isOn").to(r,"value",a=>a===l.model),c.on("execute",()=>{t.execute("highlight",{value:l.model}),t.editing.view.focus()}),u.children.add(c),s.items.add(u)}s.items.add(new T(o));const n=new f(o,i),h=new v(o);return h.set({label:g("Remove highlight"),icon:k}),h.delegate("execute").to(i),h.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),n.children.add(h),s.items.add(n),i.panelView.children.add(s),i})}}function C(d){d.buttonView.actionView.iconView.bind("fillColor").to(d.buttonView,"color")}function b(d){return d==="marker"?x:B}class G extends w{static get requires(){return[_,S]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}export{G as Highlight,O as HighlightCommand,_ as HighlightEditing,S as HighlightUI};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import{Plugin as s,Command as m}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as u,toWidget as d,findOptimalInsertionRange as h}from"../../../../../@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{IconHorizontalLine as g}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as z,MenuBarMenuListItemButtonView as L}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js"
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class p extends m{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=f(n,e,t)}execute(){const t=this.editor.model;t.change(e=>{const n=e.createElement("horizontalLine");t.insertObject(n,null,null,{setSelection:"after"})})}}function f(o,t,e){const n=E(o,e);return t.checkChild(n,"horizontalLine")}function E(o,t){const n=h(o,t).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}class H extends s{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.model.schema,n=t.t,a=t.conversion;e.register("horizontalLine",{inheritAllFrom:"$blockObject"}),a.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:i})=>i.createEmptyElement("hr")}),a.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:i})=>{const c=n("Horizontal line"),l=i.createContainerElement("div",null,i.createEmptyElement("hr"));return i.addClass("ck-horizontal-line",l),i.setCustomProperty("hr",!0,l),b(l,i,c)}}),a.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),t.commands.add("horizontalLine",new p(t))}}function b(o,t,e){return t.setCustomProperty("horizontalLine",!0,o),d(o,t,{label:e})}class v extends s{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("horizontalLine",()=>{const e=this._createButton(z);return e.set({tooltip:!0}),e}),t.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(L))}_createButton(t){const e=this.editor,n=e.locale,a=e.commands.get("horizontalLine"),r=new t(e.locale),i=n.t;return r.set({label:i("Horizontal line"),icon:g}),r.bind("isEnabled").to(a,"isEnabled"),this.listenTo(r,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),r}}class B extends s{static get requires(){return[H,v,u]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}export{B as HorizontalLine,p as HorizontalLineCommand,H as HorizontalLineEditing,v as HorizontalLineUI};
|
|
1
|
+
import{Plugin as s,Command as m}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as u,toWidget as d,findOptimalInsertionRange as h}from"../../../../../@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{IconHorizontalLine as g}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as z,MenuBarMenuListItemButtonView as L}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class p extends m{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=f(n,e,t)}execute(){const t=this.editor.model;t.change(e=>{const n=e.createElement("horizontalLine");t.insertObject(n,null,null,{setSelection:"after"})})}}function f(o,t,e){const n=E(o,e);return t.checkChild(n,"horizontalLine")}function E(o,t){const n=h(o,t).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}class H extends s{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.model.schema,n=t.t,a=t.conversion;e.register("horizontalLine",{inheritAllFrom:"$blockObject"}),a.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:i})=>i.createEmptyElement("hr")}),a.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:i})=>{const c=n("Horizontal line"),l=i.createContainerElement("div",null,i.createEmptyElement("hr"));return i.addClass("ck-horizontal-line",l),i.setCustomProperty("hr",!0,l),b(l,i,c)}}),a.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),t.commands.add("horizontalLine",new p(t))}}function b(o,t,e){return t.setCustomProperty("horizontalLine",!0,o),d(o,t,{label:e})}class v extends s{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("horizontalLine",()=>{const e=this._createButton(z);return e.set({tooltip:!0}),e}),t.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(L))}_createButton(t){const e=this.editor,n=e.locale,a=e.commands.get("horizontalLine"),r=new t(e.locale),i=n.t;return r.set({label:i("Horizontal line"),icon:g}),r.bind("isEnabled").to(a,"isEnabled"),this.listenTo(r,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),r}}class B extends s{static get requires(){return[H,v,u]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}export{B as HorizontalLine,p as HorizontalLineCommand,H as HorizontalLineEditing,v as HorizontalLineUI};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import{Plugin as f,Command as B}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as V,toWidget as S,findOptimalInsertionRange as A}from"../../../../../@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{ButtonView as P,MenuBarMenuListItemButtonView as T}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{logWarning as I,createElement as b}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconHtml as L,IconPencil as C,IconCheck as D,IconCancel as M}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js"
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class y extends B{refresh(){const e=this.editor.model,i=e.schema,a=e.document.selection,t=H(a);this.isEnabled=O(a,i,e),this.value=t?t.getAttribute("value")||"":null}execute(e){const i=this.editor.model,a=i.document.selection;i.change(t=>{let w;this.value!==null?w=H(a):(w=t.createElement("rawHtml"),i.insertObject(w,null,null,{setSelection:"on"})),t.setAttribute("value",e,w)})}}function O(m,e,i){const a=W(m,i);return e.checkChild(a,"rawHtml")}function W(m,e){const a=A(m,e).start.parent;return a.isEmpty&&!a.is("rootElement")?a.parent:a}function H(m){const e=m.getSelectedElement();return e&&e.is("element","rawHtml")?e:null}class z extends f{_widgetButtonViewReferences=new Set;static get pluginName(){return"HtmlEmbedEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:i=>(I("html-embed-provide-sanitize-function"),{html:i,hasChanged:!1})})}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new y(e)),this._setupConversion()}_setupConversion(){const e=this.editor,i=e.t,a=e.editing.view,t=this._widgetButtonViewReferences,w=e.config.get("htmlEmbed");this.editor.editing.view.on("render",()=>{for(const o of t){if(o.element&&o.element.isConnected)return;o.destroy(),t.delete(o)}},{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(o,{writer:l})=>l.createElement("rawHtml",{value:o.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(o,{writer:l})=>l.createRawElement("div",{class:"raw-html-embed"},function(s){s.innerHTML=o.getAttribute("value")||""})}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(o,{writer:l})=>{let s,n,c;const r=l.createRawElement("div",{class:"raw-html-embed__content-wrapper"},function(u){s=u,g({editor:e,domElement:u,state:n,props:c}),s.addEventListener("mousedown",()=>{if(n.isEditable){const h=e.model;h.document.selection.getSelectedElement()!==o&&h.change(R=>R.setSelection(o,"on"))}},!0)}),p={makeEditable(){n=Object.assign({},n,{isEditable:!0}),g({domElement:s,editor:e,state:n,props:c}),a.change(u=>{u.setAttribute("data-cke-ignore-events","true",r)}),s.querySelector("textarea").focus()},save(u){u!==n.getRawHtmlValue()?(e.execute("htmlEmbed",u),e.editing.view.focus()):this.cancel()},cancel(){n=Object.assign({},n,{isEditable:!1}),g({domElement:s,editor:e,state:n,props:c}),e.editing.view.focus(),a.change(u=>{u.removeAttribute("data-cke-ignore-events",r)})}};n={showPreviews:w.showPreviews,isEditable:!1,getRawHtmlValue:()=>o.getAttribute("value")||""},c={sanitizeHtml:w.sanitizeHtml,textareaPlaceholder:i("Paste raw HTML here..."),onEditClick(){p.makeEditable()},onSaveClick(u){p.save(u)},onCancelClick(){p.cancel()}};const d=l.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":i("HTML snippet"),dir:e.locale.uiLanguageDirection},r);return l.setCustomProperty("rawHtmlApi",p,d),l.setCustomProperty("rawHtml",!0,d),S(d,l,{label:i("HTML snippet"),hasSelectionHandle:!0})}});function g({editor:o,domElement:l,state:s,props:n}){l.textContent="";const c=l.ownerDocument;let r;if(s.isEditable){const d={isDisabled:!1,placeholder:n.textareaPlaceholder};r=E({domDocument:c,state:s,props:d}),l.append(r)}else if(s.showPreviews){const d={sanitizeHtml:n.sanitizeHtml};l.append(x({domDocument:c,state:s,props:d,editor:o}))}else{const d={isDisabled:!0,placeholder:n.textareaPlaceholder};l.append(E({domDocument:c,state:s,props:d}))}const p={onEditClick:n.onEditClick,onSaveClick:()=>{n.onSaveClick(r.value)},onCancelClick:n.onCancelClick};l.prepend(k({editor:o,domDocument:c,state:s,props:p}))}function k({editor:o,domDocument:l,state:s,props:n}){const c=b(l,"div",{class:"raw-html-embed__buttons-wrapper"});if(s.isEditable){const r=v(o,"save",n.onSaveClick),p=v(o,"cancel",n.onCancelClick);c.append(r.element,p.element),t.add(r).add(p)}else{const r=v(o,"edit",n.onEditClick);c.append(r.element),t.add(r)}return c}function E({domDocument:o,state:l,props:s}){const n=b(o,"textarea",{placeholder:s.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return n.disabled=s.isDisabled,n.value=l.getRawHtmlValue(),n}function x({editor:o,domDocument:l,state:s,props:n}){const c=n.sanitizeHtml(s.getRawHtmlValue()),r=s.getRawHtmlValue().length>0?i("No preview available"):i("Empty snippet content"),p=b(l,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},r),d=b(l,"div",{class:"raw-html-embed__preview-content",dir:o.locale.contentLanguageDirection}),h=l.createRange().createContextualFragment(c.html);return d.appendChild(h),b(l,"div",{class:"raw-html-embed__preview"},[p,d])}}}function v(m,e,i){const{t:a}=m.locale,t=new P(m.locale),w=m.commands.get("htmlEmbed");return t.set({class:`raw-html-embed__${e}-button`,icon:C,tooltip:!0,tooltipPosition:m.locale.uiLanguageDirection==="rtl"?"e":"w"}),t.render(),e==="edit"?(t.set({icon:C,label:a("Edit source")}),t.bind("isEnabled").to(w)):e==="save"?(t.set({icon:D,label:a("Save changes")}),t.bind("isEnabled").to(w)):t.set({icon:M,label:a("Cancel")}),t.on("execute",i),t}class F extends f{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,a=e.locale.t;e.ui.componentFactory.add("htmlEmbed",()=>{const t=this._createButton(P);return t.set({tooltip:!0,label:a("Insert HTML")}),t}),e.ui.componentFactory.add("menuBar:htmlEmbed",()=>{const t=this._createButton(T);return t.set({label:a("HTML snippet")}),t})}_createButton(e){const i=this.editor,a=i.commands.get("htmlEmbed"),t=new e(i.locale);return t.set({icon:L}),t.bind("isEnabled").to(a,"isEnabled"),this.listenTo(t,"execute",()=>{i.execute("htmlEmbed"),i.editing.view.focus(),i.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()}),t}}class G extends f{static get requires(){return[z,F,V]}static get pluginName(){return"HtmlEmbed"}static get isOfficialPlugin(){return!0}}export{G as HtmlEmbed,y as HtmlEmbedCommand,z as HtmlEmbedEditing,F as HtmlEmbedUI};
|
|
1
|
+
import{Plugin as f,Command as B}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as V,toWidget as S,findOptimalInsertionRange as A}from"../../../../../@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{ButtonView as P,MenuBarMenuListItemButtonView as T}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{logWarning as I,createElement as b}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconHtml as L,IconPencil as C,IconCheck as D,IconCancel as M}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";class y extends B{refresh(){const e=this.editor.model,i=e.schema,a=e.document.selection,t=H(a);this.isEnabled=O(a,i,e),this.value=t?t.getAttribute("value")||"":null}execute(e){const i=this.editor.model,a=i.document.selection;i.change(t=>{let w;this.value!==null?w=H(a):(w=t.createElement("rawHtml"),i.insertObject(w,null,null,{setSelection:"on"})),t.setAttribute("value",e,w)})}}function O(m,e,i){const a=W(m,i);return e.checkChild(a,"rawHtml")}function W(m,e){const a=A(m,e).start.parent;return a.isEmpty&&!a.is("rootElement")?a.parent:a}function H(m){const e=m.getSelectedElement();return e&&e.is("element","rawHtml")?e:null}class z extends f{_widgetButtonViewReferences=new Set;static get pluginName(){return"HtmlEmbedEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:i=>(I("html-embed-provide-sanitize-function"),{html:i,hasChanged:!1})})}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new y(e)),this._setupConversion()}_setupConversion(){const e=this.editor,i=e.t,a=e.editing.view,t=this._widgetButtonViewReferences,w=e.config.get("htmlEmbed");this.editor.editing.view.on("render",()=>{for(const o of t){if(o.element&&o.element.isConnected)return;o.destroy(),t.delete(o)}},{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(o,{writer:l})=>l.createElement("rawHtml",{value:o.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(o,{writer:l})=>l.createRawElement("div",{class:"raw-html-embed"},function(s){s.innerHTML=o.getAttribute("value")||""})}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(o,{writer:l})=>{let s,n,c;const r=l.createRawElement("div",{class:"raw-html-embed__content-wrapper"},function(u){s=u,g({editor:e,domElement:u,state:n,props:c}),s.addEventListener("mousedown",()=>{if(n.isEditable){const h=e.model;h.document.selection.getSelectedElement()!==o&&h.change(R=>R.setSelection(o,"on"))}},!0)}),p={makeEditable(){n=Object.assign({},n,{isEditable:!0}),g({domElement:s,editor:e,state:n,props:c}),a.change(u=>{u.setAttribute("data-cke-ignore-events","true",r)}),s.querySelector("textarea").focus()},save(u){u!==n.getRawHtmlValue()?(e.execute("htmlEmbed",u),e.editing.view.focus()):this.cancel()},cancel(){n=Object.assign({},n,{isEditable:!1}),g({domElement:s,editor:e,state:n,props:c}),e.editing.view.focus(),a.change(u=>{u.removeAttribute("data-cke-ignore-events",r)})}};n={showPreviews:w.showPreviews,isEditable:!1,getRawHtmlValue:()=>o.getAttribute("value")||""},c={sanitizeHtml:w.sanitizeHtml,textareaPlaceholder:i("Paste raw HTML here..."),onEditClick(){p.makeEditable()},onSaveClick(u){p.save(u)},onCancelClick(){p.cancel()}};const d=l.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":i("HTML snippet"),dir:e.locale.uiLanguageDirection},r);return l.setCustomProperty("rawHtmlApi",p,d),l.setCustomProperty("rawHtml",!0,d),S(d,l,{label:i("HTML snippet"),hasSelectionHandle:!0})}});function g({editor:o,domElement:l,state:s,props:n}){l.textContent="";const c=l.ownerDocument;let r;if(s.isEditable){const d={isDisabled:!1,placeholder:n.textareaPlaceholder};r=E({domDocument:c,state:s,props:d}),l.append(r)}else if(s.showPreviews){const d={sanitizeHtml:n.sanitizeHtml};l.append(x({domDocument:c,state:s,props:d,editor:o}))}else{const d={isDisabled:!0,placeholder:n.textareaPlaceholder};l.append(E({domDocument:c,state:s,props:d}))}const p={onEditClick:n.onEditClick,onSaveClick:()=>{n.onSaveClick(r.value)},onCancelClick:n.onCancelClick};l.prepend(k({editor:o,domDocument:c,state:s,props:p}))}function k({editor:o,domDocument:l,state:s,props:n}){const c=b(l,"div",{class:"raw-html-embed__buttons-wrapper"});if(s.isEditable){const r=v(o,"save",n.onSaveClick),p=v(o,"cancel",n.onCancelClick);c.append(r.element,p.element),t.add(r).add(p)}else{const r=v(o,"edit",n.onEditClick);c.append(r.element),t.add(r)}return c}function E({domDocument:o,state:l,props:s}){const n=b(o,"textarea",{placeholder:s.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return n.disabled=s.isDisabled,n.value=l.getRawHtmlValue(),n}function x({editor:o,domDocument:l,state:s,props:n}){const c=n.sanitizeHtml(s.getRawHtmlValue()),r=s.getRawHtmlValue().length>0?i("No preview available"):i("Empty snippet content"),p=b(l,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},r),d=b(l,"div",{class:"raw-html-embed__preview-content",dir:o.locale.contentLanguageDirection}),h=l.createRange().createContextualFragment(c.html);return d.appendChild(h),b(l,"div",{class:"raw-html-embed__preview"},[p,d])}}}function v(m,e,i){const{t:a}=m.locale,t=new P(m.locale),w=m.commands.get("htmlEmbed");return t.set({class:`raw-html-embed__${e}-button`,icon:C,tooltip:!0,tooltipPosition:m.locale.uiLanguageDirection==="rtl"?"e":"w"}),t.render(),e==="edit"?(t.set({icon:C,label:a("Edit source")}),t.bind("isEnabled").to(w)):e==="save"?(t.set({icon:D,label:a("Save changes")}),t.bind("isEnabled").to(w)):t.set({icon:M,label:a("Cancel")}),t.on("execute",i),t}class F extends f{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,a=e.locale.t;e.ui.componentFactory.add("htmlEmbed",()=>{const t=this._createButton(P);return t.set({tooltip:!0,label:a("Insert HTML")}),t}),e.ui.componentFactory.add("menuBar:htmlEmbed",()=>{const t=this._createButton(T);return t.set({label:a("HTML snippet")}),t})}_createButton(e){const i=this.editor,a=i.commands.get("htmlEmbed"),t=new e(i.locale);return t.set({icon:L}),t.bind("isEnabled").to(a,"isEnabled"),this.listenTo(t,"execute",()=>{i.execute("htmlEmbed"),i.editing.view.focus(),i.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()}),t}}class G extends f{static get requires(){return[z,F,V]}static get pluginName(){return"HtmlEmbed"}static get isOfficialPlugin(){return!0}}export{G as HtmlEmbed,y as HtmlEmbedCommand,z as HtmlEmbedEditing,F as HtmlEmbedUI};
|