@ebl-vue/editor-full 2.31.24 → 2.31.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -28
- package/dist/index.mjs +540 -702
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/types/index.d.ts +5 -1
- package/.postcssrc.yml +0 -33
- package/postcss.config.js +0 -15
- package/src/components/Editor/Editor.vue +0 -293
- package/src/components/Editor/EditorRender.vue +0 -274
- package/src/components/index.ts +0 -29
- package/src/constants/index.ts +0 -1
- package/src/i18n/zh-cn.ts +0 -158
- package/src/icons/index.ts +0 -93
- package/src/index.ts +0 -22
- package/src/installer.ts +0 -21
- package/src/plugins/alert/index.css +0 -150
- package/src/plugins/alert/index.ts +0 -456
- package/src/plugins/block-alignment/index.css +0 -9
- package/src/plugins/block-alignment/index.ts +0 -117
- package/src/plugins/block-alignment/readme.md +0 -1
- package/src/plugins/code/LICENSE +0 -21
- package/src/plugins/code/index.css +0 -158
- package/src/plugins/code/index.ts +0 -573
- package/src/plugins/code/utils/string.ts +0 -34
- package/src/plugins/color-picker/index.ts +0 -130
- package/src/plugins/color-picker/styles.css +0 -27
- package/src/plugins/delimiter/index.css +0 -14
- package/src/plugins/delimiter/index.ts +0 -121
- package/src/plugins/drag-drop/index.css +0 -19
- package/src/plugins/drag-drop/index.ts +0 -151
- package/src/plugins/drag-drop/readme.md +0 -1
- package/src/plugins/header/H1.ts +0 -404
- package/src/plugins/header/H2.ts +0 -403
- package/src/plugins/header/H3.ts +0 -404
- package/src/plugins/header/H4.ts +0 -404
- package/src/plugins/header/H5.ts +0 -403
- package/src/plugins/header/H6.ts +0 -404
- package/src/plugins/header/index.css +0 -20
- package/src/plugins/header/index.ts +0 -15
- package/src/plugins/header/types.d.ts +0 -46
- package/src/plugins/imageResizeCrop/ImageTune.ts +0 -916
- package/src/plugins/imageResizeCrop/index.css +0 -230
- package/src/plugins/imageResizeCrop/index.ts +0 -5
- package/src/plugins/imageResizeCrop/types.d.ts +0 -23
- package/src/plugins/imageTool/index.css +0 -156
- package/src/plugins/imageTool/index.ts +0 -538
- package/src/plugins/imageTool/types/codexteam__ajax.d.ts +0 -89
- package/src/plugins/imageTool/types/types.ts +0 -236
- package/src/plugins/imageTool/ui.ts +0 -313
- package/src/plugins/imageTool/uploader.ts +0 -272
- package/src/plugins/imageTool/utils/dom.ts +0 -24
- package/src/plugins/imageTool/utils/index.ts +0 -73
- package/src/plugins/imageTool/utils/isPromise.ts +0 -10
- package/src/plugins/indent/index.css +0 -86
- package/src/plugins/indent/index.ts +0 -695
- package/src/plugins/inline-code/index.css +0 -11
- package/src/plugins/inline-code/index.ts +0 -202
- package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +0 -208
- package/src/plugins/list/ListRenderer/ListRenderer.ts +0 -73
- package/src/plugins/list/ListRenderer/OrderedListRenderer.ts +0 -123
- package/src/plugins/list/ListRenderer/UnorderedListRenderer.ts +0 -123
- package/src/plugins/list/ListRenderer/index.ts +0 -6
- package/src/plugins/list/ListTabulator/index.ts +0 -1179
- package/src/plugins/list/index.ts +0 -480
- package/src/plugins/list/styles/CssPrefix.ts +0 -4
- package/src/plugins/list/styles/input.css +0 -36
- package/src/plugins/list/styles/list.css +0 -165
- package/src/plugins/list/types/Elements.ts +0 -14
- package/src/plugins/list/types/ItemMeta.ts +0 -40
- package/src/plugins/list/types/ListParams.ts +0 -102
- package/src/plugins/list/types/ListRenderer.ts +0 -6
- package/src/plugins/list/types/OlCounterType.ts +0 -63
- package/src/plugins/list/types/index.ts +0 -14
- package/src/plugins/list/utils/focusItem.ts +0 -18
- package/src/plugins/list/utils/getChildItems.ts +0 -40
- package/src/plugins/list/utils/getItemChildWrapper.ts +0 -10
- package/src/plugins/list/utils/getItemContentElement.ts +0 -10
- package/src/plugins/list/utils/getSiblings.ts +0 -52
- package/src/plugins/list/utils/isLastItem.ts +0 -9
- package/src/plugins/list/utils/itemHasSublist.ts +0 -10
- package/src/plugins/list/utils/normalizeData.ts +0 -83
- package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +0 -31
- package/src/plugins/list/utils/renderToolboxInput.ts +0 -105
- package/src/plugins/list/utils/stripNumbers.ts +0 -7
- package/src/plugins/list/utils/type-guards.ts +0 -8
- package/src/plugins/marker/index.css +0 -4
- package/src/plugins/marker/index.ts +0 -199
- package/src/plugins/outline/index.css +0 -52
- package/src/plugins/outline/index.ts +0 -63
- package/src/plugins/paragraph/index.css +0 -23
- package/src/plugins/paragraph/index.ts +0 -381
- package/src/plugins/paragraph/types/icons.d.ts +0 -4
- package/src/plugins/paragraph/utils/makeFragment.ts +0 -17
- package/src/plugins/quote/index.css +0 -26
- package/src/plugins/quote/index.ts +0 -203
- package/src/plugins/table/index.ts +0 -4
- package/src/plugins/table/plugin.ts +0 -254
- package/src/plugins/table/style.css +0 -388
- package/src/plugins/table/table.ts +0 -1195
- package/src/plugins/table/toolbox.ts +0 -166
- package/src/plugins/table/utils/dom.ts +0 -130
- package/src/plugins/table/utils/popover.ts +0 -185
- package/src/plugins/table/utils/throttled.ts +0 -22
- package/src/plugins/underline/index.css +0 -3
- package/src/plugins/underline/index.ts +0 -214
- package/src/plugins/undo/index.ts +0 -524
- package/src/plugins/undo/observer.ts +0 -101
- package/src/style.css +0 -114
- package/src/types.ts +0 -3
- package/src/utils/AxiosService.ts +0 -87
- package/src/utils/index.ts +0 -15
- package/src/utils/install.ts +0 -19
- package/tsconfig.json +0 -37
- package/vite.config.ts +0 -81
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode(':root{--color-border: #EFF0F1}.ebl-editor{cursor:text;font-size:16px;font-weight:400;background-color:#fff;height:100%;overflow:hidden;position:relative}.codex-editor{height:100%;overflow:auto}.ebl-editor.outline{padding-right:280px}.ebl-editor.outline .codex-editor{-webkit-box-flex:1;-ms-flex:1;flex:1}@media (max-width:1240px){.ebl-outline{display:none}.ebl-editor.outline{padding-right:0}}@media (min-width:1240px){.ebl-editor.readonly .ce-block__content{max-width:100%;padding-left:100px;padding-right:100px}}.ce-toolbar,.ce-inline-toolbar{z-index:1000}.ce-toolbar__plus{border:1px solid #EFF0F1}.ce-toolbar .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}.ce-toolbar .ce-popover__items .ce-popover-item{position:relative}.ce-toolbar .ce-popover__items .ce-popover-item__title{display:none}.ce-toolbar .ce-popover-item-html,.ce-toolbar .ce-popover-item-separator,.ce-toolbar .ce-popover-item[data-item-name=convert-to]{width:100%}.ce-toolbar .ce-popover-item[data-item-name=convert-to] .ce-popover-item__title{display:block}.ce-inline-toolbar .ce-popover__items{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.ce-inline-toolbar .ce-popover__items{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}.ce-inline-toolbar .ce-popover__items .ce-popover-item__title{display:none}.ebl-editor ::-webkit-scrollbar{width:6px;height:6px}.ebl-editor ::-webkit-scrollbar-track{background:#f1f1f1;border-radius:1px}.ebl-editor ::-webkit-scrollbar-thumb{background:#C0C0C0;border-radius:10px;border:1px solid #fff}.ebl-editor ::-webkit-scrollbar-thumb:hover{background:#555}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:50%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #a0a0a0;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{background:none}.ce-header{padding:15px 0 3px;margin:0;line-height:1.25;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}.ce-tune-alignment--right{text-align:right}.ce-tune-alignment--center{text-align:center}.ce-tune-alignment--left{text-align:left}.ce-paragraph{line-height:2!important}.ce-paragraph{outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}.ce-editorjs-x-shiki{border-radius:10px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin:10px 0}.ce-editorjs-x-shiki__code{position:relative;float:left;min-width:100%;overflow-x:auto}.ce-editorjs-x-shiki__selector{display:-webkit-box;display:-ms-flexbox;display:flex;gap:15px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;z-index:12;border-bottom-style:solid;border-color:#9ca3af0d;border-bottom-width:1px;padding:8px}.ce-editorjs-x-shiki__selector-language,.ce-editorjs-x-shiki__selector-theme{font-size:13px;font-family:inherit}.ce-editorjs-x-shiki__selector-language{width:90px}.ce-editorjs-x-shiki__selector select{border:none;outline:none}.ce-editorjs-x-shiki__span{position:relative;z-index:0;padding:20px 20px 20px 55px;margin:0;white-space:pre;font-size:13px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.ce-editorjs-x-shiki__span code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.ce-editorjs-x-shiki__textarea{all:unset;white-space:pre;overflow:hidden;background-color:transparent;position:absolute;padding:20px 20px 20px 55px;inset:0;color:transparent;z-index:0;font-size:13px;caret-color:#999;resize:none;border:none;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.ce-editorjs-x-shiki__textarea::-moz-selection{background-color:#083ca9;color:#fff}.ce-editorjs-x-shiki__textarea::selection{background-color:#083ca9;color:#fff}.ce-editorjs-x-shiki__copy{width:24px;height:24px;cursor:pointer;position:relative;margin-right:0}.ce-editorjs-x-shiki__copy_tip{font-size:12px;width:60px;margin-left:-20px;background-color:#0c0c0c;color:#ececec;text-align:center;border-radius:6px;padding:5px 10px;position:absolute;z-index:1;top:125%;-webkit-transition:opacity .3s;transition:opacity .3s;visibility:hidden;opacity:0}.ce-editorjs-x-shiki__copy_tip:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:transparent transparent #0c0c0c transparent}.ce-editorjs-x-shiki__copy_tip.visible{visibility:visible;opacity:1}.ce-editorjs-x-shiki__span.shiki .line:before{content:attr(data-line);width:40px;display:inline-block;text-align:right;color:#888;position:absolute;left:0}.cdx-quote{overflow:hidden;margin:0;-webkit-box-sizing:border-box;box-sizing:border-box;word-wrap:break-word;word-break:break-all}.cdx-quote blockquote{margin:0}.cdx-block-quote{border:solid #acacac;border-width:0 0 0 3px;-webkit-box-shadow:none;box-shadow:none;color:#666;line-height:1.6em;padding:1px 0 0 12px;text-align:left}.ce-delimiter__line__wrapper{height:24px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-delimiter__line{-webkit-box-flex:1;-ms-flex:1;flex:1;height:2px;background-color:#eff0f1}.cdx-list{margin:0;padding:0;outline:none;display:grid;counter-reset:item;grid-gap:var(--spacing-s);padding:var(--spacing-xs);--spacing-s: 8px;--spacing-xs: 6px;--list-counter-type: numeric;--radius-border: 5px;--checkbox-background: #fff;--color-border: #C9C9C9;--color-bg-checked: #369FFF;--line-height: 1.45em;--color-bg-checked-hover: #0059AB;--color-tick: #fff;--size-checkbox: 1.2em}.cdx-list ol{padding-left:0}.cdx-list__item{line-height:var(--line-height);display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;grid-template-areas:"checkbox content" ". child"}.cdx-list__item-children{display:grid;grid-area:child;grid-gap:var(--spacing-s);padding-top:var(--spacing-s)}.cdx-list__item [contenteditable]{outline:none}.cdx-list__item-content{word-break:break-word;white-space:pre-wrap;grid-area:content;padding-left:var(--spacing-s)}.cdx-list__item:before{counter-increment:item;white-space:nowrap}.cdx-list-ordered .cdx-list__item:before{content:counters(item,".",var(--list-counter-type)) "."}.cdx-list-ordered{counter-reset:item}.cdx-list-unordered{padding-left:0}.cdx-list-unordered .cdx-list__item:before{content:"•"}.cdx-list-checklist .cdx-list__item:before{content:""}.cdx-list__settings .cdx-settings-button{width:50%}.cdx-list__checkbox{padding-top:calc((var(--line-height) - var(--size-checkbox)) / 2);grid-area:checkbox;width:var(--size-checkbox);height:var(--size-checkbox);display:-webkit-box;display:-ms-flexbox;display:flex;cursor:pointer}.cdx-list__checkbox svg{opacity:0;height:var(--size-checkbox);width:var(--size-checkbox);left:-1px;top:-1px;position:absolute}@media (hover: hover){.cdx-list__checkbox:not(.cdx-list__checkbox--no-hover):hover .cdx-list__checkbox-check svg{opacity:1}}.cdx-list__checkbox--checked{line-height:var(--line-height)}@media (hover: hover){.cdx-list__checkbox--checked:not(.cdx-list__checkbox--checked--no-hover):hover .cdx-checklist__checkbox-check{background:var(--color-bg-checked-hover);border-color:var(--color-bg-checked-hover)}}.cdx-list__checkbox--checked .cdx-list__checkbox-check{background:var(--color-bg-checked);border-color:var(--color-bg-checked)}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg{opacity:1}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg path{stroke:var(--color-tick)}.cdx-list__checkbox--checked .cdx-list__checkbox-check:before{opacity:0;visibility:visible;-webkit-transform:scale(2.5);transform:scale(2.5)}.cdx-list__checkbox-check{cursor:pointer;display:inline-block;position:relative;margin:0 auto;width:var(--size-checkbox);height:var(--size-checkbox);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:var(--radius-border);border:1px solid var(--color-border);background:var(--checkbox-background)}.cdx-list__checkbox-check:before{content:"";position:absolute;inset:0;border-radius:100%;background-color:var(--color-bg-checked);visibility:hidden;pointer-events:none;-webkit-transform:scale(1);transform:scale(1);-webkit-transition:opacity .4s,-webkit-transform .4s ease-out;transition:opacity .4s,-webkit-transform .4s ease-out;transition:transform .4s ease-out,opacity .4s;transition:transform .4s ease-out,opacity .4s,-webkit-transform .4s ease-out}.cdx-list__checkbox-check--disabled{pointer-events:none}.cdx-list-start-with-field{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-list-start-with-field--invalid{background:#FFECED;border:1px solid #E13F3F}.cdx-list-start-with-field--invalid .cdx-list-start-with-field__input{color:#e13f3f}.cdx-list-start-with-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - var(--toolbox-buttons-size) - var(--icon-margin-right))}.cdx-list-start-with-field__input::-webkit-input-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input::-moz-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input:-ms-input-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input::-ms-input-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input::placeholder{color:var(--grayText);font-weight:500}.cdx-alert{position:relative;padding:10px;border-radius:5px;margin-bottom:10px}.cdx-alert-primary{background-color:#ebf8ff;border:1px solid #4299e1;color:#2b6cb0}.cdx-alert-secondary{background-color:#f7fafc;border:1px solid #cbd5e0;color:#222731}.cdx-alert-info{background-color:#e6fdff;border:1px solid #4cd4ce;color:#00727c}.cdx-alert-success{background-color:#f0fff4;border:1px solid #68d391;color:#2f855a}.cdx-alert-warning{background-color:#fffaf0;border:1px solid #ed8936;color:#c05621}.cdx-alert-danger{background-color:#fff5f5;border:1px solid #fc8181;color:#c53030}.cdx-alert-light{background-color:#fff;border:1px solid #edf2f7;color:#1a202c}.cdx-alert-dark{background-color:#2d3748;border:1px solid #1a202c;color:#d3d3d3}.cdx-alert-align-left{text-align:left}.cdx-alert-align-center{text-align:center}.cdx-alert-align-right{text-align:right}.cdx-alert__message{outline:none}.cdx-alert [contentEditable=true][data-placeholder]:before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:400;opacity:0}.cdx-alert [contentEditable=true][data-placeholder]:empty:before{opacity:1}.cdx-alert [contentEditable=true][data-placeholder]:empty:focus:before{opacity:0}.ce-popover__item[data-item-name=alert-primary] .ce-popover__item-icon svg #background{fill:#ebf8ff;stroke:#4299e1}.ce-popover__item[data-item-name=alert-primary] .ce-popover__item-icon svg #content{fill:#2b6cb0}.ce-popover__item[data-item-name=alert-secondary] .ce-popover__item-icon svg #background{fill:#f7fafc;stroke:#cbd5e0}.ce-popover__item[data-item-name=alert-secondary] .ce-popover__item-icon svg #content{fill:#222731}.ce-popover__item[data-item-name=alert-info] .ce-popover__item-icon svg #background{fill:#e6fdff;stroke:#4cd4ce}.ce-popover__item[data-item-name=alert-info] .ce-popover__item-icon svg #content{fill:#00727c}.ce-popover__item[data-item-name=alert-success] .ce-popover__item-icon svg #background{fill:#f0fff4;stroke:#68d391}.ce-popover__item[data-item-name=alert-success] .ce-popover__item-icon svg #content{fill:#2f855a}.ce-popover__item[data-item-name=alert-warning] .ce-popover__item-icon svg #background{fill:#fffaf0;stroke:#ed8936}.ce-popover__item[data-item-name=alert-warning] .ce-popover__item-icon svg #content{fill:#c05621}.ce-popover__item[data-item-name=alert-danger] .ce-popover__item-icon svg #background{fill:#fff5f5;stroke:#fc8181}.ce-popover__item[data-item-name=alert-danger] .ce-popover__item-icon svg #content{fill:#c53030}.ce-popover__item[data-item-name=alert-light] .ce-popover__item-icon svg #background{fill:#fff;stroke:#edf2f7}.ce-popover__item[data-item-name=alert-light] .ce-popover__item-icon svg #content{fill:#1a202c}.ce-popover__item[data-item-name=alert-dark] .ce-popover__item-icon svg #background{fill:#2d3748;stroke:#1a202c}.ce-popover__item[data-item-name=alert-dark] .ce-popover__item-icon svg #content{fill:#d3d3d3}.cdx-alert_setting__icon_wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:10px}.cdx-alert_setting__icon_wrapper_align{margin-top:10px}.cdx-alert_setting__icon{display:inline-block;width:24px;height:24px;text-align:center;line-height:24px;cursor:pointer}.cdx-alert_setting__icon_active{opacity:.3}.ce-popover-indent-item{cursor:default!important}.ce-popover-indent-item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:3px}.ce-popover-indent-item[version^="2.26"]{gap:10px}.ce-popover-indent-item:hover{background-color:transparent!important}.ce-popover-indent-item .ce-popover-item__icon{width:26px;height:26px;cursor:pointer;will-change:background-color,color;transition:.3s background-color,.3s color;padding:0;border-width:0px;color:#000;background-color:#fff;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;-webkit-transition:.3s background-color,.3s color;-moz-transition:.3s background-color,.3s color;-ms-transition:.3s background-color,.3s color;-o-transition:.3s background-color,.3s color}.ce-popover-indent-item .ce-popover-item--disabled{color:#707684;opacity:.3;cursor:default}.ce-popover-indent-item .ce-popover-item__icon:focus{outline:none}.ce-popover-indent-item[version^="2.26"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.27"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.28"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.29"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.26"] .ce-popover-item__icon,.ce-popover-indent-item[version^="2.27"] .ce-popover-item__icon,.ce-popover-indent-item[version^="2.28"] .ce-popover-item__icon,.ce-popover-indent-item[version^="2.29"] .ce-popover-item__icon{box-shadow:0 0 0 1px #c9c9cc7a!important;-webkit-box-shadow:0 0 0 1px rgba(201,201,204,.48)!important}.ce-popover-indent-item[version^="2.26"] .ce-popover-item__icon:hover,.ce-popover-indent-item[version^="2.27"] .ce-popover-item__icon:hover,.ce-popover-indent-item[version^="2.28"] .ce-popover-item__icon:hover,.ce-popover-indent-item[version^="2.29"] .ce-popover-item__icon:hover{background-color:#eff2f5}.ce-highlight-indent{display:inline-block;height:1.6em;top:50%;position:absolute;transform:translateY(-50%);-webkit-transform:translate(0px,-50%);-moz-transform:translate(0px,-50%);-ms-transform:translate(0px,-50%);-o-transform:translate(0px,-50%)}.ce-popover-indent-item[version^="2.3"] .ce-popover-item__title{margin-left:4px}.cdx-marker{background:rgba(245,235,111,.29);padding:3px 0}.ce-popover--inline .ce-popover--nested .ce-popover__container{width:-webkit-min-content!important;width:-moz-min-content!important;width:min-content!important;min-width:0!important;min-width:initial!important}.ce-popover--inline .ce-popover--nested .ce-popover__items{width:-webkit-max-content;width:-moz-max-content;width:max-content}.editorjs__color-selector-container{display:grid;grid-gap:10px;padding:4px}.editorjs__color-selector__container-item{width:30px;height:30px;display:block;cursor:pointer;border-radius:100%;-webkit-transition:-webkit-transform .2s ease;transition:-webkit-transform .2s ease;transition:transform .2s ease;transition:transform .2s ease,-webkit-transform .2s ease}.editorjs__color-selector__container-item:hover{-webkit-transform:scale(1.1);transform:scale(1.1)}.cdx-underline{-webkit-text-decoration:underline;text-decoration:underline}.inline-code{background:rgba(250,239,240,.78);color:#b44437;padding:3px 4px;border-radius:5px;margin:0 1px;font-family:inherit;font-size:.86em;font-weight:500;letter-spacing:.3px}.tc-wrap{--color-background: #f9f9fb;--color-text-secondary: #7b7e89;--color-border: #e8e8eb;--cell-size: 34px;--toolbox-icon-size: 18px;--toolbox-padding: 6px;--toolbox-aiming-field-size: calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);--col-width: 100px 100px 100px;position:relative;height:100%;margin-top:var(--toolbox-icon-size);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-grid;z-index:0}.tc-wrap svg{vertical-align:top}@media print{.tc-wrap{border-left-color:var(--color-border);border-left-style:solid;border-left-width:1px}}@media print{.tc-wrap .tc-row:after{display:none}}.tc-table{position:relative;width:100%;height:100%;display:grid;font-size:14px;border-top:1px solid var(--color-border);border-left:1px solid var(--color-border);line-height:1.4;overflow-x:auto}.tc-table:after{width:calc(var(--cell-size));height:100%;left:calc(var(--cell-size)*-1);top:0}.tc-table:after,.tc-table:before{position:absolute;content:""}.tc-table:before{width:100%;height:var(--toolbox-aiming-field-size);top:calc(var(--toolbox-aiming-field-size)*-1);left:0}.tc-table--heading .tc-row:first-child{font-weight:600;border-bottom:2px solid var(--color-border);position:sticky;top:0;z-index:2;background:var(--color-background)}.tc-table--heading .tc-row:first-child [contenteditable]:empty:before{content:attr(heading);color:var(--color-text-secondary)}.tc-table--heading .tc-row:first-child:after{bottom:-2px;border-bottom:2px solid var(--color-border)}.tc-add-column,.tc-add-row{display:-webkit-box;display:-ms-flexbox;display:flex;color:var(--color-text-secondary)}@media print{.tc-add{display:none}}.tc-add-column{display:grid;border-top:1px solid var(--color-border);grid-auto-rows:var(--cell-size);-webkit-box-align:center;-ms-flex-align:center;align-items:center;justify-items:center}.tc-add-column svg{padding:5px;position:sticky;top:0;background-color:var(--color-background)}.tc-add-column--disabled{visibility:hidden}@media print{.tc-add-column{display:none}}.tc-add-row{height:var(--cell-size);-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:4px;position:relative}.tc-add-row--disabled{display:none}.tc-add-row:before{content:"";position:absolute;right:calc(var(--cell-size)*-1);width:var(--cell-size);height:100%}@media print{.tc-add-row{display:none}}.tc-add-column,.tc-add-row{-webkit-transition:0s;transition:0s;cursor:pointer;will-change:background-color}.tc-add-column:hover,.tc-add-row:hover{-webkit-transition:background-color .1s ease;transition:background-color .1s ease;background-color:var(--color-background)}.tc-add-row{margin-top:1px}.tc-add-row:hover:before{-webkit-transition:.1s;transition:.1s;background-color:var(--color-background)}.tc-row{display:grid;grid-template-columns:var(--col-width);position:relative;border-bottom:1px solid var(--color-border)}.tc-row--selected{background:var(--color-background)}.tc-row--selected:after{background:var(--color-background)}.tc-cell{border-right:1px solid var(--color-border);padding:6px 12px;overflow:hidden;outline:none;line-break:normal}.tc-cell--selected{background:var(--color-background)}.tc-wrap--readonly .tc-row:after{display:none}.tc-toolbox{--toolbox-padding: 6px;--popover-margin: 30px;--toggler-click-zone-size: 30px;--toggler-dots-color: #7b7e89;--toggler-dots-color-hovered: #1d202b;position:absolute;cursor:pointer;z-index:1;opacity:0;-webkit-transition:opacity .1s;transition:opacity .1s;will-change:left,opacity}.tc-toolbox--column{top:calc(var(--toggler-click-zone-size)*-1);-webkit-transform:translate(calc(var(--toggler-click-zone-size)*-1/2));transform:translate(calc(var(--toggler-click-zone-size)*-1/2));will-change:left,opacity}.tc-toolbox--row{left:calc(var(--popover-margin)*-1);-webkit-transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));margin-top:-1px;will-change:top,opacity}.tc-toolbox--showed{opacity:1}.tc-toolbox .tc-popover{position:absolute;top:0;left:var(--popover-margin)}.tc-toolbox__toggler{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:var(--toggler-click-zone-size);height:var(--toggler-click-zone-size);color:var(--toggler-dots-color);opacity:0;-webkit-transition:opacity .15s ease;transition:opacity .15s ease;will-change:opacity}.tc-toolbox__toggler:hover{color:var(--toggler-dots-color-hovered)}.tc-toolbox__toggler svg{fill:currentColor}.tc-wrap:hover .tc-toolbox__toggler{opacity:1}.tc-settings .cdx-settings-button{width:50%;margin:0}.tc-popover{--color-border: #eaeaea;--color-background: #fff;--color-background-hover: rgba(232, 232, 235, .49);--color-background-confirm: #e24a4a;--color-background-confirm-hover: #d54040;--color-text-confirm: #fff;background:var(--color-background);border:1px solid var(--color-border);-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.12941);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;padding:6px;display:none;will-change:opacity,transform}.tc-popover--opened{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards;animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards}.tc-popover__item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:2px 14px 2px 2px;border-radius:5px;cursor:pointer;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.tc-popover__item:hover{background:var(--color-background-hover)}.tc-popover__item:not(:last-of-type){margin-bottom:2px}.tc-popover__item-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:26px;height:26px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;background:var(--color-background);border-radius:5px;border:1px solid var(--color-border);margin-right:8px}.tc-popover__item-label{line-height:22px;font-size:14px;font-weight:500}.tc-popover__item--confirm{background:var(--color-background-confirm);color:var(--color-text-confirm)}.tc-popover__item--confirm:hover{background-color:var(--color-background-confirm-hover)}.tc-popover__item--confirm .tc-popover__item-icon{background:var(--color-background-confirm);border-color:#0000001a}.tc-popover__item--confirm .tc-popover__item-icon svg{-webkit-transition:-webkit-transform .2s ease-in;transition:-webkit-transform .2s ease-in;transition:transform .2s ease-in;transition:transform .2s ease-in,-webkit-transform .2s ease-in;-webkit-transform:rotate(90deg) scale(1.2);transform:rotate(90deg) scale(1.2)}.tc-popover__item--hidden{display:none}@-webkit-keyframes menuShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes menuShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.cell-resizable{cursor:col-resize}.image-tool{--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb;display:inline-block}.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}.image-tool__image-preloader{width:150px;height:150px;border-radius:50%;background-size:cover;margin:auto;position:relative;background-color:var(--bg-color);background-position:center center}.image-tool__image-preloader:after{content:"";position:absolute;z-index:3;width:60px;height:60px;border-radius:50%;border:2px solid var(--bg-color);border-top-color:var(--front-color);left:50%;top:50%;margin-top:-30px;margin-left:-30px;-webkit-animation:image-preloader-spin 2s infinite linear;animation:image-preloader-spin 2s infinite linear;-webkit-box-sizing:border-box;box-sizing:border-box}.image-tool__caption{visibility:hidden;position:absolute;bottom:0;left:0;margin-bottom:10px}.image-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute!important}.image-tool__caption[contentEditable=true][data-placeholder]:before{content:attr(data-placeholder);color:#707684;font-weight:400;display:none}.image-tool__caption[contentEditable=true][data-placeholder]:empty:before{display:block}.image-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{display:none}.image-tool--empty .image-tool__image,.image-tool--empty .image-tool__image-preloader{display:none}.image-tool--empty .image-tool__caption,.image-tool--uploading .image-tool__caption{visibility:hidden!important}.image-tool .cdx-button{display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.image-tool .cdx-button svg{height:auto;margin:0 6px 0 0}.image-tool--filled .cdx-button,.image-tool--filled .image-tool__image-preloader{display:none}.image-tool--uploading{width:100%}.image-tool--uploading .resizable{display:none!important}.image-tool--uploading .image-tool__image{min-height:200px;display:-webkit-box;display:-ms-flexbox;display:flex;background-color:#fff}.image-tool--uploading .image-tool__image-picture,.image-tool--uploading .cdx-button{display:none}.image-tool--withBorder .image-tool__image{border:1px solid var(--border-color)}.image-tool--withBackground .image-tool__image{padding:15px;background:var(--bg-color)}.image-tool--withBackground .image-tool__image-picture{max-width:60%;margin:0 auto}.image-tool--stretched .image-tool__image-picture{width:100%}.image-tool--caption .image-tool__caption{visibility:visible}.image-tool--caption{padding-bottom:50px}@-webkit-keyframes image-preloader-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes image-preloader-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-image-tool-tune--floatLeft .cdx-block,.cdx-image-tool-tune--center .cdx-block,.cdx-image-tool-tune--floatRight .cdx-block,.cdx-image-tool-tune--floatLeft .image-tool__image,.cdx-image-tool-tune--center .image-tool__image,.cdx-image-tool-tune--floatRight .image-tool__image{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}:root{--primary: #2492F5;--primary-content: #E9F4FE}.cdx-settings-button--active{background:#E9F4FE;color:#2492f5}.cdx-settings-button:hover{background:#E9F4FE}.cdx-image-tool-tune--center{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}@media all and (min-width: 470px){.codex-editor:not(.read-only) .cdx-image-tool-tune--floatLeft.ce-block__content,.codex-editor:not(.read-only) .cdx-image-tool-tune--floatRight.ce-block__content{min-height:20px}.cdx-image-tool-tune--floatLeft.ce-block__content .image-tool__image,.cdx-image-tool-tune--floatRight.ce-block__content .image-tool__image{margin-top:40px}.cdx-image-tool-tune--floatLeft.ce-block__content .image-tool__image{margin-left:20px}.cdx-image-tool-tune--floatRight.ce-block__content .image-tool__image{margin-right:20px}.cdx-image-tool-tune--floatLeft.ce-block__content .cdx-input,.cdx-image-tool-tune--floatRight.ce-block__content .cdx-input{width:calc(100% - 20px)}.cdx-image-tool-tune--floatLeft.ce-block__content .cdx-input{margin-left:20px}.cdx-image-tool-tune--floatRight.ce-block__content .cdx-input{margin-right:20px}.cdx-image-tool-tune--floatLeft .cdx-block{float:left;margin-right:10px}.cdx-image-tool-tune--floatRight .cdx-block{float:right;margin-left:10px}.cdx-image-tool-tune--sizeSmall .cdx-block{max-width:25%!important}.cdx-image-tool-tune--sizeMiddle .cdx-block{max-width:50%!important}.cdx-image-tool-tune--sizeLarge .cdx-block{max-width:75%!important}}.cdx-image-tool-tune--sizeLarge img,.cdx-image-tool-tune--sizeSmall img,.cdx-image-tool-tune--sizeMiddle img{-o-object-fit:cover;object-fit:cover;max-width:100%}.codex-editor.read-only .cdx-input.image-tool__caption:empty,.read-only>.codex-editor .cdx-input.image-tool__caption:empty{display:none}.cdx-image-tool-tune--resize .cdx-block{position:relative;overflow:visible}.cdx-image-tool-tune--resize .cdx-block .resizable{display:none}.cdx-image-tool-tune--resize .image-tool__image-picture{width:100%!important}.cdx-image-tool-tune--resize .cdx-block:hover .resizable{display:block}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer{-webkit-box-sizing:border-box;box-sizing:border-box;width:14px;height:14px;border-radius:50%;background:#E9F4FE;border:3px solid #2492F5;position:absolute}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.top-left{left:-8px;top:2px;cursor:nwse-resize}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.top-right{right:-8px;top:1px;cursor:nesw-resize}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.bottom-left{left:-9px;bottom:10px;cursor:nesw-resize}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.bottom-right{right:-9px;bottom:10px;cursor:nwse-resize}.cdx-image-tool-tune--crop:hover,.cdx-image-tool-tune--crop.isCropping,.cdx-image-tool-tune--resize:hover{z-index:2}.cdx-image-tool-tune--crop .image-tool__image{position:relative}.cdx-image-tool-tune--crop .isCropping .image-tool__image{min-height:600px;min-width:100%}.cdx-image-tool-tune--crop .image-tool__image .crop-btn,.cdx-image-tool-tune--crop .image-tool__image .crop-save{position:absolute;top:0;left:0;padding:7px;background:#2492F5;color:#e9f4fe;text-align:center;line-height:20px;cursor:pointer;display:none}.cdx-image-tool-tune--crop .image-tool__image:hover .crop-btn,.cdx-image-tool-tune--crop .image-tool__image:hover .crop-save{display:block}.cdx-image-tool-tune--crop .image-tool__image img.isCropped{position:absolute;min-width:0;min-width:initial;max-width:none;max-width:initial;min-height:0;min-height:initial;max-height:none;max-height:initial}.cdx-image-tool-tune--crop .cdx-block.image-tool.isCropping{min-width:0!important;min-width:initial!important;max-width:none!important;max-width:initial!important;min-height:0!important;min-height:initial!important;max-height:none!important;max-height:initial!important}.image-tool__caption{background-color:#fff}.image-tool{position:relative;z-index:1}.cdx-image-tool-tune{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;gap:4px;width:100%}.ebl-outline{background-color:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;top:84px;right:0;padding:15px 12px 50px;width:280px;overflow:hidden;font-family:Qihei Lenovo,Microsoft YaHei,微软雅黑,宋体,sans-serif;color:#606266;font-size:14px;max-height:calc(100vh - 84px)}.ebl-outline:hover{overflow:auto}.ebl-outline__item{cursor:pointer;height:36px;line-height:36px;padding:0 24px;word-break:break-word;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ebl-outline .level_1{padding-left:24px}.ebl-outline .level_2{padding-left:42px}.ebl-outline .level_3{padding-left:60px}.ebl-outline__item.active{color:#222;font-weight:700;background-color:#ebebeb}.ebl-outline__item:hover{background-color:#ebebeb}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import
|
|
4
|
-
import { bundledLanguagesInfo as
|
|
5
|
-
import * as
|
|
1
|
+
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode(':root{--color-border: #EFF0F1}.ebl-editor{cursor:text;font-size:16px;font-weight:400;background-color:#fff;height:100%;overflow:hidden;position:relative;padding-top:15px}.codex-editor{height:100%;overflow:auto}.ebl-editor.outline{padding-right:280px}.ebl-editor.outline .codex-editor{-webkit-box-flex:1;-ms-flex:1;flex:1}@media (max-width:1240px){.ebl-outline{display:none}.ebl-editor.outline{padding-right:0}}@media (min-width:1240px){.ebl-editor.readonly .ce-block__content{max-width:100%;padding-left:100px;padding-right:100px}}.ce-toolbar,.ce-inline-toolbar{z-index:1000}.ce-toolbar__plus{border:1px solid #EFF0F1}.ce-toolbar .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}.ce-toolbar .ce-popover__items .ce-popover-item{position:relative}.ce-toolbar .ce-popover__items .ce-popover-item__title{display:none}.ce-toolbar .ce-popover-item-html,.ce-toolbar .ce-popover-item-separator,.ce-toolbar .ce-popover-item[data-item-name=convert-to]{width:100%}.ce-toolbar .ce-popover-item-html[data-item-name=list-setting]{width:auto;overflow:hidden}.ce-toolbar .ce-popover-item-html[data-item-name=list-setting-start-with]{border-radius:6px;padding:3px}.ce-toolbar .ce-popover-item-html[data-item-name=list-setting-start-with]:hover{background-color:#f8f8f8}.ce-toolbar .ce-popover-item[data-item-name=convert-to] .ce-popover-item__title{display:block}.ce-toolbar .ce-popover-item[data-item-name=add-below]{width:100%}.ce-toolbar .ce-popover-item[data-item-name=add-below] .ce-popover-item__title{display:block}.ce-toolbar .ce-popover-item[data-item-name=list-setting]{width:100%}.ce-toolbar .ce-popover-item[data-item-name=list-setting] .ce-popover-item__title{display:block}.ce-inline-toolbar .ce-popover__items{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.ce-inline-toolbar .ce-popover__items{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}.ce-inline-toolbar .ce-popover__items .ce-popover-item__title{display:none}.ebl-editor ::-webkit-scrollbar{width:6px;height:6px}.ebl-editor ::-webkit-scrollbar-track{background:#f1f1f1;border-radius:1px}.ebl-editor ::-webkit-scrollbar-thumb{background:silver;border-radius:10px;border:1px solid #fff}.ebl-editor ::-webkit-scrollbar-thumb:hover{background:#555}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:50%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #a0a0a0;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{background:none}.ce-header{padding:15px 0 3px;margin:0;line-height:1.25;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}.ce-tune-alignment--right{text-align:right}.ce-tune-alignment--center{text-align:center}.ce-tune-alignment--left{text-align:left}.ce-paragraph{line-height:2!important}.ce-paragraph{outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}.ce-editorjs-x-shiki{border-radius:10px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin:10px 0;border:2px solid transparent;position:relative}.ce-editorjs-x-shiki.editable:hover{border:2px solid #C0C0C0}.ce-editorjs-x-shiki__lang{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:8px}.ce-editorjs-x-shiki__code{position:relative;float:left;min-width:100%;overflow:hidden;height:auto}.ce-editorjs-x-shiki__code__dragHandler{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translate(-50%);bottom:-5px;cursor:ns-resize;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;height:8px;width:60px;background-color:silver;border-radius:5px;display:none}.ce-editorjs-x-shiki:hover .ce-editorjs-x-shiki__code__dragHandler{display:block}.ce-editorjs-x-shiki__selector{display:-webkit-box;display:-ms-flexbox;display:flex;gap:15px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;z-index:12;border-bottom-style:solid;border-color:#9ca3af0d;border-bottom-width:1px;padding:0 8px 8px}.ce-editorjs-x-shiki__selector-language,.ce-editorjs-x-shiki__selector-theme{font-size:13px;font-family:inherit}.ce-editorjs-x-shiki__selector-language{width:90px}.ce-editorjs-x-shiki__selector select{border:none;outline:none}.ce-editorjs-x-shiki__span{position:relative;z-index:0;padding:20px 20px 20px 55px;margin:0;white-space:pre;font-size:13px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.ce-editorjs-x-shiki__span code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.ce-editorjs-x-shiki__textarea{all:unset;white-space:pre;background-color:transparent;position:absolute;padding:20px 20px 20px 55px;inset:0;color:transparent;z-index:0;font-size:13px;caret-color:#999;resize:none;border:none;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.ce-editorjs-x-shiki__textarea::-moz-selection{background-color:#083ca9;color:#fff}.ce-editorjs-x-shiki__textarea::selection{background-color:#083ca9;color:#fff}.ce-editorjs-x-shiki__copy{width:24px;height:24px;cursor:pointer;position:relative;margin-right:0}.ce-editorjs-x-shiki__copy_tip{font-size:12px;width:60px;margin-left:-20px;background-color:#0c0c0c;color:#ececec;text-align:center;border-radius:6px;padding:5px 10px;position:absolute;z-index:1;top:125%;-webkit-transition:opacity .3s;transition:opacity .3s;visibility:hidden;opacity:0}.ce-editorjs-x-shiki__copy_tip:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:transparent transparent #0c0c0c transparent}.ce-editorjs-x-shiki__copy_tip.visible{visibility:visible;opacity:1}.ce-editorjs-x-shiki__span.shiki .line:before{content:attr(data-line);width:40px;display:inline-block;text-align:right;color:#888;position:absolute;left:0}.ce-editorjs-x-shiki__code ::-webkit-scrollbar{width:8px;height:8px}.ce-editorjs-x-shiki__code ::-webkit-scrollbar-track{background:#22272e;border-radius:1px}.ce-editorjs-x-shiki__code ::-webkit-scrollbar-thumb{background:silver;border-radius:10px;border:2px solid #22272e}.ce-editorjs-x-shiki__code ::-webkit-scrollbar-thumb:hover{background:#555}.cdx-quote{overflow:hidden;margin:0;-webkit-box-sizing:border-box;box-sizing:border-box;word-wrap:break-word;word-break:break-all}.cdx-quote blockquote{margin:0}.cdx-block-quote{border:solid #acacac;border-width:0 0 0 3px;-webkit-box-shadow:none;box-shadow:none;color:#666;line-height:1.6em;padding:1px 0 0 12px;text-align:left}.ce-delimiter__line__wrapper{height:24px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-delimiter__line{-webkit-box-flex:1;-ms-flex:1;flex:1;height:2px;background-color:#eff0f1}.cdx-list{margin:0;padding:0;outline:none;display:grid;counter-reset:item;grid-gap:var(--spacing-s);padding:var(--spacing-xs);--spacing-s: 8px;--spacing-xs: 6px;--list-counter-type: numeric;--radius-border: 5px;--checkbox-background: #fff;--color-border: #C9C9C9;--color-bg-checked: #369FFF;--line-height: 1.45em;--color-bg-checked-hover: #0059AB;--color-tick: #fff;--size-checkbox: 1.2em}.cdx-list ol{padding-left:0}.cdx-list__item{line-height:var(--line-height);display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;grid-template-areas:"checkbox content" ". child"}.cdx-list__item-children{display:grid;grid-area:child;grid-gap:var(--spacing-s);padding-top:var(--spacing-s)}.cdx-list__item [contenteditable]{outline:none}.cdx-list__item-content{word-break:break-word;white-space:pre-wrap;grid-area:content;padding-left:var(--spacing-s)}.cdx-list__item:before{counter-increment:item;white-space:nowrap}.cdx-list-ordered .cdx-list__item:before{content:counters(item,".",var(--list-counter-type)) "."}.cdx-list-ordered{counter-reset:item}.cdx-list-unordered{padding-left:0}.cdx-list-unordered .cdx-list__item:before{content:"•"}.cdx-list-checklist .cdx-list__item:before{content:""}.cdx-list__settings .cdx-settings-button{width:50%}.cdx-list__checkbox{padding-top:calc((var(--line-height) - var(--size-checkbox)) / 2);grid-area:checkbox;width:var(--size-checkbox);height:var(--size-checkbox);display:-webkit-box;display:-ms-flexbox;display:flex;cursor:pointer}.cdx-list__checkbox svg{opacity:0;height:var(--size-checkbox);width:var(--size-checkbox);left:-1px;top:-1px;position:absolute}@media (hover: hover){.cdx-list__checkbox:not(.cdx-list__checkbox--no-hover):hover .cdx-list__checkbox-check svg{opacity:1}}.cdx-list__checkbox--checked{line-height:var(--line-height)}@media (hover: hover){.cdx-list__checkbox--checked:not(.cdx-list__checkbox--checked--no-hover):hover .cdx-checklist__checkbox-check{background:var(--color-bg-checked-hover);border-color:var(--color-bg-checked-hover)}}.cdx-list__checkbox--checked .cdx-list__checkbox-check{background:var(--color-bg-checked);border-color:var(--color-bg-checked)}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg{opacity:1}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg path{stroke:var(--color-tick)}.cdx-list__checkbox--checked .cdx-list__checkbox-check:before{opacity:0;visibility:visible;-webkit-transform:scale(2.5);transform:scale(2.5)}.cdx-list__checkbox-check{cursor:pointer;display:inline-block;position:relative;margin:0 auto;width:var(--size-checkbox);height:var(--size-checkbox);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:var(--radius-border);border:1px solid var(--color-border);background:var(--checkbox-background)}.cdx-list__checkbox-check:before{content:"";position:absolute;inset:0;border-radius:100%;background-color:var(--color-bg-checked);visibility:hidden;pointer-events:none;-webkit-transform:scale(1);transform:scale(1);-webkit-transition:opacity .4s,-webkit-transform .4s ease-out;transition:opacity .4s,-webkit-transform .4s ease-out;transition:transform .4s ease-out,opacity .4s;transition:transform .4s ease-out,opacity .4s,-webkit-transform .4s ease-out}.cdx-list__checkbox-check--disabled{pointer-events:none}.cdx-list-start-with-field{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;overflow:hidden;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.cdx-list-start-with-field--invalid{background:#ffeced;border:1px solid #E13F3F}.cdx-list-start-with-field:hover{background-color:#f8f8f8}.cdx-list-start-with-field--invalid .cdx-list-start-with-field__input{color:#e13f3f}.cdx-list-start-with-field__startlabel{width:70px;font-size:14px}.cdx-list-start-with-field__input-wrapper{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden}.cdx-list-start-with-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;line-height:22px;-webkit-box-flex:1;-ms-flex:1;flex:1;border:1px solid rgba(226,226,229,1);border-radius:6px;padding:0 10px;width:50px;text-align:center}.cdx-list-start-with-field__input::-webkit-input-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input::-moz-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input:-ms-input-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input::-ms-input-placeholder{color:var(--grayText);font-weight:500}.cdx-list-start-with-field__input::placeholder{color:var(--grayText);font-weight:500}.cdx-alert{position:relative;padding:10px;border-radius:5px;margin-bottom:10px;margin-top:10px}.cdx-alert-primary{background-color:#ebf8ff;border:1px solid #4299e1;color:#2b6cb0}.cdx-alert-secondary{background-color:#f7fafc;border:1px solid #cbd5e0;color:#222731}.cdx-alert-info{background-color:#e6fdff;border:1px solid #4cd4ce;color:#00727c}.cdx-alert-success{background-color:#f0fff4;border:1px solid #68d391;color:#2f855a}.cdx-alert-warning{background-color:#fffaf0;border:1px solid #ed8936;color:#c05621}.cdx-alert-danger{background-color:#fff5f5;border:1px solid #fc8181;color:#c53030}.cdx-alert-light{background-color:#fff;border:1px solid #edf2f7;color:#1a202c}.cdx-alert-dark{background-color:#2d3748;border:1px solid #1a202c;color:#d3d3d3}.cdx-alert-align-left{text-align:left}.cdx-alert-align-center{text-align:center}.cdx-alert-align-right{text-align:right}.cdx-alert__message{outline:none}.cdx-alert [contentEditable=true][data-placeholder]:before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:400;opacity:0}.cdx-alert [contentEditable=true][data-placeholder]:empty:before{opacity:1}.cdx-alert [contentEditable=true][data-placeholder]:empty:focus:before{opacity:0}.ce-popover__item[data-item-name=alert-primary] .ce-popover__item-icon svg #background{fill:#ebf8ff;stroke:#4299e1}.ce-popover__item[data-item-name=alert-primary] .ce-popover__item-icon svg #content{fill:#2b6cb0}.ce-popover__item[data-item-name=alert-secondary] .ce-popover__item-icon svg #background{fill:#f7fafc;stroke:#cbd5e0}.ce-popover__item[data-item-name=alert-secondary] .ce-popover__item-icon svg #content{fill:#222731}.ce-popover__item[data-item-name=alert-info] .ce-popover__item-icon svg #background{fill:#e6fdff;stroke:#4cd4ce}.ce-popover__item[data-item-name=alert-info] .ce-popover__item-icon svg #content{fill:#00727c}.ce-popover__item[data-item-name=alert-success] .ce-popover__item-icon svg #background{fill:#f0fff4;stroke:#68d391}.ce-popover__item[data-item-name=alert-success] .ce-popover__item-icon svg #content{fill:#2f855a}.ce-popover__item[data-item-name=alert-warning] .ce-popover__item-icon svg #background{fill:#fffaf0;stroke:#ed8936}.ce-popover__item[data-item-name=alert-warning] .ce-popover__item-icon svg #content{fill:#c05621}.ce-popover__item[data-item-name=alert-danger] .ce-popover__item-icon svg #background{fill:#fff5f5;stroke:#fc8181}.ce-popover__item[data-item-name=alert-danger] .ce-popover__item-icon svg #content{fill:#c53030}.ce-popover__item[data-item-name=alert-light] .ce-popover__item-icon svg #background{fill:#fff;stroke:#edf2f7}.ce-popover__item[data-item-name=alert-light] .ce-popover__item-icon svg #content{fill:#1a202c}.ce-popover__item[data-item-name=alert-dark] .ce-popover__item-icon svg #background{fill:#2d3748;stroke:#1a202c}.ce-popover__item[data-item-name=alert-dark] .ce-popover__item-icon svg #content{fill:#d3d3d3}.cdx-alert_setting__icon_wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:10px}.cdx-alert_setting__icon_wrapper_align{margin-top:10px}.cdx-alert_setting__icon{display:inline-block;width:24px;height:24px;text-align:center;line-height:24px;cursor:pointer}.cdx-alert_setting__icon_active{opacity:.3}.ce-popover-indent-item{cursor:default!important}.ce-popover-indent-item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:3px}.ce-popover-indent-item[version^="2.26"]{gap:10px}.ce-popover-indent-item:hover{background-color:transparent!important}.ce-popover-indent-item .ce-popover-item__icon{width:26px;height:26px;cursor:pointer;will-change:background-color,color;transition:.3s background-color,.3s color;padding:0;border-width:0px;color:#000;background-color:#fff;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;-webkit-transition:.3s background-color,.3s color;-moz-transition:.3s background-color,.3s color;-ms-transition:.3s background-color,.3s color;-o-transition:.3s background-color,.3s color}.ce-popover-indent-item .ce-popover-item--disabled{color:#707684;opacity:.3;cursor:default}.ce-popover-indent-item .ce-popover-item__icon:focus{outline:none}.ce-popover-indent-item[version^="2.26"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.27"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.28"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.29"]:hover .ce-popover-item__icon,.ce-popover-indent-item[version^="2.26"] .ce-popover-item__icon,.ce-popover-indent-item[version^="2.27"] .ce-popover-item__icon,.ce-popover-indent-item[version^="2.28"] .ce-popover-item__icon,.ce-popover-indent-item[version^="2.29"] .ce-popover-item__icon{box-shadow:0 0 0 1px #c9c9cc7a!important;-webkit-box-shadow:0 0 0 1px rgba(201,201,204,.48)!important}.ce-popover-indent-item[version^="2.26"] .ce-popover-item__icon:hover,.ce-popover-indent-item[version^="2.27"] .ce-popover-item__icon:hover,.ce-popover-indent-item[version^="2.28"] .ce-popover-item__icon:hover,.ce-popover-indent-item[version^="2.29"] .ce-popover-item__icon:hover{background-color:#eff2f5}.ce-highlight-indent{display:inline-block;height:1.6em;top:50%;position:absolute;transform:translateY(-50%);-webkit-transform:translate(0px,-50%);-moz-transform:translate(0px,-50%);-ms-transform:translate(0px,-50%);-o-transform:translate(0px,-50%)}.ce-popover-indent-item[version^="2.3"] .ce-popover-item__title{margin-left:4px}.cdx-marker{background:#f5eb6f4a;padding:3px 0}.ce-popover--inline .ce-popover--nested .ce-popover__container{width:-webkit-min-content!important;width:-moz-min-content!important;width:min-content!important;min-width:0!important;min-width:initial!important}.ce-popover--inline .ce-popover--nested .ce-popover__items{width:-webkit-max-content;width:-moz-max-content;width:max-content}.editorjs__color-selector-container{display:grid;grid-gap:10px;padding:4px}.editorjs__color-selector__container-item{width:30px;height:30px;display:block;cursor:pointer;border-radius:100%;-webkit-transition:-webkit-transform .2s ease;transition:-webkit-transform .2s ease;transition:transform .2s ease;transition:transform .2s ease,-webkit-transform .2s ease}.editorjs__color-selector__container-item:hover{-webkit-transform:scale(1.1);transform:scale(1.1)}.cdx-underline{-webkit-text-decoration:underline;text-decoration:underline}.inline-code{background:#faeff0c7;color:#b44437;padding:3px 4px;border-radius:5px;margin:0 1px;font-family:inherit;font-size:.86em;font-weight:500;letter-spacing:.3px}.tc-wrap{--color-background: #f9f9fb;--color-text-secondary: #7b7e89;--color-border: #e8e8eb;--cell-size: 34px;--toolbox-icon-size: 18px;--toolbox-padding: 6px;--toolbox-aiming-field-size: calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);--col-width: 100px 100px 100px;position:relative;height:100%;margin-top:var(--toolbox-icon-size);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-grid;z-index:0}.tc-wrap svg{vertical-align:top}@media print{.tc-wrap{border-left-color:var(--color-border);border-left-style:solid;border-left-width:1px}}@media print{.tc-wrap .tc-row:after{display:none}}.tc-table{position:relative;width:100%;height:100%;display:grid;font-size:14px;border-top:1px solid var(--color-border);border-left:1px solid var(--color-border);line-height:1.4;overflow-x:auto}.tc-table:after{width:calc(var(--cell-size));height:100%;left:calc(var(--cell-size)*-1);top:0}.tc-table:after,.tc-table:before{position:absolute;content:""}.tc-table:before{width:100%;height:var(--toolbox-aiming-field-size);top:calc(var(--toolbox-aiming-field-size)*-1);left:0}.tc-table--heading .tc-row:first-child{font-weight:600;border-bottom:2px solid var(--color-border);position:sticky;top:0;z-index:2;background:var(--color-background)}.tc-table--heading .tc-row:first-child [contenteditable]:empty:before{content:attr(heading);color:var(--color-text-secondary)}.tc-table--heading .tc-row:first-child:after{bottom:-2px;border-bottom:2px solid var(--color-border)}.tc-add-column,.tc-add-row{display:-webkit-box;display:-ms-flexbox;display:flex;color:var(--color-text-secondary)}@media print{.tc-add{display:none}}.tc-add-column{display:grid;border-top:1px solid var(--color-border);grid-auto-rows:var(--cell-size);-webkit-box-align:center;-ms-flex-align:center;align-items:center;justify-items:center}.tc-add-column svg{padding:5px;position:sticky;top:0;background-color:var(--color-background)}.tc-add-column--disabled{visibility:hidden}@media print{.tc-add-column{display:none}}.tc-add-row{height:var(--cell-size);-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:4px;position:relative}.tc-add-row--disabled{display:none}.tc-add-row:before{content:"";position:absolute;right:calc(var(--cell-size)*-1);width:var(--cell-size);height:100%}@media print{.tc-add-row{display:none}}.tc-add-column,.tc-add-row{-webkit-transition:0s;transition:0s;cursor:pointer;will-change:background-color}.tc-add-column:hover,.tc-add-row:hover{-webkit-transition:background-color .1s ease;transition:background-color .1s ease;background-color:var(--color-background)}.tc-add-row{margin-top:1px}.tc-add-row:hover:before{-webkit-transition:.1s;transition:.1s;background-color:var(--color-background)}.tc-row{display:grid;grid-template-columns:var(--col-width);position:relative;border-bottom:1px solid var(--color-border)}.tc-row--selected{background:var(--color-background)}.tc-row--selected:after{background:var(--color-background)}.tc-cell{border-right:1px solid var(--color-border);padding:6px 12px;overflow:hidden;outline:none;line-break:normal}.tc-cell--selected{background:var(--color-background)}.tc-wrap--readonly .tc-row:after{display:none}.tc-toolbox{--toolbox-padding: 6px;--popover-margin: 30px;--toggler-click-zone-size: 30px;--toggler-dots-color: #7b7e89;--toggler-dots-color-hovered: #1d202b;position:absolute;cursor:pointer;z-index:1;opacity:0;-webkit-transition:opacity .1s;transition:opacity .1s;will-change:left,opacity}.tc-toolbox--column{top:calc(var(--toggler-click-zone-size)*-1);-webkit-transform:translate(calc(var(--toggler-click-zone-size)*-1/2));transform:translate(calc(var(--toggler-click-zone-size)*-1/2));will-change:left,opacity}.tc-toolbox--row{left:calc(var(--popover-margin)*-1);-webkit-transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));margin-top:-1px;will-change:top,opacity}.tc-toolbox--showed{opacity:1}.tc-toolbox .tc-popover{position:absolute;top:0;left:var(--popover-margin)}.tc-toolbox__toggler{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:var(--toggler-click-zone-size);height:var(--toggler-click-zone-size);color:var(--toggler-dots-color);opacity:0;-webkit-transition:opacity .15s ease;transition:opacity .15s ease;will-change:opacity}.tc-toolbox__toggler:hover{color:var(--toggler-dots-color-hovered)}.tc-toolbox__toggler svg{fill:currentColor}.tc-wrap:hover .tc-toolbox__toggler{opacity:1}.tc-settings .cdx-settings-button{width:50%;margin:0}.tc-popover{--color-border: #eaeaea;--color-background: #fff;--color-background-hover: rgba(232, 232, 235, .49);--color-background-confirm: #e24a4a;--color-background-confirm-hover: #d54040;--color-text-confirm: #fff;background:var(--color-background);border:1px solid var(--color-border);-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.12941);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;padding:6px;display:none;will-change:opacity,transform}.tc-popover--opened{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards;animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards}.tc-popover__item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:2px 14px 2px 2px;border-radius:5px;cursor:pointer;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.tc-popover__item:hover{background:var(--color-background-hover)}.tc-popover__item:not(:last-of-type){margin-bottom:2px}.tc-popover__item-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:26px;height:26px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;background:var(--color-background);border-radius:5px;border:1px solid var(--color-border);margin-right:8px}.tc-popover__item-label{line-height:22px;font-size:14px;font-weight:500}.tc-popover__item--confirm{background:var(--color-background-confirm);color:var(--color-text-confirm)}.tc-popover__item--confirm:hover{background-color:var(--color-background-confirm-hover)}.tc-popover__item--confirm .tc-popover__item-icon{background:var(--color-background-confirm);border-color:#0000001a}.tc-popover__item--confirm .tc-popover__item-icon svg{-webkit-transition:-webkit-transform .2s ease-in;transition:-webkit-transform .2s ease-in;transition:transform .2s ease-in;transition:transform .2s ease-in,-webkit-transform .2s ease-in;-webkit-transform:rotate(90deg) scale(1.2);transform:rotate(90deg) scale(1.2)}.tc-popover__item--hidden{display:none}@-webkit-keyframes menuShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes menuShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.cell-resizable{cursor:col-resize}.image-tool{--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb;display:inline-block}.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}.image-tool__image-preloader{width:150px;height:150px;border-radius:50%;background-size:cover;margin:auto;position:relative;background-color:var(--bg-color);background-position:center center}.image-tool__image-preloader:after{content:"";position:absolute;z-index:3;width:60px;height:60px;border-radius:50%;border:2px solid var(--bg-color);border-top-color:var(--front-color);left:50%;top:50%;margin-top:-30px;margin-left:-30px;-webkit-animation:image-preloader-spin 2s infinite linear;animation:image-preloader-spin 2s infinite linear;-webkit-box-sizing:border-box;box-sizing:border-box}.image-tool__caption{visibility:hidden;position:absolute;bottom:0;left:0;margin-bottom:10px}.image-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute!important}.image-tool__caption[contentEditable=true][data-placeholder]:before{content:attr(data-placeholder);color:#707684;font-weight:400;display:none}.image-tool__caption[contentEditable=true][data-placeholder]:empty:before{display:block}.image-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{display:none}.image-tool--empty .image-tool__image,.image-tool--empty .image-tool__image-preloader{display:none}.image-tool--empty .image-tool__caption,.image-tool--uploading .image-tool__caption{visibility:hidden!important}.image-tool .cdx-button{display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.image-tool .cdx-button svg{height:auto;margin:0 6px 0 0}.image-tool--filled .cdx-button,.image-tool--filled .image-tool__image-preloader{display:none}.image-tool--uploading{width:100%}.image-tool--uploading .resizable{display:none!important}.image-tool--uploading .image-tool__image{min-height:200px;display:-webkit-box;display:-ms-flexbox;display:flex;background-color:#fff}.image-tool--uploading .image-tool__image-picture,.image-tool--uploading .cdx-button{display:none}.image-tool--withBorder .image-tool__image{border:1px solid var(--border-color)}.image-tool--withBackground .image-tool__image{padding:15px;background:var(--bg-color)}.image-tool--withBackground .image-tool__image-picture{max-width:60%;margin:0 auto}.image-tool--stretched .image-tool__image-picture{width:100%}.image-tool--caption .image-tool__caption{visibility:visible}.image-tool--caption{padding-bottom:50px}@-webkit-keyframes image-preloader-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes image-preloader-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-image-tool-tune--floatLeft .cdx-block,.cdx-image-tool-tune--center .cdx-block,.cdx-image-tool-tune--floatRight .cdx-block,.cdx-image-tool-tune--floatLeft .image-tool__image,.cdx-image-tool-tune--center .image-tool__image,.cdx-image-tool-tune--floatRight .image-tool__image{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}:root{--primary: #2492F5;--primary-content: #E9F4FE}.cdx-settings-button--active{background:#e9f4fe;color:#2492f5}.cdx-settings-button:hover{background:#e9f4fe}.cdx-image-tool-tune--center{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}@media all and (min-width: 470px){.codex-editor:not(.read-only) .cdx-image-tool-tune--floatLeft.ce-block__content,.codex-editor:not(.read-only) .cdx-image-tool-tune--floatRight.ce-block__content{min-height:20px}.cdx-image-tool-tune--floatLeft.ce-block__content .image-tool__image,.cdx-image-tool-tune--floatRight.ce-block__content .image-tool__image{margin-top:40px}.cdx-image-tool-tune--floatLeft.ce-block__content .image-tool__image{margin-left:20px}.cdx-image-tool-tune--floatRight.ce-block__content .image-tool__image{margin-right:20px}.cdx-image-tool-tune--floatLeft.ce-block__content .cdx-input,.cdx-image-tool-tune--floatRight.ce-block__content .cdx-input{width:calc(100% - 20px)}.cdx-image-tool-tune--floatLeft.ce-block__content .cdx-input{margin-left:20px}.cdx-image-tool-tune--floatRight.ce-block__content .cdx-input{margin-right:20px}.cdx-image-tool-tune--floatLeft .cdx-block{float:left;margin-right:10px}.cdx-image-tool-tune--floatRight .cdx-block{float:right;margin-left:10px}.cdx-image-tool-tune--sizeSmall .cdx-block{max-width:25%!important}.cdx-image-tool-tune--sizeMiddle .cdx-block{max-width:50%!important}.cdx-image-tool-tune--sizeLarge .cdx-block{max-width:75%!important}}.cdx-image-tool-tune--sizeLarge img,.cdx-image-tool-tune--sizeSmall img,.cdx-image-tool-tune--sizeMiddle img{-o-object-fit:cover;object-fit:cover;max-width:100%}.codex-editor.read-only .cdx-input.image-tool__caption:empty,.read-only>.codex-editor .cdx-input.image-tool__caption:empty{display:none}.cdx-image-tool-tune--resize .cdx-block{position:relative;overflow:visible}.cdx-image-tool-tune--resize .cdx-block .resizable{display:none}.cdx-image-tool-tune--resize .image-tool__image-picture{width:100%!important}.cdx-image-tool-tune--resize .cdx-block:hover .resizable{display:block}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer{-webkit-box-sizing:border-box;box-sizing:border-box;width:14px;height:14px;border-radius:50%;background:#e9f4fe;border:3px solid #2492F5;position:absolute}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.top-left{left:-8px;top:2px;cursor:nwse-resize}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.top-right{right:-8px;top:1px;cursor:nesw-resize}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.bottom-left{left:-9px;bottom:10px;cursor:nesw-resize}.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.bottom-right{right:-9px;bottom:10px;cursor:nwse-resize}.cdx-image-tool-tune--crop:hover,.cdx-image-tool-tune--crop.isCropping,.cdx-image-tool-tune--resize:hover{z-index:2}.cdx-image-tool-tune--crop .image-tool__image{position:relative}.cdx-image-tool-tune--crop .isCropping .image-tool__image{min-height:600px;min-width:100%}.cdx-image-tool-tune--crop .image-tool__image .crop-btn,.cdx-image-tool-tune--crop .image-tool__image .crop-save{position:absolute;top:0;left:0;padding:7px;background:#2492f5;color:#e9f4fe;text-align:center;line-height:20px;cursor:pointer;display:none}.cdx-image-tool-tune--crop .image-tool__image:hover .crop-btn,.cdx-image-tool-tune--crop .image-tool__image:hover .crop-save{display:block}.cdx-image-tool-tune--crop .image-tool__image img.isCropped{position:absolute;min-width:0;min-width:initial;max-width:none;max-width:initial;min-height:0;min-height:initial;max-height:none;max-height:initial}.cdx-image-tool-tune--crop .cdx-block.image-tool.isCropping{min-width:0!important;min-width:initial!important;max-width:none!important;max-width:initial!important;min-height:0!important;min-height:initial!important;max-height:none!important;max-height:initial!important}.image-tool__caption{background-color:#fff}.image-tool{position:relative;z-index:1}.cdx-image-tool-tune{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;gap:4px;width:100%}.ebl-outline{background-color:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;top:84px;right:0;padding:15px 12px 50px;width:280px;overflow:hidden;font-family:Qihei Lenovo,Microsoft YaHei,微软雅黑,宋体,sans-serif;color:#606266;font-size:14px;max-height:calc(100vh - 84px)}.ebl-outline:hover{overflow:auto}.ebl-outline__item{cursor:pointer;height:36px;line-height:36px;padding:0 24px;word-break:break-word;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ebl-outline .level_1{padding-left:24px}.ebl-outline .level_2{padding-left:42px}.ebl-outline .level_3{padding-left:60px}.ebl-outline__item.active{color:#222;font-weight:700;background-color:#ebebeb}.ebl-outline__item:hover{background-color:#ebebeb}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
import { defineComponent as Ut, inject as jt, toRaw as J, onMounted as qt, onUnmounted as Vt, watch as Kt, createElementBlock as Yt, openBlock as Gt } from "vue";
|
|
3
|
+
import Xt from "@ebl-vue/editorjs";
|
|
4
|
+
import { bundledLanguagesInfo as Zt, codeToHtml as Jt } from "shiki";
|
|
5
|
+
import * as V from "@editorjs/dom";
|
|
6
6
|
import { make as S, isEmpty as dt } from "@editorjs/dom";
|
|
7
|
-
import { focus as
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
e.component(i.name, i);
|
|
14
|
-
}, t)
|
|
15
|
-
for (const [e, i] of Object.entries(t))
|
|
16
|
-
u[e] = i;
|
|
17
|
-
return u;
|
|
18
|
-
};
|
|
19
|
-
class we {
|
|
7
|
+
import { focus as Qt, isCaretAtStartOfInput as te, getCaretNodeAndOffset as ee, getContenteditableSlice as ie } from "@editorjs/caret";
|
|
8
|
+
import K from "axios";
|
|
9
|
+
const pt = Symbol("INSTALLED_KEY"), se = (u, t) => (u.install = (e) => {
|
|
10
|
+
for (const i of [u, ...Object.values({})]) e.component(i.name, i);
|
|
11
|
+
}, u);
|
|
12
|
+
class ne {
|
|
20
13
|
constructor(t, e, i, s) {
|
|
21
14
|
const { blocks: n, toolbar: r } = i;
|
|
22
15
|
this.toolbar = r, this.borderStyle = s || "1px dashed #aaa", this.api = n, this.holder = document.getElementById(t), this.readOnly = e, this.startBlock = null, this.endBlock = null, this.setDragListener(), this.setDropListener();
|
|
23
16
|
}
|
|
24
17
|
setElementCursor(t) {
|
|
25
|
-
if (!t)
|
|
26
|
-
return;
|
|
18
|
+
if (!t) return;
|
|
27
19
|
const e = document.createRange(), i = window.getSelection();
|
|
28
20
|
e.setStart(t.childNodes[0], 0), e.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(e), t.focus();
|
|
29
21
|
}
|
|
@@ -51,8 +43,7 @@ class we {
|
|
|
51
43
|
setBorderBlocks(t, e) {
|
|
52
44
|
Object.values(t).forEach((i) => {
|
|
53
45
|
const s = i.querySelector(".ce-block__content");
|
|
54
|
-
if (i !== e)
|
|
55
|
-
s == null || s.style.removeProperty("border-top"), s == null || s.style.removeProperty("border-bottom");
|
|
46
|
+
if (i !== e) s == null || s.style.removeProperty("border-top"), s == null || s.style.removeProperty("border-bottom");
|
|
56
47
|
else {
|
|
57
48
|
const n = Object.keys(t).find((r) => t[Number(r)] === e);
|
|
58
49
|
n && Number(n) > this.startBlock ? s.style.borderBottom = this.borderStyle : s.style.borderTop = this.borderStyle;
|
|
@@ -88,8 +79,8 @@ class we {
|
|
|
88
79
|
this.isTheOnlyBlock() || this.api.move(this.endBlock, this.startBlock);
|
|
89
80
|
}
|
|
90
81
|
}
|
|
91
|
-
const
|
|
92
|
-
class
|
|
82
|
+
const gt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>', mt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>', ft = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>', Ct = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>', vt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>', kt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>', wt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.2 12L11.0586 13.8586C11.1367 13.9367 11.2633 13.9367 11.3414 13.8586L14.7 10.5"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>', bt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>', yt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>', St = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>', Lt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M11.3535 9.31802L12.7678 7.90381C13.5488 7.12276 14.8151 7.12276 15.5962 7.90381C16.3772 8.68486 16.3772 9.95119 15.5962 10.7322L14.182 12.1464M11.3535 9.31802L7.96729 12.7043C7.40889 13.2627 7.02826 13.9739 6.87339 14.7482L6.69798 15.6253C6.55803 16.325 7.17495 16.942 7.87467 16.802L8.75175 16.6266C9.52612 16.4717 10.2373 16.0911 10.7957 15.5327L14.182 12.1464M11.3535 9.31802L14.182 12.1464"/><line x1="15" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>', Pt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.13968 15.32L8.69058 11.5661C9.02934 11.2036 9.48873 11 9.96774 11C10.4467 11 10.9061 11.2036 11.2449 11.5661L15.3871 16M13.5806 14.0664L15.0132 12.533C15.3519 12.1705 15.8113 11.9668 16.2903 11.9668C16.7693 11.9668 17.2287 12.1705 17.5675 12.533L18.841 13.9634"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.7778 9.33331H13.7867"/></svg>', Wt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>', xt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2604" width="24" height="24"><path d="M469.3330000000001 725.333H896V640H469.3330000000001v85.333zM128 512l170.667 170.667V341.3330000000001L128 512z m0 384h768v-85.333H128V896z m0-768v85.333h768V128H128z m341.333 256H896v-85.333H469.3330000000001V384z m0 170.667H896v-85.334H469.3330000000001v85.334z" p-id="2605" fill="#000000"></path></svg>', Tt = '<svg t="1763708124227" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2788" width="24" height="24"><path d="M128 896h768v-85.333H128V896z m0-554.667v341.334L298.667 512 128 341.333z m341.333 384H896V640H469.333v85.333zM128 128v85.333h768V128H128z m341.333 256H896v-85.333H469.333V384z m0 170.667H896v-85.334H469.333v85.334z" p-id="2789" fill="#000000"></path></svg>';
|
|
83
|
+
class re {
|
|
93
84
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
94
85
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H1" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
95
86
|
}
|
|
@@ -157,7 +148,7 @@ class Gt {
|
|
|
157
148
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
158
149
|
}
|
|
159
150
|
get defaultLevel() {
|
|
160
|
-
return { number: 1, tag: "H1", svg:
|
|
151
|
+
return { number: 1, tag: "H1", svg: gt };
|
|
161
152
|
}
|
|
162
153
|
onPaste(t) {
|
|
163
154
|
const e = t.detail;
|
|
@@ -170,10 +161,10 @@ class Gt {
|
|
|
170
161
|
return { tags: ["H1", "h1"] };
|
|
171
162
|
}
|
|
172
163
|
static get toolbox() {
|
|
173
|
-
return { icon:
|
|
164
|
+
return { icon: gt, title: "H1" };
|
|
174
165
|
}
|
|
175
166
|
}
|
|
176
|
-
class
|
|
167
|
+
class oe {
|
|
177
168
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
178
169
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H2" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
179
170
|
}
|
|
@@ -241,7 +232,7 @@ class Xt {
|
|
|
241
232
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
242
233
|
}
|
|
243
234
|
get defaultLevel() {
|
|
244
|
-
return { number: 2, tag: "H2", svg:
|
|
235
|
+
return { number: 2, tag: "H2", svg: mt };
|
|
245
236
|
}
|
|
246
237
|
onPaste(t) {
|
|
247
238
|
const e = t.detail;
|
|
@@ -254,10 +245,10 @@ class Xt {
|
|
|
254
245
|
return { tags: ["H2"] };
|
|
255
246
|
}
|
|
256
247
|
static get toolbox() {
|
|
257
|
-
return { icon:
|
|
248
|
+
return { icon: mt, title: "H2" };
|
|
258
249
|
}
|
|
259
250
|
}
|
|
260
|
-
class
|
|
251
|
+
class ae {
|
|
261
252
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
262
253
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H3" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
263
254
|
}
|
|
@@ -325,7 +316,7 @@ class Jt {
|
|
|
325
316
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
326
317
|
}
|
|
327
318
|
get defaultLevel() {
|
|
328
|
-
return { number: 3, tag: "H3", svg:
|
|
319
|
+
return { number: 3, tag: "H3", svg: ft };
|
|
329
320
|
}
|
|
330
321
|
onPaste(t) {
|
|
331
322
|
const e = t.detail;
|
|
@@ -338,10 +329,10 @@ class Jt {
|
|
|
338
329
|
return { tags: ["H3"] };
|
|
339
330
|
}
|
|
340
331
|
static get toolbox() {
|
|
341
|
-
return { icon:
|
|
332
|
+
return { icon: ft, title: "H3" };
|
|
342
333
|
}
|
|
343
334
|
}
|
|
344
|
-
class
|
|
335
|
+
class le {
|
|
345
336
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
346
337
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H4" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
347
338
|
}
|
|
@@ -409,7 +400,7 @@ class Qt {
|
|
|
409
400
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
410
401
|
}
|
|
411
402
|
get defaultLevel() {
|
|
412
|
-
return { number: 4, tag: "H4", svg:
|
|
403
|
+
return { number: 4, tag: "H4", svg: Ct };
|
|
413
404
|
}
|
|
414
405
|
onPaste(t) {
|
|
415
406
|
const e = t.detail;
|
|
@@ -422,10 +413,10 @@ class Qt {
|
|
|
422
413
|
return { tags: ["H4"] };
|
|
423
414
|
}
|
|
424
415
|
static get toolbox() {
|
|
425
|
-
return { icon:
|
|
416
|
+
return { icon: Ct, title: "H4" };
|
|
426
417
|
}
|
|
427
418
|
}
|
|
428
|
-
class
|
|
419
|
+
class de {
|
|
429
420
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
430
421
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H5" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
431
422
|
}
|
|
@@ -493,7 +484,7 @@ class Zt {
|
|
|
493
484
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
494
485
|
}
|
|
495
486
|
get defaultLevel() {
|
|
496
|
-
return { number: 5, tag: "H5", svg:
|
|
487
|
+
return { number: 5, tag: "H5", svg: vt };
|
|
497
488
|
}
|
|
498
489
|
onPaste(t) {
|
|
499
490
|
const e = t.detail;
|
|
@@ -506,10 +497,10 @@ class Zt {
|
|
|
506
497
|
return { tags: ["H5"] };
|
|
507
498
|
}
|
|
508
499
|
static get toolbox() {
|
|
509
|
-
return { icon:
|
|
500
|
+
return { icon: vt, title: "H5" };
|
|
510
501
|
}
|
|
511
502
|
}
|
|
512
|
-
class
|
|
503
|
+
class he {
|
|
513
504
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
514
505
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H6" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
515
506
|
}
|
|
@@ -577,7 +568,7 @@ class te {
|
|
|
577
568
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
578
569
|
}
|
|
579
570
|
get defaultLevel() {
|
|
580
|
-
return { number: 6, tag: "H6", svg:
|
|
571
|
+
return { number: 6, tag: "H6", svg: kt };
|
|
581
572
|
}
|
|
582
573
|
onPaste(t) {
|
|
583
574
|
const e = t.detail;
|
|
@@ -590,10 +581,10 @@ class te {
|
|
|
590
581
|
return { tags: ["H6"] };
|
|
591
582
|
}
|
|
592
583
|
static get toolbox() {
|
|
593
|
-
return { icon:
|
|
584
|
+
return { icon: kt, title: "H6" };
|
|
594
585
|
}
|
|
595
586
|
}
|
|
596
|
-
class
|
|
587
|
+
class ht {
|
|
597
588
|
static get DEFAULT_ALIGNMENT() {
|
|
598
589
|
return "left";
|
|
599
590
|
}
|
|
@@ -602,10 +593,10 @@ class Z {
|
|
|
602
593
|
}
|
|
603
594
|
getAlignment() {
|
|
604
595
|
var t, e;
|
|
605
|
-
return (t = this.settings) != null && t.blocks && this.settings.blocks.hasOwnProperty(this.block.name) ? this.settings.blocks[this.block.name] : (e = this.settings) != null && e.default ? this.settings.default :
|
|
596
|
+
return (t = this.settings) != null && t.blocks && this.settings.blocks.hasOwnProperty(this.block.name) ? this.settings.blocks[this.block.name] : (e = this.settings) != null && e.default ? this.settings.default : ht.DEFAULT_ALIGNMENT;
|
|
606
597
|
}
|
|
607
598
|
constructor({ api: t, data: e, config: i, block: s }) {
|
|
608
|
-
this.api = t, this.block = s, this.settings = i, this.data = e || { alignment: this.getAlignment() }, this.alignmentSettings = [{ name: "left", icon:
|
|
599
|
+
this.api = t, this.block = s, this.settings = i, this.data = e || { alignment: this.getAlignment() }, this.alignmentSettings = [{ name: "left", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 7L5 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 17H5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13 12L5 12"/></svg>' }, { name: "center", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 7L6 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 17H6"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 12L8 12"/></svg>' }, { name: "right", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 7L7 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17H7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 12L11 12"/></svg>' }], this._CSS = { alignment: { left: "ce-tune-alignment--left", center: "ce-tune-alignment--center", right: "ce-tune-alignment--right" } };
|
|
609
600
|
}
|
|
610
601
|
wrap(t) {
|
|
611
602
|
return this.wrapper = document.createElement("div"), this.wrapper.classList.toggle(this._CSS.alignment[this.data.alignment]), this.wrapper.append(t), this.wrapper;
|
|
@@ -630,17 +621,16 @@ class Z {
|
|
|
630
621
|
return this.data;
|
|
631
622
|
}
|
|
632
623
|
}
|
|
633
|
-
class
|
|
624
|
+
class ct {
|
|
634
625
|
static get DEFAULT_PLACEHOLDER() {
|
|
635
626
|
return "";
|
|
636
627
|
}
|
|
637
628
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
638
629
|
var n;
|
|
639
|
-
this.api = i, this.readOnly = s, this._CSS = { block: this.api.styles.block, wrapper: "ce-paragraph" }, this.readOnly || (this.onKeyUp = this.onKeyUp.bind(this)), this._placeholder = e.placeholder ? e.placeholder :
|
|
630
|
+
this.api = i, this.readOnly = s, this._CSS = { block: this.api.styles.block, wrapper: "ce-paragraph" }, this.readOnly || (this.onKeyUp = this.onKeyUp.bind(this)), this._placeholder = e.placeholder ? e.placeholder : ct.DEFAULT_PLACEHOLDER, this._data = t != null ? t : {}, this._element = null, this._preserveBlank = (n = e.preserveBlank) != null ? n : !1;
|
|
640
631
|
}
|
|
641
632
|
onKeyUp(t) {
|
|
642
|
-
if (t.code !== "Backspace" && t.code !== "Delete" || !this._element)
|
|
643
|
-
return;
|
|
633
|
+
if (t.code !== "Backspace" && t.code !== "Delete" || !this._element) return;
|
|
644
634
|
const { textContent: e } = this._element;
|
|
645
635
|
e === "" && (this._element.innerHTML = "");
|
|
646
636
|
}
|
|
@@ -652,8 +642,7 @@ class tt {
|
|
|
652
642
|
return this._element = this.drawView(), this._element;
|
|
653
643
|
}
|
|
654
644
|
merge(t) {
|
|
655
|
-
if (!this._element)
|
|
656
|
-
return;
|
|
645
|
+
if (!this._element) return;
|
|
657
646
|
this._data.text += t.text;
|
|
658
647
|
const e = function(i) {
|
|
659
648
|
const s = document.createElement("div");
|
|
@@ -688,13 +677,13 @@ class tt {
|
|
|
688
677
|
return { tags: ["P", "div", "br"] };
|
|
689
678
|
}
|
|
690
679
|
static get toolbox() {
|
|
691
|
-
return { icon:
|
|
680
|
+
return { icon: Wt, title: "Text" };
|
|
692
681
|
}
|
|
693
682
|
}
|
|
694
|
-
class
|
|
683
|
+
class q {
|
|
695
684
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
696
685
|
var n;
|
|
697
|
-
this._selectorLanguage = "", this._selectorTheme = "", this.api = i, this.readOnly = s, this.placeholder = this.api.i18n.t(e.placeholder ||
|
|
686
|
+
this._selectorLanguage = "", this._selectorTheme = "", this.api = i, this.readOnly = s, this.placeholder = this.api.i18n.t(e.placeholder || q.DEFAULT_PLACEHOLDER), this._selectorLanguage = t.lang || e.lang || q.DEFAULT_LANGUAGE, this._selectorTheme = t.theme || e.theme || q.DEFAULT_THEME, this.CSS = { baseClass: this.api.styles.block, input: this.api.styles.input, wrapper: "ce-editorjs-x-shiki", textarea: "ce-editorjs-x-shiki__textarea", span: "ce-editorjs-x-shiki__span", selectorLanguage: "ce-editorjs-x-shiki__selector-language", selectorTheme: "ce-editorjs-x-shiki__selector-theme" }, this.nodes = { holder: null, textarea: null }, this.data = { code: (n = t.code) != null ? n : "", lang: this._selectorLanguage, theme: this._selectorTheme, resizeSize: t.resizeSize || 0 }, this.nodes.holder = this.drawView();
|
|
698
687
|
}
|
|
699
688
|
static get isReadOnlySupported() {
|
|
700
689
|
return !0;
|
|
@@ -706,7 +695,7 @@ class U {
|
|
|
706
695
|
return this.nodes.holder;
|
|
707
696
|
}
|
|
708
697
|
save(t) {
|
|
709
|
-
return { code: t.querySelector("textarea").value, lang: this._selectorLanguage, theme: this._selectorTheme };
|
|
698
|
+
return { code: t.querySelector("textarea").value, lang: this._selectorLanguage, theme: this._selectorTheme, resizeSize: this.data.resizeSize || 0 };
|
|
710
699
|
}
|
|
711
700
|
onPaste(t) {
|
|
712
701
|
const e = t.detail;
|
|
@@ -745,52 +734,65 @@ class U {
|
|
|
745
734
|
let o;
|
|
746
735
|
if (i) {
|
|
747
736
|
const a = function(d, l) {
|
|
748
|
-
let
|
|
749
|
-
for (;
|
|
750
|
-
` && l > 0; )
|
|
751
|
-
|
|
752
|
-
return c === `
|
|
737
|
+
let p = "";
|
|
738
|
+
for (; p !== `
|
|
739
|
+
` && l > 0; ) l -= 1, p = d.substr(l, 1);
|
|
740
|
+
return p === `
|
|
753
741
|
` && (l += 1), l;
|
|
754
742
|
}(n, s);
|
|
755
|
-
if (n.substr(a, 2) !== r)
|
|
756
|
-
return;
|
|
743
|
+
if (n.substr(a, 2) !== r) return;
|
|
757
744
|
e.value = n.substring(0, a) + n.substring(a + 2), o = s - 2;
|
|
758
|
-
} else
|
|
759
|
-
o = s + 2, e.value = n.substring(0, s) + r + n.substring(s);
|
|
745
|
+
} else o = s + 2, e.value = n.substring(0, s) + r + n.substring(s);
|
|
760
746
|
e.setSelectionRange(o, o);
|
|
761
747
|
}
|
|
762
748
|
drawView() {
|
|
763
|
-
const t = document.createElement("div"), e = document.createElement("div"), i = document.createElement("div"), s = document.createElement("div"), n = document.createElement("div"), r = document.createElement("div"), o = document.createElement("select"), a = document.createElement("select"), d = document.createElement("span"), l = document.createElement("textarea");
|
|
764
|
-
return t.classList.add(this.CSS.baseClass, this.CSS.wrapper), e.classList.add("ce-editorjs-x-shiki__code"), i.classList.add("ce-editorjs-x-shiki__selector"), s.classList.add("ce-editorjs-x-shiki__lang"), n.classList.add("ce-editorjs-x-shiki__copy"), r.classList.add("ce-editorjs-x-shiki__copy_tip"), o.classList.add(this.CSS.selectorLanguage), l.classList.add(this.CSS.textarea, this.CSS.input), s.innerHTML = this.data.lang, n.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.25 8.5H10.25C9.2835 8.5 8.5 9.2835 8.5 10.25V17.25C8.5 18.2165 9.2835 19 10.25 19H17.25C18.2165 19 19 18.2165 19 17.25V10.25C19 9.2835 18.2165 8.5 17.25 8.5Z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.5 8.5V6.75C15.5 6.28587 15.3156 5.84075 14.9874 5.51256C14.6592 5.18437 14.2141 5 13.75 5H6.75C6.28587 5 5.84075 5.18437 5.51256 5.51256C5.18437 5.84075 5 6.28587 5 6.75V13.75C5 14.2141 5.18437 14.6592 5.51256 14.9874C5.84075 15.3156 6.28587 15.5 6.75 15.5H8.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 12L15.5 12"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15.5L15.5 15.5"/></svg>', r.innerText = this.api.i18n.t("Copied"),
|
|
749
|
+
const t = document.createElement("div"), e = document.createElement("div"), i = document.createElement("div"), s = document.createElement("div"), n = document.createElement("div"), r = document.createElement("div"), o = document.createElement("select"), a = document.createElement("select"), d = document.createElement("span"), l = document.createElement("textarea"), p = document.createElement("div");
|
|
750
|
+
return p.classList.add("ce-editorjs-x-shiki__code__dragHandler"), t.classList.add(this.CSS.baseClass, this.CSS.wrapper), this.readOnly ? t.classList.add("read-only") : t.classList.add("editable"), e.classList.add("ce-editorjs-x-shiki__code"), i.classList.add("ce-editorjs-x-shiki__selector"), s.classList.add("ce-editorjs-x-shiki__lang"), n.classList.add("ce-editorjs-x-shiki__copy"), r.classList.add("ce-editorjs-x-shiki__copy_tip"), o.classList.add(this.CSS.selectorLanguage), l.classList.add(this.CSS.textarea, this.CSS.input), s.innerHTML = this.data.lang, n.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.25 8.5H10.25C9.2835 8.5 8.5 9.2835 8.5 10.25V17.25C8.5 18.2165 9.2835 19 10.25 19H17.25C18.2165 19 19 18.2165 19 17.25V10.25C19 9.2835 18.2165 8.5 17.25 8.5Z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.5 8.5V6.75C15.5 6.28587 15.3156 5.84075 14.9874 5.51256C14.6592 5.18437 14.2141 5 13.75 5H6.75C6.28587 5 5.84075 5.18437 5.51256 5.51256C5.18437 5.84075 5 6.28587 5 6.75V13.75C5 14.2141 5.18437 14.6592 5.51256 14.9874C5.84075 15.3156 6.28587 15.5 6.75 15.5H8.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 12L15.5 12"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15.5L15.5 15.5"/></svg>', r.innerText = this.api.i18n.t("Copied"), Zt.forEach((c) => {
|
|
765
751
|
const h = document.createElement("option");
|
|
766
752
|
h.value = c.id, h.text = c.name, o.appendChild(h);
|
|
767
|
-
}), o.value = this.data.lang, l.value = this.data.code, l.placeholder = this.placeholder, l.spellcheck = !1, l.autocomplete = "off", l.autocapitalize = "off", this.readOnly && (l.disabled = !0), e.appendChild(d), e.appendChild(l), this.readOnly ? i.appendChild(s) : i.appendChild(o), n.appendChild(r), i.appendChild(n), t.appendChild(i), t.appendChild(e), this.runShiki().then(({ html: c, preStyle: h }) => {
|
|
753
|
+
}), o.value = this.data.lang, l.value = this.data.code, l.placeholder = this.placeholder, l.spellcheck = !1, l.autocomplete = "off", l.autocapitalize = "off", this.readOnly && (l.disabled = !0), e.appendChild(d), e.appendChild(l), t.appendChild(p), this.data.resizeSize && this.data.resizeSize > 0 && (e.style.height = this.data.resizeSize + "px"), this.readOnly ? i.appendChild(s) : i.appendChild(o), n.appendChild(r), i.appendChild(n), t.appendChild(i), t.appendChild(e), this.runShiki().then(({ html: c, preStyle: h }) => {
|
|
768
754
|
d.innerHTML = c, t == null || t.setAttribute("style", h), o.setAttribute("style", h), a.setAttribute("style", h);
|
|
769
755
|
}), o.addEventListener("change", (c) => {
|
|
770
756
|
const h = c.target.value;
|
|
771
|
-
this._selectorLanguage = h, this.runShiki().then(({ html:
|
|
772
|
-
d.innerHTML =
|
|
757
|
+
this._selectorLanguage = h, this.runShiki().then(({ html: g, preStyle: m }) => {
|
|
758
|
+
d.innerHTML = g, s.innerHTML = h;
|
|
773
759
|
});
|
|
774
760
|
}), a.addEventListener("change", (c) => {
|
|
775
761
|
const h = c.target.value;
|
|
776
|
-
this._selectorTheme = h, this.runShiki().then(({ html:
|
|
777
|
-
d.innerHTML =
|
|
762
|
+
this._selectorTheme = h, this.runShiki().then(({ html: g, preStyle: m }) => {
|
|
763
|
+
d.innerHTML = g, t == null || t.setAttribute("style", m), o.setAttribute("style", m), a.setAttribute("style", m);
|
|
778
764
|
});
|
|
779
765
|
}), l.addEventListener("input", () => {
|
|
780
766
|
this.data.code = l.value, this.runShiki().then(({ html: c, preStyle: h }) => {
|
|
781
767
|
d.innerHTML = c, t == null || t.setAttribute("style", h), o.setAttribute("style", h), a.setAttribute("style", h);
|
|
782
768
|
});
|
|
783
769
|
}), l.addEventListener("keydown", (c) => {
|
|
784
|
-
c.code === "Tab" && (this.tabHandler(c), this.data.code = l.value, this.runShiki().then(({ html: h, preStyle:
|
|
770
|
+
c.code === "Tab" && (this.tabHandler(c), this.data.code = l.value, this.runShiki().then(({ html: h, preStyle: g }) => {
|
|
785
771
|
d.innerHTML = h;
|
|
786
772
|
}));
|
|
773
|
+
}), l.addEventListener("scroll", () => {
|
|
774
|
+
d.style = `display:block;transform: translateY(-${l.scrollTop}px)`;
|
|
787
775
|
}), n.addEventListener("click", (c) => {
|
|
788
776
|
this.copyCode(this.data.code, c);
|
|
777
|
+
}), p.addEventListener("mousedown", (c) => {
|
|
778
|
+
this.resizeClick(e, c);
|
|
789
779
|
}), this.nodes.textarea = l, t;
|
|
790
780
|
}
|
|
781
|
+
resizeClick(t, e) {
|
|
782
|
+
let i = e.clientY, s = parseInt(window.getComputedStyle(t).height, 10);
|
|
783
|
+
const n = (o) => {
|
|
784
|
+
const a = o.clientY - i;
|
|
785
|
+
let d = s + a;
|
|
786
|
+
d < 100 && (d = 100), t.style.height = d + "px";
|
|
787
|
+
}, r = () => {
|
|
788
|
+
const o = parseInt(window.getComputedStyle(t).height, 10);
|
|
789
|
+
this.data.resizeSize = o, document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r);
|
|
790
|
+
};
|
|
791
|
+
document.addEventListener("mousemove", n), document.addEventListener("mouseup", r);
|
|
792
|
+
}
|
|
791
793
|
async runShiki() {
|
|
792
794
|
let t = "";
|
|
793
|
-
return { html: await
|
|
795
|
+
return { html: await Jt(this.data.code, { lang: this._selectorLanguage, theme: this._selectorTheme, transformers: [{ preprocess: (e) => `${e}
|
|
794
796
|
`, pre(e) {
|
|
795
797
|
var i;
|
|
796
798
|
this.addClassToHast(e, "ce-editorjs-x-shiki__span"), t = ((i = e.properties) == null ? void 0 : i.style) || "";
|
|
@@ -811,29 +813,27 @@ class U {
|
|
|
811
813
|
}
|
|
812
814
|
}
|
|
813
815
|
copyCode(t, e) {
|
|
814
|
-
if (this.data.code)
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
} catch (s) {
|
|
831
|
-
this.showCopyTip("Unable to copy", e), document.body.removeChild(i);
|
|
832
|
-
}
|
|
816
|
+
if (this.data.code) if (navigator.clipboard && window.isSecureContext) try {
|
|
817
|
+
navigator.clipboard.writeText(t).then(() => {
|
|
818
|
+
this.showCopyTip("Copied", e);
|
|
819
|
+
}).catch((i) => {
|
|
820
|
+
this.showCopyTip("Unable to copy", e);
|
|
821
|
+
});
|
|
822
|
+
} catch (i) {
|
|
823
|
+
this.showCopyTip("Unable to copy", e);
|
|
824
|
+
}
|
|
825
|
+
else {
|
|
826
|
+
const i = document.createElement("textarea");
|
|
827
|
+
i.value = t, i.style.top = "0", i.style.left = "0", i.style.position = "fixed", i.style.opacity = "0", i.style.pointerEvents = "none", i.style.zIndex = "-1000", document.body.appendChild(i), i.focus(), i.select();
|
|
828
|
+
try {
|
|
829
|
+
document.execCommand("copy"), document.body.removeChild(i), this.showCopyTip("Copied", e);
|
|
830
|
+
} catch (s) {
|
|
831
|
+
this.showCopyTip("Unable to copy", e), document.body.removeChild(i);
|
|
833
832
|
}
|
|
833
|
+
}
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
|
-
class
|
|
836
|
+
class ce {
|
|
837
837
|
constructor({ data: t, api: e, readOnly: i }) {
|
|
838
838
|
this.api = e, this.readOnly = i, this._data = { text: t.text || "" }, this._CSS = { baseClass: this.api.styles.block, wrapper: "cdx-quote", text: "cdx-quote__text", input: this.api.styles.input };
|
|
839
839
|
}
|
|
@@ -886,7 +886,7 @@ class ee {
|
|
|
886
886
|
return { text: { br: !0 } };
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
|
-
class
|
|
889
|
+
class ue {
|
|
890
890
|
static get isReadOnlySupported() {
|
|
891
891
|
return !0;
|
|
892
892
|
}
|
|
@@ -917,7 +917,7 @@ class ie {
|
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
const b = "cdx-list", k = { wrapper: b, item: `${b}__item`, itemContent: `${b}__item-content`, itemChildren: `${b}__item-children` };
|
|
920
|
-
class
|
|
920
|
+
class T {
|
|
921
921
|
static get CSS() {
|
|
922
922
|
return { ...k, orderedList: `${b}-ordered` };
|
|
923
923
|
}
|
|
@@ -926,14 +926,14 @@ class E {
|
|
|
926
926
|
}
|
|
927
927
|
renderWrapper(t) {
|
|
928
928
|
let e;
|
|
929
|
-
return e = S("ol", t === !0 ? [
|
|
929
|
+
return e = S("ol", t === !0 ? [T.CSS.wrapper, T.CSS.orderedList] : [T.CSS.orderedList, T.CSS.itemChildren]), e;
|
|
930
930
|
}
|
|
931
931
|
renderItem(t, e) {
|
|
932
|
-
const i = S("li",
|
|
932
|
+
const i = S("li", T.CSS.item), s = S("div", T.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() });
|
|
933
933
|
return i.appendChild(s), i;
|
|
934
934
|
}
|
|
935
935
|
getItemContent(t) {
|
|
936
|
-
const e = t.querySelector(`.${
|
|
936
|
+
const e = t.querySelector(`.${T.CSS.itemContent}`);
|
|
937
937
|
return e ? dt(e) ? "" : e.innerHTML : "";
|
|
938
938
|
}
|
|
939
939
|
getItemMeta() {
|
|
@@ -943,7 +943,7 @@ class E {
|
|
|
943
943
|
return {};
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
class
|
|
946
|
+
class E {
|
|
947
947
|
static get CSS() {
|
|
948
948
|
return { ...k, unorderedList: `${b}-unordered` };
|
|
949
949
|
}
|
|
@@ -952,14 +952,14 @@ class M {
|
|
|
952
952
|
}
|
|
953
953
|
renderWrapper(t) {
|
|
954
954
|
let e;
|
|
955
|
-
return e = S("ul", t === !0 ? [
|
|
955
|
+
return e = S("ul", t === !0 ? [E.CSS.wrapper, E.CSS.unorderedList] : [E.CSS.unorderedList, E.CSS.itemChildren]), e;
|
|
956
956
|
}
|
|
957
957
|
renderItem(t, e) {
|
|
958
|
-
const i = S("li",
|
|
958
|
+
const i = S("li", E.CSS.item), s = S("div", E.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() });
|
|
959
959
|
return i.appendChild(s), i;
|
|
960
960
|
}
|
|
961
961
|
getItemContent(t) {
|
|
962
|
-
const e = t.querySelector(`.${
|
|
962
|
+
const e = t.querySelector(`.${E.CSS.itemContent}`);
|
|
963
963
|
return e ? dt(e) ? "" : e.innerHTML : "";
|
|
964
964
|
}
|
|
965
965
|
getItemMeta() {
|
|
@@ -969,7 +969,7 @@ class M {
|
|
|
969
969
|
return {};
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
|
-
function
|
|
972
|
+
function B(u) {
|
|
973
973
|
return u.nodeType === Node.ELEMENT_NODE;
|
|
974
974
|
}
|
|
975
975
|
class C {
|
|
@@ -1011,7 +1011,7 @@ class C {
|
|
|
1011
1011
|
t.classList.remove(C.CSS.noHover);
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function Q(u, t = "after") {
|
|
1015
1015
|
const e = [];
|
|
1016
1016
|
let i;
|
|
1017
1017
|
function s(n) {
|
|
@@ -1022,43 +1022,39 @@ function et(u, t = "after") {
|
|
|
1022
1022
|
return n.previousElementSibling;
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
|
-
for (i = s(u); i !== null; )
|
|
1026
|
-
e.push(i), i = s(i);
|
|
1025
|
+
for (i = s(u); i !== null; ) e.push(i), i = s(i);
|
|
1027
1026
|
return e.length !== 0 ? e : null;
|
|
1028
1027
|
}
|
|
1029
|
-
function
|
|
1028
|
+
function _(u, t = !0) {
|
|
1030
1029
|
let e = u;
|
|
1031
1030
|
return u.classList.contains(k.item) && (e = u.querySelector(`.${k.itemChildren}`)), e === null ? [] : t ? Array.from(e.querySelectorAll(`:scope > .${k.item}`)) : Array.from(e.querySelectorAll(`.${k.item}`));
|
|
1032
1031
|
}
|
|
1033
|
-
function
|
|
1032
|
+
function H(u) {
|
|
1034
1033
|
return u.querySelector(`.${k.itemChildren}`);
|
|
1035
1034
|
}
|
|
1036
|
-
function
|
|
1035
|
+
function tt(u) {
|
|
1037
1036
|
let t = u;
|
|
1038
|
-
u.classList.contains(k.item) && (t =
|
|
1037
|
+
u.classList.contains(k.item) && (t = H(u)), t !== null && _(t).length === 0 && t.remove();
|
|
1039
1038
|
}
|
|
1040
|
-
function
|
|
1039
|
+
function Y(u) {
|
|
1041
1040
|
return u.querySelector(`.${k.itemContent}`);
|
|
1042
1041
|
}
|
|
1043
|
-
function
|
|
1044
|
-
const e =
|
|
1045
|
-
e &&
|
|
1042
|
+
function N(u, t = !0) {
|
|
1043
|
+
const e = Y(u);
|
|
1044
|
+
e && Qt(e, t);
|
|
1046
1045
|
}
|
|
1047
|
-
class
|
|
1046
|
+
class et {
|
|
1048
1047
|
get currentItem() {
|
|
1049
1048
|
const t = window.getSelection();
|
|
1050
|
-
if (!t)
|
|
1051
|
-
return null;
|
|
1049
|
+
if (!t) return null;
|
|
1052
1050
|
let e = t.anchorNode;
|
|
1053
|
-
return e ? (
|
|
1051
|
+
return e ? (B(e) || (e = e.parentNode), e && B(e) ? e.closest(`.${k.item}`) : null) : null;
|
|
1054
1052
|
}
|
|
1055
1053
|
get currentItemLevel() {
|
|
1056
1054
|
const t = this.currentItem;
|
|
1057
|
-
if (t === null)
|
|
1058
|
-
return null;
|
|
1055
|
+
if (t === null) return null;
|
|
1059
1056
|
let e = t.parentNode, i = 0;
|
|
1060
|
-
for (; e !== null && e !== this.listWrapper; )
|
|
1061
|
-
R(e) && e.classList.contains(k.item) && (i += 1), e = e.parentNode;
|
|
1057
|
+
for (; e !== null && e !== this.listWrapper; ) B(e) && e.classList.contains(k.item) && (i += 1), e = e.parentNode;
|
|
1062
1058
|
return i + 1;
|
|
1063
1059
|
}
|
|
1064
1060
|
constructor({ data: t, config: e, api: i, readOnly: s, block: n }, r) {
|
|
@@ -1079,8 +1075,8 @@ class st {
|
|
|
1079
1075
|
}, !1), "start" in this.data.meta && this.data.meta.start !== void 0 && this.changeStartWith(this.data.meta.start), "counterType" in this.data.meta && this.data.meta.counterType !== void 0 && this.changeCounters(this.data.meta.counterType), this.listWrapper;
|
|
1080
1076
|
}
|
|
1081
1077
|
save(t) {
|
|
1082
|
-
const e = t != null ? t : this.listWrapper, i = (r) =>
|
|
1083
|
-
const a =
|
|
1078
|
+
const e = t != null ? t : this.listWrapper, i = (r) => _(r).map((o) => {
|
|
1079
|
+
const a = H(o);
|
|
1084
1080
|
return { content: this.renderer.getItemContent(o), meta: this.renderer.getItemMeta(o), items: a ? i(a) : [] };
|
|
1085
1081
|
}), s = e ? i(e) : [];
|
|
1086
1082
|
let n = { style: this.data.style, meta: {}, items: s };
|
|
@@ -1090,13 +1086,11 @@ class st {
|
|
|
1090
1086
|
return { tags: ["OL", "UL", "LI"] };
|
|
1091
1087
|
}
|
|
1092
1088
|
merge(t) {
|
|
1093
|
-
const e = this.block.holder.querySelectorAll(`.${k.item}`), i = e[e.length - 1], s =
|
|
1094
|
-
if (i === null || s === null || (s.insertAdjacentHTML("beforeend", t.items[0].content), this.listWrapper === void 0))
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
return;
|
|
1099
|
-
let r = A(n[n.length - 1]);
|
|
1089
|
+
const e = this.block.holder.querySelectorAll(`.${k.item}`), i = e[e.length - 1], s = Y(i);
|
|
1090
|
+
if (i === null || s === null || (s.insertAdjacentHTML("beforeend", t.items[0].content), this.listWrapper === void 0)) return;
|
|
1091
|
+
const n = _(this.listWrapper);
|
|
1092
|
+
if (n.length === 0) return;
|
|
1093
|
+
let r = H(n[n.length - 1]);
|
|
1100
1094
|
const o = t.items.shift();
|
|
1101
1095
|
o !== void 0 && (o.items.length !== 0 && (r === null && (r = this.renderer.renderWrapper(!1)), this.appendItems(o.items, r)), t.items.length > 0 && this.appendItems(t.items, this.listWrapper));
|
|
1102
1096
|
}
|
|
@@ -1120,9 +1114,9 @@ class st {
|
|
|
1120
1114
|
const n = { style: s, meta: {}, items: [] };
|
|
1121
1115
|
s === "ordered" && (this.data.meta.counterType = "numeric", this.data.meta.start = 1);
|
|
1122
1116
|
const r = (o) => Array.from(o.querySelectorAll(":scope > li")).map((a) => {
|
|
1123
|
-
var
|
|
1117
|
+
var p;
|
|
1124
1118
|
const d = a.querySelector(`:scope > ${i}`), l = d ? r(d) : [];
|
|
1125
|
-
return { content: (
|
|
1119
|
+
return { content: (p = a.innerHTML) != null ? p : "", meta: {}, items: l };
|
|
1126
1120
|
});
|
|
1127
1121
|
return n.items = r(t), n;
|
|
1128
1122
|
}
|
|
@@ -1135,48 +1129,41 @@ class st {
|
|
|
1135
1129
|
enterPressed(t) {
|
|
1136
1130
|
var o;
|
|
1137
1131
|
const e = this.currentItem;
|
|
1138
|
-
if (t.stopPropagation(), t.preventDefault(), t.isComposing || e === null)
|
|
1139
|
-
return;
|
|
1132
|
+
if (t.stopPropagation(), t.preventDefault(), t.isComposing || e === null) return;
|
|
1140
1133
|
const i = ((o = this.renderer) == null ? void 0 : o.getItemContent(e).trim().length) === 0, s = e.parentNode === this.listWrapper, n = e.previousElementSibling === null, r = this.api.blocks.getCurrentBlockIndex();
|
|
1141
|
-
if (s && i)
|
|
1142
|
-
return
|
|
1143
|
-
|
|
1144
|
-
}(e) ? void this.splitList(e) : void (n ? this.convertItemToDefaultBlock(r, !0) : this.convertItemToDefaultBlock());
|
|
1134
|
+
if (s && i) return e.nextElementSibling !== null || function(a) {
|
|
1135
|
+
return a.querySelector(`.${k.itemChildren}`) !== null;
|
|
1136
|
+
}(e) ? void this.splitList(e) : void (n ? this.convertItemToDefaultBlock(r, !0) : this.convertItemToDefaultBlock());
|
|
1145
1137
|
i ? this.unshiftItem(e) : this.splitItem(e);
|
|
1146
1138
|
}
|
|
1147
1139
|
backspace(t) {
|
|
1148
1140
|
var i;
|
|
1149
1141
|
const e = this.currentItem;
|
|
1150
|
-
e !== null &&
|
|
1142
|
+
e !== null && te(e) && ((i = window.getSelection()) == null ? void 0 : i.isCollapsed) !== !1 && (t.stopPropagation(), e.parentNode !== this.listWrapper || e.previousElementSibling !== null ? (t.preventDefault(), this.mergeItemWithPrevious(e)) : this.convertFirstItemToDefaultBlock());
|
|
1151
1143
|
}
|
|
1152
1144
|
shiftTab(t) {
|
|
1153
1145
|
t.stopPropagation(), t.preventDefault(), this.currentItem !== null && this.unshiftItem(this.currentItem);
|
|
1154
1146
|
}
|
|
1155
1147
|
unshiftItem(t) {
|
|
1156
|
-
if (!t.parentNode || !
|
|
1157
|
-
return;
|
|
1148
|
+
if (!t.parentNode || !B(t.parentNode)) return;
|
|
1158
1149
|
const e = t.parentNode.closest(`.${k.item}`);
|
|
1159
|
-
if (!e)
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
return;
|
|
1164
|
-
const s = et(t);
|
|
1150
|
+
if (!e) return;
|
|
1151
|
+
let i = H(t);
|
|
1152
|
+
if (t.parentElement === null) return;
|
|
1153
|
+
const s = Q(t);
|
|
1165
1154
|
s !== null && (i === null && (i = this.renderer.renderWrapper(!1)), s.forEach((n) => {
|
|
1166
1155
|
i.appendChild(n);
|
|
1167
|
-
}), t.appendChild(i)), e.after(t),
|
|
1156
|
+
}), t.appendChild(i)), e.after(t), N(t, !1), tt(e);
|
|
1168
1157
|
}
|
|
1169
1158
|
splitList(t) {
|
|
1170
|
-
const e =
|
|
1159
|
+
const e = _(t), i = this.block, s = this.api.blocks.getCurrentBlockIndex();
|
|
1171
1160
|
if (e.length !== 0) {
|
|
1172
1161
|
const a = e[0];
|
|
1173
|
-
this.unshiftItem(a),
|
|
1162
|
+
this.unshiftItem(a), N(t, !1);
|
|
1174
1163
|
}
|
|
1175
|
-
if (t.previousElementSibling === null && t.parentNode === this.listWrapper)
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
if (n === null)
|
|
1179
|
-
return;
|
|
1164
|
+
if (t.previousElementSibling === null && t.parentNode === this.listWrapper) return void this.convertItemToDefaultBlock(s);
|
|
1165
|
+
const n = Q(t);
|
|
1166
|
+
if (n === null) return;
|
|
1180
1167
|
const r = this.renderer.renderWrapper(!0);
|
|
1181
1168
|
n.forEach((a) => {
|
|
1182
1169
|
r.appendChild(a);
|
|
@@ -1185,73 +1172,63 @@ class st {
|
|
|
1185
1172
|
o.meta.start = this.data.style == "ordered" ? 1 : void 0, this.api.blocks.insert(i == null ? void 0 : i.name, o, this.config, s + 1), this.convertItemToDefaultBlock(s + 1), r.remove();
|
|
1186
1173
|
}
|
|
1187
1174
|
splitItem(t) {
|
|
1188
|
-
const [e, i] =
|
|
1189
|
-
if (e === null)
|
|
1190
|
-
|
|
1191
|
-
const s = X(t);
|
|
1175
|
+
const [e, i] = ee();
|
|
1176
|
+
if (e === null) return;
|
|
1177
|
+
const s = Y(t);
|
|
1192
1178
|
let n;
|
|
1193
|
-
n = s === null ? "" :
|
|
1194
|
-
const r =
|
|
1195
|
-
t == null || t.after(o), r && o.appendChild(r),
|
|
1179
|
+
n = s === null ? "" : ie(s, e, i, "right", !0);
|
|
1180
|
+
const r = H(t), o = this.renderItem(n);
|
|
1181
|
+
t == null || t.after(o), r && o.appendChild(r), N(o);
|
|
1196
1182
|
}
|
|
1197
1183
|
mergeItemWithPrevious(t) {
|
|
1198
|
-
var
|
|
1184
|
+
var p;
|
|
1199
1185
|
const e = t.previousElementSibling, i = t.parentNode;
|
|
1200
|
-
if (i === null || !
|
|
1201
|
-
return;
|
|
1186
|
+
if (i === null || !B(i)) return;
|
|
1202
1187
|
const s = i.closest(`.${k.item}`);
|
|
1203
|
-
if (!e && !s || e && !
|
|
1204
|
-
return;
|
|
1188
|
+
if (!e && !s || e && !B(e)) return;
|
|
1205
1189
|
let n;
|
|
1206
1190
|
if (e) {
|
|
1207
|
-
const
|
|
1208
|
-
n =
|
|
1209
|
-
} else
|
|
1210
|
-
n = s;
|
|
1191
|
+
const c = _(e, !1);
|
|
1192
|
+
n = c.length !== 0 && c.length !== 0 ? c[c.length - 1] : e;
|
|
1193
|
+
} else n = s;
|
|
1211
1194
|
const r = this.renderer.getItemContent(t);
|
|
1212
|
-
if (!n)
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
if (o === null)
|
|
1217
|
-
return;
|
|
1195
|
+
if (!n) return;
|
|
1196
|
+
N(n, !1);
|
|
1197
|
+
const o = Y(n);
|
|
1198
|
+
if (o === null) return;
|
|
1218
1199
|
o.insertAdjacentHTML("beforeend", r);
|
|
1219
|
-
const a =
|
|
1220
|
-
if (a.length === 0)
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
}), A(d) === null && n.appendChild(l), t.remove();
|
|
1200
|
+
const a = _(t);
|
|
1201
|
+
if (a.length === 0) return t.remove(), void tt(n);
|
|
1202
|
+
const d = e || s, l = (p = H(d)) != null ? p : this.renderer.renderWrapper(!1);
|
|
1203
|
+
e ? a.forEach((c) => {
|
|
1204
|
+
l.appendChild(c);
|
|
1205
|
+
}) : a.forEach((c) => {
|
|
1206
|
+
l.prepend(c);
|
|
1207
|
+
}), H(d) === null && n.appendChild(l), t.remove();
|
|
1228
1208
|
}
|
|
1229
1209
|
addTab(t) {
|
|
1230
1210
|
var n;
|
|
1231
1211
|
t.stopPropagation(), t.preventDefault();
|
|
1232
1212
|
const e = this.currentItem;
|
|
1233
|
-
if (!e)
|
|
1234
|
-
return;
|
|
1213
|
+
if (!e) return;
|
|
1235
1214
|
if (((n = this.config) == null ? void 0 : n.maxLevel) !== void 0) {
|
|
1236
1215
|
const r = this.currentItemLevel;
|
|
1237
|
-
if (r !== null && r === this.config.maxLevel)
|
|
1238
|
-
return;
|
|
1216
|
+
if (r !== null && r === this.config.maxLevel) return;
|
|
1239
1217
|
}
|
|
1240
1218
|
const i = e.previousSibling;
|
|
1241
|
-
if (i === null || !
|
|
1242
|
-
|
|
1243
|
-
const s = A(i);
|
|
1219
|
+
if (i === null || !B(i)) return;
|
|
1220
|
+
const s = H(i);
|
|
1244
1221
|
if (s)
|
|
1245
|
-
s.appendChild(e),
|
|
1222
|
+
s.appendChild(e), _(e).forEach((r) => {
|
|
1246
1223
|
s.appendChild(r);
|
|
1247
1224
|
});
|
|
1248
1225
|
else {
|
|
1249
1226
|
const r = this.renderer.renderWrapper(!1);
|
|
1250
|
-
r.appendChild(e),
|
|
1227
|
+
r.appendChild(e), _(e).forEach((o) => {
|
|
1251
1228
|
r.appendChild(o);
|
|
1252
1229
|
}), i.appendChild(r);
|
|
1253
1230
|
}
|
|
1254
|
-
|
|
1231
|
+
tt(e), N(e, !1);
|
|
1255
1232
|
}
|
|
1256
1233
|
convertItemToDefaultBlock(t, e) {
|
|
1257
1234
|
let i;
|
|
@@ -1260,21 +1237,20 @@ class st {
|
|
|
1260
1237
|
}
|
|
1261
1238
|
convertFirstItemToDefaultBlock() {
|
|
1262
1239
|
const t = this.currentItem;
|
|
1263
|
-
if (t === null)
|
|
1264
|
-
|
|
1265
|
-
const e = H(t);
|
|
1240
|
+
if (t === null) return;
|
|
1241
|
+
const e = _(t);
|
|
1266
1242
|
if (e.length !== 0) {
|
|
1267
1243
|
const r = e[0];
|
|
1268
|
-
this.unshiftItem(r),
|
|
1244
|
+
this.unshiftItem(r), N(t);
|
|
1269
1245
|
}
|
|
1270
|
-
const i =
|
|
1246
|
+
const i = Q(t), s = this.api.blocks.getCurrentBlockIndex(), n = i === null;
|
|
1271
1247
|
this.convertItemToDefaultBlock(s, n);
|
|
1272
1248
|
}
|
|
1273
1249
|
renderItem(t, e) {
|
|
1274
1250
|
const i = e != null ? e : this.renderer.composeDefaultMeta();
|
|
1275
1251
|
switch (!0) {
|
|
1252
|
+
case this.renderer instanceof T:
|
|
1276
1253
|
case this.renderer instanceof E:
|
|
1277
|
-
case this.renderer instanceof M:
|
|
1278
1254
|
}
|
|
1279
1255
|
return this.renderer.renderItem(t, i);
|
|
1280
1256
|
}
|
|
@@ -1289,8 +1265,8 @@ class st {
|
|
|
1289
1265
|
});
|
|
1290
1266
|
}
|
|
1291
1267
|
}
|
|
1292
|
-
const P = { wrapper: `${b}-start-with-field`, input: `${b}-start-with-field__input`, startWithElementWrapperInvalid: `${b}-start-with-field--invalid` },
|
|
1293
|
-
class
|
|
1268
|
+
const P = { wrapper: `${b}-start-with-field`, input: `${b}-start-with-field__input`, startWithElementWrapperInvalid: `${b}-start-with-field--invalid` }, j = /* @__PURE__ */ new Map([["Numeric", "numeric"], ["Lower Roman", "lower-roman"], ["Upper Roman", "upper-roman"], ["Lower Alpha", "lower-alpha"], ["Upper Alpha", "upper-alpha"]]), Et = /* @__PURE__ */ new Map([["numeric", '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 14.2L10 7.4135C10 7.32872 9.90111 7.28241 9.83598 7.33668L7 9.7" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>'], ["lower-roman", '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 14.2L10 9.5" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 7.01L10 7" stroke="black" stroke-width="1.8" stroke-linecap="round"/></svg>'], ["upper-roman", '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 14.2L10 7.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>'], ["lower-alpha", '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.2087 14.2H14.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M11.5 14.5C11.5 14.5 11 13.281 11 12.5M7 9.5C7 9.5 7.5 8.5 9 8.5C10.5 8.5 11 9.5 11 10.5L11 11.5M11 11.5L11 12.5M11 11.5C11 11.5 7 11 7 13C7 15.3031 11 15 11 12.5" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>'], ["upper-alpha", '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.0087 14.2H16" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M7 14.2L7.78865 12M13 14.2L12.1377 12M7.78865 12C7.78865 12 9.68362 7 10 7C10.3065 7 12.1377 12 12.1377 12M7.78865 12L12.1377 12" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>']]);
|
|
1269
|
+
class X {
|
|
1294
1270
|
static get isReadOnlySupported() {
|
|
1295
1271
|
return !0;
|
|
1296
1272
|
}
|
|
@@ -1298,13 +1274,13 @@ class K {
|
|
|
1298
1274
|
return !0;
|
|
1299
1275
|
}
|
|
1300
1276
|
static get toolbox() {
|
|
1301
|
-
return [{ icon:
|
|
1277
|
+
return [{ icon: yt, title: "Unordered List", data: { style: "unordered" } }, { icon: St, title: "Ordered List", data: { style: "ordered" } }, { icon: wt, title: "Checklist", data: { style: "checklist" } }];
|
|
1302
1278
|
}
|
|
1303
1279
|
static get pasteConfig() {
|
|
1304
1280
|
return { tags: ["OL", "UL", "LI"] };
|
|
1305
1281
|
}
|
|
1306
1282
|
static get conversionConfig() {
|
|
1307
|
-
return { export: (t) =>
|
|
1283
|
+
return { export: (t) => X.joinRecursive(t), import: (t, e) => ({ meta: {}, items: [{ content: t, meta: {}, items: [] }], style: (e == null ? void 0 : e.defaultStyle) !== void 0 ? e.defaultStyle : "unordered" }) };
|
|
1308
1284
|
}
|
|
1309
1285
|
get listStyle() {
|
|
1310
1286
|
return this.data.style || this.defaultListStyle;
|
|
@@ -1317,7 +1293,7 @@ class K {
|
|
|
1317
1293
|
}
|
|
1318
1294
|
constructor({ data: t, config: e, api: i, readOnly: s, block: n }) {
|
|
1319
1295
|
var o;
|
|
1320
|
-
this.api = i, this.readOnly = s, this.config = e, this.block = n, this.defaultListStyle = ((o = this.config) == null ? void 0 : o.defaultStyle) || "unordered", this.defaultCounterTypes = this.config.counterTypes || Array.from(
|
|
1296
|
+
this.api = i, this.readOnly = s, this.config = e, this.block = n, this.defaultListStyle = ((o = this.config) == null ? void 0 : o.defaultStyle) || "unordered", this.defaultCounterTypes = this.config.counterTypes || Array.from(j.values());
|
|
1321
1297
|
const r = { style: this.defaultListStyle, meta: {}, items: [] };
|
|
1322
1298
|
this.data = Object.keys(t).length ? function(a) {
|
|
1323
1299
|
const d = [];
|
|
@@ -1335,7 +1311,7 @@ class K {
|
|
|
1335
1311
|
}(t) : r, this.listStyle === "ordered" && this.data.meta.counterType === void 0 && (this.data.meta.counterType = "numeric"), this.changeTabulatorByStyle();
|
|
1336
1312
|
}
|
|
1337
1313
|
static joinRecursive(t) {
|
|
1338
|
-
return t.items.map((e) => `${e.content} ${
|
|
1314
|
+
return t.items.map((e) => `${e.content} ${X.joinRecursive(e)}`).join("");
|
|
1339
1315
|
}
|
|
1340
1316
|
render() {
|
|
1341
1317
|
return this.listElement = this.list.render(), this.listElement;
|
|
@@ -1348,30 +1324,29 @@ class K {
|
|
|
1348
1324
|
}
|
|
1349
1325
|
renderSettings() {
|
|
1350
1326
|
var e;
|
|
1351
|
-
const t = [{ label: this.api.i18n.t("Unordered"), icon:
|
|
1327
|
+
const t = [{ label: this.api.i18n.t("Unordered"), icon: yt, closeOnActivate: !0, isActive: this.listStyle == "unordered", onActivate: () => {
|
|
1352
1328
|
this.listStyle = "unordered";
|
|
1353
|
-
} }, { label: this.api.i18n.t("Ordered"), icon:
|
|
1329
|
+
} }, { label: this.api.i18n.t("Ordered"), icon: St, closeOnActivate: !0, isActive: this.listStyle == "ordered", onActivate: () => {
|
|
1354
1330
|
this.listStyle = "ordered";
|
|
1355
|
-
} }, { label: this.api.i18n.t("Checklist"), icon:
|
|
1331
|
+
} }, { label: this.api.i18n.t("Checklist"), icon: wt, closeOnActivate: !0, isActive: this.listStyle == "checklist", onActivate: () => {
|
|
1356
1332
|
this.listStyle = "checklist";
|
|
1357
1333
|
} }];
|
|
1358
1334
|
if (this.listStyle === "ordered") {
|
|
1359
|
-
const i = function(r, { value:
|
|
1360
|
-
const c =
|
|
1361
|
-
for (const
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
p || c.classList.contains(P.startWithElementWrapperInvalid) || c.classList.add(P.startWithElementWrapperInvalid), p && c.classList.contains(P.startWithElementWrapperInvalid) && c.classList.remove(P.startWithElementWrapperInvalid), p && r(h.value);
|
|
1335
|
+
const i = function(r, o, { value: a, placeholder: d, attributes: l, sanitize: p }) {
|
|
1336
|
+
const c = V.make("div", P.wrapper), h = V.make("div", "cdx-list-start-with-field__startlabel", { innerText: r }), g = V.make("div", "cdx-list-start-with-field__input-wrapper"), m = V.make("input", P.input, { placeholder: d, tabIndex: -1, value: a, type: "number" });
|
|
1337
|
+
for (const f in l) m.setAttribute(f, l[f]);
|
|
1338
|
+
return c.appendChild(h), g.appendChild(m), c.appendChild(g), m.addEventListener("input", () => {
|
|
1339
|
+
p !== void 0 && (m.value = p(m.value));
|
|
1340
|
+
const f = m.checkValidity();
|
|
1341
|
+
f || c.classList.contains(P.startWithElementWrapperInvalid) || c.classList.add(P.startWithElementWrapperInvalid), f && c.classList.contains(P.startWithElementWrapperInvalid) && c.classList.remove(P.startWithElementWrapperInvalid), f && o(m.value);
|
|
1367
1342
|
}), c;
|
|
1368
|
-
}((r) => this.changeStartWith(Number(r)), { value: String((e = this.data.meta.start) != null ? e : 1), placeholder: "", attributes: { required: "true" }, sanitize: (r) => function(o) {
|
|
1343
|
+
}(this.api.i18n.t("Start with"), (r) => this.changeStartWith(Number(r)), { value: String((e = this.data.meta.start) != null ? e : 1), placeholder: "", attributes: { required: "true" }, sanitize: (r) => function(o) {
|
|
1369
1344
|
return o.replace(/\D+/g, "");
|
|
1370
|
-
}(r) }), s = [{ label: this.api.i18n.t("Start with"), icon: '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 14.2L8 7.4135C8 7.32872 7.90111 7.28241 7.83598 7.33668L5 9.7" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M14 13L16.4167 10.7778M16.4167 10.7778L14 8.5M16.4167 10.7778H11.6562" stroke="black" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
1371
|
-
|
|
1372
|
-
const a =
|
|
1373
|
-
this.defaultCounterTypes.includes(a) && n.children.items.push({ title: this.api.i18n.t(o), icon:
|
|
1374
|
-
this.changeCounters(
|
|
1345
|
+
}(r) }), s = [{ label: this.api.i18n.t("Start with"), icon: '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 14.2L8 7.4135C8 7.32872 7.90111 7.28241 7.83598 7.33668L5 9.7" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M14 13L16.4167 10.7778M16.4167 10.7778L14 8.5M16.4167 10.7778H11.6562" stroke="black" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>', name: "list-setting-start-with", element: i, type: "html" }], n = { label: this.api.i18n.t("Counter type"), name: "list-setting", icon: Et.get(this.data.meta.counterType), children: { items: [] } };
|
|
1346
|
+
j.forEach((r, o) => {
|
|
1347
|
+
const a = j.get(o);
|
|
1348
|
+
this.defaultCounterTypes.includes(a) && n.children.items.push({ title: this.api.i18n.t(o), icon: Et.get(a), isActive: this.data.meta.counterType === j.get(o), closeOnActivate: !0, onActivate: () => {
|
|
1349
|
+
this.changeCounters(j.get(o));
|
|
1375
1350
|
} });
|
|
1376
1351
|
}), n.children.items.length > 1 && s.push(n), t.push({ type: "separator" }, ...s);
|
|
1377
1352
|
}
|
|
@@ -1403,17 +1378,49 @@ class K {
|
|
|
1403
1378
|
changeTabulatorByStyle() {
|
|
1404
1379
|
switch (this.listStyle) {
|
|
1405
1380
|
case "ordered":
|
|
1406
|
-
this.list = new
|
|
1381
|
+
this.list = new et({ data: this.data, readOnly: this.readOnly, api: this.api, config: this.config, block: this.block }, new T(this.readOnly, this.config));
|
|
1407
1382
|
break;
|
|
1408
1383
|
case "unordered":
|
|
1409
|
-
this.list = new
|
|
1384
|
+
this.list = new et({ data: this.data, readOnly: this.readOnly, api: this.api, config: this.config, block: this.block }, new E(this.readOnly, this.config));
|
|
1410
1385
|
break;
|
|
1411
1386
|
case "checklist":
|
|
1412
|
-
this.list = new
|
|
1387
|
+
this.list = new et({ data: this.data, readOnly: this.readOnly, api: this.api, config: this.config, block: this.block }, new C(this.readOnly, this.config));
|
|
1413
1388
|
}
|
|
1414
1389
|
}
|
|
1415
1390
|
}
|
|
1416
|
-
class
|
|
1391
|
+
class Mt {
|
|
1392
|
+
constructor(t) {
|
|
1393
|
+
this.target = t, this.isContentEditable = t && t.contentEditable;
|
|
1394
|
+
}
|
|
1395
|
+
getPos() {
|
|
1396
|
+
if (document.activeElement !== this.target) return -1;
|
|
1397
|
+
if (this.isContentEditable === "true") {
|
|
1398
|
+
this.target.focus();
|
|
1399
|
+
const t = document.getSelection();
|
|
1400
|
+
if (!t) return -1;
|
|
1401
|
+
let e = t.getRangeAt(0), i = e.cloneRange();
|
|
1402
|
+
return i.selectNodeContents(this.target), i.setEnd(e.endContainer, e.endOffset), i.toString().length;
|
|
1403
|
+
}
|
|
1404
|
+
return this.target.selectionStart;
|
|
1405
|
+
}
|
|
1406
|
+
setPos(t) {
|
|
1407
|
+
if (this.isContentEditable === "true") {
|
|
1408
|
+
if (t >= 0) {
|
|
1409
|
+
const e = window.getSelection();
|
|
1410
|
+
if (!e) return;
|
|
1411
|
+
const i = this.createRange(this.target, { count: t });
|
|
1412
|
+
i && (i.collapse(!1), e.removeAllRanges(), e.addRange(i));
|
|
1413
|
+
}
|
|
1414
|
+
} else this.target.focus(), this.target.setSelectionRange(t, t);
|
|
1415
|
+
}
|
|
1416
|
+
createRange(t, e, i) {
|
|
1417
|
+
if (i || ((i = document.createRange()).selectNode(t), i.setStart(t, 0)), e.count === 0) i.setEnd(t, e.count);
|
|
1418
|
+
else if (t && e.count > 0) if (t.nodeType === Node.TEXT_NODE) t.textContent && t.textContent.length < e.count ? e.count -= t.textContent.length : (i.setEnd(t, e.count), e.count = 0);
|
|
1419
|
+
else for (let s = 0; s < t.childNodes.length && (i = this.createRange(t.childNodes[s], e, i), e.count !== 0); s++) ;
|
|
1420
|
+
return i;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
class pe {
|
|
1417
1424
|
constructor(t, e, i) {
|
|
1418
1425
|
this.holder = e, this.observer = null, this.debounceTimer = i, this.mutationDebouncer = this.debounce(() => {
|
|
1419
1426
|
t();
|
|
@@ -1453,19 +1460,18 @@ class be {
|
|
|
1453
1460
|
document.dispatchEvent(t), (e = this.observer) == null || e.disconnect();
|
|
1454
1461
|
}
|
|
1455
1462
|
}
|
|
1456
|
-
class
|
|
1463
|
+
class ge {
|
|
1457
1464
|
constructor({ editor: t, config: e = {}, onUpdate: i, maxLength: s }) {
|
|
1458
1465
|
this.position = 0;
|
|
1459
1466
|
const n = { maxLength: 30, onUpdate() {
|
|
1460
|
-
}, config: { debounceTimer: 200, shortcuts: { undo: ["CMD+Z"], redo: ["CMD+Y", "CMD+SHIFT+Z"] } } }, { blocks: r, caret: o } = t, { configuration: a } = t, { holder: d, defaultBlock: l } = a,
|
|
1461
|
-
this.holder = typeof d == "string" ? document.getElementById(d) : d, this.editor = t, this.defaultBlock = l, this.blocks = r, this.caret = o, this.shouldSaveHistory = !0, this.readOnly = a.readOnly, this.maxLength = s || n.maxLength, this.onUpdate = i || n.onUpdate, this.config = { debounceTimer: v, shortcuts: { undo: g, redo: m } }, new
|
|
1467
|
+
}, config: { debounceTimer: 200, shortcuts: { undo: ["CMD+Z"], redo: ["CMD+Y", "CMD+SHIFT+Z"] } } }, { blocks: r, caret: o } = t, { configuration: a } = t, { holder: d, defaultBlock: l } = a, p = n.config.shortcuts, { shortcuts: c } = e, h = { ...p, ...c }, g = Array.isArray(h.undo) ? h.undo : [h.undo], m = Array.isArray(h.redo) ? h.redo : [h.redo], f = n.config.debounceTimer, { debounceTimer: v = f } = e;
|
|
1468
|
+
this.holder = typeof d == "string" ? document.getElementById(d) : d, this.editor = t, this.defaultBlock = l, this.blocks = r, this.caret = o, this.shouldSaveHistory = !0, this.readOnly = a.readOnly, this.maxLength = s || n.maxLength, this.onUpdate = i || n.onUpdate, this.config = { debounceTimer: v, shortcuts: { undo: g, redo: m } }, new pe(() => this.registerChange(), this.holder, this.config.debounceTimer).setMutationObserver(), this.setEventListeners(), this.initialItem = null, this.clear();
|
|
1462
1469
|
}
|
|
1463
1470
|
static get isReadOnlySupported() {
|
|
1464
1471
|
return !0;
|
|
1465
1472
|
}
|
|
1466
1473
|
truncate(t, e) {
|
|
1467
|
-
for (; t.length > e; )
|
|
1468
|
-
t.shift();
|
|
1474
|
+
for (; t.length > e; ) t.shift();
|
|
1469
1475
|
}
|
|
1470
1476
|
initialize(t) {
|
|
1471
1477
|
const e = "blocks" in t ? t.blocks : t, i = { index: e.length - 1, state: e };
|
|
@@ -1497,14 +1503,13 @@ class ye {
|
|
|
1497
1503
|
}
|
|
1498
1504
|
getCaretIndex(t) {
|
|
1499
1505
|
const e = this.holder.getElementsByClassName("ce-block__content");
|
|
1500
|
-
return new
|
|
1506
|
+
return new Mt(e[t].firstChild).getPos();
|
|
1501
1507
|
}
|
|
1502
1508
|
insertDeletedBlock(t, e, i) {
|
|
1503
|
-
for (let s = 0; s < t.length; s += 1)
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
}
|
|
1509
|
+
for (let s = 0; s < t.length; s += 1) if (!e[s] || t[s].id !== e[s].id) {
|
|
1510
|
+
this.blocks.insert(t[s].type, t[s].data, {}, s, !0), this.caret.setToBlock(i, "end");
|
|
1511
|
+
break;
|
|
1512
|
+
}
|
|
1508
1513
|
}
|
|
1509
1514
|
blockWasDropped(t, e) {
|
|
1510
1515
|
return t.length === e.length && t.some((i, s) => i.id !== e[s].id);
|
|
@@ -1519,7 +1524,7 @@ class ye {
|
|
|
1519
1524
|
return t.length > e.length;
|
|
1520
1525
|
}
|
|
1521
1526
|
contentWasCopied(t, e, i) {
|
|
1522
|
-
return Object.keys(t[i].data).length === 0 && JSON.stringify(e[i + 1]) !== JSON.stringify(t[i + 1]);
|
|
1527
|
+
return t[i] && t[i].data && Object.keys(t[i].data).length === 0 && JSON.stringify(e[i + 1]) !== JSON.stringify(t[i + 1]);
|
|
1523
1528
|
}
|
|
1524
1529
|
async undo() {
|
|
1525
1530
|
if (this.canUndo()) {
|
|
@@ -1529,19 +1534,14 @@ class ye {
|
|
|
1529
1534
|
const { state: s, caretIndex: n } = this.stack[this.position];
|
|
1530
1535
|
this.onUpdate();
|
|
1531
1536
|
const r = this.blocks.getBlocksCount();
|
|
1532
|
-
if (s[i] || (i -= 1, this.stack[this.position].index = i), this.blockWasDeleted(s, e))
|
|
1533
|
-
|
|
1534
|
-
else if (this.
|
|
1535
|
-
|
|
1536
|
-
else if (
|
|
1537
|
-
await this.blocks.delete(t), this.caret.setToBlock(i, "end");
|
|
1538
|
-
else if (r > s.length)
|
|
1539
|
-
await this.blocks.render({ blocks: s }), this.setCaretIndex(i, n);
|
|
1540
|
-
else if (this.blockWasDropped(s, e))
|
|
1541
|
-
await this.blocks.render({ blocks: s }), this.caret.setToBlock(i, "end");
|
|
1537
|
+
if (s[i] || (i -= 1, this.stack[this.position].index = i), this.blockWasDeleted(s, e)) this.insertDeletedBlock(s, e, i);
|
|
1538
|
+
else if (this.contentWasCopied(s, e, i)) await this.blocks.render({ blocks: s }), this.caret.setToBlock(i, "end");
|
|
1539
|
+
else if (i < t && this.blockWasSkipped(s, e)) await this.blocks.delete(t), this.caret.setToBlock(i, "end");
|
|
1540
|
+
else if (r > s.length) await this.blocks.render({ blocks: s }), this.setCaretIndex(i, n);
|
|
1541
|
+
else if (this.blockWasDropped(s, e)) await this.blocks.render({ blocks: s }), this.caret.setToBlock(i, "end");
|
|
1542
1542
|
else if (this.contentChangedInNoFocusBlock(i, t)) {
|
|
1543
|
-
const
|
|
1544
|
-
await this.blocks.update(a, s[t].data), this.setCaretIndex(i, n);
|
|
1543
|
+
const a = this.blocks.getBlockByIndex(t);
|
|
1544
|
+
a.id && (await this.blocks.update(a.id, s[t].data), this.setCaretIndex(i, n));
|
|
1545
1545
|
}
|
|
1546
1546
|
const o = this.blocks.getBlockByIndex(i);
|
|
1547
1547
|
o && (await this.blocks.update(o.id, s[i].data), this.setCaretIndex(i, n));
|
|
@@ -1549,17 +1549,15 @@ class ye {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
setCaretIndex(t, e) {
|
|
1551
1551
|
if (e && e !== -1) {
|
|
1552
|
-
const i = this.holder.getElementsByClassName("ce-block__content"), s = new
|
|
1552
|
+
const i = this.holder.getElementsByClassName("ce-block__content"), s = new Mt(i[t].firstChild);
|
|
1553
1553
|
setTimeout(() => s.setPos(e), 50);
|
|
1554
|
-
} else
|
|
1555
|
-
this.caret.setToBlock(t, "end");
|
|
1554
|
+
} else this.caret.setToBlock(t, "end");
|
|
1556
1555
|
}
|
|
1557
1556
|
async insertBlock(t, e) {
|
|
1558
1557
|
await this.blocks.insert(t[e].type, t[e].data, {}, e, !0);
|
|
1559
1558
|
}
|
|
1560
1559
|
async insertSkippedBlocks(t, e, i) {
|
|
1561
|
-
for (let s = t.length; s < e.length; s += 1)
|
|
1562
|
-
this.insertBlock(e, s);
|
|
1560
|
+
for (let s = t.length; s < e.length; s += 1) this.insertBlock(e, s);
|
|
1563
1561
|
JSON.stringify(t[i - 1]) !== JSON.stringify(e[i - 1]) && await this.updateModifiedBlock(e, i);
|
|
1564
1562
|
}
|
|
1565
1563
|
async updateModifiedBlock(t, e) {
|
|
@@ -1589,17 +1587,17 @@ class ye {
|
|
|
1589
1587
|
return i.push(s), i;
|
|
1590
1588
|
}
|
|
1591
1589
|
setEventListeners() {
|
|
1592
|
-
const { holder: t } = this, { shortcuts: e } = this.config, { undo: i, redo: s } = e, n = i.map((
|
|
1593
|
-
l(
|
|
1594
|
-
},
|
|
1595
|
-
l(
|
|
1590
|
+
const { holder: t } = this, { shortcuts: e } = this.config, { undo: i, redo: s } = e, n = i.map((h) => h.replace(/ /g, "").split("+")), r = s.map((h) => h.replace(/ /g, "").split("+")), o = n.map((h) => this.parseKeys(h)), a = r.map((h) => this.parseKeys(h)), d = (h, g) => g.reduce((m, f) => m || ((v, M) => M.length === 3 && v[M[0]] && v[M[1]] && v.key.toLowerCase() === M[2])(h, f), !1), l = (h, g, m) => !(!((f, v) => v.reduce((M, L) => M || ((D, U) => U.length === 2 && D[U[0]] && D.key.toLowerCase() === U[1])(f, L), !1))(h, g) || d(h, m)) || !!d(h, g), p = (h) => {
|
|
1591
|
+
l(h, o, a) && (h.preventDefault(), this.undo());
|
|
1592
|
+
}, c = (h) => {
|
|
1593
|
+
l(h, a, o) && (h.preventDefault(), this.redo());
|
|
1596
1594
|
};
|
|
1597
|
-
t.addEventListener("keydown",
|
|
1598
|
-
t.removeEventListener("keydown",
|
|
1595
|
+
t.addEventListener("keydown", p), t.addEventListener("keydown", c), t.addEventListener("destroy", () => {
|
|
1596
|
+
t.removeEventListener("keydown", p), t.removeEventListener("keydown", c);
|
|
1599
1597
|
});
|
|
1600
1598
|
}
|
|
1601
1599
|
}
|
|
1602
|
-
class
|
|
1600
|
+
class I {
|
|
1603
1601
|
static get toolbox() {
|
|
1604
1602
|
return { icon: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M83.2 147.2V448c0 25.6 19.2 44.8 44.8 44.8h768c25.6 0 44.8-19.2 44.8-44.8V147.2c0-25.6-19.2-44.8-44.8-44.8H128c-25.6 6.4-44.8 25.6-44.8 44.8z m89.6 256V192h684.8v211.2H172.8zM810.24 642.56c0-25.6-19.2-44.8-44.8-44.8h-640c-25.6 0-44.8 19.2-44.8 44.8 0 25.6 19.2 44.8 44.8 44.8h640c25.6 6.4 44.8-12.8 44.8-44.8zM554.56 866.24c0-25.6-19.2-44.8-44.8-44.8h-384c-25.6 0-44.8 19.2-44.8 44.8 0 25.6 19.2 44.8 44.8 44.8h384c25.6 6.4 44.8-12.8 44.8-44.8z" fill="#000000" ></path></svg>', title: "Alert" };
|
|
1605
1603
|
}
|
|
@@ -1625,13 +1623,13 @@ class _ {
|
|
|
1625
1623
|
return { wrapper: "cdx-alert", wrapperForType: (t) => `cdx-alert-${t}`, wrapperForAlignType: (t) => `cdx-alert-align-${t}`, message: "cdx-alert__message" };
|
|
1626
1624
|
}
|
|
1627
1625
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
1628
|
-
this.api = i, this.alertTypes = e.alertTypes ||
|
|
1626
|
+
this.api = i, this.alertTypes = e.alertTypes || I.ALERT_TYPES, this.defaultType = e.defaultType || I.DEFAULT_TYPE, this.defaultAlign = e.defaultAlign || I.DEFAULT_ALIGN_TYPE, this.messagePlaceholder = this.api.i18n.t(e.messagePlaceholder || I.DEFAULT_MESSAGE_PLACEHOLDER), this.data = { type: this.alertTypes.includes(t.type) ? t.type : this.defaultType, align: I.ALIGN_TYPES.includes(t.align) ? t.align : this.defaultAlign, message: t.message || "" }, this.container = void 0, this.readOnly = s;
|
|
1629
1627
|
}
|
|
1630
1628
|
static get isReadOnlySupported() {
|
|
1631
1629
|
return !0;
|
|
1632
1630
|
}
|
|
1633
1631
|
render() {
|
|
1634
|
-
const t = [this.CSS.wrapper, this.CSS.wrapperForType(this.data.type)
|
|
1632
|
+
const t = [this.CSS.wrapper, this.CSS.wrapperForType(this.data.type)];
|
|
1635
1633
|
this.container = this._make("div", t);
|
|
1636
1634
|
const e = this._make("div", [this.CSS.message], { contentEditable: !this.readOnly, innerHTML: this.data.message });
|
|
1637
1635
|
return e.dataset.placeholder = this.messagePlaceholder, this.container.appendChild(e), this.container;
|
|
@@ -1678,17 +1676,6 @@ class _ {
|
|
|
1678
1676
|
a.classList.toggle("cdx-alert_setting__icon_active", l === this.data.type);
|
|
1679
1677
|
});
|
|
1680
1678
|
});
|
|
1681
|
-
}), _.ALIGN_TYPES.map((s) => {
|
|
1682
|
-
let n;
|
|
1683
|
-
return s === "left" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = qt), s === "right" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = Vt), s === "center" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = Ut), n == null || n.setAttribute("data-align", s), this.api.tooltip.onHover(n, this.api.i18n.t(`align-${s}`), { placement: "top" }), i.appendChild(n), n;
|
|
1684
|
-
}).forEach((s, n, r) => {
|
|
1685
|
-
const o = s.getAttribute("data-align") || "";
|
|
1686
|
-
s.addEventListener("click", () => {
|
|
1687
|
-
this._changeAlignType(o), r.forEach((a, d) => {
|
|
1688
|
-
const l = a == null ? void 0 : a.getAttribute("data-align");
|
|
1689
|
-
a == null || a.classList.toggle("cdx-alert_setting__icon_active", l === this.data.align);
|
|
1690
|
-
});
|
|
1691
|
-
});
|
|
1692
1679
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
1693
1680
|
}
|
|
1694
1681
|
_getFormattedName(t) {
|
|
@@ -1701,7 +1688,7 @@ class _ {
|
|
|
1701
1688
|
});
|
|
1702
1689
|
}
|
|
1703
1690
|
_changeAlignType(t) {
|
|
1704
|
-
this.data.align = t,
|
|
1691
|
+
this.data.align = t, I.ALIGN_TYPES.forEach((e) => {
|
|
1705
1692
|
const i = this.CSS.wrapperForAlignType(e);
|
|
1706
1693
|
this.container.classList.remove(i), t === e && this.container.classList.add(i);
|
|
1707
1694
|
});
|
|
@@ -1713,8 +1700,7 @@ class _ {
|
|
|
1713
1700
|
_make(t, e, i = {}) {
|
|
1714
1701
|
let s = document.createElement(t);
|
|
1715
1702
|
Array.isArray(e) ? s.classList.add(...e) : e && s.classList.add(e);
|
|
1716
|
-
for (let n in i)
|
|
1717
|
-
s[n] = i[n];
|
|
1703
|
+
for (let n in i) s[n] = i[n];
|
|
1718
1704
|
return s;
|
|
1719
1705
|
}
|
|
1720
1706
|
onPaste(t) {
|
|
@@ -1728,14 +1714,14 @@ class _ {
|
|
|
1728
1714
|
return { message: !0, type: !1, alignType: !1 };
|
|
1729
1715
|
}
|
|
1730
1716
|
}
|
|
1731
|
-
const
|
|
1717
|
+
const _t = { orientation: !1 }, w = class w {
|
|
1732
1718
|
constructor({ api: t, data: e, config: i, block: s, ...n }) {
|
|
1733
|
-
var o, a, d, l,
|
|
1719
|
+
var o, a, d, l, p, c;
|
|
1734
1720
|
this.wrapper = document.createElement("div"), this.DEFAULT_INDENT_KEY = "Tab", this.lastResizeTimeout = null, this.cachedMaxWidthForContent = null, this.api = t, this.block = s, !i && "settings" in n && (i = (o = n.settings) != null ? o : {}), this.config = { indentSize: 24, maxIndent: 8, minIndent: 0, multiblock: !1, autoIndent: !1, tuneName: null, orientation: "horizontal", customBlockIndentLimits: {}, handleShortcut: void 0, direction: "ltr", directionChangeHandler: null, version: "2.30", ...i != null ? i : {} }, this.changeConfigBasedOnVersionIfNeeded(), (a = this.config) != null && a.directionChangeHandler && this.config.directionChangeHandler(this.alignmentChangeListener.bind(this));
|
|
1735
|
-
const r = (
|
|
1736
|
-
this.data = { indentLevel: r, ...e != null ? e : {} }, this.config.multiblock && this.config.tuneName, window.addEventListener("resize", (
|
|
1721
|
+
const r = (c = (p = this.config.customBlockIndentLimits[(l = (d = this.block) == null ? void 0 : d.name) != null ? l : ""]) == null ? void 0 : p.min) != null ? c : this.config.minIndent;
|
|
1722
|
+
this.data = { indentLevel: r, ...e != null ? e : {} }, this.config.multiblock && this.config.tuneName, window.addEventListener("resize", (h) => this.onResize.call(this, h)), this.api.events.on("block changed", ({ event: h }) => {
|
|
1737
1723
|
var f;
|
|
1738
|
-
const g =
|
|
1724
|
+
const g = h.detail.target.id;
|
|
1739
1725
|
((f = this.block) == null ? void 0 : f.id) === g && this.shouldApplyAutoIndent && queueMicrotask(() => this.autoIndentBlock());
|
|
1740
1726
|
});
|
|
1741
1727
|
}
|
|
@@ -1751,37 +1737,35 @@ const Et = { orientation: !1 }, J = class x {
|
|
|
1751
1737
|
const t = () => {
|
|
1752
1738
|
if (this.data.indentLevel == this.maxIndent) {
|
|
1753
1739
|
const a = this.getTuneButton("indent");
|
|
1754
|
-
if (a == null || a.classList.add(this.CSS.disabledItem), !a)
|
|
1755
|
-
return !0;
|
|
1740
|
+
if (a == null || a.classList.add(this.CSS.disabledItem), !a) return !0;
|
|
1756
1741
|
}
|
|
1757
1742
|
if (this.data.indentLevel == this.minIndent) {
|
|
1758
1743
|
const a = this.getTuneButton("unindent");
|
|
1759
|
-
if (a == null || a.classList.add(this.CSS.disabledItem), !a)
|
|
1760
|
-
return !0;
|
|
1744
|
+
if (a == null || a.classList.add(this.CSS.disabledItem), !a) return !0;
|
|
1761
1745
|
}
|
|
1762
1746
|
};
|
|
1763
1747
|
if (queueMicrotask(() => {
|
|
1764
1748
|
t() && setTimeout(t, 300);
|
|
1765
1749
|
}), this.config.orientation === "vertical") {
|
|
1766
1750
|
const a = `${this.TuneNames.indentLeft}-${(r = this.block) == null ? void 0 : r.id}`, d = `${this.TuneNames.indentRight}-${(o = this.block) == null ? void 0 : o.id}`;
|
|
1767
|
-
return [{ title: this.rightText, hint: { title: this.api.i18n.t(this.rightText) }, onActivate: (l,
|
|
1751
|
+
return [{ title: this.rightText, hint: { title: this.api.i18n.t(this.rightText) }, onActivate: (l, p) => {
|
|
1768
1752
|
this.handleIndentRight(), l.title = this.rightText;
|
|
1769
|
-
}, icon:
|
|
1753
|
+
}, icon: Tt, name: d }, { title: this.leftText, hint: { title: this.api.i18n.t(this.leftText) }, onActivate: (l, p) => {
|
|
1770
1754
|
this.handleIndentLeft(), l.title = this.leftText;
|
|
1771
|
-
}, icon:
|
|
1755
|
+
}, icon: xt, name: a }];
|
|
1772
1756
|
}
|
|
1773
1757
|
const e = `
|
|
1774
1758
|
<div class="${this.CSS.popoverItem} ${this.CSS.customPopoverItem}" data-item-name='indent' version=${this.config.version}>
|
|
1775
|
-
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentLeft}>${
|
|
1759
|
+
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentLeft}>${xt}</button>
|
|
1776
1760
|
<span class="${this.CSS.popoverItemTitle}">${this.api.sanitizer.clean(this.api.i18n.t("Indent"), {})}</span>
|
|
1777
|
-
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentRight} style="margin-left:10px;">${
|
|
1761
|
+
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentRight} style="margin-left:10px;">${Tt}</button>
|
|
1778
1762
|
</div>
|
|
1779
1763
|
`, i = this.createElementFromTemplate(e), s = i.querySelector(`[data-${this.TuneNames.indentRight}]`), n = i.querySelector(`[data-${this.TuneNames.indentLeft}]`);
|
|
1780
1764
|
return s && (s.addEventListener("click", () => this.handleIndentRight()), this.api.tooltip.onHover(s, this.api.i18n.t("Indent right"), { placement: "top" })), n && (n.addEventListener("click", () => this.handleIndentLeft()), this.api.tooltip.onHover(n, this.api.i18n.t("Indent left"), { placement: "top" })), i;
|
|
1781
1765
|
}
|
|
1782
1766
|
wrap(t) {
|
|
1783
1767
|
var i, s, n, r, o;
|
|
1784
|
-
this.wrapper.appendChild(t), this.wrapper.setAttribute(
|
|
1768
|
+
this.wrapper.appendChild(t), this.wrapper.setAttribute(w.DATA_WRAPPER_NAME, "");
|
|
1785
1769
|
let e = !!this.config.highlightIndent;
|
|
1786
1770
|
if ((i = this.config.highlightIndent) != null && i.tuneNames && !this.config.highlightIndent.tuneNames.includes((n = (s = this.block) == null ? void 0 : s.name) != null ? n : "") && (e = !1), e) {
|
|
1787
1771
|
const a = this.createElementFromTemplate(`
|
|
@@ -1827,29 +1811,22 @@ const Et = { orientation: !1 }, J = class x {
|
|
|
1827
1811
|
}
|
|
1828
1812
|
get shouldApplyAutoIndent() {
|
|
1829
1813
|
var s;
|
|
1830
|
-
if (!this.config.autoIndent)
|
|
1831
|
-
|
|
1832
|
-
if (typeof this.config.autoIndent == "boolean")
|
|
1833
|
-
return this.config.autoIndent;
|
|
1814
|
+
if (!this.config.autoIndent) return !1;
|
|
1815
|
+
if (typeof this.config.autoIndent == "boolean") return this.config.autoIndent;
|
|
1834
1816
|
const t = this.api.blocks.getCurrentBlockIndex();
|
|
1835
|
-
if (t < 0)
|
|
1836
|
-
return !1;
|
|
1817
|
+
if (t < 0) return !1;
|
|
1837
1818
|
const e = this.api.blocks.getBlockByIndex(t);
|
|
1838
|
-
if (!e)
|
|
1839
|
-
return !1;
|
|
1819
|
+
if (!e) return !1;
|
|
1840
1820
|
const i = e.name;
|
|
1841
1821
|
return !((s = this.config.autoIndent.tuneNames) != null && s.length) || this.config.autoIndent.tuneNames.includes(i);
|
|
1842
1822
|
}
|
|
1843
1823
|
handlePropagationForKeyEvent(t) {
|
|
1844
1824
|
var r, o, a;
|
|
1845
|
-
if (!((r = this.block) != null && r.id) || this.config.handleShortcut === !1)
|
|
1846
|
-
return null;
|
|
1825
|
+
if (!((r = this.block) != null && r.id) || this.config.handleShortcut === !1) return null;
|
|
1847
1826
|
const e = t.key == this.DEFAULT_INDENT_KEY, i = typeof this.config.handleShortcut == "function";
|
|
1848
|
-
if (!i && !e)
|
|
1849
|
-
return null;
|
|
1827
|
+
if (!i && !e) return null;
|
|
1850
1828
|
const s = (a = (o = this.config).handleShortcut) == null ? void 0 : a.call(o, t, this.block.id);
|
|
1851
|
-
if (!s && i)
|
|
1852
|
-
return null;
|
|
1829
|
+
if (!s && i) return null;
|
|
1853
1830
|
let n;
|
|
1854
1831
|
switch (s) {
|
|
1855
1832
|
case "indent":
|
|
@@ -1859,35 +1836,29 @@ const Et = { orientation: !1 }, J = class x {
|
|
|
1859
1836
|
n = !1;
|
|
1860
1837
|
break;
|
|
1861
1838
|
default:
|
|
1862
|
-
if (!e)
|
|
1863
|
-
return null;
|
|
1839
|
+
if (!e) return null;
|
|
1864
1840
|
n = !t.shiftKey;
|
|
1865
1841
|
}
|
|
1866
1842
|
return t.stopPropagation(), t.preventDefault(), { isIndent: n };
|
|
1867
1843
|
}
|
|
1868
1844
|
onKeyDown(t) {
|
|
1869
1845
|
var n, r, o;
|
|
1870
|
-
if (!((n = this.block) != null && n.id))
|
|
1871
|
-
return;
|
|
1846
|
+
if (!((n = this.block) != null && n.id)) return;
|
|
1872
1847
|
const e = this.handlePropagationForKeyEvent(t);
|
|
1873
|
-
if (!e)
|
|
1874
|
-
return;
|
|
1848
|
+
if (!e) return;
|
|
1875
1849
|
const { isIndent: i } = e;
|
|
1876
1850
|
this.api.inlineToolbar.close();
|
|
1877
1851
|
const s = this.getGlobalSelectedBlocks();
|
|
1878
|
-
if (!this.config.multiblock || s.length < 2)
|
|
1879
|
-
return i ? this.indentBlock() : this.unIndentBlock(), void ((o = (r = this.block).dispatchChange) == null ? void 0 : o.call(r));
|
|
1852
|
+
if (!this.config.multiblock || s.length < 2) return i ? this.indentBlock() : this.unIndentBlock(), void ((o = (r = this.block).dispatchChange) == null ? void 0 : o.call(r));
|
|
1880
1853
|
this.config.tuneName && s.forEach(async (a) => {
|
|
1881
|
-
var
|
|
1854
|
+
var c, h, g, m;
|
|
1882
1855
|
const d = await a.save();
|
|
1883
|
-
if (!d || !("tunes" in d) || typeof d.tunes != "object" || !d.tunes)
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
const c = this.getWrapperBlockById(a.id);
|
|
1890
|
-
c instanceof HTMLElement && this.applyStylesToWrapper(c, l.indentLevel);
|
|
1856
|
+
if (!d || !("tunes" in d) || typeof d.tunes != "object" || !d.tunes) return;
|
|
1857
|
+
const l = d.tunes[(c = this.config.tuneName) != null ? c : ""];
|
|
1858
|
+
if (!l) return;
|
|
1859
|
+
l.indentLevel = i ? Math.min(this.config.maxIndent, ((h = l.indentLevel) != null ? h : 0) + 1) : Math.max(0, ((g = l.indentLevel) != null ? g : 0) - 1), (m = a.dispatchChange) == null || m.call(a);
|
|
1860
|
+
const p = this.getWrapperBlockById(a.id);
|
|
1861
|
+
p instanceof HTMLElement && this.applyStylesToWrapper(p, l.indentLevel);
|
|
1891
1862
|
});
|
|
1892
1863
|
}
|
|
1893
1864
|
handleIndentLeft() {
|
|
@@ -1907,9 +1878,8 @@ const Et = { orientation: !1 }, J = class x {
|
|
|
1907
1878
|
autoIndentBlock() {
|
|
1908
1879
|
var r, o;
|
|
1909
1880
|
const t = this.api.blocks.getBlockIndex(this.block.id), e = this.api.blocks.getBlockByIndex(t - 1);
|
|
1910
|
-
if (!e)
|
|
1911
|
-
|
|
1912
|
-
const i = (o = (r = e.holder) == null ? void 0 : r.querySelector(`[${x.DATA_WRAPPER_NAME}]`)) == null ? void 0 : o.getAttribute(x.DATA_INDENT_LEVEL), s = Number(i != null ? i : 0), n = Math.min(Math.max(s, this.minIndent), this.maxIndent);
|
|
1881
|
+
if (!e) return;
|
|
1882
|
+
const i = (o = (r = e.holder) == null ? void 0 : r.querySelector(`[${w.DATA_WRAPPER_NAME}]`)) == null ? void 0 : o.getAttribute(w.DATA_INDENT_LEVEL), s = Number(i != null ? i : 0), n = Math.min(Math.max(s, this.minIndent), this.maxIndent);
|
|
1913
1883
|
this.data.indentLevel = n, this.applyStylesToWrapper(this.wrapper, this.data.indentLevel);
|
|
1914
1884
|
}
|
|
1915
1885
|
toggleDisableStateForButtons() {
|
|
@@ -1928,29 +1898,27 @@ const Et = { orientation: !1 }, J = class x {
|
|
|
1928
1898
|
var e;
|
|
1929
1899
|
return (e = this.getTuneByName(t)) == null ? void 0 : e.querySelector(`.${this.CSS.popoverItemTitle}`);
|
|
1930
1900
|
}
|
|
1931
|
-
applyStylesToWrapper(t, e = parseInt(t.getAttribute(
|
|
1901
|
+
applyStylesToWrapper(t, e = parseInt(t.getAttribute(w.DATA_INDENT_LEVEL) || "0")) {
|
|
1932
1902
|
const i = e * this.config.indentSize;
|
|
1933
|
-
t.setAttribute(
|
|
1903
|
+
t.setAttribute(w.DATA_INDENT_LEVEL, e.toString());
|
|
1934
1904
|
const s = t.querySelector(`.${this.EditorCSS.content}`), n = this.getBlockForWrapper(t) || document.querySelector(`.${this.EditorCSS.redactor}`);
|
|
1935
|
-
if (!(s instanceof HTMLElement && n))
|
|
1936
|
-
return;
|
|
1905
|
+
if (!(s instanceof HTMLElement && n)) return;
|
|
1937
1906
|
const r = n.getBoundingClientRect().width;
|
|
1938
|
-
if (r === 0)
|
|
1939
|
-
return void queueMicrotask(() => this.applyStylesToWrapper.bind(this)(t, e));
|
|
1907
|
+
if (r === 0) return void queueMicrotask(() => this.applyStylesToWrapper.bind(this)(t, e));
|
|
1940
1908
|
const o = (r - this.maxWidthForContent(t)) / 2, a = Math.max(0, Math.min(o, i)), d = 2 * a + "px", l = `${a}px`;
|
|
1941
1909
|
this.isDirectionInverted ? (t.style.paddingLeft = "0px", t.style.paddingRight = d) : (t.style.paddingLeft = d, t.style.paddingRight = "0px");
|
|
1942
|
-
const
|
|
1943
|
-
|
|
1910
|
+
const p = t.querySelector(`.${this.CSS.highlightIndent}`);
|
|
1911
|
+
p instanceof HTMLElement && (this.isDirectionInverted ? (p.style.width = l, p.style.left = "100%", p.style.right = "") : (p.style.width = l, p.style.left = "", p.style.right = "100%"));
|
|
1944
1912
|
}
|
|
1945
1913
|
onFocus(t) {
|
|
1946
|
-
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.setAttribute(
|
|
1914
|
+
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.setAttribute(w.DATA_FOCUSED, "");
|
|
1947
1915
|
}
|
|
1948
1916
|
onBlur(t) {
|
|
1949
|
-
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.removeAttribute(
|
|
1917
|
+
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.removeAttribute(w.DATA_FOCUSED);
|
|
1950
1918
|
}
|
|
1951
1919
|
onResize(t) {
|
|
1952
1920
|
this.lastResizeTimeout && clearTimeout(this.lastResizeTimeout), this.lastResizeTimeout = setTimeout(() => {
|
|
1953
|
-
document.querySelectorAll(`[${
|
|
1921
|
+
document.querySelectorAll(`[${w.DATA_WRAPPER_NAME}]`).forEach((e) => {
|
|
1954
1922
|
e instanceof HTMLElement && this.applyStylesToWrapper(e);
|
|
1955
1923
|
});
|
|
1956
1924
|
}, 500);
|
|
@@ -1960,14 +1928,13 @@ const Et = { orientation: !1 }, J = class x {
|
|
|
1960
1928
|
}
|
|
1961
1929
|
getWrapperBlockById(t) {
|
|
1962
1930
|
var i, s, n;
|
|
1963
|
-
const e = `.${this.EditorCSS.block}[data-id="${t}"] [${
|
|
1964
|
-
return (n = (s = document.querySelector(e)) != null ? s : (i = this.api.blocks.getById(t)) == null ? void 0 : i.holder.querySelector(`[${
|
|
1931
|
+
const e = `.${this.EditorCSS.block}[data-id="${t}"] [${w.DATA_WRAPPER_NAME}]`;
|
|
1932
|
+
return (n = (s = document.querySelector(e)) != null ? s : (i = this.api.blocks.getById(t)) == null ? void 0 : i.holder.querySelector(`[${w.DATA_WRAPPER_NAME}]`)) != null ? n : null;
|
|
1965
1933
|
}
|
|
1966
1934
|
getBlockForWrapper(t) {
|
|
1967
1935
|
let e = t;
|
|
1968
1936
|
for (; !e.classList.contains(this.EditorCSS.block); ) {
|
|
1969
|
-
if (!e.parentElement || e instanceof HTMLHtmlElement)
|
|
1970
|
-
return null;
|
|
1937
|
+
if (!e.parentElement || e instanceof HTMLHtmlElement) return null;
|
|
1971
1938
|
e = e.parentElement;
|
|
1972
1939
|
}
|
|
1973
1940
|
return e;
|
|
@@ -1985,23 +1952,22 @@ const Et = { orientation: !1 }, J = class x {
|
|
|
1985
1952
|
return new DOMParser().parseFromString(t, "text/html").body.firstChild;
|
|
1986
1953
|
}
|
|
1987
1954
|
changeConfigBasedOnVersionIfNeeded() {
|
|
1988
|
-
this.config.version && this.config.version < "2.27" && this.config.orientation === "vertical" && (this.config.orientation = "horizontal",
|
|
1955
|
+
this.config.version && this.config.version < "2.27" && this.config.orientation === "vertical" && (this.config.orientation = "horizontal", _t.orientation, _t.orientation = !0);
|
|
1989
1956
|
}
|
|
1990
1957
|
maxWidthForContent(t) {
|
|
1991
1958
|
const e = t.querySelector(`.${this.EditorCSS.content}`);
|
|
1992
1959
|
if (e instanceof HTMLElement) {
|
|
1993
1960
|
const { maxWidth: i } = window.getComputedStyle(e);
|
|
1994
|
-
if (i)
|
|
1995
|
-
return this.cachedMaxWidthForContent = parseInt(i), this.cachedMaxWidthForContent;
|
|
1961
|
+
if (i) return this.cachedMaxWidthForContent = parseInt(i), this.cachedMaxWidthForContent;
|
|
1996
1962
|
}
|
|
1997
1963
|
return this.cachedMaxWidthForContent !== null || (this.cachedMaxWidthForContent = 650), this.cachedMaxWidthForContent;
|
|
1998
1964
|
}
|
|
1999
1965
|
};
|
|
2000
|
-
|
|
2001
|
-
let
|
|
2002
|
-
class
|
|
1966
|
+
w.DATA_WRAPPER_NAME = "data-block-indent-wrapper", w.DATA_FOCUSED = "data-focused", w.DATA_INDENT_LEVEL = "data-indent-level";
|
|
1967
|
+
let at = w;
|
|
1968
|
+
class $ {
|
|
2003
1969
|
static get toolboxIcon() {
|
|
2004
|
-
return
|
|
1970
|
+
return Lt;
|
|
2005
1971
|
}
|
|
2006
1972
|
static get CSS() {
|
|
2007
1973
|
return "cdx-marker";
|
|
@@ -2016,14 +1982,13 @@ class N {
|
|
|
2016
1982
|
return this.button = document.createElement("button"), this.button.setAttribute("type", "button"), this.button.classList.add(this.iconClasses.base), this.button.innerHTML = this.toolboxIcon, this.button;
|
|
2017
1983
|
}
|
|
2018
1984
|
surround(t) {
|
|
2019
|
-
if (!t)
|
|
2020
|
-
|
|
2021
|
-
let e = this.api.selection.findParentTag(this.tag, N.CSS);
|
|
1985
|
+
if (!t) return;
|
|
1986
|
+
let e = this.api.selection.findParentTag(this.tag, $.CSS);
|
|
2022
1987
|
e ? this.unwrap(e) : this.wrap(t);
|
|
2023
1988
|
}
|
|
2024
1989
|
wrap(t) {
|
|
2025
1990
|
let e = document.createElement(this.tag);
|
|
2026
|
-
e.classList.add(
|
|
1991
|
+
e.classList.add($.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
2027
1992
|
}
|
|
2028
1993
|
unwrap(t) {
|
|
2029
1994
|
var n;
|
|
@@ -2033,17 +1998,17 @@ class N {
|
|
|
2033
1998
|
}
|
|
2034
1999
|
checkState() {
|
|
2035
2000
|
var e;
|
|
2036
|
-
const t = this.api.selection.findParentTag(this.tag,
|
|
2001
|
+
const t = this.api.selection.findParentTag(this.tag, $.CSS);
|
|
2037
2002
|
(e = this.button) == null || e.classList.toggle(this.iconClasses.active, !!t);
|
|
2038
2003
|
}
|
|
2039
2004
|
get toolboxIcon() {
|
|
2040
|
-
return
|
|
2005
|
+
return Lt;
|
|
2041
2006
|
}
|
|
2042
2007
|
static get sanitize() {
|
|
2043
|
-
return { mark: { class:
|
|
2008
|
+
return { mark: { class: $.CSS } };
|
|
2044
2009
|
}
|
|
2045
2010
|
}
|
|
2046
|
-
class
|
|
2011
|
+
class ut {
|
|
2047
2012
|
constructor(t) {
|
|
2048
2013
|
this.tag = "SPAN", this.class = "cdx-text-color", this.defaultColor = "#2644FF", this.lastRange = null, this.colors = ["#182a4e", "#0055cc", "#1f6a83", "#206e4e", "#e56910", "#ae2e24", "#5e4db2", "#758195", "#1e7afd", "#2998bd", "#23a06b", "#fea363", "#c9372c", "#8270db"], this.columns = 7;
|
|
2049
2014
|
const { api: e, config: i } = t;
|
|
@@ -2065,8 +2030,7 @@ class Se {
|
|
|
2065
2030
|
this.lastRange = t;
|
|
2066
2031
|
}
|
|
2067
2032
|
wrapAndColor(t, e) {
|
|
2068
|
-
if (!t)
|
|
2069
|
-
return;
|
|
2033
|
+
if (!t) return;
|
|
2070
2034
|
const i = t.extractContents(), s = document.createElement(this.tag);
|
|
2071
2035
|
s.classList.add(this.class), s.appendChild(i), s.style.color = e, s.innerHTML = s.textContent || "", t.insertNode(s), this.api.selection.expandToTag(s);
|
|
2072
2036
|
}
|
|
@@ -2079,15 +2043,16 @@ class Se {
|
|
|
2079
2043
|
}, t.append(i);
|
|
2080
2044
|
}), t;
|
|
2081
2045
|
}
|
|
2082
|
-
static get
|
|
2083
|
-
return
|
|
2046
|
+
static get CSS() {
|
|
2047
|
+
return ut.CSS;
|
|
2084
2048
|
}
|
|
2085
|
-
}
|
|
2086
|
-
class ne extends Se {
|
|
2087
2049
|
static get sanitize() {
|
|
2050
|
+
return { span: { style: !0, class: !0 } };
|
|
2088
2051
|
}
|
|
2089
2052
|
}
|
|
2090
|
-
|
|
2053
|
+
class me extends ut {
|
|
2054
|
+
}
|
|
2055
|
+
const z = class z {
|
|
2091
2056
|
constructor(t) {
|
|
2092
2057
|
this.tag = "U", this.api = t.api, this.iconClasses = { base: this.api.styles.inlineToolButton, active: this.api.styles.inlineToolButtonActive };
|
|
2093
2058
|
}
|
|
@@ -2098,42 +2063,39 @@ const re = class V {
|
|
|
2098
2063
|
return this.button = document.createElement("button"), this.button.type = "button", this.button.classList.add(this.iconClasses.base), this.button.innerHTML = this.toolboxIcon, this.button;
|
|
2099
2064
|
}
|
|
2100
2065
|
surround(t) {
|
|
2101
|
-
if (!t)
|
|
2102
|
-
|
|
2103
|
-
const e = this.api.selection.findParentTag(this.tag, V.CSS);
|
|
2066
|
+
if (!t) return;
|
|
2067
|
+
const e = this.api.selection.findParentTag(this.tag, z.CSS);
|
|
2104
2068
|
e ? this.unwrap(e) : this.wrap(t);
|
|
2105
2069
|
}
|
|
2106
2070
|
wrap(t) {
|
|
2107
2071
|
const e = document.createElement(this.tag);
|
|
2108
|
-
e.classList.add(
|
|
2072
|
+
e.classList.add(z.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
2109
2073
|
}
|
|
2110
2074
|
unwrap(t) {
|
|
2111
2075
|
var n;
|
|
2112
2076
|
this.api.selection.expandToTag(t);
|
|
2113
2077
|
const e = window.getSelection();
|
|
2114
|
-
if (!e)
|
|
2115
|
-
return;
|
|
2078
|
+
if (!e) return;
|
|
2116
2079
|
const i = e.getRangeAt(0);
|
|
2117
|
-
if (!i)
|
|
2118
|
-
return;
|
|
2080
|
+
if (!i) return;
|
|
2119
2081
|
const s = i.extractContents();
|
|
2120
2082
|
s && ((n = t.parentNode) == null || n.removeChild(t), i.insertNode(s), e.removeAllRanges(), e.addRange(i));
|
|
2121
2083
|
}
|
|
2122
2084
|
checkState() {
|
|
2123
2085
|
var e;
|
|
2124
|
-
const t = this.api.selection.findParentTag(this.tag,
|
|
2086
|
+
const t = this.api.selection.findParentTag(this.tag, z.CSS);
|
|
2125
2087
|
return (e = this.button) == null || e.classList.toggle(this.iconClasses.active, !!t), !!t;
|
|
2126
2088
|
}
|
|
2127
2089
|
get toolboxIcon() {
|
|
2128
2090
|
return '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7.71429 18H16.2857"/></svg>';
|
|
2129
2091
|
}
|
|
2130
2092
|
static get sanitize() {
|
|
2131
|
-
return { u: { class:
|
|
2093
|
+
return { u: { class: z.CSS } };
|
|
2132
2094
|
}
|
|
2133
2095
|
};
|
|
2134
|
-
|
|
2135
|
-
let
|
|
2136
|
-
class
|
|
2096
|
+
z.isInline = !0;
|
|
2097
|
+
let lt = z;
|
|
2098
|
+
class F {
|
|
2137
2099
|
constructor({ api: t }) {
|
|
2138
2100
|
this.tag = "CODE", this.api = t, this.button = null, this.iconClasses = { base: this.api.styles.inlineToolButton, active: this.api.styles.inlineToolButtonActive };
|
|
2139
2101
|
}
|
|
@@ -2148,55 +2110,52 @@ class W {
|
|
|
2148
2110
|
}
|
|
2149
2111
|
surround(t) {
|
|
2150
2112
|
var i;
|
|
2151
|
-
if (!t)
|
|
2152
|
-
|
|
2153
|
-
let e = this.api.selection.findParentTag(this.tag, W.CSS);
|
|
2113
|
+
if (!t) return;
|
|
2114
|
+
let e = this.api.selection.findParentTag(this.tag, F.CSS);
|
|
2154
2115
|
e ? this.unwrap(e) : (i = t.commonAncestorContainer.parentElement) != null && i.querySelector(this.tag) || this.wrap(t);
|
|
2155
2116
|
}
|
|
2156
2117
|
wrap(t) {
|
|
2157
2118
|
let e = document.createElement(this.tag);
|
|
2158
|
-
e.classList.add(
|
|
2119
|
+
e.classList.add(F.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
2159
2120
|
}
|
|
2160
2121
|
unwrap(t) {
|
|
2161
2122
|
var n;
|
|
2162
2123
|
this.api.selection.expandToTag(t);
|
|
2163
2124
|
const e = window.getSelection();
|
|
2164
|
-
if (!e)
|
|
2165
|
-
return;
|
|
2125
|
+
if (!e) return;
|
|
2166
2126
|
const i = e.getRangeAt(0), s = i.extractContents();
|
|
2167
2127
|
(n = t.parentNode) == null || n.removeChild(t), i.insertNode(s), e.removeAllRanges(), e.addRange(i);
|
|
2168
2128
|
}
|
|
2169
2129
|
checkState() {
|
|
2170
|
-
const t = this.api.selection.findParentTag(this.tag,
|
|
2130
|
+
const t = this.api.selection.findParentTag(this.tag, F.CSS);
|
|
2171
2131
|
return this.button && this.button.classList.toggle(this.iconClasses.active, !!t), !!t;
|
|
2172
2132
|
}
|
|
2173
2133
|
get toolboxIcon() {
|
|
2174
2134
|
return '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 8L5 12L9 16"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8L19 12L15 16"/></svg>';
|
|
2175
2135
|
}
|
|
2176
2136
|
static get sanitize() {
|
|
2177
|
-
return { code: { class:
|
|
2137
|
+
return { code: { class: F.CSS } };
|
|
2178
2138
|
}
|
|
2179
2139
|
}
|
|
2180
|
-
function
|
|
2140
|
+
function x(u, t, e = {}) {
|
|
2181
2141
|
const i = document.createElement(u);
|
|
2182
2142
|
Array.isArray(t) ? i.classList.add(...t) : t && i.classList.add(t);
|
|
2183
|
-
for (const s in e)
|
|
2184
|
-
Object.prototype.hasOwnProperty.call(e, s) && (i[s] = e[s]);
|
|
2143
|
+
for (const s in e) Object.prototype.hasOwnProperty.call(e, s) && (i[s] = e[s]);
|
|
2185
2144
|
return i;
|
|
2186
2145
|
}
|
|
2187
|
-
function
|
|
2146
|
+
function Ht(u) {
|
|
2188
2147
|
const t = u.getBoundingClientRect();
|
|
2189
2148
|
return { y1: Math.floor(t.top + window.pageYOffset), x1: Math.floor(t.left + window.pageXOffset), x2: Math.floor(t.right + window.pageXOffset), y2: Math.floor(t.bottom + window.pageYOffset) };
|
|
2190
2149
|
}
|
|
2191
|
-
function
|
|
2192
|
-
const e =
|
|
2150
|
+
function it(u, t) {
|
|
2151
|
+
const e = Ht(u), i = Ht(t);
|
|
2193
2152
|
return { fromTopBorder: i.y1 - e.y1, fromLeftBorder: i.x1 - e.x1, fromRightBorder: e.x2 - i.x2, fromBottomBorder: e.y2 - i.y2 };
|
|
2194
2153
|
}
|
|
2195
|
-
function
|
|
2154
|
+
function It(u, t) {
|
|
2196
2155
|
var e;
|
|
2197
2156
|
return (e = t == null ? void 0 : t.parentNode) == null ? void 0 : e.insertBefore(u, t);
|
|
2198
2157
|
}
|
|
2199
|
-
function
|
|
2158
|
+
function At(u, t = !0) {
|
|
2200
2159
|
const e = document.createRange(), i = window.getSelection();
|
|
2201
2160
|
e.selectNodeContents(u), e.collapse(t), i == null || i.removeAllRanges(), i == null || i.addRange(e);
|
|
2202
2161
|
}
|
|
@@ -2208,9 +2167,9 @@ class y {
|
|
|
2208
2167
|
return { popover: "tc-popover", popoverOpened: "tc-popover--opened", item: "tc-popover__item", itemHidden: "tc-popover__item--hidden", itemConfirmState: "tc-popover__item--confirm", itemIcon: "tc-popover__item-icon", itemLabel: "tc-popover__item-label" };
|
|
2209
2168
|
}
|
|
2210
2169
|
render() {
|
|
2211
|
-
return this.wrapper =
|
|
2170
|
+
return this.wrapper = x("div", y.CSS.popover), this.items.forEach((t, e) => {
|
|
2212
2171
|
var r;
|
|
2213
|
-
const i =
|
|
2172
|
+
const i = x("div", y.CSS.item), s = x("div", y.CSS.itemIcon, { innerHTML: t.icon }), n = x("div", y.CSS.itemLabel, { textContent: t.label });
|
|
2214
2173
|
i.dataset.index = e + "", i.appendChild(s), i.appendChild(n), (r = this.wrapper) == null || r.appendChild(i), this.itemEls.push(i);
|
|
2215
2174
|
}), this.wrapper.addEventListener("click", (t) => {
|
|
2216
2175
|
this.popoverClicked(t);
|
|
@@ -2218,11 +2177,9 @@ class y {
|
|
|
2218
2177
|
}
|
|
2219
2178
|
popoverClicked(t) {
|
|
2220
2179
|
const e = t.target.closest(`.${y.CSS.item}`);
|
|
2221
|
-
if (!e)
|
|
2222
|
-
return;
|
|
2180
|
+
if (!e) return;
|
|
2223
2181
|
const i = e.dataset.index;
|
|
2224
|
-
if (!i)
|
|
2225
|
-
return;
|
|
2182
|
+
if (!i) return;
|
|
2226
2183
|
const s = this.items[parseInt(i)];
|
|
2227
2184
|
!s.confirmationRequired || this.hasConfirmationState(e) ? s.onClick() : this.setConfirmationState(e);
|
|
2228
2185
|
}
|
|
@@ -2252,7 +2209,7 @@ class y {
|
|
|
2252
2209
|
});
|
|
2253
2210
|
}
|
|
2254
2211
|
}
|
|
2255
|
-
class
|
|
2212
|
+
class A {
|
|
2256
2213
|
constructor({ items: t, onOpen: e, onClose: i, cssModifier: s = "" }) {
|
|
2257
2214
|
this.items = t, this.onOpen = e, this.onClose = i, this.cssModifier = s, this.popover = null, this.wrapper = this.createToolbox();
|
|
2258
2215
|
}
|
|
@@ -2263,13 +2220,13 @@ class O {
|
|
|
2263
2220
|
return this.wrapper;
|
|
2264
2221
|
}
|
|
2265
2222
|
createToolbox() {
|
|
2266
|
-
const t =
|
|
2223
|
+
const t = x("div", [A.CSS.toolbox, this.cssModifier ? `${A.CSS.toolbox}--${this.cssModifier}` : ""]);
|
|
2267
2224
|
t.dataset.mutationFree = "true";
|
|
2268
2225
|
const e = this.createPopover(), i = this.createToggler();
|
|
2269
2226
|
return t.appendChild(i), t.appendChild(e), t;
|
|
2270
2227
|
}
|
|
2271
2228
|
createToggler() {
|
|
2272
|
-
const t =
|
|
2229
|
+
const t = x("div", A.CSS.toggler, { innerHTML: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.41 9.66H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 9.66H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.31 14.36H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 14.36H14.59"/></svg>' });
|
|
2273
2230
|
return t.addEventListener("click", () => {
|
|
2274
2231
|
this.togglerClicked();
|
|
2275
2232
|
}), t;
|
|
@@ -2285,30 +2242,29 @@ class O {
|
|
|
2285
2242
|
const e = t();
|
|
2286
2243
|
Object.entries(e).forEach(([i, s]) => {
|
|
2287
2244
|
this.wrapper.style.setProperty(i, s);
|
|
2288
|
-
}), this.wrapper.classList.add(
|
|
2245
|
+
}), this.wrapper.classList.add(A.CSS.toolboxShowed);
|
|
2289
2246
|
}
|
|
2290
2247
|
hide() {
|
|
2291
2248
|
var t;
|
|
2292
|
-
(t = this.popover) == null || t.close(), this.wrapper.classList.remove(
|
|
2249
|
+
(t = this.popover) == null || t.close(), this.wrapper.classList.remove(A.CSS.toolboxShowed);
|
|
2293
2250
|
}
|
|
2294
2251
|
}
|
|
2295
|
-
const
|
|
2296
|
-
class
|
|
2252
|
+
const Bt = "tc-wrap", fe = "tc-wrap--readonly", Rt = "tc-table", R = "tc-row", Ot = "tc-table--heading", st = "tc-row--selected", O = "tc-cell", nt = "tc-cell--selected", rt = "tc-add-row", zt = "tc-add-row--disabled", ot = "tc-add-column", Dt = "tc-add-column--disabled";
|
|
2253
|
+
class Ce {
|
|
2297
2254
|
constructor(t, e, i, s) {
|
|
2298
2255
|
this.minCellWidhth = 50, this.defaultCellWidth = 100, this.handleDocumentMousedown = (n) => {
|
|
2299
2256
|
this.wrapper.contains(n.target) && n.target.classList.contains("cell-resizable") && (n.preventDefault(), this.isDragging = !0, this.table.classList.add("table-resizing"), document.addEventListener("mousemove", this.handleDocumentMousemove), document.addEventListener("mouseup", this.handleDocumentMouseup), this.draggingColumn = this.hoveredColumn, this.startWidth = this.colWidthArr[this.draggingColumn - 1], this.mouseStartX = n.clientX);
|
|
2300
2257
|
}, this.handleDocumentMousemove = (n) => {
|
|
2301
|
-
if (!this.isDragging)
|
|
2302
|
-
return;
|
|
2258
|
+
if (!this.isDragging) return;
|
|
2303
2259
|
const r = n.clientX - this.mouseStartX, o = Math.max(this.startWidth + r, this.minCellWidhth);
|
|
2304
2260
|
this.colWidthArr[this.draggingColumn - 1] = o, this.updateColWidth();
|
|
2305
2261
|
}, this.handleDocumentMouseup = () => {
|
|
2306
2262
|
this.updateToolboxesPosition(), this.isDragging = !1, this.table.classList.remove("table-resizing"), document.removeEventListener("mousemove", this.handleDocumentMousemove), document.removeEventListener("mouseup", this.handleDocumentMouseup);
|
|
2307
2263
|
}, this.readOnly = t, this.api = e, this.data = i, this.config = s, this.wrapper = null, this.table = null, this.hoveredCell = null, this.isDragging = !1, this.draggingColumn = 0, this.startWidth = 0, this.mouseStartX = 0, this.colWidthArr = [], this.focusedCell = { row: 0, col: 0 }, this.toolboxColumn = this.createColumnToolbox(), this.toolboxRow = this.createRowToolbox(), this.createTableWrapper(), this.hoveredRow = 0, this.hoveredColumn = 0, this.selectedRow = 0, this.selectedColumn = 0, this.tunes = { withHeadings: !1 }, this.resize(), this.data.colWidth && this.data.colWidth.length > 0 && (this.colWidthArr = this.data.colWidth), this.updateColWidth(), this.fill(), this.focusedCell = { row: 0, column: 0 }, this.documentClicked = (n) => {
|
|
2308
2264
|
let r = n.target;
|
|
2309
|
-
const o = r.closest(`.${
|
|
2265
|
+
const o = r.closest(`.${Rt}`) !== null, a = r.closest(`.${Bt}`) === null;
|
|
2310
2266
|
(o || a) && this.hideToolboxes();
|
|
2311
|
-
const d = r.closest(`.${
|
|
2267
|
+
const d = r.closest(`.${rt}`), l = r.closest(`.${ot}`);
|
|
2312
2268
|
d && d.parentNode === this.wrapper ? (this.addRow(void 0, !0), this.hideToolboxes()) : l && l.parentNode === this.wrapper && (this.addColumn(void 0, !0), this.hideToolboxes());
|
|
2313
2269
|
}, this.readOnly || this.bindEvents();
|
|
2314
2270
|
}
|
|
@@ -2316,28 +2272,27 @@ class xe {
|
|
|
2316
2272
|
return this.wrapper;
|
|
2317
2273
|
}
|
|
2318
2274
|
bindEvents() {
|
|
2319
|
-
document.addEventListener("click", this.documentClicked), document.addEventListener("mousedown", (t) => this.handleDocumentMousedown(t)), this.table.addEventListener("mousemove", function(t, e) {
|
|
2275
|
+
document.addEventListener("click", this.documentClicked), document.addEventListener("mousedown", (t) => this.handleDocumentMousedown(t)), this.table.addEventListener("mousemove", /* @__PURE__ */ function(t, e) {
|
|
2320
2276
|
let i = 0;
|
|
2321
2277
|
return function(...s) {
|
|
2322
2278
|
const n = (/* @__PURE__ */ new Date()).getTime();
|
|
2323
|
-
if (!(n - i < t))
|
|
2324
|
-
return i = n, e(...s);
|
|
2279
|
+
if (!(n - i < t)) return i = n, e(...s);
|
|
2325
2280
|
};
|
|
2326
2281
|
}(150, (t) => this.onMouseMoveInTable(t)), { passive: !0 }), this.table.onkeypress = (t) => this.onKeyPressListener(t), this.table.addEventListener("keydown", (t) => this.onKeyDownListener(t)), this.table.addEventListener("focusin", (t) => this.focusInTableListener(t));
|
|
2327
2282
|
}
|
|
2328
2283
|
getCellInCol(t) {
|
|
2329
2284
|
const e = [];
|
|
2330
|
-
return this.table.querySelectorAll(`.${
|
|
2331
|
-
const s = i.querySelector(`.${
|
|
2285
|
+
return this.table.querySelectorAll(`.${R}`).forEach((i) => {
|
|
2286
|
+
const s = i.querySelector(`.${O}:nth-child(${t})`);
|
|
2332
2287
|
s && e.push(s);
|
|
2333
2288
|
}), e;
|
|
2334
2289
|
}
|
|
2335
2290
|
createColumnToolbox() {
|
|
2336
|
-
return new
|
|
2291
|
+
return new A({ api: this.api, cssModifier: "column", items: [{ label: this.api.i18n.t("Add column to left"), icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.9167 14.9167L11.5833 18.25M11.5833 18.25L8.25 14.9167M11.5833 18.25L11.5833 10.0833C11.5833 9.19928 11.9345 8.35143 12.5596 7.72631C13.1848 7.10119 14.0326 6.75 14.9167 6.75"/></svg>', hideIf: () => this.numberOfColumns === this.config.maxcols, onClick: () => {
|
|
2337
2292
|
this.addColumn(this.selectedColumn, !0), this.hideToolboxes(), this.updateColWidth();
|
|
2338
2293
|
} }, { label: this.api.i18n.t("Add column to right"), icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.13333 14.9167L12.4667 18.25M12.4667 18.25L15.8 14.9167M12.4667 18.25L12.4667 10.0833C12.4667 9.19928 12.1155 8.35143 11.4904 7.72631C10.8652 7.10119 10.0174 6.75 9.13333 6.75"/></svg>', hideIf: () => this.numberOfColumns === this.config.maxcols, onClick: () => {
|
|
2339
2294
|
this.addColumn(this.selectedColumn + 1, !0), this.hideToolboxes(), this.updateColWidth();
|
|
2340
|
-
} }, { label: this.api.i18n.t("Delete column"), icon:
|
|
2295
|
+
} }, { label: this.api.i18n.t("Delete column"), icon: bt, hideIf: () => this.numberOfColumns === 1, confirmationRequired: !0, onClick: () => {
|
|
2341
2296
|
this.deleteColumn(this.selectedColumn), this.hideToolboxes(), this.updateColWidth();
|
|
2342
2297
|
} }], onOpen: () => {
|
|
2343
2298
|
this.selectColumn(this.hoveredColumn), this.hideRowToolbox();
|
|
@@ -2346,11 +2301,11 @@ class xe {
|
|
|
2346
2301
|
} });
|
|
2347
2302
|
}
|
|
2348
2303
|
createRowToolbox() {
|
|
2349
|
-
return new
|
|
2304
|
+
return new A({ api: this.api, cssModifier: "row", items: [{ label: this.api.i18n.t("Add row above"), icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 15.8333L18.2167 12.5M18.2167 12.5L14.8833 9.16667M18.2167 12.5L10.05 12.5C9.16595 12.5 8.31811 12.8512 7.69299 13.4763C7.06787 14.1014 6.71667 14.9493 6.71667 15.8333"/></svg>', hideIf: () => this.numberOfRows === this.config.maxrows, onClick: () => {
|
|
2350
2305
|
this.addRow(this.selectedRow, !0), this.hideToolboxes();
|
|
2351
2306
|
} }, { label: this.api.i18n.t("Add row below"), icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 9.16666L18.2167 12.5M18.2167 12.5L14.8833 15.8333M18.2167 12.5H10.05C9.16594 12.5 8.31809 12.1488 7.69297 11.5237C7.06785 10.8986 6.71666 10.0507 6.71666 9.16666"/></svg>', hideIf: () => this.numberOfRows === this.config.maxrows, onClick: () => {
|
|
2352
2307
|
this.addRow(this.selectedRow + 1, !0), this.hideToolboxes();
|
|
2353
|
-
} }, { label: this.api.i18n.t("Delete row"), icon:
|
|
2308
|
+
} }, { label: this.api.i18n.t("Delete row"), icon: bt, hideIf: () => this.numberOfRows === 1, confirmationRequired: !0, onClick: () => {
|
|
2354
2309
|
this.deleteRow(this.selectedRow), this.hideToolboxes();
|
|
2355
2310
|
} }], onOpen: () => {
|
|
2356
2311
|
this.selectRow(this.hoveredRow), this.hideColumnToolbox();
|
|
@@ -2362,16 +2317,16 @@ class xe {
|
|
|
2362
2317
|
this.focusedCell.row !== this.numberOfRows ? (this.focusedCell.row += 1, this.focusCell()) : (this.addRow(), this.focusedCell.row += 1, this.focusCell(), this.updateToolboxesPosition(0, 0));
|
|
2363
2318
|
}
|
|
2364
2319
|
getCell(t, e) {
|
|
2365
|
-
return this.table.querySelectorAll(`.${
|
|
2320
|
+
return this.table.querySelectorAll(`.${R}:nth-child(${t}) .${O}`)[e - 1];
|
|
2366
2321
|
}
|
|
2367
2322
|
getRow(t) {
|
|
2368
|
-
return this.table.querySelector(`.${
|
|
2323
|
+
return this.table.querySelector(`.${R}:nth-child(${t})`);
|
|
2369
2324
|
}
|
|
2370
2325
|
getRowByCell(t) {
|
|
2371
2326
|
return t.parentElement;
|
|
2372
2327
|
}
|
|
2373
2328
|
getRowFirstCell(t) {
|
|
2374
|
-
return t.querySelector(`.${
|
|
2329
|
+
return t.querySelector(`.${O}:first-child`);
|
|
2375
2330
|
}
|
|
2376
2331
|
setCellContent(t, e, i) {
|
|
2377
2332
|
this.getCell(t, e).innerHTML = i;
|
|
@@ -2379,48 +2334,45 @@ class xe {
|
|
|
2379
2334
|
addColumn(t = -1, e = !1) {
|
|
2380
2335
|
var n;
|
|
2381
2336
|
let i = this.numberOfColumns;
|
|
2382
|
-
if (this.config && this.config.maxcols && this.numberOfColumns >= this.config.maxcols)
|
|
2383
|
-
return;
|
|
2337
|
+
if (this.config && this.config.maxcols && this.numberOfColumns >= this.config.maxcols) return;
|
|
2384
2338
|
for (let r = 1; r <= this.numberOfRows; r++) {
|
|
2385
2339
|
let o;
|
|
2386
2340
|
const a = this.createCell();
|
|
2387
|
-
if (t > 0 && t <= i ? (o = this.getCell(r, t),
|
|
2341
|
+
if (t > 0 && t <= i ? (o = this.getCell(r, t), It(a, o)) : o = this.getRow(r).appendChild(a), r === 1) {
|
|
2388
2342
|
const d = this.getCell(r, t > 0 ? t : i + 1);
|
|
2389
|
-
d && e &&
|
|
2343
|
+
d && e && At(d);
|
|
2390
2344
|
}
|
|
2391
2345
|
}
|
|
2392
|
-
const s = this.wrapper.querySelector(`.${
|
|
2393
|
-
(n = this.config) != null && n.maxcols && this.numberOfColumns > this.config.maxcols - 1 && s && s.classList.add(
|
|
2346
|
+
const s = this.wrapper.querySelector(`.${ot}`);
|
|
2347
|
+
(n = this.config) != null && n.maxcols && this.numberOfColumns > this.config.maxcols - 1 && s && s.classList.add(Dt), this.addHeadingAttrToFirstRow(), this.colWidthArr.splice(t - 1, 0, this.defaultCellWidth);
|
|
2394
2348
|
}
|
|
2395
2349
|
addRow(t = -1, e = !1) {
|
|
2396
|
-
let i, s =
|
|
2350
|
+
let i, s = x("div", R);
|
|
2397
2351
|
this.tunes.withHeadings && this.removeHeadingAttrFromFirstRow();
|
|
2398
2352
|
let n = this.numberOfColumns;
|
|
2399
|
-
if (this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows)
|
|
2400
|
-
|
|
2401
|
-
t > 0 && t <= this.numberOfRows ? i = _t(s, this.getRow(t)) : i = this.table.appendChild(s), this.fillRow(i, n), this.tunes.withHeadings && this.addHeadingAttrToFirstRow();
|
|
2353
|
+
if (this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows) return;
|
|
2354
|
+
t > 0 && t <= this.numberOfRows ? i = It(s, this.getRow(t)) : i = this.table.appendChild(s), this.fillRow(i, n), this.tunes.withHeadings && this.addHeadingAttrToFirstRow();
|
|
2402
2355
|
const r = this.getRowFirstCell(i);
|
|
2403
|
-
r && e &&
|
|
2404
|
-
const o = this.wrapper.querySelector(`.${
|
|
2405
|
-
return this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows && o && o.classList.add(
|
|
2356
|
+
r && e && At(r);
|
|
2357
|
+
const o = this.wrapper.querySelector(`.${rt}`);
|
|
2358
|
+
return this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows && o && o.classList.add(zt), i;
|
|
2406
2359
|
}
|
|
2407
2360
|
deleteColumn(t) {
|
|
2408
2361
|
for (let i = 1; i <= this.numberOfRows; i++) {
|
|
2409
2362
|
const s = this.getCell(i, t);
|
|
2410
|
-
if (!s)
|
|
2411
|
-
return;
|
|
2363
|
+
if (!s) return;
|
|
2412
2364
|
s.remove();
|
|
2413
2365
|
}
|
|
2414
|
-
const e = this.wrapper.querySelector(`.${
|
|
2415
|
-
e && e.classList.remove(
|
|
2366
|
+
const e = this.wrapper.querySelector(`.${ot}`);
|
|
2367
|
+
e && e.classList.remove(Dt), this.colWidthArr.splice(t - 1, 1);
|
|
2416
2368
|
}
|
|
2417
2369
|
deleteRow(t) {
|
|
2418
2370
|
this.getRow(t).remove();
|
|
2419
|
-
const e = this.wrapper.querySelector(`.${
|
|
2420
|
-
e && e.classList.remove(
|
|
2371
|
+
const e = this.wrapper.querySelector(`.${rt}`);
|
|
2372
|
+
e && e.classList.remove(zt), this.addHeadingAttrToFirstRow();
|
|
2421
2373
|
}
|
|
2422
2374
|
createTableWrapper() {
|
|
2423
|
-
this.wrapper =
|
|
2375
|
+
this.wrapper = x("div", Bt), this.table = x("div", Rt), this.readOnly && this.wrapper.classList.add(fe), this.wrapper.appendChild(this.toolboxRow.element), this.wrapper.appendChild(this.toolboxColumn.element), this.wrapper.appendChild(this.table);
|
|
2424
2376
|
}
|
|
2425
2377
|
computeInitialSize() {
|
|
2426
2378
|
const t = this.data && this.data.content, e = Array.isArray(t), i = !!e && t.length, s = e ? t.length : void 0, n = i ? t[0].length : void 0, r = Number.parseInt(this.config && this.config.rows), o = Number.parseInt(this.config && this.config.cols), a = !isNaN(r) && r > 0 ? r : void 0, d = !isNaN(o) && o > 0 ? o : void 0;
|
|
@@ -2428,24 +2380,17 @@ class xe {
|
|
|
2428
2380
|
}
|
|
2429
2381
|
resize() {
|
|
2430
2382
|
const { rows: t, cols: e } = this.computeInitialSize();
|
|
2431
|
-
for (let i = 0; i < t; i++)
|
|
2432
|
-
|
|
2433
|
-
for (let i = 0; i < e; i++)
|
|
2434
|
-
this.addColumn();
|
|
2383
|
+
for (let i = 0; i < t; i++) this.addRow();
|
|
2384
|
+
for (let i = 0; i < e; i++) this.addColumn();
|
|
2435
2385
|
}
|
|
2436
2386
|
updateColWidth() {
|
|
2437
2387
|
let t = "";
|
|
2438
|
-
if (this.colWidthArr && this.colWidthArr.length > 0)
|
|
2439
|
-
for (let e = 0; e < this.colWidthArr.length; e++)
|
|
2440
|
-
t += " " + this.colWidthArr[e] + "px";
|
|
2388
|
+
if (this.colWidthArr && this.colWidthArr.length > 0) for (let e = 0; e < this.colWidthArr.length; e++) t += " " + this.colWidthArr[e] + "px";
|
|
2441
2389
|
t && this.wrapper.style.setProperty("--col-width", t);
|
|
2442
2390
|
}
|
|
2443
2391
|
fill() {
|
|
2444
2392
|
const t = this.data;
|
|
2445
|
-
if (t && t.content)
|
|
2446
|
-
for (let e = 0; e < t.content.length; e++)
|
|
2447
|
-
for (let i = 0; i < t.content[e].length; i++)
|
|
2448
|
-
this.setCellContent(e + 1, i + 1, t.content[e][i]);
|
|
2393
|
+
if (t && t.content) for (let e = 0; e < t.content.length; e++) for (let i = 0; i < t.content[e].length; i++) this.setCellContent(e + 1, i + 1, t.content[e][i]);
|
|
2449
2394
|
}
|
|
2450
2395
|
fillRow(t, e) {
|
|
2451
2396
|
for (let i = 1; i <= e; i++) {
|
|
@@ -2454,13 +2399,13 @@ class xe {
|
|
|
2454
2399
|
}
|
|
2455
2400
|
}
|
|
2456
2401
|
createCell() {
|
|
2457
|
-
return
|
|
2402
|
+
return x("div", O, { contentEditable: !this.readOnly });
|
|
2458
2403
|
}
|
|
2459
2404
|
get numberOfRows() {
|
|
2460
2405
|
return this.table.childElementCount;
|
|
2461
2406
|
}
|
|
2462
2407
|
get numberOfColumns() {
|
|
2463
|
-
return this.numberOfRows ? this.table.querySelectorAll(`.${
|
|
2408
|
+
return this.numberOfRows ? this.table.querySelectorAll(`.${R}:first-child .${O}`).length : 0;
|
|
2464
2409
|
}
|
|
2465
2410
|
get isColumnMenuShowing() {
|
|
2466
2411
|
return this.selectedColumn !== 0;
|
|
@@ -2477,8 +2422,7 @@ class xe {
|
|
|
2477
2422
|
}
|
|
2478
2423
|
onKeyPressListener(t) {
|
|
2479
2424
|
if (t.key === "Enter") {
|
|
2480
|
-
if (t.shiftKey)
|
|
2481
|
-
return !0;
|
|
2425
|
+
if (t.shiftKey) return !0;
|
|
2482
2426
|
this.moveCursorToNextRow();
|
|
2483
2427
|
}
|
|
2484
2428
|
return t.key !== "Enter";
|
|
@@ -2488,7 +2432,7 @@ class xe {
|
|
|
2488
2432
|
}
|
|
2489
2433
|
focusInTableListener(t) {
|
|
2490
2434
|
const e = t.target, i = this.getRowByCell(e);
|
|
2491
|
-
i && (this.focusedCell = { row: Array.from(this.table.querySelectorAll(`.${
|
|
2435
|
+
i && (this.focusedCell = { row: Array.from(this.table.querySelectorAll(`.${R}`)).indexOf(i) + 1, column: Array.from(i.querySelectorAll(`.${O}`)).indexOf(e) + 1 });
|
|
2492
2436
|
}
|
|
2493
2437
|
hideToolboxes() {
|
|
2494
2438
|
this.hideRowToolbox(), this.hideColumnToolbox(), this.updateToolboxesPosition();
|
|
@@ -2507,13 +2451,17 @@ class xe {
|
|
|
2507
2451
|
return this.getCell(t, e);
|
|
2508
2452
|
}
|
|
2509
2453
|
updateToolboxesPosition(t = this.hoveredRow, e = this.hoveredColumn) {
|
|
2510
|
-
this.isColumnMenuShowing || e > 0 && e <= this.numberOfColumns && this.toolboxColumn.show(() =>
|
|
2511
|
-
|
|
2454
|
+
this.isColumnMenuShowing || e > 0 && e <= this.numberOfColumns && this.toolboxColumn.show(() => {
|
|
2455
|
+
let i = 0;
|
|
2456
|
+
for (var s = 0; s < e - 1; s++) i += this.colWidthArr[s];
|
|
2457
|
+
return i += this.colWidthArr[e - 1] / 2, { left: `${i}px` };
|
|
2458
|
+
}), this.isRowMenuShowing || t > 0 && t <= this.numberOfRows && this.toolboxRow.show(() => {
|
|
2459
|
+
const i = this.getRow(t), { fromTopBorder: s } = it(this.table, i), { height: n } = i.getBoundingClientRect();
|
|
2512
2460
|
return { top: `${Math.ceil(s + n / 2)}px` };
|
|
2513
2461
|
});
|
|
2514
2462
|
}
|
|
2515
2463
|
setHeadingsSetting(t) {
|
|
2516
|
-
this.tunes.withHeadings = t, t ? (this.table.classList.add(
|
|
2464
|
+
this.tunes.withHeadings = t, t ? (this.table.classList.add(Ot), this.addHeadingAttrToFirstRow()) : (this.table.classList.remove(Ot), this.removeHeadingAttrFromFirstRow());
|
|
2517
2465
|
}
|
|
2518
2466
|
addHeadingAttrToFirstRow() {
|
|
2519
2467
|
for (let t = 1; t <= this.numberOfColumns; t++) {
|
|
@@ -2529,60 +2477,56 @@ class xe {
|
|
|
2529
2477
|
}
|
|
2530
2478
|
selectRow(t) {
|
|
2531
2479
|
const e = this.getRow(t);
|
|
2532
|
-
e && (this.selectedRow = t, e.classList.add(
|
|
2480
|
+
e && (this.selectedRow = t, e.classList.add(st));
|
|
2533
2481
|
}
|
|
2534
2482
|
unselectRow() {
|
|
2535
|
-
if (this.selectedRow <= 0)
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
t && t.classList.remove(rt), this.selectedRow = 0;
|
|
2483
|
+
if (this.selectedRow <= 0) return;
|
|
2484
|
+
const t = this.table.querySelector(`.${st}`);
|
|
2485
|
+
t && t.classList.remove(st), this.selectedRow = 0;
|
|
2539
2486
|
}
|
|
2540
2487
|
selectColumn(t) {
|
|
2541
2488
|
for (let e = 1; e <= this.numberOfRows; e++) {
|
|
2542
2489
|
const i = this.getCell(e, t);
|
|
2543
|
-
i && i.classList.add(
|
|
2490
|
+
i && i.classList.add(nt);
|
|
2544
2491
|
}
|
|
2545
2492
|
this.selectedColumn = t;
|
|
2546
2493
|
}
|
|
2547
2494
|
unselectColumn() {
|
|
2548
|
-
if (this.selectedColumn <= 0)
|
|
2549
|
-
|
|
2550
|
-
let t = this.table.querySelectorAll(`.${ot}`);
|
|
2495
|
+
if (this.selectedColumn <= 0) return;
|
|
2496
|
+
let t = this.table.querySelectorAll(`.${nt}`);
|
|
2551
2497
|
Array.from(t).forEach((e) => {
|
|
2552
|
-
e.classList.remove(
|
|
2498
|
+
e.classList.remove(nt);
|
|
2553
2499
|
}), this.selectedColumn = 0;
|
|
2554
2500
|
}
|
|
2555
2501
|
getHoveredCell(t) {
|
|
2556
2502
|
let e = this.hoveredRow, i = this.hoveredColumn;
|
|
2557
|
-
const { width: s, height: n, x: r, y: o } = function(
|
|
2558
|
-
const g =
|
|
2559
|
-
return { width: m, height: f, x:
|
|
2503
|
+
const { width: s, height: n, x: r, y: o } = function(c, h) {
|
|
2504
|
+
const g = c.getBoundingClientRect(), { width: m, height: f, x: v, y: M } = g, { clientX: L, clientY: D } = h;
|
|
2505
|
+
return { width: m, height: f, x: L - v, y: D - M };
|
|
2560
2506
|
}(this.table, t);
|
|
2561
2507
|
if (r >= 0) {
|
|
2562
|
-
const
|
|
2563
|
-
i = this.binSearch(this.numberOfColumns, (g) => this.getCell(1, g),
|
|
2508
|
+
const c = ({ fromLeftBorder: g }) => r < g, h = ({ fromRightBorder: g }) => r > s - g;
|
|
2509
|
+
i = this.binSearch(this.numberOfColumns, (g) => this.getCell(1, g), c, h);
|
|
2564
2510
|
}
|
|
2565
2511
|
if (o >= 0) {
|
|
2566
|
-
const
|
|
2567
|
-
e = this.binSearch(this.numberOfRows, (g) => this.getCell(g, 1),
|
|
2512
|
+
const c = ({ fromTopBorder: g }) => o < g, h = ({ fromBottomBorder: g }) => o > n - g;
|
|
2513
|
+
e = this.binSearch(this.numberOfRows, (g) => this.getCell(g, 1), c, h);
|
|
2568
2514
|
}
|
|
2569
|
-
const a = e || this.hoveredRow, d = i || this.hoveredColumn, { deltaXCell: l, deltaYCell:
|
|
2570
|
-
return { row: a, column: d, deltaXCell: l, deltaYCell:
|
|
2515
|
+
const a = e || this.hoveredRow, d = i || this.hoveredColumn, { deltaXCell: l, deltaYCell: p } = this.getMousePositionRelateToCell(a, d, r, o);
|
|
2516
|
+
return { row: a, column: d, deltaXCell: l, deltaYCell: p };
|
|
2571
2517
|
}
|
|
2572
2518
|
getMousePositionRelateToCell(t, e, i, s) {
|
|
2573
|
-
const n = this.getCell(t, e), { fromTopBorder: r, fromLeftBorder: o } =
|
|
2519
|
+
const n = this.getCell(t, e), { fromTopBorder: r, fromLeftBorder: o } = it(this.table, n);
|
|
2574
2520
|
return { deltaXCell: i - o, deltaYCell: s - r };
|
|
2575
2521
|
}
|
|
2576
2522
|
binSearch(t, e, i, s) {
|
|
2577
2523
|
let n, r = 0, o = t + 1, a = 0;
|
|
2578
2524
|
for (; r < o - 1 && a < 10; ) {
|
|
2579
2525
|
n = Math.ceil((r + o) / 2);
|
|
2580
|
-
const d = e(n), l =
|
|
2581
|
-
if (i(l))
|
|
2582
|
-
o = n;
|
|
2526
|
+
const d = e(n), l = it(this.table, d);
|
|
2527
|
+
if (i(l)) o = n;
|
|
2583
2528
|
else {
|
|
2584
|
-
if (!s(l))
|
|
2585
|
-
break;
|
|
2529
|
+
if (!s(l)) break;
|
|
2586
2530
|
r = n;
|
|
2587
2531
|
}
|
|
2588
2532
|
a++;
|
|
@@ -2592,7 +2536,7 @@ class xe {
|
|
|
2592
2536
|
getData() {
|
|
2593
2537
|
const t = [];
|
|
2594
2538
|
for (let e = 1; e <= this.numberOfRows; e++) {
|
|
2595
|
-
const i = this.table.querySelector(`.${
|
|
2539
|
+
const i = this.table.querySelector(`.${R}:nth-child(${e})`), s = Array.from(i.querySelectorAll(`.${O}`));
|
|
2596
2540
|
s.every((n) => !n.textContent.trim()) || t.push(s.map((n) => n.innerHTML));
|
|
2597
2541
|
}
|
|
2598
2542
|
return t;
|
|
@@ -2601,7 +2545,7 @@ class xe {
|
|
|
2601
2545
|
document.removeEventListener("click", this.documentClicked);
|
|
2602
2546
|
}
|
|
2603
2547
|
}
|
|
2604
|
-
class
|
|
2548
|
+
class ve {
|
|
2605
2549
|
static get isReadOnlySupported() {
|
|
2606
2550
|
return !0;
|
|
2607
2551
|
}
|
|
@@ -2615,7 +2559,7 @@ class ae {
|
|
|
2615
2559
|
return { icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>', title: "Table" };
|
|
2616
2560
|
}
|
|
2617
2561
|
render() {
|
|
2618
|
-
return this.table = new
|
|
2562
|
+
return this.table = new Ce(this.readOnly, this.api, this.data, this.config), this.container = x("div", this.api.styles.block), this.container.appendChild(this.table.getWrapper()), this.table.setHeadingsSetting(this.data.withHeadings), this.container;
|
|
2619
2563
|
}
|
|
2620
2564
|
renderSettings() {
|
|
2621
2565
|
return [{ label: this.api.i18n.t("With headings"), icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>', isActive: this.data.withHeadings, closeOnActivate: !0, toggle: !0, hint: { title: this.api.i18n.t("With headings") }, onActivate: () => {
|
|
@@ -2626,7 +2570,7 @@ class ae {
|
|
|
2626
2570
|
}
|
|
2627
2571
|
save() {
|
|
2628
2572
|
const t = this.table.getData();
|
|
2629
|
-
return { withHeadings: this.data.withHeadings, stretched: this.data.stretched, content: t };
|
|
2573
|
+
return { withHeadings: this.data.withHeadings, stretched: this.data.stretched, content: t, colWidth: this.table.colWidthArr };
|
|
2630
2574
|
}
|
|
2631
2575
|
destroy() {
|
|
2632
2576
|
this.table.destroy();
|
|
@@ -2645,17 +2589,16 @@ class ae {
|
|
|
2645
2589
|
}
|
|
2646
2590
|
}
|
|
2647
2591
|
}
|
|
2648
|
-
function
|
|
2592
|
+
function W(u, t = null, e = {}) {
|
|
2649
2593
|
const i = document.createElement(u);
|
|
2650
2594
|
Array.isArray(t) ? i.classList.add(...t) : t !== null && i.classList.add(t);
|
|
2651
|
-
for (const s in e)
|
|
2652
|
-
e.hasOwnProperty(s) && (i[s] = e[s]);
|
|
2595
|
+
for (const s in e) e.hasOwnProperty(s) && (i[s] = e[s]);
|
|
2653
2596
|
return i;
|
|
2654
2597
|
}
|
|
2655
|
-
var
|
|
2656
|
-
class
|
|
2598
|
+
var G = ((u) => (u.Empty = "empty", u.Uploading = "uploading", u.Filled = "filled", u))(G || {});
|
|
2599
|
+
class ke {
|
|
2657
2600
|
constructor({ api: t, config: e, onSelectFile: i, readOnly: s }) {
|
|
2658
|
-
this.api = t, this.config = e, this.onSelectFile = i, this.readOnly = s, this.nodes = { wrapper:
|
|
2601
|
+
this.api = t, this.config = e, this.onSelectFile = i, this.readOnly = s, this.nodes = { wrapper: W("div", [this.CSS.baseClass, this.CSS.wrapper]), imageContainer: W("div", [this.CSS.imageContainer]), fileButton: this.createFileButton(), imageEl: void 0, imagePreloader: W("div", this.CSS.imagePreloader), caption: W("div", [this.CSS.input, this.CSS.caption], { contentEditable: !this.readOnly }) }, this.nodes.caption.dataset.placeholder = this.config.captionPlaceholder, this.nodes.imageContainer.appendChild(this.nodes.imagePreloader), this.nodes.wrapper.appendChild(this.nodes.imageContainer), this.nodes.wrapper.appendChild(this.nodes.caption), this.nodes.wrapper.appendChild(this.nodes.fileButton);
|
|
2659
2602
|
}
|
|
2660
2603
|
applyTune(t, e) {
|
|
2661
2604
|
this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${t}`, e);
|
|
@@ -2672,7 +2615,7 @@ class Te {
|
|
|
2672
2615
|
fillImage(t) {
|
|
2673
2616
|
const e = /\.mp4$/.test(t) ? "VIDEO" : "IMG", i = { src: t };
|
|
2674
2617
|
let s = "load";
|
|
2675
|
-
e === "VIDEO" && (i.autoplay = !0, i.loop = !0, i.muted = !0, i.playsinline = !0, s = "loadeddata"), this.nodes.imageEl =
|
|
2618
|
+
e === "VIDEO" && (i.autoplay = !0, i.loop = !0, i.muted = !0, i.playsinline = !0, s = "loadeddata"), this.nodes.imageEl = W(e, this.CSS.imageEl, i), this.nodes.imageEl.addEventListener(s, () => {
|
|
2676
2619
|
this.toggleStatus("filled"), this.nodes.imagePreloader !== void 0 && (this.nodes.imagePreloader.style.backgroundImage = "");
|
|
2677
2620
|
}), this.nodes.imageContainer.appendChild(this.nodes.imageEl);
|
|
2678
2621
|
}
|
|
@@ -2680,24 +2623,23 @@ class Te {
|
|
|
2680
2623
|
this.nodes.caption !== void 0 && (this.nodes.caption.innerHTML = t);
|
|
2681
2624
|
}
|
|
2682
2625
|
toggleStatus(t) {
|
|
2683
|
-
for (const e in
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
}
|
|
2626
|
+
for (const e in G) if (Object.prototype.hasOwnProperty.call(G, e)) {
|
|
2627
|
+
const i = G[e];
|
|
2628
|
+
this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${i}`, i === t);
|
|
2629
|
+
}
|
|
2688
2630
|
}
|
|
2689
2631
|
get CSS() {
|
|
2690
2632
|
return { baseClass: this.api.styles.block, loading: this.api.styles.loader, input: this.api.styles.input, button: this.api.styles.button, wrapper: "image-tool", imageContainer: "image-tool__image", imagePreloader: "image-tool__image-preloader", imageEl: "image-tool__image-picture", caption: "image-tool__caption" };
|
|
2691
2633
|
}
|
|
2692
2634
|
createFileButton() {
|
|
2693
2635
|
var e;
|
|
2694
|
-
const t =
|
|
2695
|
-
return t.innerHTML = (e = this.config.buttonContent) != null ? e : `${
|
|
2636
|
+
const t = W("div", [this.CSS.button]);
|
|
2637
|
+
return t.innerHTML = (e = this.config.buttonContent) != null ? e : `${Pt} ${this.api.i18n.t("Select an Image")}`, t.addEventListener("click", () => {
|
|
2696
2638
|
this.onSelectFile();
|
|
2697
2639
|
}), t;
|
|
2698
2640
|
}
|
|
2699
2641
|
}
|
|
2700
|
-
class
|
|
2642
|
+
class we {
|
|
2701
2643
|
constructor({ config: t, onUpload: e, onError: i }) {
|
|
2702
2644
|
this.config = t, this.onUpload = e, this.onError = i;
|
|
2703
2645
|
}
|
|
@@ -2706,45 +2648,42 @@ class Ee {
|
|
|
2706
2648
|
let i = "", s = "";
|
|
2707
2649
|
const n = await function(m = {}) {
|
|
2708
2650
|
let f = !0;
|
|
2709
|
-
return new Promise((v,
|
|
2710
|
-
let
|
|
2711
|
-
|
|
2651
|
+
return new Promise((v, M) => {
|
|
2652
|
+
let L = document.createElement("INPUT");
|
|
2653
|
+
L.type = "file", m.multiple && L.setAttribute("multiple", "multiple"), m.accept && L.setAttribute("accept", m.accept), L.style.display = "none", document.body.appendChild(L), L.addEventListener("change", (D) => {
|
|
2712
2654
|
f = !1;
|
|
2713
|
-
const
|
|
2714
|
-
v(
|
|
2655
|
+
const U = D.target.files;
|
|
2656
|
+
v(U), document.body.removeChild(L);
|
|
2715
2657
|
}, !1), window.addEventListener("focus", () => {
|
|
2716
2658
|
setTimeout(() => {
|
|
2717
2659
|
f && v([]);
|
|
2718
2660
|
}, 1e3);
|
|
2719
|
-
}, { once: !0 }),
|
|
2661
|
+
}, { once: !0 }), L.click();
|
|
2720
2662
|
});
|
|
2721
2663
|
}({ accept: (g = this.config.types) != null ? g : "image/*" });
|
|
2722
|
-
if (!(n && n.length > 0))
|
|
2723
|
-
return void e();
|
|
2664
|
+
if (!(n && n.length > 0)) return void e();
|
|
2724
2665
|
(function(m) {
|
|
2725
2666
|
const f = new FileReader();
|
|
2726
2667
|
f.readAsDataURL(m), f.onload = (v) => {
|
|
2727
2668
|
t(v.target.result);
|
|
2728
2669
|
};
|
|
2729
2670
|
})(n[0]);
|
|
2730
|
-
const r = n[0], o = this.config.types.split(",");
|
|
2671
|
+
const r = n[0], o = this.config.types ? this.config.types.split(",") : [];
|
|
2731
2672
|
let a = r.name.lastIndexOf("."), d = r.name.slice(a);
|
|
2732
|
-
if (!o.includes(d.toLowerCase()))
|
|
2733
|
-
return void this.onError("文件类型不支持");
|
|
2673
|
+
if (!o.includes(d.toLowerCase())) return void this.onError("文件类型不支持");
|
|
2734
2674
|
let l = {};
|
|
2735
2675
|
if (this.config.userStore) {
|
|
2736
2676
|
const m = this.config.userStore.token, f = this.config.userStore.tokenName, v = this.config.userStore.tokenPrefix;
|
|
2737
2677
|
m && f && (l[f] = v + " " + m);
|
|
2738
2678
|
}
|
|
2739
2679
|
l["Content-Type"] = "application/json";
|
|
2740
|
-
const
|
|
2741
|
-
if (
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
m.status === 200 && (m = { success: 1, file: { url: i + s } }), this.onUpload(m);
|
|
2680
|
+
const p = K.create({ timeout: 18e5, headers: l }), c = await p.post(this.config.endpoints.byFile, { fileName: r.name, contentType: r.type });
|
|
2681
|
+
if (c.status !== 200) return void this.onError(c.statusText);
|
|
2682
|
+
const h = c.data;
|
|
2683
|
+
if (!h.success) return void this.onError(h.message);
|
|
2684
|
+
i = h.data.cdn, s = h.data.objectKey, K.create({ timeout: 18e5, headers: { "Content-Type": r.type } }).put(h.data.presignedUrl, r).then((m) => {
|
|
2685
|
+
let f = {};
|
|
2686
|
+
f = m.status === 200 ? { success: 1, file: { url: i + s } } : { success: 0, message: m.statusText }, this.onUpload(f);
|
|
2748
2687
|
}).catch((m) => {
|
|
2749
2688
|
this.onError(m);
|
|
2750
2689
|
});
|
|
@@ -2755,9 +2694,8 @@ class Ee {
|
|
|
2755
2694
|
const s = this.config.userStore.token, n = this.config.userStore.tokenName, r = this.config.userStore.tokenPrefix;
|
|
2756
2695
|
s && n && (i[n] = r + " " + s);
|
|
2757
2696
|
}
|
|
2758
|
-
e =
|
|
2759
|
-
if (s.status !== 200 || s.data.success === !1)
|
|
2760
|
-
return void this.onError(s.data.message);
|
|
2697
|
+
e = K.create({ timeout: 18e5, headers: i }).post(this.config.endpoints.byUrl, { url: t, accept: ".jpg,.jpeg,.gif,.png,.webp" }), e.then((s) => {
|
|
2698
|
+
if (s.status !== 200 || s.data.success === !1) return void this.onError(s.data.message);
|
|
2761
2699
|
let n = { success: 1, file: { url: s.data.data.cdn + s.data.data.objectKey } };
|
|
2762
2700
|
this.onUpload(n);
|
|
2763
2701
|
}).catch((s) => {
|
|
@@ -2765,35 +2703,33 @@ class Ee {
|
|
|
2765
2703
|
});
|
|
2766
2704
|
}
|
|
2767
2705
|
async uploadByFile(t, { onPreview: e }) {
|
|
2768
|
-
const i = this.config.types.split(",");
|
|
2706
|
+
const i = this.config.types ? this.config.types.split(",") : [];
|
|
2769
2707
|
let s = t.name.lastIndexOf("."), n = t.name.slice(s);
|
|
2770
|
-
if (!i.includes(n.toLowerCase()))
|
|
2771
|
-
return void this.onError("文件类型不支持");
|
|
2708
|
+
if (!i.includes(n.toLowerCase())) return void this.onError("文件类型不支持");
|
|
2772
2709
|
let r = {};
|
|
2773
2710
|
if (this.config.userStore) {
|
|
2774
|
-
const
|
|
2775
|
-
|
|
2711
|
+
const c = this.config.userStore.token, h = this.config.userStore.tokenName, g = this.config.userStore.tokenPrefix;
|
|
2712
|
+
c && h && (r[h] = g + " " + c);
|
|
2776
2713
|
}
|
|
2777
|
-
const o =
|
|
2714
|
+
const o = K.create({ timeout: 18e5, headers: r });
|
|
2778
2715
|
r["Content-Type"] = "application/json";
|
|
2779
2716
|
const a = await o.post(this.config.endpoints.byFile, { fileName: t.name, contentType: t.type });
|
|
2780
|
-
if (a.status !== 200)
|
|
2781
|
-
return void this.onError(a.statusText);
|
|
2717
|
+
if (a.status !== 200) return void this.onError(a.statusText);
|
|
2782
2718
|
const d = a.data;
|
|
2783
|
-
if (!d.success)
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
h.status === 200
|
|
2788
|
-
}).catch((
|
|
2789
|
-
this.onError(
|
|
2719
|
+
if (!d.success) return void this.onError(d.message);
|
|
2720
|
+
let l = d.data.cdn, p = d.data.objectKey;
|
|
2721
|
+
r["Content-Type"] = t.type, o.put(d.data.presignedUrl, t).then((c) => {
|
|
2722
|
+
let h = {};
|
|
2723
|
+
h = c.status === 200 ? { success: 1, file: { url: l + p } } : { success: 0, message: c.statusText }, this.onUpload(h);
|
|
2724
|
+
}).catch((c) => {
|
|
2725
|
+
this.onError(c);
|
|
2790
2726
|
});
|
|
2791
2727
|
}
|
|
2792
2728
|
}
|
|
2793
|
-
class
|
|
2729
|
+
class Z {
|
|
2794
2730
|
constructor({ data: t, config: e, api: i, readOnly: s, block: n }) {
|
|
2795
2731
|
var r;
|
|
2796
|
-
this.isCaptionEnabled = null, this.api = i, this.block = n, this.
|
|
2732
|
+
this.isCaptionEnabled = null, this.api = i, this.block = n, this.config = { endpoints: e.endpoints, additionalRequestData: e.additionalRequestData, additionalRequestHeaders: e.additionalRequestHeaders, field: e.field, types: e.types, captionPlaceholder: this.api.i18n.t((r = e.captionPlaceholder) != null ? r : "Caption"), buttonContent: e.buttonContent, uploader: e.uploader, actions: e.actions, features: e.features || {}, userStore: e.userStore }, this.uploader = new we({ config: this.config, onUpload: (o) => this.onUpload(o), onError: (o) => this.uploadingFailed(o) }), this.ui = new ke({ api: i, config: this.config, onSelectFile: () => {
|
|
2797
2733
|
this.uploader.uploadSelectedFile({ onPreview: (o) => {
|
|
2798
2734
|
this.ui.showPreloader(o);
|
|
2799
2735
|
}, noSelectedFile: () => {
|
|
@@ -2811,7 +2747,7 @@ class Y {
|
|
|
2811
2747
|
return !0;
|
|
2812
2748
|
}
|
|
2813
2749
|
static get toolbox() {
|
|
2814
|
-
return { icon:
|
|
2750
|
+
return { icon: Pt, title: "Image" };
|
|
2815
2751
|
}
|
|
2816
2752
|
static get tunes() {
|
|
2817
2753
|
return [{ name: "withBorder", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>', title: "With border", toggle: !0 }, { name: "stretched", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>', title: "Stretch image", toggle: !0 }, { name: "withBackground", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>', title: "With background", toggle: !0 }];
|
|
@@ -2829,8 +2765,8 @@ class Y {
|
|
|
2829
2765
|
}
|
|
2830
2766
|
renderSettings() {
|
|
2831
2767
|
var n;
|
|
2832
|
-
const t =
|
|
2833
|
-
((n = this.config.features) == null ? void 0 : n.caption) === "optional" && t.push({ name: "caption", icon:
|
|
2768
|
+
const t = Z.tunes.concat(this.config.actions || []), e = { border: "withBorder", background: "withBackground", stretch: "stretched", caption: "caption" };
|
|
2769
|
+
((n = this.config.features) == null ? void 0 : n.caption) === "optional" && t.push({ name: "caption", icon: Wt, title: "With caption", toggle: !0 });
|
|
2834
2770
|
const i = t.filter((r) => {
|
|
2835
2771
|
var a, d;
|
|
2836
2772
|
const o = Object.keys(e).find((l) => e[l] === r.name);
|
|
@@ -2841,8 +2777,7 @@ class Y {
|
|
|
2841
2777
|
return r.name === "caption" && (o = (a = this.isCaptionEnabled) != null ? a : o), o;
|
|
2842
2778
|
};
|
|
2843
2779
|
return i.map((r) => ({ icon: r.icon, label: this.api.i18n.t(r.title), name: r.name, toggle: r.toggle, isActive: s(r), onActivate: () => {
|
|
2844
|
-
if (typeof r.action == "function")
|
|
2845
|
-
return void r.action(r.name);
|
|
2780
|
+
if (typeof r.action == "function") return void r.action(r.name);
|
|
2846
2781
|
let o = !s(r);
|
|
2847
2782
|
r.name === "caption" && (this.isCaptionEnabled = !this.isCaptionEnabled, o = this.isCaptionEnabled), this.tuneToggled(r.name, o);
|
|
2848
2783
|
} }));
|
|
@@ -2874,7 +2809,7 @@ class Y {
|
|
|
2874
2809
|
}
|
|
2875
2810
|
set data(t) {
|
|
2876
2811
|
var e;
|
|
2877
|
-
this.image = t.file, this._data.caption = t.caption || "", this.ui.fillCaption(this._data.caption),
|
|
2812
|
+
this.image = t.file, this._data.caption = t.caption || "", this.ui.fillCaption(this._data.caption), Z.tunes.forEach(({ name: i }) => {
|
|
2878
2813
|
const s = t[i] !== void 0 && (t[i] === !0 || t[i] === "true");
|
|
2879
2814
|
this.setTune(i, s);
|
|
2880
2815
|
}), (t.caption || ((e = this.config.features) == null ? void 0 : e.caption) === !0) && this.setTune("caption", !0);
|
|
@@ -2910,19 +2845,19 @@ class Y {
|
|
|
2910
2845
|
this.ui.showPreloader(t), this.uploader.uploadByUrl(t);
|
|
2911
2846
|
}
|
|
2912
2847
|
}
|
|
2913
|
-
class
|
|
2848
|
+
class be {
|
|
2914
2849
|
constructor({ api: t, data: e, config: i, block: s }) {
|
|
2915
|
-
var n, r, o, a, d, l,
|
|
2916
|
-
this.settings = [], this.api = t, this.block = s, this.data = { floatLeft: (n = e == null ? void 0 : e.floatLeft) != null ? n : !1, floatRight: (r = e == null ? void 0 : e.floatRight) != null ? r : !1, center: (o = e == null ? void 0 : e.center) != null ? o : !1, sizeSmall: (a = e == null ? void 0 : e.sizeSmall) != null ? a : !1, sizeMiddle: (d = e == null ? void 0 : e.sizeMiddle) != null ? d : !1, sizeLarge: (l = e == null ? void 0 : e.sizeLarge) != null ? l : !1, resize: (
|
|
2850
|
+
var n, r, o, a, d, l, p, c, h;
|
|
2851
|
+
this.settings = [], this.api = t, this.block = s, this.data = { floatLeft: (n = e == null ? void 0 : e.floatLeft) != null ? n : !1, floatRight: (r = e == null ? void 0 : e.floatRight) != null ? r : !1, center: (o = e == null ? void 0 : e.center) != null ? o : !1, sizeSmall: (a = e == null ? void 0 : e.sizeSmall) != null ? a : !1, sizeMiddle: (d = e == null ? void 0 : e.sizeMiddle) != null ? d : !1, sizeLarge: (l = e == null ? void 0 : e.sizeLarge) != null ? l : !1, resize: (c = (p = e == null ? void 0 : e.resize) != null ? p : i == null ? void 0 : i.resize) != null ? c : !1, resizeSize: (h = e == null ? void 0 : e.resizeSize) != null ? h : 0 }, this.wrapper = void 0, this.buttons = [], this.styles = { settingsButton: "cdx-settings-button", settingsButtonActive: "cdx-settings-button--active", settingsButtonModifier: "", settingsButtonModifierActive: "" };
|
|
2917
2852
|
}
|
|
2918
2853
|
static get isTune() {
|
|
2919
2854
|
return !0;
|
|
2920
2855
|
}
|
|
2921
2856
|
static get sanitize() {
|
|
2922
|
-
return { floatLeft: {}, floatRight: {}, center: {}, sizeSmall: {}, sizeMiddle: {}, sizeLarge: {}, resize: {}, resizeSize: {}
|
|
2857
|
+
return { floatLeft: {}, floatRight: {}, center: {}, sizeSmall: {}, sizeMiddle: {}, sizeLarge: {}, resize: {}, resizeSize: {} };
|
|
2923
2858
|
}
|
|
2924
2859
|
get CSS() {
|
|
2925
|
-
return { wrapper: "cdx-image-tool-tune", button: this.styles.settingsButton, buttonActive: this.styles.settingsButtonActive, buttonModifier: this.styles.settingsButtonModifier || "", buttonModifierActive: this.styles.settingsButtonModifierActive || "", isFloatLeft: "cdx-image-tool-tune--floatLeft", isFloatRight: "cdx-image-tool-tune--floatRight", isCenter: "cdx-image-tool-tune--center", isSizeSmall: "cdx-image-tool-tune--sizeSmall", isSizeMiddle: "cdx-image-tool-tune--sizeMiddle", isSizeLarge: "cdx-image-tool-tune--sizeLarge", isResize: "cdx-image-tool-tune--resize"
|
|
2860
|
+
return { wrapper: "cdx-image-tool-tune", button: this.styles.settingsButton, buttonActive: this.styles.settingsButtonActive, buttonModifier: this.styles.settingsButtonModifier || "", buttonModifierActive: this.styles.settingsButtonModifierActive || "", isFloatLeft: "cdx-image-tool-tune--floatLeft", isFloatRight: "cdx-image-tool-tune--floatRight", isCenter: "cdx-image-tool-tune--center", isSizeSmall: "cdx-image-tool-tune--sizeSmall", isSizeMiddle: "cdx-image-tool-tune--sizeMiddle", isSizeLarge: "cdx-image-tool-tune--sizeLarge", isResize: "cdx-image-tool-tune--resize" };
|
|
2926
2861
|
}
|
|
2927
2862
|
get view() {
|
|
2928
2863
|
return this.wrapper || (this.wrapper = this.createView()), this.wrapper;
|
|
@@ -2948,93 +2883,29 @@ class le {
|
|
|
2948
2883
|
this.data.center = !this.data.center, this.data.floatLeft = !1, this.data.floatRight = !1;
|
|
2949
2884
|
break;
|
|
2950
2885
|
case "sizeSmall":
|
|
2951
|
-
this.data.sizeSmall = !this.data.sizeSmall, this.data.sizeMiddle = !1, this.data.sizeLarge = !1, this.data.resize = !1
|
|
2886
|
+
this.data.sizeSmall = !this.data.sizeSmall, this.data.sizeMiddle = !1, this.data.sizeLarge = !1, this.data.resize = !1;
|
|
2952
2887
|
break;
|
|
2953
2888
|
case "sizeMiddle":
|
|
2954
|
-
this.data.sizeSmall = !1, this.data.sizeMiddle = !this.data.sizeMiddle, this.data.sizeLarge = !1, this.data.resize = !1
|
|
2889
|
+
this.data.sizeSmall = !1, this.data.sizeMiddle = !this.data.sizeMiddle, this.data.sizeLarge = !1, this.data.resize = !1;
|
|
2955
2890
|
break;
|
|
2956
2891
|
case "sizeLarge":
|
|
2957
|
-
this.data.sizeSmall = !1, this.data.sizeMiddle = !1, this.data.sizeLarge = !this.data.sizeLarge, this.data.resize = !1
|
|
2892
|
+
this.data.sizeSmall = !1, this.data.sizeMiddle = !1, this.data.sizeLarge = !this.data.sizeLarge, this.data.resize = !1;
|
|
2958
2893
|
break;
|
|
2959
2894
|
case "resize":
|
|
2960
|
-
this.data.sizeSmall = !1, this.data.sizeMiddle = !1, this.data.sizeLarge = !1, this.data.resize = !this.data.resize
|
|
2961
|
-
break;
|
|
2962
|
-
case "crop":
|
|
2963
|
-
this.data.crop = !this.data.crop, this.data.sizeSmall = !1, this.data.sizeMiddle = !1, this.data.sizeLarge = !1, this.data.resize = !1, this.data.resizeSize = 0;
|
|
2895
|
+
this.data.sizeSmall = !1, this.data.sizeMiddle = !1, this.data.sizeLarge = !1, this.data.resize = !this.data.resize;
|
|
2964
2896
|
break;
|
|
2965
2897
|
default:
|
|
2966
|
-
this.data.floatLeft = !1, this.data.floatRight = !1, this.data.sizeSmall = !1, this.data.sizeMiddle = !1, this.data.sizeLarge = !1, this.data.resize = !1
|
|
2898
|
+
this.data.floatLeft = !1, this.data.floatRight = !1, this.data.sizeSmall = !1, this.data.sizeMiddle = !1, this.data.sizeLarge = !1, this.data.resize = !1;
|
|
2967
2899
|
}
|
|
2968
|
-
this.data.resize || (this.data.resizeSize = 0)
|
|
2900
|
+
this.data.resize || (this.data.resizeSize = 0);
|
|
2969
2901
|
const e = this.block.holder.querySelector(".ce-block__content");
|
|
2970
2902
|
this.apply(e), this.block.dispatchChange();
|
|
2971
2903
|
}
|
|
2972
2904
|
apply(t) {
|
|
2973
|
-
this.data.floatLeft ? t.classList.add(this.CSS.isFloatLeft) : t.classList.remove(this.CSS.isFloatLeft), this.data.floatRight ? t.classList.add(this.CSS.isFloatRight) : t.classList.remove(this.CSS.isFloatRight), this.data.center ? t.classList.add(this.CSS.isCenter) : t.classList.remove(this.CSS.isCenter), this.data.sizeSmall ? t.classList.add(this.CSS.isSizeSmall) : t.classList.remove(this.CSS.isSizeSmall), this.data.sizeMiddle ? t.classList.add(this.CSS.isSizeMiddle) : t.classList.remove(this.CSS.isSizeMiddle), this.data.sizeLarge ? t.classList.add(this.CSS.isSizeLarge) : t.classList.remove(this.CSS.isSizeLarge), this.data.resize ? (t.classList.add(this.CSS.isResize), this.data.resizeSize > 0 && (t.getElementsByClassName("cdx-block")[0].style.width = this.data.resizeSize + "px"), this.resize(t)) : (t.classList.remove(this.CSS.isResize), this.unresize(t))
|
|
2974
|
-
}
|
|
2975
|
-
crop(t) {
|
|
2976
|
-
if (this.api.readOnly.isEnabled)
|
|
2977
|
-
return;
|
|
2978
|
-
const e = t.getElementsByClassName("image-tool__image")[0], i = document.createElement("div");
|
|
2979
|
-
i.classList.add("crop-btn", "btn-crop-action"), i.innerHTML = this.api.i18n.t("Crop"), i.addEventListener("click", () => {
|
|
2980
|
-
e.removeChild(i), this.appendCrop(t);
|
|
2981
|
-
}), e.appendChild(i);
|
|
2982
|
-
}
|
|
2983
|
-
appendCrop(t) {
|
|
2984
|
-
if (this.api.readOnly.isEnabled)
|
|
2985
|
-
return;
|
|
2986
|
-
this.uncrop(t);
|
|
2987
|
-
const e = t.getElementsByClassName("cdx-block")[0], i = e.getElementsByTagName("img")[0];
|
|
2988
|
-
e.classList.add("isCropping"), this.data.cropperInterface = new Cropper(i);
|
|
2989
|
-
const s = document.createElement("div");
|
|
2990
|
-
s.classList.add("crop-save", "btn-crop-action"), s.innerHTML = this.api.i18n.t("Apply"), s.addEventListener("click", () => {
|
|
2991
|
-
this.data.cropperInterface && (this.data.cropperFrameHeight = this.data.cropperInterface.getCropBoxData().height, this.data.cropperFrameWidth = this.data.cropperInterface.getCropBoxData().width, this.data.cropperFrameLeft = this.data.cropperInterface.getCanvasData().left - this.data.cropperInterface.getCropBoxData().left, this.data.cropperFrameTop = this.data.cropperInterface.getCanvasData().top - this.data.cropperInterface.getCropBoxData().top, this.data.cropperImageHeight = this.data.cropperInterface.getImageData().height, this.data.cropperImageWidth = this.data.cropperInterface.getImageData().width), this.applyCrop(t);
|
|
2992
|
-
}), t.getElementsByClassName("image-tool__image")[0].appendChild(s), t.classList.add("isCropping");
|
|
2993
|
-
}
|
|
2994
|
-
applyCrop(t) {
|
|
2995
|
-
const e = t.getElementsByClassName("cdx-block")[0];
|
|
2996
|
-
if (e) {
|
|
2997
|
-
e.style.minWidth = this.data.cropperFrameWidth + "px", e.style.maxWidth = this.data.cropperFrameWidth + "px";
|
|
2998
|
-
const n = e.getElementsByTagName("img")[0];
|
|
2999
|
-
n.style.width = this.data.cropperImageWidth + "px", n.style.height = this.data.cropperImageHeight + "px";
|
|
3000
|
-
const r = t.getElementsByClassName("image-tool__image")[0];
|
|
3001
|
-
r.style.width = this.data.cropperFrameWidth + "px", r.style.height = this.data.cropperFrameHeight + "px";
|
|
3002
|
-
const o = r.getElementsByTagName("img")[0];
|
|
3003
|
-
o && (o.style.left = this.data.cropperFrameLeft + "px", o.style.top = this.data.cropperFrameTop + "px", o.classList.add("isCropped")), e.classList.remove("isCropping");
|
|
3004
|
-
const a = t.getElementsByClassName("btn-crop-action")[0];
|
|
3005
|
-
a && r.removeChild(a);
|
|
3006
|
-
}
|
|
3007
|
-
if (this.data.cropperInterface && (this.data.cropperInterface.destroy(), this.data.cropperInterface = void 0), this.api.readOnly.isEnabled)
|
|
3008
|
-
return;
|
|
3009
|
-
const i = document.createElement("div");
|
|
3010
|
-
i.classList.add("crop-btn", "btn-crop-action"), i.innerHTML = this.api.i18n.t("Crop");
|
|
3011
|
-
const s = t.getElementsByClassName("image-tool__image")[0];
|
|
3012
|
-
s && (i.addEventListener("click", () => {
|
|
3013
|
-
s.removeChild(i), this.appendCrop(t);
|
|
3014
|
-
}), s.appendChild(i)), t.classList.remove("isCropping"), this.block.dispatchChange();
|
|
3015
|
-
}
|
|
3016
|
-
uncrop(t) {
|
|
3017
|
-
if (this.api.readOnly.isEnabled)
|
|
3018
|
-
return;
|
|
3019
|
-
const e = t.getElementsByClassName("image-tool__image")[0], i = t.getElementsByClassName("btn-crop-action")[0];
|
|
3020
|
-
i && e && e.removeChild(i);
|
|
3021
|
-
const s = t.getElementsByClassName("btn-crop-action")[0];
|
|
3022
|
-
s && e && e.removeChild(s);
|
|
3023
|
-
const n = t.getElementsByClassName("cdx-block")[0];
|
|
3024
|
-
if (n) {
|
|
3025
|
-
const r = n.getElementsByTagName("img")[0];
|
|
3026
|
-
r && r.classList.remove("isCropped"), n.classList.remove("isCropping"), n.style.minWidth = "", n.style.maxWidth = "";
|
|
3027
|
-
}
|
|
3028
|
-
if (e) {
|
|
3029
|
-
e.style.width = "", e.style.height = "";
|
|
3030
|
-
const r = e.getElementsByTagName("img")[0];
|
|
3031
|
-
r && (r.style.left = "", r.style.top = "", r.style.width = "", r.style.height = "");
|
|
3032
|
-
}
|
|
3033
|
-
t.classList.remove("isCropping"), this.data.cropperInterface && (this.data.cropperInterface.destroy(), this.data.cropperInterface = void 0), this.data.cropperFrameHeight = 0, this.data.cropperFrameWidth = 0, this.data.cropperFrameLeft = 0, this.data.cropperFrameTop = 0, this.data.cropperImageHeight = 0, this.data.cropperImageWidth = 0;
|
|
2905
|
+
this.data.floatLeft ? t.classList.add(this.CSS.isFloatLeft) : t.classList.remove(this.CSS.isFloatLeft), this.data.floatRight ? t.classList.add(this.CSS.isFloatRight) : t.classList.remove(this.CSS.isFloatRight), this.data.center ? t.classList.add(this.CSS.isCenter) : t.classList.remove(this.CSS.isCenter), this.data.sizeSmall ? t.classList.add(this.CSS.isSizeSmall) : t.classList.remove(this.CSS.isSizeSmall), this.data.sizeMiddle ? t.classList.add(this.CSS.isSizeMiddle) : t.classList.remove(this.CSS.isSizeMiddle), this.data.sizeLarge ? t.classList.add(this.CSS.isSizeLarge) : t.classList.remove(this.CSS.isSizeLarge), this.data.resize ? (t.classList.add(this.CSS.isResize), this.data.resizeSize > 0 && (t.getElementsByClassName("cdx-block")[0].style.width = this.data.resizeSize + "px"), this.resize(t)) : (t.classList.remove(this.CSS.isResize), this.unresize(t));
|
|
3034
2906
|
}
|
|
3035
2907
|
resize(t) {
|
|
3036
|
-
if (this.api.readOnly.isEnabled)
|
|
3037
|
-
return;
|
|
2908
|
+
if (this.api.readOnly.isEnabled) return;
|
|
3038
2909
|
const e = document.createElement("div");
|
|
3039
2910
|
e.classList.add("resizable");
|
|
3040
2911
|
const i = document.createElement("div");
|
|
@@ -3061,8 +2932,8 @@ class le {
|
|
|
3061
2932
|
let n = 0, r = 0;
|
|
3062
2933
|
const o = (d) => {
|
|
3063
2934
|
const l = d.clientX - n;
|
|
3064
|
-
let
|
|
3065
|
-
e === "right" && (
|
|
2935
|
+
let p = r;
|
|
2936
|
+
e === "right" && (p += l), e === "left" && (p -= l), p > 50 && p < s && (t.style.width = p + "px");
|
|
3066
2937
|
}, a = () => {
|
|
3067
2938
|
const d = parseInt(window.getComputedStyle(t).width, 10);
|
|
3068
2939
|
d > 0 && (this.data.resizeSize = d), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", a), this.block.dispatchChange();
|
|
@@ -3076,13 +2947,13 @@ class le {
|
|
|
3076
2947
|
unwrap(t) {
|
|
3077
2948
|
this.buttons.forEach((n) => {
|
|
3078
2949
|
n.classList.remove(this.CSS.buttonActive);
|
|
3079
|
-
}), t.classList.remove(this.CSS.isFloatLeft), t.classList.remove(this.CSS.isFloatRight), t.classList.remove(this.CSS.isCenter), t.classList.remove(this.CSS.isSizeSmall), t.classList.remove(this.CSS.isSizeMiddle), t.classList.remove(this.CSS.isSizeLarge), t.classList.remove(this.CSS.isResize)
|
|
2950
|
+
}), t.classList.remove(this.CSS.isFloatLeft), t.classList.remove(this.CSS.isFloatRight), t.classList.remove(this.CSS.isCenter), t.classList.remove(this.CSS.isSizeSmall), t.classList.remove(this.CSS.isSizeMiddle), t.classList.remove(this.CSS.isSizeLarge), t.classList.remove(this.CSS.isResize);
|
|
3080
2951
|
const e = t.getElementsByClassName("cdx-block")[0];
|
|
3081
|
-
e.
|
|
2952
|
+
e.style.minWidth = "", e.style.maxWidth = "";
|
|
3082
2953
|
const i = t.getElementsByClassName("image-tool__image")[0];
|
|
3083
2954
|
i.style.width = "", i.style.height = "";
|
|
3084
2955
|
const s = i.getElementsByTagName("img")[0];
|
|
3085
|
-
return s.style.left = "", s.style.top = "", s.style.width = "", s.style.height = "", this.unresize(t),
|
|
2956
|
+
return s.style.left = "", s.style.top = "", s.style.width = "", s.style.height = "", this.unresize(t), t;
|
|
3086
2957
|
}
|
|
3087
2958
|
save() {
|
|
3088
2959
|
return this.data;
|
|
@@ -3091,7 +2962,7 @@ class le {
|
|
|
3091
2962
|
return this.wrapper || (this.wrapper = this.createView()), this.apply(t), t;
|
|
3092
2963
|
}
|
|
3093
2964
|
tuneNameToI18nKey(t) {
|
|
3094
|
-
return {
|
|
2965
|
+
return { resize: "Resize" }[t];
|
|
3095
2966
|
}
|
|
3096
2967
|
createView() {
|
|
3097
2968
|
this.buttons = this.settings.map((e) => {
|
|
@@ -3119,9 +2990,9 @@ class le {
|
|
|
3119
2990
|
this.setTune(t);
|
|
3120
2991
|
}
|
|
3121
2992
|
}
|
|
3122
|
-
class
|
|
2993
|
+
class ye {
|
|
3123
2994
|
constructor(t, e) {
|
|
3124
|
-
this.
|
|
2995
|
+
this.holder = document.getElementById(t);
|
|
3125
2996
|
}
|
|
3126
2997
|
render(t) {
|
|
3127
2998
|
var i;
|
|
@@ -3151,83 +3022,50 @@ class de {
|
|
|
3151
3022
|
}), e;
|
|
3152
3023
|
}
|
|
3153
3024
|
}
|
|
3154
|
-
const
|
|
3155
|
-
const i =
|
|
3025
|
+
const Se = { class: "ebl-editor", id: "holder" }, Le = Ut({ name: "EblEditor", inheritAttrs: !1, __name: "Editor", props: { readOnly: { type: Boolean, default: !1 }, placeholder: { default: "Enter something" }, data: { default: () => ({ blocks: [] }) }, locale: { default: {} }, userStore: {}, showOutline: { type: Boolean, default: !1 } }, emits: ["onReady", "onChange"], setup(u, { expose: t, emit: e }) {
|
|
3026
|
+
const i = jt("EblEditorSettings");
|
|
3156
3027
|
let s = e;
|
|
3157
3028
|
const n = u;
|
|
3158
|
-
let r =
|
|
3159
|
-
const
|
|
3160
|
-
return
|
|
3161
|
-
a = new
|
|
3162
|
-
s("onChange",
|
|
3029
|
+
let r = J(n.data), o = !1, a = null, d = null, l = null;
|
|
3030
|
+
const p = ["indent", "blockAlignment"];
|
|
3031
|
+
return qt(() => {
|
|
3032
|
+
a = new Xt({ minHeight: 300, holder: "holder", autofocus: !0, defaultBlock: "paragraph", placeholder: n.placeholder, tunes: p, tools: { inlineCode: F, underline: lt, Color: { class: me }, marker: { class: $ }, indent: { class: at }, alert: { class: I, inlineToolbar: !0 }, List: { class: X, inlineToolbar: !0, config: { defaultStyle: "checklist", maxLevel: 4 } }, h1: { class: re, inlineToolbar: !0 }, h2: { class: oe, inlineToolbar: !0 }, h3: { class: ae, inlineToolbar: !0 }, h4: { class: le, inlineToolbar: !0 }, h5: { class: de, inlineToolbar: !0 }, h6: { class: he, inlineToolbar: !0 }, paragraph: { class: ct, inlineToolbar: !0 }, blockAlignment: { class: ht, inlineToolbar: !0 }, code: { class: q, config: { lang: "javascript", theme: "github-dark-dimmed" } }, quote: { class: ce, inlineToolbar: !0 }, delimiter: ue, table: { class: ve, inlineToolbar: !0, config: { rows: 2, cols: 3 } }, image: { class: Z, inlineToolbar: !0, tunes: p.concat(["imageResize"]), config: { types: ".png,.jpeg,.jpg,.gif,.webp", userStore: n.userStore, endpoints: { byFile: i == null ? void 0 : i.fileUploadEndpoint }, features: { caption: !1, stretch: !1, border: !1, background: !1 } } }, imageResize: { class: be, config: { resize: !0, crop: !1 } } }, data: r, readOnly: n.readOnly, i18n: n.locale, onChange: (c, h) => {
|
|
3033
|
+
s("onChange", c, h);
|
|
3163
3034
|
}, onReady: () => {
|
|
3164
|
-
o = !0, new
|
|
3165
|
-
} }), r =
|
|
3035
|
+
o = !0, new ne("holder", n.readOnly, a, "1px solid #999"), d = new ge({ editor: a, config: { debounceTimer: 200, maxLength: 100 }, onUpdate: () => {
|
|
3036
|
+
} }), r = J(n.data), d.initialize(r), n.data && n.data.blocks && n.data.blocks.length > 0 && a.render(r), n.showOutline && (l = new ye("holder", a), l.render(r)), s("onReady");
|
|
3166
3037
|
} });
|
|
3167
|
-
}),
|
|
3038
|
+
}), Vt(() => {
|
|
3168
3039
|
a !== null && (a.destroy(), a = null);
|
|
3169
|
-
}),
|
|
3170
|
-
r =
|
|
3040
|
+
}), Kt(() => n.data, (c, h) => {
|
|
3041
|
+
r = J(c), a != null && o && a.render(r).then(() => {
|
|
3171
3042
|
l != null && n.showOutline && l.render(r);
|
|
3172
3043
|
}), d != null && (d.clear(), d.initialize(r));
|
|
3173
3044
|
}, { deep: !0 }), t({ validate: function() {
|
|
3174
|
-
return new Promise((
|
|
3175
|
-
if (a === null)
|
|
3176
|
-
|
|
3177
|
-
a.save().then((g) => g.blocks.length > 0 ? h(!0) : h(!1));
|
|
3178
|
-
});
|
|
3179
|
-
}, getData: function() {
|
|
3180
|
-
return new Promise((h, p) => {
|
|
3181
|
-
if (a === null)
|
|
3182
|
-
return h(null);
|
|
3183
|
-
a.save().then((g) => h(g));
|
|
3184
|
-
});
|
|
3185
|
-
} }), (h, p) => (Pt(), $t("div", Me));
|
|
3186
|
-
} }), Ie = { class: "ebl-editor readonly", id: "holder" }, He = Dt({ name: "EblEditorRender", inheritAttrs: !1, __name: "EditorRender", props: { data: { default: () => ({ blocks: [] }) }, locale: { default: {} }, showOutline: { type: Boolean, default: !1 } }, emits: ["onReady", "onChange"], setup(u, { expose: t, emit: e }) {
|
|
3187
|
-
let i = e;
|
|
3188
|
-
const s = u;
|
|
3189
|
-
let n = j(s.data), r = !1, o = null, a = null;
|
|
3190
|
-
const d = ["indent", "blockAlignment"];
|
|
3191
|
-
return Nt(() => {
|
|
3192
|
-
o = new jt({ minHeight: 50, holder: "holder", autofocus: !0, defaultBlock: "paragraph", placeholder: s.placeholder, tunes: d, tools: { inlineCode: W, underline: oe, Color: { class: ne }, marker: { class: N }, indent: { class: se }, alert: { class: _, inlineToolbar: !0 }, List: { class: K, inlineToolbar: !0, config: { defaultStyle: "checklist", maxLevel: 4 } }, h1: { class: Gt, inlineToolbar: !0 }, h2: { class: Xt, inlineToolbar: !0 }, h3: { class: Jt, inlineToolbar: !0 }, h4: { class: Qt, inlineToolbar: !0 }, h5: { class: Zt, inlineToolbar: !0 }, h6: { class: te, inlineToolbar: !0 }, paragraph: { class: tt, inlineToolbar: !0 }, blockAlignment: { class: Z, inlineToolbar: !0 }, code: { class: U, config: { lang: "javascript", theme: "github-dark-dimmed" } }, quote: { class: ee, inlineToolbar: !0 }, delimiter: ie, table: { class: ae, inlineToolbar: !0, config: { rows: 2, cols: 3 } }, image: { class: Y, inlineToolbar: !0, tunes: d.concat(["imageResize"]), config: { types: ".png,.jpeg,.jpg,.gif,.webp", endpoints: { byFile: "" }, features: { caption: !1, stretch: !1, border: !1, background: !1 } } }, imageResize: { class: le, config: { resize: !0, crop: !1 } } }, data: n, readOnly: !0, i18n: s.locale, onChange: (l, c) => {
|
|
3193
|
-
i("onChange", l, c);
|
|
3194
|
-
}, onReady: () => {
|
|
3195
|
-
r = !0, n = j(s.data), s.data && s.data.blocks && s.data.blocks.length > 0 && o.render(n), s.showOutline && (a = new de("holder", o), a.render(n)), i("onReady");
|
|
3196
|
-
} });
|
|
3197
|
-
}), Wt(() => {
|
|
3198
|
-
o !== null && (o.destroy(), o = null);
|
|
3199
|
-
}), Ft(() => s.data, (l, c) => {
|
|
3200
|
-
n = j(l), o != null && r && o.render(n).then(() => {
|
|
3201
|
-
a != null && s.showOutline && a.render(n);
|
|
3202
|
-
});
|
|
3203
|
-
}, { deep: !0 }), t({ validate: function() {
|
|
3204
|
-
return new Promise((l, c) => {
|
|
3205
|
-
if (o === null)
|
|
3206
|
-
return l(!1);
|
|
3207
|
-
o.save().then((h) => h.blocks.length > 0 ? l(!0) : l(!1));
|
|
3045
|
+
return new Promise((c, h) => {
|
|
3046
|
+
if (a === null) return c(!1);
|
|
3047
|
+
a.save().then((g) => g.blocks.length > 0 ? c(!0) : c(!1));
|
|
3208
3048
|
});
|
|
3209
3049
|
}, getData: function() {
|
|
3210
|
-
return new Promise((
|
|
3211
|
-
if (
|
|
3212
|
-
|
|
3213
|
-
o.save().then((h) => l(h));
|
|
3050
|
+
return new Promise((c, h) => {
|
|
3051
|
+
if (a === null) return c(null);
|
|
3052
|
+
a.save().then((g) => c(g));
|
|
3214
3053
|
});
|
|
3215
|
-
} }), (
|
|
3216
|
-
} }),
|
|
3217
|
-
let
|
|
3218
|
-
for (let u in
|
|
3219
|
-
const t =
|
|
3220
|
-
|
|
3054
|
+
} }), (c, h) => (Gt(), Yt("div", Se));
|
|
3055
|
+
} }), Nt = [Le];
|
|
3056
|
+
let $t = [];
|
|
3057
|
+
for (let u in Nt) {
|
|
3058
|
+
const t = se(Nt[u]);
|
|
3059
|
+
$t.push(t);
|
|
3221
3060
|
}
|
|
3222
|
-
const
|
|
3061
|
+
const Ie = { messages: { ui: { blockTunes: { toggler: { "Click to tune": "可拖拽和点击" } }, toolbar: { toolbox: { Add: "添加", Filter: "过滤", "Nothing found": "无内容" }, popover: { Filter: "过滤", "Nothing found": "无内容" } }, popover: { Filter: "筛选", "Nothing found": "未找到任何内容", "Convert to": "转化为", "Add below": "在下方插入" } }, toolNames: { Text: "段落", H1: "一级标题", H2: "二级标题", H3: "三级标题", H4: "四级标题", H5: "五级标题", H6: "六级标题", "Ordered List": "有序列表", "Unordered List": "无序列表", Checklist: "任务列表", Quote: "引用", Code: "代码块", Delimiter: "分割线", Link: "链接", Bold: "加粗", Italic: "倾斜", Alert: "高亮块", indent: "缩进", Marker: "突出显示", Color: "文本颜色", Underline: "下划线", InlineCode: "行内代码", Table: "表格", Image: "图片" }, tools: { image: { "Couldn’t upload image. Please try another.": "上传图片失败,请稍后重试。" }, table: { "Add row above": "在上面插入行", "Add row below": "在下面插入行", "Delete row": "删除行", "Add column to left": "在左边插入列", "Add column to right": "在右边插入列", "Delete column": "删除列", "With headings": "使用标题行", "Without headings": "不使用标题行" }, marker: { Marker: "突出显示" }, link: { "Add a link": "添加链接", Save: "确定", "Pasted link is not valid.": "链接地址无效" }, List: { Unordered: "无序", Ordered: "有序", Checklist: "任务列表", "Counter type": "计数器类型", Numeric: "阿拉伯数字", "Lower Roman": "小写罗马数字", "Upper Roman": "大写罗马数字", "Lower Alpha": "小写字母", "Upper Alpha": "大写字母", "Start with": "开始序号" }, paragraph: { "Enter something": "请输入内容" }, stub: { "The block can not be displayed correctly.": "该模块不能放置在这里" }, code: { "Enter your code": "输入代码", Copied: "已复制", "Unable to copy": "复制失败" }, convertTo: { "Convert to": "转化为" }, alert: { "alert-primary": "主要样式", "alert-secondary": "次要样式", "alert-info": "信息", "alert-success": "成功", "alert-warning": "警告", "alert-danger": "危险", "alert-light": "浅色", "alert-dark": "深色", "align-left": "左对齐", "align-center": "居中", "align-right": "右对齐", "Type here...": "输入内容" } }, blockTunes: { delete: { Delete: "删除", "Click to delete": "点击删除" }, moveUp: { "Move up": "向上移" }, moveDown: { "Move down": "向下移" }, filter: { Filter: "过滤" }, blockAlignment: { "left align": "左对齐", "center align": "居中对齐", "right align": "右对齐", "justify align": "两端对齐" }, indent: { "Indent right": "向右缩进", "Indent left": "向左缩进" } } } }, Ft = /* @__PURE__ */ ((u = []) => ({ version: "2.31.28", install: (t, e) => {
|
|
3223
3062
|
t[pt] || (t[pt] = !0, u.forEach((i) => t.use(i)), t.provide("EblEditorSettings", e));
|
|
3224
|
-
} }))(
|
|
3063
|
+
} }))($t), Ae = Ft.install, Be = Ft.version;
|
|
3225
3064
|
export {
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
We as zhCn
|
|
3065
|
+
Le as EblEditor,
|
|
3066
|
+
Ft as default,
|
|
3067
|
+
Ae as install,
|
|
3068
|
+
Be as version,
|
|
3069
|
+
Ie as zhCn
|
|
3232
3070
|
};
|
|
3233
3071
|
//# sourceMappingURL=index.mjs.map
|