@ncino/web-components 9.2.0-preview.4 → 9.2.1

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.
Files changed (91) hide show
  1. package/dist/components/accordion/gator/base/accordion.gator.js +1 -1
  2. package/dist/components/accordion/gator/group/accordion-group.gator.js +1 -1
  3. package/dist/components/alert/gator/base/alert.gator.js +1 -1
  4. package/dist/components/banner/gator/banner.gator.js +1 -1
  5. package/dist/components/button/gator/button.gator.js +1 -1
  6. package/dist/components/display-card/gator/display-card.gator.js +1 -1
  7. package/dist/components/headline-card/gator/headline-card.gator.js +1 -1
  8. package/dist/components/icon/gator/icon.gator.js +2 -2
  9. package/dist/components/icon/gator/index.js +1 -1
  10. package/dist/components/icon/gator/templates/arrows-down-up.js +8 -0
  11. package/dist/components/icon/gator/templates/index.js +1 -1
  12. package/dist/components/image-card/gator/image-card.gator.js +1 -1
  13. package/dist/components/input/base/input-base.gator.js +1 -1
  14. package/dist/components/input/gator/dropdown/input-dropdown.gator.js +1 -1
  15. package/dist/components/input/gator/help-text/help-text.gator.js +1 -1
  16. package/dist/components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.js +1 -1
  17. package/dist/components/input/gator/input-file/input-file.gator.js +1 -1
  18. package/dist/components/input/gator/input-textarea/input-textarea.gator.js +1 -1
  19. package/dist/components/input/gator/input-time/input-time.gator.js +1 -1
  20. package/dist/components/input-rich-text/ckeditor-config.js +1 -1
  21. package/dist/components/input-rich-text/input-rich-text.slds.js +2 -2
  22. package/dist/components/list/gator/list-item/list-item.gator.js +1 -1
  23. package/dist/components/popover/popover.js +1 -1
  24. package/dist/components/selection-box/selection-box.gator.js +1 -1
  25. package/dist/components/table/gator/table-pagination/table-pagination.gator.js +1 -1
  26. package/dist/components/table/gator/table.gator.js +135 -45
  27. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-alignment@47.5.0 → @ckeditor_ckeditor5-alignment@47.6.0}/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -1
  28. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autoformat@47.5.0 → @ckeditor_ckeditor5-autoformat@47.6.0}/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -1
  29. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autosave@47.5.0 → @ckeditor_ckeditor5-autosave@47.6.0}/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -1
  30. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-basic-styles@47.5.0 → @ckeditor_ckeditor5-basic-styles@47.6.0}/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -1
  31. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-block-quote@47.5.0 → @ckeditor_ckeditor5-block-quote@47.6.0}/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -1
  32. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-clipboard@47.5.0 → @ckeditor_ckeditor5-clipboard@47.6.0}/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +1 -1
  33. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-cloud-services@47.5.0 → @ckeditor_ckeditor5-cloud-services@47.6.0}/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -1
  34. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-code-block@47.5.0 → @ckeditor_ckeditor5-code-block@47.6.0}/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -1
  35. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-core@47.5.0 → @ckeditor_ckeditor5-core@47.6.0}/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -1
  36. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-editor-classic@47.5.0 → @ckeditor_ckeditor5-editor-classic@47.6.0}/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -1
  37. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-engine@47.5.0 → @ckeditor_ckeditor5-engine@47.6.0}/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +1 -1
  38. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-enter@47.5.0 → @ckeditor_ckeditor5-enter@47.6.0}/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -1
  39. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-essentials@47.5.0 → @ckeditor_ckeditor5-essentials@47.6.0}/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -1
  40. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-find-and-replace@47.5.0 → @ckeditor_ckeditor5-find-and-replace@47.6.0}/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +1 -1
  41. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-font@47.5.0 → @ckeditor_ckeditor5-font@47.6.0}/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -1
  42. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-heading@47.5.0 → @ckeditor_ckeditor5-heading@47.6.0}/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -1
  43. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-highlight@47.5.0 → @ckeditor_ckeditor5-highlight@47.6.0}/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -1
  44. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-horizontal-line@47.5.0 → @ckeditor_ckeditor5-horizontal-line@47.6.0}/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -1
  45. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-embed@47.5.0 → @ckeditor_ckeditor5-html-embed@47.6.0}/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -1
  46. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@47.6.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +3 -0
  47. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-icons@47.5.0 → @ckeditor_ckeditor5-icons@47.6.0}/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +3 -3
  48. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-image@47.5.0 → @ckeditor_ckeditor5-image@47.6.0}/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -1
  49. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@47.6.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -0
  50. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-language@47.5.0 → @ckeditor_ckeditor5-language@47.6.0}/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -1
  51. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@47.6.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -0
  52. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@47.6.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -0
  53. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-markdown-gfm@47.5.0 → @ckeditor_ckeditor5-markdown-gfm@47.6.0}/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +1 -1
  54. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-media-embed@47.5.0 → @ckeditor_ckeditor5-media-embed@47.6.0}/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -1
  55. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-mention@47.5.0 → @ckeditor_ckeditor5-mention@47.6.0}/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
  56. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-page-break@47.5.0 → @ckeditor_ckeditor5-page-break@47.6.0}/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -1
  57. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paragraph@47.5.0 → @ckeditor_ckeditor5-paragraph@47.6.0}/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
  58. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@47.6.0/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -0
  59. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-remove-format@47.5.0 → @ckeditor_ckeditor5-remove-format@47.6.0}/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -1
  60. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-select-all@47.5.0 → @ckeditor_ckeditor5-select-all@47.6.0}/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -1
  61. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-show-blocks@47.5.0 → @ckeditor_ckeditor5-show-blocks@47.6.0}/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -1
  62. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-source-editing@47.5.0 → @ckeditor_ckeditor5-source-editing@47.6.0}/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +1 -1
  63. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-special-characters@47.5.0 → @ckeditor_ckeditor5-special-characters@47.6.0}/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -1
  64. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-style@47.5.0 → @ckeditor_ckeditor5-style@47.6.0}/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -1
  65. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@47.6.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -0
  66. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-typing@47.5.0 → @ckeditor_ckeditor5-typing@47.6.0}/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +1 -1
  67. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-ui@47.5.0 → @ckeditor_ckeditor5-ui@47.6.0}/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -1
  68. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-undo@47.5.0 → @ckeditor_ckeditor5-undo@47.6.0}/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -1
  69. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-upload@47.5.0 → @ckeditor_ckeditor5-upload@47.6.0}/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -1
  70. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +8 -0
  71. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-widget@47.5.0 → @ckeditor_ckeditor5-widget@47.6.0}/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -1
  72. package/dist/node_modules/.pnpm/es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/pick.js +1 -0
  73. package/dist/node_modules/.pnpm/es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isNil.js +1 -0
  74. package/dist/packages/web-components/src/components/popover/gator/popover.gator.scss.js +1 -1
  75. package/dist/packages/web-components/src/components/table/gator/table.gator.scss.js +1 -1
  76. package/dist/types/components/icon/gator/templates/arrows-down-up.d.ts +1 -0
  77. package/dist/types/components/icon/gator/templates/index.d.ts +1 -0
  78. package/dist/types/components/popover/popover.d.ts +2 -0
  79. package/dist/types/components/table/gator/table.gator.d.ts +27 -0
  80. package/dist/types/components/table/table-column-definition.d.ts +8 -0
  81. package/package.json +5 -5
  82. package/web-types.json +35 -5
  83. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@47.5.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +0 -3
  84. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@47.5.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +0 -1
  85. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@47.5.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +0 -1
  86. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@47.5.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +0 -1
  87. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@47.5.0/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +0 -1
  88. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@47.5.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +0 -1
  89. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +0 -8
  90. /package/dist/assets/node_modules/.pnpm/{ckeditor5@47.5.0 → ckeditor5@47.6.0}/node_modules/ckeditor5/dist/ckeditor5.css +0 -0
  91. /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-watchdog@47.5.0 → @ckeditor_ckeditor5-watchdog@47.6.0}/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +0 -0
@@ -1 +1 @@
1
- import{Plugin as m,Command as b}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Enter as Q}from"../../../../../@ckeditor_ckeditor5-enter@47.5.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{Delete as g}from"../../../../../@ckeditor_ckeditor5-typing@47.5.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{first as f}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconQuote as B}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as v,MenuBarMenuListItemButtonView as E}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class x extends b{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,o=t.schema,i=t.document.selection,n=Array.from(i.getSelectedBlocks()),s=e.forceValue===void 0?!this.value:e.forceValue;t.change(u=>{if(!s)this._removeQuote(u,n.filter(d));else{const r=n.filter(c=>d(c)||k(o,c));this._applyQuote(u,r)}})}_getValue(){const e=this.editor.model.document.selection,t=f(e.getSelectedBlocks());return!!(t&&d(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,o=f(e.getSelectedBlocks());return o?k(t,o):!1}_removeQuote(e,t){h(e,t).reverse().forEach(o=>{if(o.start.isAtStart&&o.end.isAtEnd){e.unwrap(o.start.parent);return}if(o.start.isAtStart){const n=e.createPositionBefore(o.start.parent);e.move(o,n);return}o.end.isAtEnd||e.split(o.end);const i=e.createPositionAfter(o.end.parent);e.move(o,i)})}_applyQuote(e,t){const o=[];h(e,t).reverse().forEach(i=>{let n=d(i.start);n||(n=e.createElement("blockQuote"),e.wrap(i,n)),o.push(n)}),o.reverse().reduce((i,n)=>i.nextSibling==n?(e.merge(e.createPositionAfter(i)),i):n)}}function d(l){return l.parent.name=="blockQuote"?l.parent:null}function h(l,e){let t,o=0;const i=[];for(;o<e.length;){const n=e[o],s=e[o+1];t||(t=l.createPositionBefore(n)),(!s||n.nextSibling!=s)&&(i.push(l.createRange(t,l.createPositionAfter(n))),t=null),o++}return i}function k(l,e){const t=l.checkChild(e.parent,"blockQuote"),o=l.checkChild(["$root","blockQuote"],e);return t&&o}class P extends m{static get pluginName(){return"BlockQuoteEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Q,g]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new x(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(s=>{const u=e.model.document.differ.getChanges();for(const r of u)if(r.type=="insert"){const c=r.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(r.position,c))return s.unwrap(c),!0;if(c.is("element")){const p=s.createRangeIn(c);for(const a of p.getItems())if(a.is("element","blockQuote")&&!t.checkChild(s.createPositionBefore(a),a))return s.unwrap(a),!0}}else if(r.type=="remove"){const c=r.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0}return!1});const o=this.editor.editing.view.document,i=e.model.document.selection,n=e.commands.get("blockQuote");this.listenTo(o,"enter",(s,u)=>{if(!i.isCollapsed||!n.value)return;i.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),u.preventDefault(),s.stop())},{context:"blockquote"}),this.listenTo(o,"delete",(s,u)=>{if(u.direction!="backward"||!i.isCollapsed||!n.value)return;const r=i.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),u.preventDefault(),s.stop())},{context:"blockquote"})}}class A extends m{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",()=>{const t=this._createButton(v);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:blockQuote",()=>{const t=this._createButton(E);return t.set({role:"menuitemcheckbox"}),t})}_createButton(e){const t=this.editor,o=t.locale,i=t.commands.get("blockQuote"),n=new e(t.locale),s=o.t;return n.set({label:s("Block quote"),icon:B,isToggleable:!0}),n.bind("isEnabled").to(i,"isEnabled"),n.bind("isOn").to(i,"value"),this.listenTo(n,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus()}),n}}class V extends m{static get requires(){return[P,A]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}}export{V as BlockQuote,x as BlockQuoteCommand,P as BlockQuoteEditing,A as BlockQuoteUI};
1
+ import{Plugin as m,Command as b}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Enter as Q}from"../../../../../@ckeditor_ckeditor5-enter@47.6.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{Delete as g}from"../../../../../@ckeditor_ckeditor5-typing@47.6.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{first as f}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconQuote as B}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as v,MenuBarMenuListItemButtonView as E}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";class x extends b{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,o=t.schema,i=t.document.selection,n=Array.from(i.getSelectedBlocks()),s=e.forceValue===void 0?!this.value:e.forceValue;t.change(u=>{if(!s)this._removeQuote(u,n.filter(d));else{const r=n.filter(c=>d(c)||k(o,c));this._applyQuote(u,r)}})}_getValue(){const e=this.editor.model.document.selection,t=f(e.getSelectedBlocks());return!!(t&&d(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,o=f(e.getSelectedBlocks());return o?k(t,o):!1}_removeQuote(e,t){h(e,t).reverse().forEach(o=>{if(o.start.isAtStart&&o.end.isAtEnd){e.unwrap(o.start.parent);return}if(o.start.isAtStart){const n=e.createPositionBefore(o.start.parent);e.move(o,n);return}o.end.isAtEnd||e.split(o.end);const i=e.createPositionAfter(o.end.parent);e.move(o,i)})}_applyQuote(e,t){const o=[];h(e,t).reverse().forEach(i=>{let n=d(i.start);n||(n=e.createElement("blockQuote"),e.wrap(i,n)),o.push(n)}),o.reverse().reduce((i,n)=>i.nextSibling==n?(e.merge(e.createPositionAfter(i)),i):n)}}function d(l){return l.parent.name=="blockQuote"?l.parent:null}function h(l,e){let t,o=0;const i=[];for(;o<e.length;){const n=e[o],s=e[o+1];t||(t=l.createPositionBefore(n)),(!s||n.nextSibling!=s)&&(i.push(l.createRange(t,l.createPositionAfter(n))),t=null),o++}return i}function k(l,e){const t=l.checkChild(e.parent,"blockQuote"),o=l.checkChild(["$root","blockQuote"],e);return t&&o}class P extends m{static get pluginName(){return"BlockQuoteEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Q,g]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new x(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(s=>{const u=e.model.document.differ.getChanges();for(const r of u)if(r.type=="insert"){const c=r.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(r.position,c))return s.unwrap(c),!0;if(c.is("element")){const p=s.createRangeIn(c);for(const a of p.getItems())if(a.is("element","blockQuote")&&!t.checkChild(s.createPositionBefore(a),a))return s.unwrap(a),!0}}else if(r.type=="remove"){const c=r.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0}return!1});const o=this.editor.editing.view.document,i=e.model.document.selection,n=e.commands.get("blockQuote");this.listenTo(o,"enter",(s,u)=>{if(!i.isCollapsed||!n.value)return;i.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),u.preventDefault(),s.stop())},{context:"blockquote"}),this.listenTo(o,"delete",(s,u)=>{if(u.direction!="backward"||!i.isCollapsed||!n.value)return;const r=i.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),u.preventDefault(),s.stop())},{context:"blockquote"})}}class A extends m{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",()=>{const t=this._createButton(v);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:blockQuote",()=>{const t=this._createButton(E);return t.set({role:"menuitemcheckbox"}),t})}_createButton(e){const t=this.editor,o=t.locale,i=t.commands.get("blockQuote"),n=new e(t.locale),s=o.t;return n.set({label:s("Block quote"),icon:B,isToggleable:!0}),n.bind("isEnabled").to(i,"isEnabled"),n.bind("isOn").to(i,"value"),this.listenTo(n,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus()}),n}}class V extends m{static get requires(){return[P,A]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}}export{V as BlockQuote,x as BlockQuoteCommand,P as BlockQuoteEditing,A as BlockQuoteUI};
@@ -1,4 +1,4 @@
1
- import{Plugin as b}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{EventInfo as z,uid as q,delay as j,DomEmitterMixin as A,env as f,global as h,createElement as I,Rect as _,getRangeFromMouseEvent as ee,ResizeObserver as te,toUnit as re}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{PointerObserver as ne,ModelLiveRange as T,DomEventObserver as ie,ViewDataTransfer as oe,ModelRange as se}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ae,isWidget as k}from"../../../../../@ckeditor_ckeditor5-widget@47.5.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{View as le}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{mapValues as ce}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/mapValues.js";import{throttle as V}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/throttle.js";class v extends ie{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;this.listenTo(t,"paste",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",r("dragging"),{priority:"low"});function r(i){return(s,o)=>{o.preventDefault();const n=o.dropRange?[o.dropRange]:null,a=new z(t,i);t.fire(a,{dataTransfer:o.dataTransfer,method:s.name,targetRanges:n,target:o.target,domEvent:o.domEvent}),a.stop.called&&o.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,r=e.type=="drop"||e.type=="paste",i={dataTransfer:new oe(t,{cacheFiles:r})};if(e.type=="drop"||e.type=="dragover"){const s=ee(e);i.dropRange=s&&this.view.domConverter.domRangeToView(s)}this.fire(e.type,e,i)}}function de(l){return l=l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;"),(l.includes("</p><p>")||l.includes("<br>"))&&(l=`<p>${l}</p>`),l}function ge(l){return l.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?" ":t).replace(/<!--[\s\S]*?-->/g,"")}const B=["figcaption","li"],L=["ol","ul"];function H(l,e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return`
1
+ import{Plugin as b}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{EventInfo as z,uid as q,delay as j,DomEmitterMixin as A,env as f,global as h,createElement as I,Rect as _,getRangeFromMouseEvent as ee,ResizeObserver as te,toUnit as re}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{PointerObserver as ne,ModelLiveRange as T,DomEventObserver as ie,ViewDataTransfer as oe,ModelRange as se}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ae,isWidget as k}from"../../../../../@ckeditor_ckeditor5-widget@47.6.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{View as le}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{mapValues as ce}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/mapValues.js";import{throttle as V}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/throttle.js";class v extends ie{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;this.listenTo(t,"paste",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",r("dragging"),{priority:"low"});function r(i){return(s,o)=>{o.preventDefault();const n=o.dropRange?[o.dropRange]:null,a=new z(t,i);t.fire(a,{dataTransfer:o.dataTransfer,method:s.name,targetRanges:n,target:o.target,domEvent:o.domEvent}),a.stop.called&&o.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,r=e.type=="drop"||e.type=="paste",i={dataTransfer:new oe(t,{cacheFiles:r})};if(e.type=="drop"||e.type=="dragover"){const s=ee(e);i.dropRange=s&&this.view.domConverter.domRangeToView(s)}this.fire(e.type,e,i)}}function de(l){return l=l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;"),(l.includes("</p><p>")||l.includes("<br>"))&&(l=`<p>${l}</p>`),l}function ge(l){return l.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?" ":t).replace(/<!--[\s\S]*?-->/g,"")}const B=["figcaption","li"],L=["ol","ul"];function H(l,e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return`
2
2
  `;let t="",r=null;for(const i of e.getChildren())t+=pe(i,r)+H(l,i),r=i;if(e.is("rawElement")){const s=document.implementation.createHTMLDocument("").createElement("div");e.render(s,l),t+=K(s)}return t}function K(l){let e="";if(l.nodeType===Node.TEXT_NODE)return l.textContent;if(l.tagName==="BR")return`
3
3
  `;for(const t of l.childNodes)e+=K(t);return e}function pe(l,e){return e?l.is("element","li")&&!l.isEmpty&&l.getChild(0).is("containerElement")||L.includes(l.name)&&L.includes(e.name)?`
4
4
 
@@ -1 +1 @@
1
- import{ContextPlugin as f}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{CKEditorError as i,ObservableMixin as p,logWarning as g,EmitterMixin as _}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";const T={autoRefresh:!0},d=36e5,k=5e3;class l extends p(){_refresh;_options;_tokenRefreshTimeout;_isDestroyed=!1;constructor(e,t={}){if(super(),!e)throw new i("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),typeof e=="function"?this._refresh=e:this._refresh=()=>w(e),this._options={...T,...t}}init(){return new Promise((e,t)=>{if(!this.value){this.refreshToken().then(e).catch(t);return}this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)})}refreshToken(){const e=this._options.autoRefresh;return this._refresh().then(t=>(this._validateTokenValue(t),this.set("value",t),e&&this._registerRefreshTokenTimeout(),this)).catch(t=>{throw g("token-refresh-failed",{autoRefresh:e}),e&&this._registerRefreshTokenTimeout(k),t})}destroy(){this._isDestroyed=!0,clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t=typeof e=="string",r=!/^".*"$/.test(e),s=t&&e.split(".").length===3;if(!(r&&s))throw new i("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(e){if(clearTimeout(this._tokenRefreshTimeout),this._isDestroyed)return;const t=e||this._getTokenRefreshTimeoutTime();this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},t)}_getTokenRefreshTimeoutTime(){try{const[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));return t?(t>2147483647&&console.warn("Token expiration time exceeds 32-bit integer range. This might cause unpredictable token refresh timing. Token expiration time should always be provided in seconds.",{tokenExpireTime:t}),Math.floor((t*1e3-Date.now())/2)):d}catch{return d}}static create(e,t={}){return new l(e,t).init()}}function w(n){return new Promise((e,t)=>{const r=new XMLHttpRequest;r.open("GET",n),r.addEventListener("load",()=>{const s=r.status,o=r.response;return s<200||s>299?t(new i("token-cannot-download-new-token",null)):e(o)}),r.addEventListener("error",()=>t(new Error("Network Error"))),r.addEventListener("abort",()=>t(new Error("Abort"))),r.send()})}const h=/^data:(\S*?);base64,/;class m extends _(){file;xhr;_token;_apiAddress;constructor(e,t,r){if(super(),!e)throw new i("fileuploader-missing-file",null);if(!t)throw new i("fileuploader-missing-token",null);if(!r)throw new i("fileuploader-missing-api-address",null);this.file=R(e)?E(e):e,this._token=t,this._apiAddress=r}onProgress(e){return this.on("progress",(t,r)=>e(r)),this}onError(e){return this.once("error",(t,r)=>e(r)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){const e=this.xhr,t=r=>()=>this.fire("error",r);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort"));e.upload&&e.upload.addEventListener("progress",r=>{r.lengthComputable&&this.fire("progress",{total:r.total,uploaded:r.loaded})}),e.addEventListener("load",()=>{const r=e.status,s=e.response;if(r<200||r>299)return this.fire("error",s.message||s.error)})}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((r,s)=>{t.addEventListener("load",()=>{const o=t.status,a=t.response;return o<200||o>299?a.message?s(new i("fileuploader-uploading-data-failed",this,{message:a.message})):s(a.error):r(a)}),t.addEventListener("error",()=>s(new Error("Network Error"))),t.addEventListener("abort",()=>s(new Error("Abort"))),t.send(e)})}}function E(n,e=512){try{const t=n.match(h)[1],r=atob(n.replace(h,"")),s=[];for(let o=0;o<r.length;o+=e){const a=r.slice(o,o+e),c=new Array(a.length);for(let u=0;u<a.length;u++)c[u]=a.charCodeAt(u);s.push(new Uint8Array(c))}return new Blob(s,{type:t})}catch{throw new i("fileuploader-decoding-image-data-error",null)}}function R(n){return typeof n!="string"?!1:!!n.match(h)?.length}class v{_token;_apiAddress;constructor(e,t){if(!e)throw new i("uploadgateway-missing-token",null);if(!t)throw new i("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new m(e,this._token,this._apiAddress)}}class y extends f{static get pluginName(){return"CloudServicesCore"}static get isOfficialPlugin(){return!0}createToken(e,t){return new l(e,t)}createUploadGateway(e,t){return new v(e,t)}}class C extends f{tokenUrl;uploadUrl;webSocketUrl;bundleVersion;autoRefresh=!0;token=null;_tokens=new Map;static get pluginName(){return"CloudServices"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}async init(){const t=this.context.config.get("cloudServices")||{};for(const[o,a]of Object.entries(t))this[o]=a;if(!this.tokenUrl){this.token=null;return}const s=this.context.plugins.get("CloudServicesCore").createToken(this.tokenUrl,{autoRefresh:this.autoRefresh});try{this.token=await s.init(),this._tokens.set(this.tokenUrl,this.token)}catch(o){throw s.destroy(),o}}async registerTokenUrl(e){if(this._tokens.has(e))return this.getTokenFor(e);const r=await this.context.plugins.get("CloudServicesCore").createToken(e,{autoRefresh:this.autoRefresh}).init();return this._tokens.set(e,r),r}getTokenFor(e){const t=this._tokens.get(e);if(!t)throw new i("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(const e of this._tokens.values())e.destroy()}}export{C as CloudServices,y as CloudServicesCore,l as Token};
1
+ import{ContextPlugin as f}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{CKEditorError as i,ObservableMixin as p,logWarning as g,EmitterMixin as _}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";const T={autoRefresh:!0},d=36e5,k=5e3;class l extends p(){_refresh;_options;_tokenRefreshTimeout;_isDestroyed=!1;constructor(e,t={}){if(super(),!e)throw new i("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),typeof e=="function"?this._refresh=e:this._refresh=()=>w(e),this._options={...T,...t}}init(){return new Promise((e,t)=>{if(!this.value){this.refreshToken().then(e).catch(t);return}this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)})}refreshToken(){const e=this._options.autoRefresh;return this._refresh().then(t=>(this._validateTokenValue(t),this.set("value",t),e&&this._registerRefreshTokenTimeout(),this)).catch(t=>{throw g("token-refresh-failed",{autoRefresh:e}),e&&this._registerRefreshTokenTimeout(k),t})}destroy(){this._isDestroyed=!0,clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t=typeof e=="string",r=!/^".*"$/.test(e),s=t&&e.split(".").length===3;if(!(r&&s))throw new i("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(e){if(clearTimeout(this._tokenRefreshTimeout),this._isDestroyed)return;const t=e||this._getTokenRefreshTimeoutTime();this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},t)}_getTokenRefreshTimeoutTime(){try{const[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));return t?(t>2147483647&&console.warn("Token expiration time exceeds 32-bit integer range. This might cause unpredictable token refresh timing. Token expiration time should always be provided in seconds.",{tokenExpireTime:t}),Math.floor((t*1e3-Date.now())/2)):d}catch{return d}}static create(e,t={}){return new l(e,t).init()}}function w(n){return new Promise((e,t)=>{const r=new XMLHttpRequest;r.open("GET",n),r.addEventListener("load",()=>{const s=r.status,o=r.response;return s<200||s>299?t(new i("token-cannot-download-new-token",null)):e(o)}),r.addEventListener("error",()=>t(new Error("Network Error"))),r.addEventListener("abort",()=>t(new Error("Abort"))),r.send()})}const h=/^data:(\S*?);base64,/;class m extends _(){file;xhr;_token;_apiAddress;constructor(e,t,r){if(super(),!e)throw new i("fileuploader-missing-file",null);if(!t)throw new i("fileuploader-missing-token",null);if(!r)throw new i("fileuploader-missing-api-address",null);this.file=R(e)?E(e):e,this._token=t,this._apiAddress=r}onProgress(e){return this.on("progress",(t,r)=>e(r)),this}onError(e){return this.once("error",(t,r)=>e(r)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){const e=this.xhr,t=r=>()=>this.fire("error",r);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort"));e.upload&&e.upload.addEventListener("progress",r=>{r.lengthComputable&&this.fire("progress",{total:r.total,uploaded:r.loaded})}),e.addEventListener("load",()=>{const r=e.status,s=e.response;if(r<200||r>299)return this.fire("error",s.message||s.error)})}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((r,s)=>{t.addEventListener("load",()=>{const o=t.status,a=t.response;return o<200||o>299?a.message?s(new i("fileuploader-uploading-data-failed",this,{message:a.message})):s(a.error):r(a)}),t.addEventListener("error",()=>s(new Error("Network Error"))),t.addEventListener("abort",()=>s(new Error("Abort"))),t.send(e)})}}function E(n,e=512){try{const t=n.match(h)[1],r=atob(n.replace(h,"")),s=[];for(let o=0;o<r.length;o+=e){const a=r.slice(o,o+e),c=new Array(a.length);for(let u=0;u<a.length;u++)c[u]=a.charCodeAt(u);s.push(new Uint8Array(c))}return new Blob(s,{type:t})}catch{throw new i("fileuploader-decoding-image-data-error",null)}}function R(n){return typeof n!="string"?!1:!!n.match(h)?.length}class v{_token;_apiAddress;constructor(e,t){if(!e)throw new i("uploadgateway-missing-token",null);if(!t)throw new i("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new m(e,this._token,this._apiAddress)}}class y extends f{static get pluginName(){return"CloudServicesCore"}static get isOfficialPlugin(){return!0}createToken(e,t){return new l(e,t)}createUploadGateway(e,t){return new v(e,t)}}class C extends f{tokenUrl;uploadUrl;webSocketUrl;bundleVersion;autoRefresh=!0;token=null;_tokens=new Map;static get pluginName(){return"CloudServices"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}async init(){const t=this.context.config.get("cloudServices")||{};for(const[o,a]of Object.entries(t))this[o]=a;if(!this.tokenUrl){this.token=null;return}const s=this.context.plugins.get("CloudServicesCore").createToken(this.tokenUrl,{autoRefresh:this.autoRefresh});try{this.token=await s.init(),this._tokens.set(this.tokenUrl,this.token)}catch(o){throw s.destroy(),o}}async registerTokenUrl(e){if(this._tokens.has(e))return this.getTokenFor(e);const r=await this.context.plugins.get("CloudServicesCore").createToken(e,{autoRefresh:this.autoRefresh}).init();return this._tokens.set(e,r),r}getTokenFor(e){const t=this._tokens.get(e);if(!t)throw new i("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(const e of this._tokens.values())e.destroy()}}export{C as CloudServices,y as CloudServicesCore,l as Token};
@@ -1,4 +1,4 @@
1
- import{Plugin as v,Command as S}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{ShiftEnter as y}from"../../../../../@ckeditor_ckeditor5-enter@47.5.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{UpcastWriter as O}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{ClipboardPipeline as N}from"../../../../../@ckeditor_ckeditor5-clipboard@47.5.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Collection as M,first as b}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{createDropdown as R,addListToDropdown as q,MenuBarMenuView as F,MenuBarMenuListView as $,MenuBarMenuListItemView as z,MenuBarMenuListItemButtonView as W,UIModel as U,SplitButtonView as j}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconCodeBlock as L}from"../../../../../@ckeditor_ckeditor5-icons@47.5.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";function h(i){const e=i.t,n=i.config.get("codeBlock.languages");for(const o of n)o.label==="Plain text"&&(o.label=e("Plain text")),o.class===void 0&&(o.class=`language-${o.language}`);return n}function k(i,e,n){const o={};for(const c of i)if(e==="class"){const s=c[e].split(" ").shift();o[s]=c[n]}else o[c[e]]=c[n];return o}function w(i){return i.data.match(/^(\s*)/)[0]}function H(i,e){const n=i.createDocumentFragment(),o=e.split(`
1
+ import{Plugin as v,Command as S}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{ShiftEnter as y}from"../../../../../@ckeditor_ckeditor5-enter@47.6.0/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{UpcastWriter as O}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{ClipboardPipeline as N}from"../../../../../@ckeditor_ckeditor5-clipboard@47.6.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Collection as M,first as b}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{createDropdown as R,addListToDropdown as q,MenuBarMenuView as F,MenuBarMenuListView as $,MenuBarMenuListItemView as z,MenuBarMenuListItemButtonView as W,UIModel as U,SplitButtonView as j}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconCodeBlock as L}from"../../../../../@ckeditor_ckeditor5-icons@47.6.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";function h(i){const e=i.t,n=i.config.get("codeBlock.languages");for(const o of n)o.label==="Plain text"&&(o.label=e("Plain text")),o.class===void 0&&(o.class=`language-${o.language}`);return n}function k(i,e,n){const o={};for(const c of i)if(e==="class"){const s=c[e].split(" ").shift();o[s]=c[n]}else o[c[e]]=c[n];return o}function w(i){return i.data.match(/^(\s*)/)[0]}function H(i,e){const n=i.createDocumentFragment(),o=e.split(`
2
2
  `),c=o.reduce((s,t,a)=>(s.push(t),a<o.length-1&&s.push(i.createElement("br")),s),[]);return i.appendChild(c,n),n}function C(i){const e=i.document.selection,n=[];if(e.isCollapsed)return[e.anchor];const o=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:c}of o){let s=c.is("$textProxy")?c.textNode:c;const t=s.parent;if(!t.is("element","codeBlock")||s.is("element","softBreak"))continue;for(;s.previousSibling&&!s.previousSibling.is("element","softBreak");)s=s.previousSibling;const a=s.is("$text")?s.startOffset+w(s).length:s.startOffset,l=i.createPositionAt(t,a);n.every(r=>!r.isEqual(l))&&n.push(l)}return n}function T(i){const e=b(i.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function A(i,e){return e.is("rootElement")||i.isLimit(e)?!1:i.checkChild(e.parent,"codeBlock")}function P(i,e,n,o){const c=k(e,"language","label"),s=n.getAttribute("language");if(s in c){const t=c[s];return i(o==="enter"?"Entering %0 code snippet":"Leaving %0 code snippet",t)}return i(o==="enter"?"Entering code snippet":"Leaving code snippet")}function I(i,e){for(i.textNode&&(i=e.createPositionBefore(i.textNode));i.nodeBefore&&!i.nodeBefore.is("element","softBreak");)i=e.createPositionBefore(i.nodeBefore);const n=i.nodeAfter;return n&&n.is("$text")?n:null}class J extends S{_lastLanguage;constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const n=this.editor,o=n.model,c=o.document.selection,t=h(n)[0],a=Array.from(c.getSelectedBlocks()),l=e.forceValue==null?!this.value:e.forceValue,r=K(e,this._lastLanguage,t.language);o.change(u=>{l?this._applyCodeBlock(u,a,r):this._removeCodeBlock(u,a)})}_getValue(){const e=this.editor.model.document.selection,n=b(e.getSelectedBlocks());return!!n?.is("element","codeBlock")?n.getAttribute("language"):!1}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,n=this.editor.model.schema,o=b(e.getSelectedBlocks());return o?A(n,o):!1}_applyCodeBlock(e,n,o){this._lastLanguage=o;const c=this.editor.model.schema,s=n.filter(t=>A(c,t));for(const t of s)e.rename(t,"codeBlock"),e.setAttribute("language",o,t),c.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter(a=>!c.checkChild(t,a)).forEach(a=>e.remove(a));s.reverse().forEach((t,a)=>{const l=s[a+1];t.previousSibling===l&&(e.appendElement("softBreak",l),e.merge(e.createPositionBefore(t)))})}_removeCodeBlock(e,n){const o=n.filter(c=>c.is("element","codeBlock"));for(const c of o){const s=e.createRangeOn(c);for(const t of Array.from(s.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:a}=e.split(e.createPositionBefore(t)),l=a.nodeAfter;e.rename(l,"paragraph"),e.removeAttribute("language",l),e.remove(t)}e.rename(c,"paragraph"),e.removeAttribute("language",c)}}}function K(i,e,n){return i.language?i.language:i.usePreviousLanguageChoice&&e?e:n}class G extends S{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const n=this.editor.model;n.change(o=>{const c=C(n);for(const s of c){const t=o.createText(this._indentSequence);n.insertContent(t,s)}})}_checkEnabled(){return this._indentSequence?T(this.editor.model.document.selection):!1}}class X extends S{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const n=this.editor.model;n.change(()=>{const o=C(n);for(const c of o){const s=E(n,c,this._indentSequence);s&&n.deleteContent(n.createSelection(s))}})}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return T(e.document.selection)?C(e).some(n=>E(e,n,this._indentSequence)):!1}}function E(i,e,n){const o=I(e,i);if(!o)return null;const c=w(o),s=c.lastIndexOf(n);if(s+n.length!==c.length||s===-1)return null;const{parent:t,startOffset:a}=o;return i.createRange(i.createPositionAt(t,a+s),i.createPositionAt(t,a+s+n.length))}function _(i,e,n=!1){const o=k(e,"language","class"),c=k(e,"language","label");return(s,t,a)=>{const{writer:l,mapper:r,consumable:u}=a;if(!u.consume(t.item,"insert"))return;const d=t.item.getAttribute("language"),g=r.toViewPosition(i.createPositionBefore(t.item)),m={};n&&(m["data-language"]=c[d],m.spellcheck="false");const p=o[d]?{class:o[d]}:void 0,x=l.createContainerElement("code",p),V=l.createContainerElement("pre",m,x);l.insert(g,V),r.bindElements(t.item,x)}}function Q(i){return(e,n,o)=>{if(n.item.parent.name!=="codeBlock")return;const{writer:c,mapper:s,consumable:t}=o;if(!t.consume(n.item,"insert"))return;const a=s.toViewPosition(i.createPositionBefore(n.item));c.insert(a,c.createText(`
3
3
  `))}}function Y(i,e){const n=k(e,"class","language"),o=e[0].language;return(c,s,t)=>{const a=s.viewItem,l=a.parent;if(!l||!l.is("element","pre")||s.modelCursor.findAncestor("codeBlock"))return;const{consumable:r,writer:u}=t;if(!r.test(a,{name:!0}))return;const d=u.createElement("codeBlock"),g=[...a.getClassNames()];g.length||g.push("");for(const m of g){const p=n[m];if(p){r.consume(a,{classes:[m]}),u.setAttribute("language",p,d);break}}d.hasAttribute("language")||u.setAttribute("language",o,d),t.convertChildren(a,d),t.safeInsert(d,s.modelCursor)&&(r.consume(a,{name:!0}),t.updateConversionResult(d,s))}}function Z(){return(i,e,{consumable:n,writer:o})=>{let c=e.modelCursor;if(!n.test(e.viewItem)||!c.findAncestor("codeBlock"))return;n.consume(e.viewItem);const t=e.viewItem.data.split(`
4
4
  `).map(l=>o.createText(l)),a=t[t.length-1];for(const l of t)if(o.insert(l,c),c=c.getShiftedBy(l.offsetSize),l!==a){const r=o.createElement("softBreak");o.insert(r,c),c=o.createPositionAfter(r)}e.modelRange=o.createRange(e.modelCursor,c),e.modelCursor=c}}function ee(){return(i,e,{consumable:n})=>{const o=e.viewItem;if(o.findAncestor("pre"))return;const c=Array.from(o.getChildren()),s=c.find(t=>t.is("element","code"));if(s)for(const t of c)t===s||!t.is("$text")||n.consume(t,{name:!0})}}const D="paragraph";class te extends v{static get pluginName(){return"CodeBlockEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"go",label:"Go"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:" "})}init(){const e=this.editor,n=e.model.schema,o=e.model,c=e.editing.view,s=h(e);e.commands.add("codeBlock",new J(e)),e.commands.add("indentCodeBlock",new G(e)),e.commands.add("outdentCodeBlock",new X(e)),this.listenTo(c.document,"tab",(t,a)=>{const l=a.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(l).isEnabled&&(e.execute(l),a.stopPropagation(),a.preventDefault(),t.stop())},{context:"pre"}),n.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",disallowChildren:"$inlineObject",allowAttributes:["language"],allowAttributesOf:"$listItem",isBlock:!0}),n.addAttributeCheck((t,a)=>{const l=t.getItem(t.length-2);if(n.getAttributeProperties(a).isFormatting&&l&&l.name=="codeBlock")return!1}),e.editing.downcastDispatcher.on("insert:codeBlock",_(o,s,!0)),e.data.downcastDispatcher.on("insert:codeBlock",_(o,s)),e.data.downcastDispatcher.on("insert:softBreak",Q(o),{priority:"high"}),e.data.upcastDispatcher.on("element:code",Y(c,s)),e.data.upcastDispatcher.on("text",Z()),e.data.upcastDispatcher.on("element:pre",ee(),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,a)=>{let l=o.createRange(o.document.selection.anchor);if(a.targetRanges&&(l=e.editing.mapper.toModelRange(a.targetRanges[0])),!l.start.parent.is("element","codeBlock"))return;const r=a.dataTransfer.getData("text/plain"),u=new O(e.editing.view.document);a.content=H(u,r)}),e.plugins.has("ClipboardPipeline")&&e.plugins.get(N).on("contentInsertion",(t,a)=>{const l=e.model,r=l.document.selection;r.anchor.parent.is("element","codeBlock")&&l.change(u=>{const d=u.createRangeIn(a.content);for(const g of[...d.getItems()])g.is("node")&&!n.checkChild(r.anchor,g)&&u.remove(g)})}),this.listenTo(o,"getSelectedContent",(t,[a])=>{const l=a.anchor;a.isCollapsed||!l.parent.is("element","codeBlock")||!l.hasSameParentAs(a.focus)||o.change(r=>{const u=t.return;if(l.parent.is("element")&&(u.childCount>1||a.containsEntireContent(l.parent))){const g=r.createElement("codeBlock",l.parent.getAttributes());r.append(u,g);const m=r.createDocumentFragment();r.append(g,m),t.return=m;return}const d=u.getChild(0);n.checkAttribute(d,"code")&&r.setAttribute("code",!0,d)})})}afterInit(){const e=this.editor,n=e.commands,o=n.get("indent"),c=n.get("outdent");o&&o.registerChildCommand(n.get("indentCodeBlock"),{priority:"highest"}),c&&c.registerChildCommand(n.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(s,t)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(!oe(e,t.isSoft)&&!ie(e,t.isSoft)&&ne(e),t.preventDefault(),s.stop())},{context:"pre"}),this._initAriaAnnouncements()}_initAriaAnnouncements(){const{model:e,ui:n,t:o}=this.editor,c=h(this.editor);let s=null;e.document.selection.on("change:range",()=>{const t=e.document.selection.focus.parent;!n||s===t||!t.is("element")||(s&&s.is("element","codeBlock")&&n.ariaLiveAnnouncer.announce(P(o,c,s,"leave")),t.is("element","codeBlock")&&n.ariaLiveAnnouncer.announce(P(o,c,t,"enter")),s=t)})}}function ne(i){const e=i.model,n=e.document,o=n.selection.getLastPosition();let c;const s=I(o,e);s&&s.is("$text")&&(c=w(s)),i.model.change(t=>{i.execute("shiftEnter"),c&&t.insertText(c,n.selection.anchor)})}function oe(i,e){const o=i.model.document,c=i.editing.view,s=o.selection.getLastPosition(),t=s.nodeAfter;return e||!o.selection.isCollapsed||!s.isAtStart||!f(t)?!1:(i.model.change(a=>{i.execute("enter");const l=o.selection.anchor.parent.previousSibling;a.rename(l,D),a.setSelection(l,"in"),i.model.schema.removeDisallowedAttributes([l],a),a.remove(t)}),c.scrollToTheSelection(),!0)}function ie(i,e){const n=i.model,o=n.document,c=i.editing.view,s=o.selection.getLastPosition(),t=s.nodeBefore;let a;if(e||!o.selection.isCollapsed||!s.isAtEnd||!t||!t.previousSibling)return!1;if(f(t)&&f(t.previousSibling))a=n.createRange(n.createPositionBefore(t.previousSibling),n.createPositionAfter(t));else if(B(t)&&f(t.previousSibling)&&f(t.previousSibling.previousSibling))a=n.createRange(n.createPositionBefore(t.previousSibling.previousSibling),n.createPositionAfter(t));else if(B(t)&&f(t.previousSibling)&&B(t.previousSibling.previousSibling)&&t.previousSibling.previousSibling&&f(t.previousSibling.previousSibling.previousSibling))a=n.createRange(n.createPositionBefore(t.previousSibling.previousSibling.previousSibling),n.createPositionAfter(t));else return!1;return i.model.change(l=>{l.remove(a),i.execute("enter");const r=o.selection.anchor.parent;l.rename(r,D),i.model.schema.removeDisallowedAttributes([r],l)}),c.scrollToTheSelection(),!0}function B(i){return i&&i.is("$text")&&!i.data.match(/\S/)}function f(i){return i&&i.is("element","softBreak")}class se extends v{static get pluginName(){return"CodeBlockUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,n=e.t,o=e.ui.componentFactory,c=h(e),s=this._getLanguageListItemDefinitions(c),t=e.commands.get("codeBlock");o.add("codeBlock",a=>{const l=R(a,j),r=l.buttonView,u=n("Insert code block");return r.set({label:u,tooltip:!0,icon:L,isToggleable:!0}),r.bind("isOn").to(t,"value",d=>!!d),r.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),l.on("execute",d=>{e.execute("codeBlock",{language:d.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),l.class="ck-code-block-dropdown",l.bind("isEnabled").to(t),q(l,s,{role:"menu",ariaLabel:u}),l}),o.add("menuBar:codeBlock",a=>{const l=new F(a);l.buttonView.set({role:"menuitem",label:n("Code block"),icon:L}),l.bind("isEnabled").to(t);const r=new $(a);r.set({ariaLabel:n("Insert code block")});for(const u of s){const d=new z(a,l),g=new W(a);g.bind(...Object.keys(u.model)).to(u.model),g.set({isToggleable:!0,role:"menuitemcheckbox"}),g.delegate("execute").to(l),g.on("execute",()=>{e.execute("codeBlock",{language:u.model._codeBlockLanguage,forceValue:t.value!=u.model._codeBlockLanguage}),e.editing.view.focus()}),d.children.add(g),r.items.add(d)}return l.panelView.children.add(r),l})}_getLanguageListItemDefinitions(e){const o=this.editor.commands.get("codeBlock"),c=new M;for(const s of e){const t={type:"button",model:new U({_codeBlockLanguage:s.language,label:s.label,role:"menuitemradio",withText:!0})};t.model.bind("isOn").to(o,"value",a=>a===t.model._codeBlockLanguage),c.add(t)}return c}}class me extends v{static get requires(){return[te,se]}static get pluginName(){return"CodeBlock"}static get isOfficialPlugin(){return!0}}export{me as CodeBlock,J as CodeBlockCommand,te as CodeBlockEditing,se as CodeBlockUI,G as IndentCodeBlockCommand,X as OutdentCodeBlockCommand,A as _canBeCodeBlock,Y as _dataViewToModelCodeBlockInsertion,ee as _dataViewToModelCodeBlockOrphanNodeConsumer,Z as _dataViewToModelCodeBlockTextNewlinesInsertion,P as _getCodeBlockAriaAnnouncement,C as _getCodeBlockIndentOutdentPositions,w as _getCodeBlockLeadingWhiteSpaces,k as _getCodeBlockPropertyAssociation,I as _getCodeBlockTextNodeAtLineStart,h as _getNormalizedAndLocalizedCodeBlockLanguageDefinitions,T as _isModelSelectionInCodeBlock,Q as _modelToDataViewCodeBlockSoftBreakInsertion,_ as _modelToViewCodeBlockInsertion,H as _rawCodeBlockSnippetTextToViewDocumentFragment};
@@ -1 +1 @@
1
- import{ObservableMixin as S,Collection as W,CKEditorError as c,insertToPriorityArray as H,setDataInElement as K,Config as z,decodeLicenseKey as U,toArray as V,crc32 as j,releaseDate as Y,uid as R,logError as J,isFeatureBlockedByLicenseKey as Q,Locale as X,EmitterMixin as Z,KeystrokeHandler as ee,global as A,env as k}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{Model as te,DataController as ie,StylesProcessor as ne,EditingController as se,Conversion as oe}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{EditorWatchdog as re,ContextWatchdog as ae}from"../../../../../@ckeditor_ckeditor5-watchdog@47.5.0/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js";import{isFunction as M}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isFunction.js";import{get as le}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/get.js";import{set as ce}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/set.js";class Le extends S(){editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",q,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",q),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}function q(r){r.return=!1,r.stop()}class ue extends S(){editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;static get _throwErrorWhenUsedAsAPlugin(){return!0}constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{if(!this.affectsData)return;const i=e.model.document.selection,u=!(i.getFirstPosition().root.rootName=="$graveyard")&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!u)&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",F,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",F),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function F(r){r.return=!1,r.stop()}class Ie extends ue{_childCommandsDefinitions=[];refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){H(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}class de{_commands;constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new c("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class $ extends Z(){_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],i=[]){super(),this._context=e,this._availablePlugins=new Map;for(const s of t)s.pluginName&&this._availablePlugins.set(s.pluginName,s);this._contextPlugins=new Map;for(const[s,u]of i)this._contextPlugins.set(s,u),this._contextPlugins.set(u,s),s.pluginName&&this._availablePlugins.set(s.pluginName,s)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let i=e;throw typeof e=="function"&&(i=e.pluginName||e.name),new c("plugincollection-plugin-not-loaded",this._context,{plugin:i})}return t}has(e){return this._plugins.has(e)}async init(e,t=[],i=[]){const s=this,u=this._context;w(e),m(e);const g=e.filter(n=>!p(n,t)),h=[...P(g)];x(h,i);const b=d(h);return await I(b,"init"),await I(b,"afterInit"),b;function y(n){return typeof n=="function"}function E(n){return y(n)&&!!n.isContextPlugin}function p(n,a){return a.some(o=>o===n||f(n)===o||f(o)===n)}function f(n){return y(n)?n.pluginName||n.name:n}function w(n,a=new Set){n.forEach(o=>{y(o)&&(a.has(o)||(a.add(o),o.pluginName&&!s._availablePlugins.has(o.pluginName)&&s._availablePlugins.set(o.pluginName,o),o.requires&&w(o.requires,a)))})}function P(n,a=new Set){return n.map(o=>y(o)?o:s._availablePlugins.get(o)).reduce((o,l)=>a.has(l)?o:(a.add(l),l.requires&&(m(l.requires,l),P(l.requires,a).forEach(_=>o.add(_))),o.add(l)),new Set)}function m(n,a=null){n.map(o=>y(o)?o:s._availablePlugins.get(o)||o).forEach(o=>{C(o),O(o,a),D(o,a),L(o,a)})}function C(n){if(typeof n=="function"&&n._throwErrorWhenUsedAsAPlugin)throw new c("plugincollection-plugin-invalid-constructor",u,{name:n.name})}function O(n,a){if(!y(n))throw a?new c("plugincollection-soft-required",u,{missingPlugin:n,requiredBy:f(a)}):new c("plugincollection-plugin-not-found",u,{plugin:n})}function D(n,a){if(E(a)&&!E(n))throw new c("plugincollection-context-required",u,{plugin:f(n),requiredBy:f(a)})}function L(n,a){if(a&&p(n,t))throw new c("plugincollection-required",u,{plugin:f(n),requiredBy:f(a)})}function d(n){return n.map(a=>{let o=s._contextPlugins.get(a);return o=o||new a(u),s._add(a,o),o})}function I(n,a){return n.reduce((o,l)=>!l[a]||s._contextPlugins.has(l)?o:o.then(l[a].bind(l)),Promise.resolve())}function x(n,a){for(const o of a){if(typeof o!="function")throw new c("plugincollection-replace-plugin-invalid-type",null,{pluginItem:o});const l=o.pluginName;if(!l)throw new c("plugincollection-replace-plugin-missing-name",null,{pluginItem:o});if(o.requires&&o.requires.length)throw new c("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:l});const _=s._availablePlugins.get(l);if(!_)throw new c("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:l});const v=n.indexOf(_);if(v===-1){if(s._contextPlugins.has(_))return;throw new c("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:l})}if(_.requires&&_.requires.length)throw new c("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:l});n.splice(v,1,o),s._availablePlugins.set(l,o)}}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy=="function"&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new c("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}class G{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){const{translations:t,...i}=e||{};this.config=new z(i,this.constructor.defaultConfig);const s=this.constructor.builtinPlugins;this.config.define("plugins",s),this.plugins=new $(this,s);const u=this.config.get("language")||{};this.locale=new X({uiLanguage:typeof u=="string"?u:u.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new W}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if(typeof i!="function")throw new c("context-initplugins-constructor-only",null,{Plugin:i});if(i.isContextPlugin!==!0)throw new c("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new c("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}static get _throwErrorWhenUsedAsAPlugin(){return!0}}class he extends S(){context;constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}class fe extends ee{editor;constructor(e){super(),this.editor=e}set(e,t,i={}){if(typeof t=="string"){const s=t;t=(u,g)=>{this.editor.execute(s),g()}}super.set(e,t,i)}}const N="contentEditing",B="common";class ge{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;const t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:N,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});const s=[{label:i("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:i("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:i("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:i("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:i("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:i("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&s.push({label:i("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:i("User interface and content navigation keystrokes"),description:i("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:s}]})}addKeystrokeInfoCategory({id:e,label:t,description:i,groups:s}){this.keystrokeInfos.set(e,{id:e,label:t,description:i,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:B}),s&&s.forEach(u=>{this.addKeystrokeInfoGroup({categoryId:e,...u})})}addKeystrokeInfoGroup({categoryId:e=N,id:t,label:i,keystrokes:s}){const u=this.keystrokeInfos.get(e);if(!u)throw new c("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});u.groups.set(t,{id:t,label:i,keystrokes:s||[]})}addKeystrokeInfos({categoryId:e=N,groupId:t=B,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new c("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});const s=this.keystrokeInfos.get(e);if(!s.groups.has(t))throw new c("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});s.groups.get(t).keystrokes.push(...i)}}function me(r){return{sessionId:_e(),pageSessionId:Ee(),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:ye(r),plugins:we(r.plugins),distribution:pe(),env:be(),integration:Object.create(null),menuBar:{isVisible:!!r.config.get("menuBar.isVisible")},language:{ui:r.locale.uiLanguage,content:r.locale.contentLanguage},toolbar:{main:T(r.config.get("toolbar")),block:T(r.config.get("blockToolbar")),balloon:T(r.config.get("balloonToolbar"))}}}function ye(r){return Object.getPrototypeOf(r).constructor.editorName}function we(r){return Array.from(r).filter(([e])=>!!e.pluginName).map(([e])=>{const{pluginName:t,isContextPlugin:i,isOfficialPlugin:s,isPremiumPlugin:u}=e;return{isContext:!!i,isOfficial:!!s,isPremium:!!u,name:t}})}function T(r){if(!r)return;const e=Array.isArray(r)?{items:r}:r,t=u(e.items||[]);return{isMultiline:t.includes("-"),shouldNotGroupWhenFull:!!e.shouldNotGroupWhenFull,items:s(t)};function s(g){return g.filter(h=>h!=="|"&&h!=="-")}function u(g){return g.flatMap(h=>typeof h=="string"?[h]:u(h.items))}}function pe(){return{channel:window[Symbol.for("cke distribution")]||"sh"}}function be(){let r="unknown",e="unknown";return k.isMac?r="mac":k.isWindows?r="windows":k.isiOS?r="ios":k.isAndroid&&(r="android"),k.isGecko?e="gecko":k.isBlink?e="blink":k.isSafari&&(e="safari"),{os:r,browser:e}}function _e(){return localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",R()),localStorage.getItem("__ckeditor-session-id")}function Ee(){return A.window.CKEDITOR_PAGE_SESSION_ID=A.window.CKEDITOR_PAGE_SESSION_ID||R(),A.window.CKEDITOR_PAGE_SESSION_ID}class Ae extends S(){static get editorName(){return"Editor"}accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;static get _throwErrorWhenUsedAsAPlugin(){return!0}constructor(e={}){if(super(),typeof e!="object"||Array.isArray(e))throw new c("editor-config-invalid-type");if("sanitizeHtml"in e)throw new c("editor-config-sanitizehtml-not-supported");const t=this.constructor,{translations:i,...s}=t.defaultConfig||{},{translations:u=i,...g}=e,h=e.language||s.language;this._context=e.context||new G({language:h,translations:u}),this._context._addEditor(this,!e.context);const b=Array.from(t.builtinPlugins||[]);this.config=new z(g,s),this.config.define("plugins",b),this.config.define(this._context._getEditorConfig()),E(this.config),this.plugins=new $(this,b,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new de,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new te(this.config),this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const y=new ne;this.data=new ie(this.model,y),this.editing=new se(this.model,y),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new oe([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new fe(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new ge(this),p(this);function E(f){let w=f.get("licenseKey");if(!w&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(w=window.CKEDITOR_GLOBAL_LICENSE_KEY,f.set("licenseKey",w)),!w)throw new c("license-key-missing")}function p(f){const w=f.config.get("licenseKey"),P=window[Symbol.for("cke distribution")]||"sh";function m(n,a){f.enableReadOnlyMode(Symbol("invalidLicense")),f._showLicenseError(n,a)}function C(n){return["exp","jti","vc"].every(o=>o in n)}function O(n){return Object.getOwnPropertyNames(n).sort().filter(l=>l!="vc"&&n[l]!=null).map(l=>n[l])}function D(n){const{hostname:a}=new URL(window.location.href);if(n.includes(a))return!0;const o=a.split(".");return n.filter(l=>l.includes("*")).map(l=>l.split(".")).filter(l=>l.length<=o.length).map(l=>Array(o.length-l.length).fill(l[0]==="*"?"*":"").concat(l)).some(l=>o.every((_,v)=>l[v]===_||l[v]==="*"))}function L(n){const a=n[0].toUpperCase()+n.slice(1),o=n==="evaluation"?"an":"a";console.info(`%cCKEditor 5 ${a} License`,"color: #ffffff; background: #743CCD; font-size: 14px; padding: 4px 8px; border-radius: 4px;"),console.warn(`⚠️ You are using ${o} ${n} license of CKEditor 5${n==="trial"?" which is for evaluation purposes only":""}. For production usage, please obtain a production license at https://portal.ckeditor.com/`)}if(w=="GPL"){P=="cloud"&&m("distributionChannel");return}const d=U(w);if(!d){m("invalid");return}if(!C(d)){m("invalid");return}if(d.distributionChannel&&!V(d.distributionChannel).includes(P)){m("distributionChannel");return}if(j(O(d))!=d.vc.toLowerCase()){m("invalid");return}if(new Date(d.exp*1e3)<Y){m("expired");return}const x=d.licensedHosts;if(x&&x.length>0&&!D(x)){m("domainLimit");return}if(["evaluation","trial"].includes(d.licenseType)&&d.exp*1e3<Date.now()){m("expired");return}if(["development","evaluation","trial"].includes(d.licenseType)){const{licenseType:n}=d;window.CKEDITOR_WARNING_SUPPRESSIONS=window.CKEDITOR_WARNING_SUPPRESSIONS||{},window.CKEDITOR_WARNING_SUPPRESSIONS[n]||(L(n),window.CKEDITOR_WARNING_SUPPRESSIONS[n]=!0)}if(["evaluation","trial"].includes(d.licenseType)){const n=d.licenseType,a=setTimeout(()=>{m(`${n}Limit`)},6e5);f.on("destroy",()=>{clearTimeout(a)})}d.usageEndpoint&&f.once("ready",()=>{const n={requestId:R(),requestTime:Math.round(Date.now()/1e3),license:w,editor:ke(f)};f._sendUsageRequest(d.usageEndpoint,n).then(a=>{const{status:o,message:l}=a;l&&console.warn(l),o!="ok"&&m("usageLimit")},()=>{J("license-key-validation-endpoint-not-reachable",{url:d.usageEndpoint})})},{priority:"high"})}}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new c("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new c("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new c("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],s=e.get("extraPlugins")||[],u=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(s),i,u).then(h=>(g(this),h));function g(h){const b=h.config.get("licenseKey");if(b==="GPL")return;const y=U(b);if(!y)return;const E=[...h.plugins].map(([p])=>p).find(p=>!p.pluginName||!p.licenseFeatureCode?!1:Q(y,p.licenseFeatureCode));E&&(h.enableReadOnlyMode(Symbol("invalidLicense")),h._showLicenseError("pluginNotAllowed",E.pluginName))}}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(i){c.rethrowUnexpectedError(i,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}static Context=G;static EditorWatchdog=re;static ContextWatchdog=ae;_showLicenseError(e,t){setTimeout(()=>{if(e=="invalid")throw new c("invalid-license-key");if(e=="expired")throw new c("license-key-expired");if(e=="domainLimit")throw new c("license-key-domain-limit");if(e=="pluginNotAllowed"){const i=t.replace(/(Editing|UI)$/,""),s=this.plugins.has(i);throw new c("license-key-plugin-not-allowed",null,{pluginName:s?i:t})}if(e=="featureNotAllowed")throw new c("license-key-feature-not-allowed",null,{featureName:t});if(e=="evaluationLimit")throw new c("license-key-evaluation-limit");if(e=="trialLimit")throw new c("license-key-trial-limit");if(e=="developmentLimit")throw new c("license-key-development-limit");if(e=="usageLimit")throw new c("license-key-usage-limit");if(e=="distributionChannel")throw new c("license-key-invalid-distribution-channel")},0),this._showLicenseError=()=>{}}async _sendUsageRequest(e,t){const i=new Headers({"Content-Type":"application/json"}),s=await fetch(new URL(e),{method:"POST",headers:i,body:JSON.stringify(t)});if(!s.ok)throw new Error(`HTTP Response: ${s.status}`);return s.json()}}function ke(r){const e=me(r);function t(i,s){if(le(e,i)!==void 0)throw new c("editor-usage-data-path-already-set",{path:i});ce(e,i,s)}return r.fire("collectUsageData",{setUsageData:t}),e}function Ne(r){if(!M(r.updateSourceElement))throw new c("attachtoform-missing-elementapi-interface",r);const e=r.sourceElement;if(Pe(e)&&e.form){let t;const i=e.form,s=()=>r.updateSourceElement();M(i.submit)&&(t=i.submit,i.submit=()=>{s(),t.apply(i)}),i.addEventListener("submit",s),r.on("destroy",()=>{i.removeEventListener("submit",s),t&&(i.submit=t)})}}function Pe(r){return!!r&&r.tagName.toLowerCase()==="textarea"}function Te(r){class e extends r{sourceElement;updateSourceElement(i){if(!this.sourceElement)throw new c("editor-missing-sourceelement",this);const s=this.config.get("updateSourceElementOnDestroy"),u=this.sourceElement instanceof HTMLTextAreaElement;if(!s&&!u){K(this.sourceElement,"");return}const g=typeof i=="string"?i:this.data.get();K(this.sourceElement,g)}}return e}class Re extends he{_actions;static get pluginName(){return"PendingActions"}static get isOfficialPlugin(){return!0}init(){this.set("hasAny",!1),this._actions=new W({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new c("pendingactions-add-invalid-message",this);const t=new(S());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}export{ge as Accessibility,ue as Command,de as CommandCollection,G as Context,he as ContextPlugin,fe as EditingKeystrokeHandler,Ae as Editor,Te as ElementApiMixin,Ie as MultiCommand,Re as PendingActions,Le as Plugin,B as _DEFAULT_ACCESSIBILITY_GROUP_ID,me as _getEditorUsageData,Ne as attachToForm};
1
+ import{ObservableMixin as S,Collection as W,CKEditorError as c,insertToPriorityArray as V,setDataInElement as K,Config as z,decodeLicenseKey as U,toArray as $,crc32 as j,releaseDate as Y,uid as R,logError as J,isFeatureBlockedByLicenseKey as Q,Locale as X,EmitterMixin as Z,KeystrokeHandler as ee,global as A,env as k}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{Model as te,DataController as ie,StylesProcessor as ne,EditingController as se,Conversion as oe}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{EditorWatchdog as re,ContextWatchdog as ae}from"../../../../../@ckeditor_ckeditor5-watchdog@47.6.0/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js";import{isFunction as M}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isFunction.js";import{get as le}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/get.js";import{set as ce}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/object/set.js";class Le extends S(){editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",q,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",q),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}function q(r){r.return=!1,r.stop()}class ue extends S(){editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;static get _throwErrorWhenUsedAsAPlugin(){return!0}constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{if(!this.affectsData)return;const i=e.model.document.selection,u=!(i.getFirstPosition().root.rootName=="$graveyard")&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!u)&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",F,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",F),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function F(r){r.return=!1,r.stop()}class Ie extends ue{_childCommandsDefinitions=[];refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){V(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}class de{_commands;constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new c("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class H extends Z(){_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],i=[]){super(),this._context=e,this._availablePlugins=new Map;for(const s of t)s.pluginName&&this._availablePlugins.set(s.pluginName,s);this._contextPlugins=new Map;for(const[s,u]of i)this._contextPlugins.set(s,u),this._contextPlugins.set(u,s),s.pluginName&&this._availablePlugins.set(s.pluginName,s)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let i=e;throw typeof e=="function"&&(i=e.pluginName||e.name),new c("plugincollection-plugin-not-loaded",this._context,{plugin:i})}return t}has(e){return this._plugins.has(e)}async init(e,t=[],i=[]){const s=this,u=this._context;w(e),m(e);const g=e.filter(n=>!p(n,t)),d=[...P(g)];x(d,i);const b=f(d);return await I(b,"init"),await I(b,"afterInit"),b;function y(n){return typeof n=="function"}function E(n){return y(n)&&!!n.isContextPlugin}function p(n,a){return a.some(o=>o===n||h(n)===o||h(o)===n)}function h(n){return y(n)?n.pluginName||n.name:n}function w(n,a=new Set){n.forEach(o=>{y(o)&&(a.has(o)||(a.add(o),o.pluginName&&!s._availablePlugins.has(o.pluginName)&&s._availablePlugins.set(o.pluginName,o),o.requires&&w(o.requires,a)))})}function P(n,a=new Set){return n.map(o=>y(o)?o:s._availablePlugins.get(o)).reduce((o,l)=>a.has(l)?o:(a.add(l),l.requires&&(m(l.requires,l),P(l.requires,a).forEach(_=>o.add(_))),o.add(l)),new Set)}function m(n,a=null){n.map(o=>y(o)?o:s._availablePlugins.get(o)||o).forEach(o=>{C(o),O(o,a),D(o,a),L(o,a)})}function C(n){if(typeof n=="function"&&n._throwErrorWhenUsedAsAPlugin)throw new c("plugincollection-plugin-invalid-constructor",u,{name:n.name})}function O(n,a){if(!y(n))throw a?new c("plugincollection-soft-required",u,{missingPlugin:n,requiredBy:h(a)}):new c("plugincollection-plugin-not-found",u,{plugin:n})}function D(n,a){if(E(a)&&!E(n))throw new c("plugincollection-context-required",u,{plugin:h(n),requiredBy:h(a)})}function L(n,a){if(a&&p(n,t))throw new c("plugincollection-required",u,{plugin:h(n),requiredBy:h(a)})}function f(n){return n.map(a=>{let o=s._contextPlugins.get(a);return o=o||new a(u),s._add(a,o),o})}function I(n,a){return n.reduce((o,l)=>!l[a]||s._contextPlugins.has(l)?o:o.then(l[a].bind(l)),Promise.resolve())}function x(n,a){for(const o of a){if(typeof o!="function")throw new c("plugincollection-replace-plugin-invalid-type",null,{pluginItem:o});const l=o.pluginName;if(!l)throw new c("plugincollection-replace-plugin-missing-name",null,{pluginItem:o});if(o.requires&&o.requires.length)throw new c("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:l});const _=s._availablePlugins.get(l);if(!_)throw new c("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:l});const v=n.indexOf(_);if(v===-1){if(s._contextPlugins.has(_))return;throw new c("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:l})}if(_.requires&&_.requires.length)throw new c("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:l});n.splice(v,1,o),s._availablePlugins.set(l,o)}}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy=="function"&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new c("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}class G{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){const{translations:t,...i}=e||{};this.config=new z(i,this.constructor.defaultConfig);const s=this.constructor.builtinPlugins;this.config.define("plugins",s),this.plugins=new H(this,s);const u=this.config.get("language")||{};this.locale=new X({uiLanguage:typeof u=="string"?u:u.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new W}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if(typeof i!="function")throw new c("context-initplugins-constructor-only",null,{Plugin:i});if(i.isContextPlugin!==!0)throw new c("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new c("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}static get _throwErrorWhenUsedAsAPlugin(){return!0}}class he extends S(){context;constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}class fe extends ee{editor;constructor(e){super(),this.editor=e}set(e,t,i={}){if(typeof t=="string"){const s=t;t=(u,g)=>{this.editor.execute(s),g()}}super.set(e,t,i)}}const N="contentEditing",B="common";class ge{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;const t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:N,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});const s=[{label:i("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:i("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:i("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:i("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:i("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:i("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&s.push({label:i("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:i("User interface and content navigation keystrokes"),description:i("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:s}]})}addKeystrokeInfoCategory({id:e,label:t,description:i,groups:s}){this.keystrokeInfos.set(e,{id:e,label:t,description:i,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:B}),s&&s.forEach(u=>{this.addKeystrokeInfoGroup({categoryId:e,...u})})}addKeystrokeInfoGroup({categoryId:e=N,id:t,label:i,keystrokes:s}){const u=this.keystrokeInfos.get(e);if(!u)throw new c("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});u.groups.set(t,{id:t,label:i,keystrokes:s||[]})}addKeystrokeInfos({categoryId:e=N,groupId:t=B,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new c("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});const s=this.keystrokeInfos.get(e);if(!s.groups.has(t))throw new c("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});s.groups.get(t).keystrokes.push(...i)}}function me(r){return{sessionId:_e(),pageSessionId:Ee(),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:ye(r),plugins:we(r.plugins),distribution:pe(),env:be(),integration:Object.create(null),menuBar:{isVisible:!!r.config.get("menuBar.isVisible")},language:{ui:r.locale.uiLanguage,content:r.locale.contentLanguage},toolbar:{main:T(r.config.get("toolbar")),block:T(r.config.get("blockToolbar")),balloon:T(r.config.get("balloonToolbar"))}}}function ye(r){return Object.getPrototypeOf(r).constructor.editorName}function we(r){return Array.from(r).filter(([e])=>!!e.pluginName).map(([e])=>{const{pluginName:t,isContextPlugin:i,isOfficialPlugin:s,isPremiumPlugin:u}=e;return{isContext:!!i,isOfficial:!!s,isPremium:!!u,name:t}})}function T(r){if(!r)return;const e=Array.isArray(r)?{items:r}:r,t=u(e.items||[]);return{isMultiline:t.includes("-"),shouldNotGroupWhenFull:!!e.shouldNotGroupWhenFull,items:s(t)};function s(g){return g.filter(d=>d!=="|"&&d!=="-")}function u(g){return g.flatMap(d=>typeof d=="string"?[d]:u(d.items))}}function pe(){return{channel:window[Symbol.for("cke distribution")]||"sh"}}function be(){let r="unknown",e="unknown";return k.isMac?r="mac":k.isWindows?r="windows":k.isiOS?r="ios":k.isAndroid&&(r="android"),k.isGecko?e="gecko":k.isBlink?e="blink":k.isSafari&&(e="safari"),{os:r,browser:e}}function _e(){return localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",R()),localStorage.getItem("__ckeditor-session-id")}function Ee(){return A.window.CKEDITOR_PAGE_SESSION_ID=A.window.CKEDITOR_PAGE_SESSION_ID||R(),A.window.CKEDITOR_PAGE_SESSION_ID}class Ae extends S(){static get editorName(){return"Editor"}accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;static get _throwErrorWhenUsedAsAPlugin(){return!0}constructor(e={}){if(super(),typeof e!="object"||Array.isArray(e))throw new c("editor-config-invalid-type");if("sanitizeHtml"in e)throw new c("editor-config-sanitizehtml-not-supported");const t=this.constructor,{translations:i,...s}=t.defaultConfig||{},{translations:u=i,...g}=e,d=e.language||s.language;this._context=e.context||new G({language:d,translations:u}),this._context._addEditor(this,!e.context);const b=Array.from(t.builtinPlugins||[]);this.config=new z(g,s),this.config.define("plugins",b),this.config.define(this._context._getEditorConfig()),E(this.config),this.plugins=new H(this,b,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new de,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new te(this.config),this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const y=new ne;this.data=new ie(this.model,y),this.editing=new se(this.model,y),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new oe([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new fe(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new ge(this),p(this);function E(h){let w=h.get("licenseKey");if(!w&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(w=window.CKEDITOR_GLOBAL_LICENSE_KEY,h.set("licenseKey",w)),!w)throw new c("license-key-missing")}function p(h){const w=h.config.get("licenseKey"),P=window[Symbol.for("cke distribution")]||"sh";function m(n,a){h.enableReadOnlyMode(Symbol("invalidLicense")),h._showLicenseError(n,a)}function C(n){return["exp","jti","vc"].every(o=>o in n)}function O(n){return Object.getOwnPropertyNames(n).sort().filter(l=>l!="vc"&&n[l]!=null).map(l=>n[l])}function D(n){const{hostname:a}=new URL(window.location.href);if(n.includes(a))return!0;const o=a.split(".");return n.filter(l=>l.includes("*")).map(l=>l.split(".")).filter(l=>l.length<=o.length).map(l=>Array(o.length-l.length).fill(l[0]==="*"?"*":"").concat(l)).some(l=>o.every((_,v)=>l[v]===_||l[v]==="*"))}function L(n){const a=n[0].toUpperCase()+n.slice(1),o=n==="evaluation"?"an":"a";console.info(`%cCKEditor 5 ${a} License`,"color: #ffffff; background: #743CCD; font-size: 14px; padding: 4px 8px; border-radius: 4px;"),console.warn(`⚠️ You are using ${o} ${n} license of CKEditor 5${n==="trial"?" which is for evaluation purposes only":""}. For production usage, please obtain a production license at https://portal.ckeditor.com/`)}if(w=="GPL"){P=="cloud"&&m("distributionChannel");return}const f=U(w);if(!f){m("invalid");return}if(!C(f)){m("invalid");return}if(f.distributionChannel&&!$(f.distributionChannel).includes(P)){m("distributionChannel");return}if(j(O(f))!=f.vc.toLowerCase()){m("invalid");return}if(new Date(f.exp*1e3)<Y){m("expired");return}const x=f.licensedHosts;if(x&&x.length>0&&!D(x)){m("domainLimit");return}if(["evaluation","trial"].includes(f.licenseType)&&f.exp*1e3<Date.now()){m("expired");return}if(["development","evaluation","trial"].includes(f.licenseType)){const{licenseType:n}=f;window.CKEDITOR_WARNING_SUPPRESSIONS=window.CKEDITOR_WARNING_SUPPRESSIONS||{},window.CKEDITOR_WARNING_SUPPRESSIONS[n]||(L(n),window.CKEDITOR_WARNING_SUPPRESSIONS[n]=!0)}if(f.licenseType==="evaluation"){const n=setTimeout(()=>{m("evaluationLimit")},6e5);h.on("destroy",()=>{clearTimeout(n)})}f.usageEndpoint&&h.once("ready",()=>{const n={requestId:R(),requestTime:Math.round(Date.now()/1e3),license:w,editor:ke(h)};h._sendUsageRequest(f.usageEndpoint,n).then(a=>{const{status:o,message:l}=a;l&&console.warn(l),o!="ok"&&m("usageLimit")},()=>{J("license-key-validation-endpoint-not-reachable",{url:f.usageEndpoint})})},{priority:"high"})}}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new c("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new c("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new c("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],s=e.get("extraPlugins")||[],u=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(s),i,u).then(d=>(g(this),d));function g(d){const b=d.config.get("licenseKey");if(b==="GPL")return;const y=U(b);if(!y)return;const E=[...d.plugins].map(([p])=>p).find(p=>!p.pluginName||!p.licenseFeatureCode?!1:Q(y,p.licenseFeatureCode));E&&(d.enableReadOnlyMode(Symbol("invalidLicense")),d._showLicenseError("pluginNotAllowed",E.pluginName))}}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(i){c.rethrowUnexpectedError(i,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}static Context=G;static EditorWatchdog=re;static ContextWatchdog=ae;_showLicenseError(e,t){setTimeout(()=>{if(e=="invalid")throw new c("invalid-license-key");if(e=="expired")throw new c("license-key-expired");if(e=="domainLimit")throw new c("license-key-domain-limit");if(e=="pluginNotAllowed"){const i=t.replace(/(Editing|UI)$/,""),s=this.plugins.has(i);throw new c("license-key-plugin-not-allowed",null,{pluginName:s?i:t})}if(e=="featureNotAllowed")throw new c("license-key-feature-not-allowed",null,{featureName:t});if(e=="evaluationLimit")throw new c("license-key-evaluation-limit");if(e=="trialLimit")throw new c("license-key-trial-limit");if(e=="developmentLimit")throw new c("license-key-development-limit");if(e=="usageLimit")throw new c("license-key-usage-limit");if(e=="distributionChannel")throw new c("license-key-invalid-distribution-channel")},0),this._showLicenseError=()=>{}}async _sendUsageRequest(e,t){const i=new Headers({"Content-Type":"application/json"}),s=await fetch(new URL(e),{method:"POST",headers:i,body:JSON.stringify(t)});if(!s.ok)throw new Error(`HTTP Response: ${s.status}`);return s.json()}}function ke(r){const e=me(r);function t(i,s){if(le(e,i)!==void 0)throw new c("editor-usage-data-path-already-set",{path:i});ce(e,i,s)}return r.fire("collectUsageData",{setUsageData:t}),e}function Ne(r){if(!M(r.updateSourceElement))throw new c("attachtoform-missing-elementapi-interface",r);const e=r.sourceElement;if(Pe(e)&&e.form){let t;const i=e.form,s=()=>r.updateSourceElement();M(i.submit)&&(t=i.submit,i.submit=()=>{s(),t.apply(i)}),i.addEventListener("submit",s),r.on("destroy",()=>{i.removeEventListener("submit",s),t&&(i.submit=t)})}}function Pe(r){return!!r&&r.tagName.toLowerCase()==="textarea"}function Te(r){class e extends r{sourceElement;updateSourceElement(i){if(!this.sourceElement)throw new c("editor-missing-sourceelement",this);const s=this.config.get("updateSourceElementOnDestroy"),u=this.sourceElement instanceof HTMLTextAreaElement;if(!s&&!u){K(this.sourceElement,"");return}const g=typeof i=="string"?i:this.data.get();K(this.sourceElement,g)}}return e}class Re extends he{_actions;static get pluginName(){return"PendingActions"}static get isOfficialPlugin(){return!0}init(){this.set("hasAny",!1),this._actions=new W({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new c("pendingactions-add-invalid-message",this);const t=new(S());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}export{ge as Accessibility,ue as Command,de as CommandCollection,G as Context,he as ContextPlugin,fe as EditingKeystrokeHandler,Ae as Editor,Te as ElementApiMixin,Ie as MultiCommand,Re as PendingActions,Le as Plugin,B as _DEFAULT_ACCESSIBILITY_GROUP_ID,me as _getEditorUsageData,Ne as attachToForm};
@@ -1 +1 @@
1
- import{BoxedEditorUIView as f,StickyPanelView as w,ToolbarView as m,MenuBarView as p,InlineEditableUIView as b,EditorUI as y,normalizeToolbarConfig as v,DialogView as u}from"../../../../../@ckeditor_ckeditor5-ui@47.5.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{enableViewPlaceholder as P}from"../../../../../@ckeditor_ckeditor5-engine@47.5.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{CKEditorError as k,getDataFromElement as T,ElementReplacer as V,Rect as a}from"../../../../../@ckeditor_ckeditor5-utils@47.5.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ElementApiMixin as C,attachToForm as B,Editor as E}from"../../../../../@ckeditor_ckeditor5-core@47.5.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{isElement as S}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isElement.js";class _ extends y{view;_toolbarConfig;_elementReplacer;constructor(t,i){super(t),this.view=i,this._toolbarConfig=v(t.config.get("toolbar")),this._elementReplacer=new V,this.listenTo(t.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(t){const i=this.editor,o=this.view,n=i.editing.view,e=o.editable,s=n.document.getRoot();e.name=s.rootName,o.render();const r=e.element;this.setEditableElement(e.name,r),o.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),o.menuBarView&&this.initMenuBar(o.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();const t=this.view,i=this.editor.editing.view;this._elementReplacer.restore(),i.getDomRoot(t.editable.name)&&i.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.view;t.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),t.stickyPanel.limiterElement=t.element,t.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:i})=>i||0),t.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){const t=this.editor,i=t.editing.view,o=i.document.getRoot(),n=t.sourceElement;let e;const s=t.config.get("placeholder");s&&(e=typeof s=="string"?s:s[this.view.editable.name]),!e&&n&&n.tagName.toLowerCase()==="textarea"&&(e=n.getAttribute("placeholder")),e&&(o.placeholder=e),P({view:i,element:o,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:t}=this.view,i=this.editor.plugins.get("ContextualBalloon");i.on("getPositionOptions",n=>{const e=n.return;if(!e||!t.isSticky||!t.element)return;const s=new a(t.element).height,r=typeof e.target=="function"?e.target():e.target,h=typeof e.limiter=="function"?e.limiter():e.limiter;if(r&&h&&new a(r).height>=new a(h).height-s)return;const d={...e.viewportOffsetConfig},g=(d.top||0)+s;n.return={...e,viewportOffsetConfig:{...d,top:g}}},{priority:"low"});const o=()=>{i.visibleView&&i.updatePosition()};this.listenTo(t,"change:isSticky",o),this.listenTo(this.editor.ui,"change:viewportOffset",o)}_handleScrollToTheSelectionWithStickyPanel(t,i,o){const n=this.view.stickyPanel;if(n.isSticky){const e=new a(n.element).height;i.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(o)};this.listenTo(n,"change:isSticky",e),setTimeout(()=>{this.stopListening(n,"change:isSticky",e)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const t=this.view.stickyPanel,i=this.editor.plugins.get("Dialog");i.on("show",()=>{const o=i.view;o.on("moveTo",(n,e)=>{if(!t.isSticky||o.wasMoved||o.isModal)return;const s=new a(t.contentPanelElement);e[1]<s.bottom+u.defaultOffset&&(e[1]=s.bottom+u.defaultOffset)},{priority:"high"})},{priority:"low"})}}class R extends f{stickyPanel;toolbar;editable;constructor(t,i,o={}){super(t),this.stickyPanel=new w(t),this.toolbar=new m(t,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),o.useMenuBar&&(this.menuBarView=new p(t)),this.editable=new b(t,i,void 0,{label:o.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class W extends C(E){static get editorName(){return"ClassicEditor"}ui;constructor(t,i={}){if(!c(t)&&i.initialData!==void 0)throw new k("editor-create-initial-data",null);super(i),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",x(t)),c(t)&&(this.sourceElement=t),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=this.config.get("menuBar"),e=new R(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:o,useMenuBar:n.isVisible,label:this.config.get("label")});this.ui=new _(this,e),B(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(t,i={}){return new Promise(o=>{const n=new this(t,i);o(n.initPlugins().then(()=>n.ui.init(c(t)?t:null)).then(()=>n.data.init(n.config.get("initialData"))).then(()=>n.fire("ready")).then(()=>n))})}}function x(l){return c(l)?T(l):l}function c(l){return S(l)}export{W as ClassicEditor,_ as ClassicEditorUI,R as ClassicEditorUIView};
1
+ import{BoxedEditorUIView as f,StickyPanelView as w,ToolbarView as m,MenuBarView as p,InlineEditableUIView as b,EditorUI as y,normalizeToolbarConfig as v,DialogView as u}from"../../../../../@ckeditor_ckeditor5-ui@47.6.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{enableViewPlaceholder as P}from"../../../../../@ckeditor_ckeditor5-engine@47.6.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{CKEditorError as k,getDataFromElement as T,ElementReplacer as V,Rect as a}from"../../../../../@ckeditor_ckeditor5-utils@47.6.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ElementApiMixin as C,attachToForm as B,Editor as E}from"../../../../../@ckeditor_ckeditor5-core@47.6.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{isElement as S}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isElement.js";class _ extends y{view;_toolbarConfig;_elementReplacer;constructor(t,i){super(t),this.view=i,this._toolbarConfig=v(t.config.get("toolbar")),this._elementReplacer=new V,this.listenTo(t.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(t){const i=this.editor,o=this.view,n=i.editing.view,e=o.editable,s=n.document.getRoot();e.name=s.rootName,o.render();const r=e.element;this.setEditableElement(e.name,r),o.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),o.menuBarView&&this.initMenuBar(o.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();const t=this.view,i=this.editor.editing.view;this._elementReplacer.restore(),i.getDomRoot(t.editable.name)&&i.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.view;t.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),t.stickyPanel.limiterElement=t.element,t.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:i})=>i||0),t.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){const t=this.editor,i=t.editing.view,o=i.document.getRoot(),n=t.sourceElement;let e;const s=t.config.get("placeholder");s&&(e=typeof s=="string"?s:s[this.view.editable.name]),!e&&n&&n.tagName.toLowerCase()==="textarea"&&(e=n.getAttribute("placeholder")),e&&(o.placeholder=e),P({view:i,element:o,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:t}=this.view,i=this.editor.plugins.get("ContextualBalloon");i.on("getPositionOptions",n=>{const e=n.return;if(!e||!t.isSticky||!t.element)return;const s=new a(t.element).height,r=typeof e.target=="function"?e.target():e.target,h=typeof e.limiter=="function"?e.limiter():e.limiter;if(r&&h&&new a(r).height>=new a(h).height-s)return;const d={...e.viewportOffsetConfig},g=(d.top||0)+s;n.return={...e,viewportOffsetConfig:{...d,top:g}}},{priority:"low"});const o=()=>{i.visibleView&&i.updatePosition()};this.listenTo(t,"change:isSticky",o),this.listenTo(this.editor.ui,"change:viewportOffset",o)}_handleScrollToTheSelectionWithStickyPanel(t,i,o){const n=this.view.stickyPanel;if(n.isSticky){const e=new a(n.element).height;i.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(o)};this.listenTo(n,"change:isSticky",e),setTimeout(()=>{this.stopListening(n,"change:isSticky",e)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const t=this.view.stickyPanel,i=this.editor.plugins.get("Dialog");i.on("show",()=>{const o=i.view;o.on("moveTo",(n,e)=>{if(!t.isSticky||o.wasMoved||o.isModal)return;const s=new a(t.contentPanelElement);e[1]<s.bottom+u.defaultOffset&&(e[1]=s.bottom+u.defaultOffset)},{priority:"high"})},{priority:"low"})}}class R extends f{stickyPanel;toolbar;editable;constructor(t,i,o={}){super(t),this.stickyPanel=new w(t),this.toolbar=new m(t,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),o.useMenuBar&&(this.menuBarView=new p(t)),this.editable=new b(t,i,void 0,{label:o.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class W extends C(E){static get editorName(){return"ClassicEditor"}ui;constructor(t,i={}){if(!c(t)&&i.initialData!==void 0)throw new k("editor-create-initial-data",null);super(i),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",x(t)),c(t)&&(this.sourceElement=t),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=this.config.get("menuBar"),e=new R(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:o,useMenuBar:n.isVisible,label:this.config.get("label")});this.ui=new _(this,e),B(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(t,i={}){return new Promise(o=>{const n=new this(t,i);o(n.initPlugins().then(()=>n.ui.init(c(t)?t:null)).then(()=>n.data.init(n.config.get("initialData"))).then(()=>n.fire("ready")).then(()=>n))})}}function x(l){return c(l)?T(l):l}function c(l){return S(l)}export{W as ClassicEditor,_ as ClassicEditorUI,R as ClassicEditorUIView};