@ebl-vue/editor-full 2.31.11 → 2.31.12
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.mjs +360 -319
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Editor/Editor.vue +22 -6
- package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +1 -1
- package/src/plugins/list/ListTabulator/index.ts +1 -1
- package/src/plugins/list/index.ts +118 -123
- package/src/plugins/list/styles/.cdx-list .css +168 -0
- package/src/plugins/list/utils/normalizeData.ts +0 -1
- package/src/plugins/list-bak/ListRenderer/ChecklistRenderer.ts +208 -0
- package/src/plugins/list-bak/ListRenderer/ListRenderer.ts +73 -0
- package/src/plugins/list-bak/ListRenderer/OrderedListRenderer.ts +123 -0
- package/src/plugins/list-bak/ListRenderer/UnorderedListRenderer.ts +123 -0
- package/src/plugins/list-bak/ListRenderer/index.ts +6 -0
- package/src/plugins/list-bak/ListTabulator/index.ts +1179 -0
- package/src/plugins/list-bak/index.ts +485 -0
- package/src/plugins/list-bak/styles/CssPrefix.ts +4 -0
- package/src/plugins/list-bak/styles/input.css +36 -0
- package/src/plugins/list-bak/styles/list.css +165 -0
- package/src/plugins/list-bak/types/Elements.ts +14 -0
- package/src/plugins/list-bak/types/ItemMeta.ts +40 -0
- package/src/plugins/list-bak/types/ListParams.ts +102 -0
- package/src/plugins/list-bak/types/ListRenderer.ts +6 -0
- package/src/plugins/list-bak/types/OlCounterType.ts +63 -0
- package/src/plugins/list-bak/types/index.ts +14 -0
- package/src/plugins/list-bak/utils/focusItem.ts +18 -0
- package/src/plugins/list-bak/utils/getChildItems.ts +40 -0
- package/src/plugins/list-bak/utils/getItemChildWrapper.ts +10 -0
- package/src/plugins/list-bak/utils/getItemContentElement.ts +10 -0
- package/src/plugins/list-bak/utils/getSiblings.ts +52 -0
- package/src/plugins/list-bak/utils/isLastItem.ts +9 -0
- package/src/plugins/list-bak/utils/itemHasSublist.ts +10 -0
- package/src/plugins/list-bak/utils/normalizeData.ts +84 -0
- package/src/plugins/list-bak/utils/removeChildWrapperIfEmpty.ts +31 -0
- package/src/plugins/list-bak/utils/renderToolboxInput.ts +105 -0
- package/src/plugins/list-bak/utils/stripNumbers.ts +7 -0
- package/src/plugins/list-bak/utils/type-guards.ts +8 -0
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
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}@media (min-width: 1050px){.ce-block__content,.ce-toolbar__content{max-width:700px}}.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}.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:.6em 0 3px;margin:0;line-height:1.25em;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:1.6em;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__textarea{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__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:50px;height:50px;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 .image-tool__image{min-height:200px;display:-webkit-box;display:-ms-flexbox;display:flex;border:1px solid var(--border-color);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{width:8px;height:8px;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%}')),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
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { defineComponent as qt, inject as Vt, toRaw as Q, onMounted as Kt, onUnmounted as Yt, watch as Gt, openBlock as Xt, createElementBlock as Jt } from "vue";
|
|
3
|
+
import Qt from "@ebl-vue/editorjs";
|
|
4
|
+
import { bundledLanguagesInfo as Zt, codeToHtml as te } from "shiki";
|
|
5
|
+
import * as ht from "@editorjs/dom";
|
|
6
|
+
import { make as S, isEmpty as at } from "@editorjs/dom";
|
|
7
|
+
import { focus as ee, isCaretAtStartOfInput as ie, getCaretNodeAndOffset as se, getContenteditableSlice as ne } from "@editorjs/caret";
|
|
8
|
+
import ct from "vanilla-caret-js";
|
|
9
|
+
import V from "axios";
|
|
10
|
+
const pt = Symbol("INSTALLED_KEY"), re = (p, t) => {
|
|
11
|
+
if (p.install = (e) => {
|
|
12
|
+
for (const i of [p, ...Object.values(t != null ? t : {})])
|
|
12
13
|
e.component(i.name, i);
|
|
13
14
|
}, t)
|
|
14
15
|
for (const [e, i] of Object.entries(t))
|
|
15
|
-
|
|
16
|
-
return
|
|
16
|
+
p[e] = i;
|
|
17
|
+
return p;
|
|
17
18
|
};
|
|
18
|
-
class
|
|
19
|
+
class oe {
|
|
19
20
|
constructor(t, e, i, s) {
|
|
20
21
|
const { blocks: n, toolbar: r } = i;
|
|
21
22
|
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();
|
|
@@ -87,8 +88,8 @@ class Qt {
|
|
|
87
88
|
this.isTheOnlyBlock() || this.api.move(this.endBlock, this.startBlock);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
const
|
|
91
|
-
class
|
|
91
|
+
const ut = '<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>', 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="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>', 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.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>', 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="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>', 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="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>', 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="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>', zt = '<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>', Nt = '<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>', 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="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>', 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="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>', 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 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>', bt = '<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>', yt = '<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>', St = '<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>', Ft = '<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>', Pt = '<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>', Lt = '<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>', xt = '<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>';
|
|
92
|
+
class ae {
|
|
92
93
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
93
94
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H1" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
94
95
|
}
|
|
@@ -156,7 +157,7 @@ class Zt {
|
|
|
156
157
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
157
158
|
}
|
|
158
159
|
get defaultLevel() {
|
|
159
|
-
return { number: 1, tag: "H1", svg:
|
|
160
|
+
return { number: 1, tag: "H1", svg: ut };
|
|
160
161
|
}
|
|
161
162
|
onPaste(t) {
|
|
162
163
|
const e = t.detail;
|
|
@@ -169,10 +170,10 @@ class Zt {
|
|
|
169
170
|
return { tags: ["H1"] };
|
|
170
171
|
}
|
|
171
172
|
static get toolbox() {
|
|
172
|
-
return { icon:
|
|
173
|
+
return { icon: ut, title: "H1" };
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
|
-
class
|
|
176
|
+
class le {
|
|
176
177
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
177
178
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H2" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
178
179
|
}
|
|
@@ -240,7 +241,7 @@ class te {
|
|
|
240
241
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
241
242
|
}
|
|
242
243
|
get defaultLevel() {
|
|
243
|
-
return { number: 2, tag: "H2", svg:
|
|
244
|
+
return { number: 2, tag: "H2", svg: gt };
|
|
244
245
|
}
|
|
245
246
|
onPaste(t) {
|
|
246
247
|
const e = t.detail;
|
|
@@ -253,10 +254,10 @@ class te {
|
|
|
253
254
|
return { tags: ["H2"] };
|
|
254
255
|
}
|
|
255
256
|
static get toolbox() {
|
|
256
|
-
return { icon:
|
|
257
|
+
return { icon: gt, title: "H2" };
|
|
257
258
|
}
|
|
258
259
|
}
|
|
259
|
-
class
|
|
260
|
+
class de {
|
|
260
261
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
261
262
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H3" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
262
263
|
}
|
|
@@ -324,7 +325,7 @@ class ee {
|
|
|
324
325
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
325
326
|
}
|
|
326
327
|
get defaultLevel() {
|
|
327
|
-
return { number: 3, tag: "H3", svg:
|
|
328
|
+
return { number: 3, tag: "H3", svg: mt };
|
|
328
329
|
}
|
|
329
330
|
onPaste(t) {
|
|
330
331
|
const e = t.detail;
|
|
@@ -337,10 +338,10 @@ class ee {
|
|
|
337
338
|
return { tags: ["H3"] };
|
|
338
339
|
}
|
|
339
340
|
static get toolbox() {
|
|
340
|
-
return { icon:
|
|
341
|
+
return { icon: mt, title: "H3" };
|
|
341
342
|
}
|
|
342
343
|
}
|
|
343
|
-
class
|
|
344
|
+
class he {
|
|
344
345
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
345
346
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H4" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
346
347
|
}
|
|
@@ -408,7 +409,7 @@ class ie {
|
|
|
408
409
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
409
410
|
}
|
|
410
411
|
get defaultLevel() {
|
|
411
|
-
return { number: 4, tag: "H4", svg:
|
|
412
|
+
return { number: 4, tag: "H4", svg: ft };
|
|
412
413
|
}
|
|
413
414
|
onPaste(t) {
|
|
414
415
|
const e = t.detail;
|
|
@@ -421,10 +422,10 @@ class ie {
|
|
|
421
422
|
return { tags: ["H4"] };
|
|
422
423
|
}
|
|
423
424
|
static get toolbox() {
|
|
424
|
-
return { icon:
|
|
425
|
+
return { icon: ft, title: "H4" };
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
|
-
class
|
|
428
|
+
class ce {
|
|
428
429
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
429
430
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H5" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
430
431
|
}
|
|
@@ -492,7 +493,7 @@ class se {
|
|
|
492
493
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
493
494
|
}
|
|
494
495
|
get defaultLevel() {
|
|
495
|
-
return { number: 5, tag: "H5", svg:
|
|
496
|
+
return { number: 5, tag: "H5", svg: Ct };
|
|
496
497
|
}
|
|
497
498
|
onPaste(t) {
|
|
498
499
|
const e = t.detail;
|
|
@@ -505,10 +506,10 @@ class se {
|
|
|
505
506
|
return { tags: ["H5"] };
|
|
506
507
|
}
|
|
507
508
|
static get toolbox() {
|
|
508
|
-
return { icon:
|
|
509
|
+
return { icon: Ct, title: "H5" };
|
|
509
510
|
}
|
|
510
511
|
}
|
|
511
|
-
class
|
|
512
|
+
class pe {
|
|
512
513
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
513
514
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H6" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
514
515
|
}
|
|
@@ -576,7 +577,7 @@ class ne {
|
|
|
576
577
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
577
578
|
}
|
|
578
579
|
get defaultLevel() {
|
|
579
|
-
return { number: 6, tag: "H6", svg:
|
|
580
|
+
return { number: 6, tag: "H6", svg: vt };
|
|
580
581
|
}
|
|
581
582
|
onPaste(t) {
|
|
582
583
|
const e = t.detail;
|
|
@@ -589,10 +590,10 @@ class ne {
|
|
|
589
590
|
return { tags: ["H6"] };
|
|
590
591
|
}
|
|
591
592
|
static get toolbox() {
|
|
592
|
-
return { icon:
|
|
593
|
+
return { icon: vt, title: "H6" };
|
|
593
594
|
}
|
|
594
595
|
}
|
|
595
|
-
class
|
|
596
|
+
class lt {
|
|
596
597
|
static get DEFAULT_ALIGNMENT() {
|
|
597
598
|
return "left";
|
|
598
599
|
}
|
|
@@ -601,10 +602,10 @@ class rt {
|
|
|
601
602
|
}
|
|
602
603
|
getAlignment() {
|
|
603
604
|
var t, e;
|
|
604
|
-
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 :
|
|
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 : lt.DEFAULT_ALIGNMENT;
|
|
605
606
|
}
|
|
606
607
|
constructor({ api: t, data: e, config: i, block: s }) {
|
|
607
|
-
this.api = t, this.block = s, this.settings = i, this.data = e || { alignment: this.getAlignment() }, this.alignmentSettings = [{ name: "left", icon:
|
|
608
|
+
this.api = t, this.block = s, this.settings = i, this.data = e || { alignment: this.getAlignment() }, this.alignmentSettings = [{ name: "left", icon: Nt }, { name: "center", icon: zt }, { name: "right", icon: Wt }], this._CSS = { alignment: { left: "ce-tune-alignment--left", center: "ce-tune-alignment--center", right: "ce-tune-alignment--right" } };
|
|
608
609
|
}
|
|
609
610
|
wrap(t) {
|
|
610
611
|
return this.wrapper = document.createElement("div"), this.wrapper.classList.toggle(this._CSS.alignment[this.data.alignment]), this.wrapper.append(t), this.wrapper;
|
|
@@ -629,13 +630,13 @@ class rt {
|
|
|
629
630
|
return this.data;
|
|
630
631
|
}
|
|
631
632
|
}
|
|
632
|
-
class
|
|
633
|
+
class dt {
|
|
633
634
|
static get DEFAULT_PLACEHOLDER() {
|
|
634
635
|
return "";
|
|
635
636
|
}
|
|
636
637
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
637
638
|
var n;
|
|
638
|
-
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 :
|
|
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 : dt.DEFAULT_PLACEHOLDER, this._data = t != null ? t : {}, this._element = null, this._preserveBlank = (n = e.preserveBlank) != null ? n : !1;
|
|
639
640
|
}
|
|
640
641
|
onKeyUp(t) {
|
|
641
642
|
if (t.code !== "Backspace" && t.code !== "Delete" || !this._element)
|
|
@@ -687,13 +688,13 @@ class ot {
|
|
|
687
688
|
return { tags: ["P"] };
|
|
688
689
|
}
|
|
689
690
|
static get toolbox() {
|
|
690
|
-
return { icon:
|
|
691
|
+
return { icon: Pt, title: "Text" };
|
|
691
692
|
}
|
|
692
693
|
}
|
|
693
|
-
class
|
|
694
|
+
class q {
|
|
694
695
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
695
696
|
var n;
|
|
696
|
-
this._selectorLanguage = "", this._selectorTheme = "", this.api = i, this.readOnly = s, this.placeholder = this.api.i18n.t(e.placeholder ||
|
|
697
|
+
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 }, this.nodes.holder = this.drawView();
|
|
697
698
|
}
|
|
698
699
|
static get isReadOnlySupported() {
|
|
699
700
|
return !0;
|
|
@@ -744,11 +745,11 @@ class j {
|
|
|
744
745
|
let o;
|
|
745
746
|
if (i) {
|
|
746
747
|
const a = function(d, l) {
|
|
747
|
-
let
|
|
748
|
-
for (;
|
|
748
|
+
let h = "";
|
|
749
|
+
for (; h !== `
|
|
749
750
|
` && l > 0; )
|
|
750
|
-
l -= 1,
|
|
751
|
-
return
|
|
751
|
+
l -= 1, h = d.substr(l, 1);
|
|
752
|
+
return h === `
|
|
752
753
|
` && (l += 1), l;
|
|
753
754
|
}(n, s);
|
|
754
755
|
if (n.substr(a, 2) !== r)
|
|
@@ -760,36 +761,36 @@ class j {
|
|
|
760
761
|
}
|
|
761
762
|
drawView() {
|
|
762
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");
|
|
763
|
-
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"),
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
}), 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:
|
|
767
|
-
d.innerHTML =
|
|
768
|
-
}), o.addEventListener("change", (
|
|
769
|
-
const
|
|
770
|
-
this._selectorLanguage =
|
|
771
|
-
d.innerHTML = u, s.innerHTML =
|
|
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"), Zt.forEach((h) => {
|
|
765
|
+
const c = document.createElement("option");
|
|
766
|
+
c.value = h.id, c.text = h.name, o.appendChild(c);
|
|
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: h, preStyle: c }) => {
|
|
768
|
+
d.innerHTML = h, t == null || t.setAttribute("style", c), o.setAttribute("style", c), a.setAttribute("style", c);
|
|
769
|
+
}), o.addEventListener("change", (h) => {
|
|
770
|
+
const c = h.target.value;
|
|
771
|
+
this._selectorLanguage = c, this.runShiki().then(({ html: u, preStyle: g }) => {
|
|
772
|
+
d.innerHTML = u, s.innerHTML = c;
|
|
772
773
|
});
|
|
773
|
-
}), a.addEventListener("change", (
|
|
774
|
-
const
|
|
775
|
-
this._selectorTheme =
|
|
774
|
+
}), a.addEventListener("change", (h) => {
|
|
775
|
+
const c = h.target.value;
|
|
776
|
+
this._selectorTheme = c, this.runShiki().then(({ html: u, preStyle: g }) => {
|
|
776
777
|
d.innerHTML = u, t == null || t.setAttribute("style", g), o.setAttribute("style", g), a.setAttribute("style", g);
|
|
777
778
|
});
|
|
778
779
|
}), l.addEventListener("input", () => {
|
|
779
|
-
this.data.code = l.value, this.runShiki().then(({ html:
|
|
780
|
-
d.innerHTML =
|
|
780
|
+
this.data.code = l.value, this.runShiki().then(({ html: h, preStyle: c }) => {
|
|
781
|
+
d.innerHTML = h, t == null || t.setAttribute("style", c), o.setAttribute("style", c), a.setAttribute("style", c);
|
|
781
782
|
});
|
|
782
|
-
}), l.addEventListener("keydown", (
|
|
783
|
-
|
|
784
|
-
d.innerHTML =
|
|
783
|
+
}), l.addEventListener("keydown", (h) => {
|
|
784
|
+
h.code === "Tab" && (this.tabHandler(h), this.data.code = l.value, this.runShiki().then(({ html: c, preStyle: u }) => {
|
|
785
|
+
d.innerHTML = c;
|
|
785
786
|
}));
|
|
786
|
-
}), n.addEventListener("click", (
|
|
787
|
-
this.copyCode(this.data.code,
|
|
787
|
+
}), n.addEventListener("click", (h) => {
|
|
788
|
+
this.copyCode(this.data.code, h);
|
|
788
789
|
}), this.nodes.textarea = l, t;
|
|
789
790
|
}
|
|
790
791
|
async runShiki() {
|
|
791
792
|
let t = "";
|
|
792
|
-
return { html: await
|
|
793
|
+
return { html: await te(this.data.code, { lang: this._selectorLanguage, theme: this._selectorTheme, transformers: [{ preprocess: (e) => `${e}
|
|
793
794
|
`, pre(e) {
|
|
794
795
|
var i;
|
|
795
796
|
this.addClassToHast(e, "ce-editorjs-x-shiki__span"), t = ((i = e.properties) == null ? void 0 : i.style) || "";
|
|
@@ -813,7 +814,7 @@ class j {
|
|
|
813
814
|
});
|
|
814
815
|
}
|
|
815
816
|
}
|
|
816
|
-
class
|
|
817
|
+
class ue {
|
|
817
818
|
constructor({ data: t, api: e, readOnly: i }) {
|
|
818
819
|
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 };
|
|
819
820
|
}
|
|
@@ -838,8 +839,8 @@ class re {
|
|
|
838
839
|
return { baseClass: this.api.styles.block, wrapper: "cdx-quote", text: "cdx-quote__text", input: this.api.styles.input };
|
|
839
840
|
}
|
|
840
841
|
render() {
|
|
841
|
-
const t =
|
|
842
|
-
return this._quoteElement =
|
|
842
|
+
const t = S("div", [this._CSS.baseClass, this._CSS.wrapper]);
|
|
843
|
+
return this._quoteElement = S("blockquote", [this._CSS.input, this._CSS.text, "cdx-block-quote"], { contentEditable: !this.readOnly, innerHTML: this._data.text }), this._quoteElement.addEventListener("keydown", (e) => this.handleKeydown(e)), t.appendChild(this._quoteElement), t;
|
|
843
844
|
}
|
|
844
845
|
get currentItem() {
|
|
845
846
|
let t = window.getSelection().anchorNode;
|
|
@@ -866,7 +867,7 @@ class re {
|
|
|
866
867
|
return { text: { br: !0 } };
|
|
867
868
|
}
|
|
868
869
|
}
|
|
869
|
-
class
|
|
870
|
+
class ge {
|
|
870
871
|
static get isReadOnlySupported() {
|
|
871
872
|
return !0;
|
|
872
873
|
}
|
|
@@ -896,25 +897,25 @@ class oe {
|
|
|
896
897
|
this.data = {};
|
|
897
898
|
}
|
|
898
899
|
}
|
|
899
|
-
const
|
|
900
|
+
const b = "cdx-list", k = { wrapper: b, item: `${b}__item`, itemContent: `${b}__item-content`, itemChildren: `${b}__item-children` };
|
|
900
901
|
class E {
|
|
901
902
|
static get CSS() {
|
|
902
|
-
return { ...k, orderedList: `${
|
|
903
|
+
return { ...k, orderedList: `${b}-ordered` };
|
|
903
904
|
}
|
|
904
905
|
constructor(t, e) {
|
|
905
906
|
this.config = e, this.readOnly = t;
|
|
906
907
|
}
|
|
907
908
|
renderWrapper(t) {
|
|
908
909
|
let e;
|
|
909
|
-
return e =
|
|
910
|
+
return e = S("ol", t === !0 ? [E.CSS.wrapper, E.CSS.orderedList] : [E.CSS.orderedList, E.CSS.itemChildren]), e;
|
|
910
911
|
}
|
|
911
912
|
renderItem(t, e) {
|
|
912
|
-
const i =
|
|
913
|
+
const i = S("li", E.CSS.item), s = S("div", E.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() });
|
|
913
914
|
return i.appendChild(s), i;
|
|
914
915
|
}
|
|
915
916
|
getItemContent(t) {
|
|
916
917
|
const e = t.querySelector(`.${E.CSS.itemContent}`);
|
|
917
|
-
return e ?
|
|
918
|
+
return e ? at(e) ? "" : e.innerHTML : "";
|
|
918
919
|
}
|
|
919
920
|
getItemMeta() {
|
|
920
921
|
return {};
|
|
@@ -925,22 +926,22 @@ class E {
|
|
|
925
926
|
}
|
|
926
927
|
class M {
|
|
927
928
|
static get CSS() {
|
|
928
|
-
return { ...k, unorderedList: `${
|
|
929
|
+
return { ...k, unorderedList: `${b}-unordered` };
|
|
929
930
|
}
|
|
930
931
|
constructor(t, e) {
|
|
931
932
|
this.config = e, this.readOnly = t;
|
|
932
933
|
}
|
|
933
934
|
renderWrapper(t) {
|
|
934
935
|
let e;
|
|
935
|
-
return e =
|
|
936
|
+
return e = S("ul", t === !0 ? [M.CSS.wrapper, M.CSS.unorderedList] : [M.CSS.unorderedList, M.CSS.itemChildren]), e;
|
|
936
937
|
}
|
|
937
938
|
renderItem(t, e) {
|
|
938
|
-
const i =
|
|
939
|
+
const i = S("li", M.CSS.item), s = S("div", M.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() });
|
|
939
940
|
return i.appendChild(s), i;
|
|
940
941
|
}
|
|
941
942
|
getItemContent(t) {
|
|
942
943
|
const e = t.querySelector(`.${M.CSS.itemContent}`);
|
|
943
|
-
return e ?
|
|
944
|
+
return e ? at(e) ? "" : e.innerHTML : "";
|
|
944
945
|
}
|
|
945
946
|
getItemMeta() {
|
|
946
947
|
return {};
|
|
@@ -949,33 +950,33 @@ class M {
|
|
|
949
950
|
return {};
|
|
950
951
|
}
|
|
951
952
|
}
|
|
952
|
-
function R(
|
|
953
|
-
return
|
|
953
|
+
function R(p) {
|
|
954
|
+
return p.nodeType === Node.ELEMENT_NODE;
|
|
954
955
|
}
|
|
955
956
|
class C {
|
|
956
957
|
static get CSS() {
|
|
957
|
-
return { ...k, checklist: `${
|
|
958
|
+
return { ...k, checklist: `${b}-checklist`, itemChecked: `${b}__checkbox--checked`, noHover: `${b}__checkbox--no-hover`, checkbox: `${b}__checkbox-check`, checkboxContainer: `${b}__checkbox`, checkboxCheckDisabled: `${b}__checkbox-check--disabled` };
|
|
958
959
|
}
|
|
959
960
|
constructor(t, e) {
|
|
960
961
|
this.config = e, this.readOnly = t;
|
|
961
962
|
}
|
|
962
963
|
renderWrapper(t) {
|
|
963
964
|
let e;
|
|
964
|
-
return t === !0 ? (e =
|
|
965
|
+
return t === !0 ? (e = S("ul", [C.CSS.wrapper, C.CSS.checklist]), e.addEventListener("click", (i) => {
|
|
965
966
|
const s = i.target;
|
|
966
967
|
if (s) {
|
|
967
968
|
const n = s.closest(`.${C.CSS.checkboxContainer}`);
|
|
968
969
|
n && n.contains(s) && this.toggleCheckbox(n);
|
|
969
970
|
}
|
|
970
|
-
})) : e =
|
|
971
|
+
})) : e = S("ul", [C.CSS.checklist, C.CSS.itemChildren]), e;
|
|
971
972
|
}
|
|
972
973
|
renderItem(t, e) {
|
|
973
|
-
const i =
|
|
974
|
+
const i = S("li", [C.CSS.item, C.CSS.item]), s = S("div", C.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() }), n = S("span", C.CSS.checkbox), r = S("div", C.CSS.checkboxContainer);
|
|
974
975
|
return e.checked === !0 && r.classList.add(C.CSS.itemChecked), this.readOnly && r.classList.add(C.CSS.checkboxCheckDisabled), 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-width="2" d="M7 12L10.4884 15.8372C10.5677 15.9245 10.705 15.9245 10.7844 15.8372L17 9"/></svg>', r.appendChild(n), i.appendChild(r), i.appendChild(s), i;
|
|
975
976
|
}
|
|
976
977
|
getItemContent(t) {
|
|
977
978
|
const e = t.querySelector(`.${C.CSS.itemContent}`);
|
|
978
|
-
return e ?
|
|
979
|
+
return e ? at(e) ? "" : e.innerHTML : "";
|
|
979
980
|
}
|
|
980
981
|
getItemMeta(t) {
|
|
981
982
|
const e = t.querySelector(`.${C.CSS.checkboxContainer}`);
|
|
@@ -991,7 +992,7 @@ class C {
|
|
|
991
992
|
t.classList.remove(C.CSS.noHover);
|
|
992
993
|
}
|
|
993
994
|
}
|
|
994
|
-
function
|
|
995
|
+
function Z(p, t = "after") {
|
|
995
996
|
const e = [];
|
|
996
997
|
let i;
|
|
997
998
|
function s(n) {
|
|
@@ -1002,29 +1003,29 @@ function J(h, t = "after") {
|
|
|
1002
1003
|
return n.previousElementSibling;
|
|
1003
1004
|
}
|
|
1004
1005
|
}
|
|
1005
|
-
for (i = s(
|
|
1006
|
+
for (i = s(p); i !== null; )
|
|
1006
1007
|
e.push(i), i = s(i);
|
|
1007
1008
|
return e.length !== 0 ? e : null;
|
|
1008
1009
|
}
|
|
1009
|
-
function I(
|
|
1010
|
-
let e =
|
|
1011
|
-
return
|
|
1010
|
+
function I(p, t = !0) {
|
|
1011
|
+
let e = p;
|
|
1012
|
+
return p.classList.contains(k.item) && (e = p.querySelector(`.${k.itemChildren}`)), e === null ? [] : t ? Array.from(e.querySelectorAll(`:scope > .${k.item}`)) : Array.from(e.querySelectorAll(`.${k.item}`));
|
|
1012
1013
|
}
|
|
1013
|
-
function A(
|
|
1014
|
-
return
|
|
1014
|
+
function A(p) {
|
|
1015
|
+
return p.querySelector(`.${k.itemChildren}`);
|
|
1015
1016
|
}
|
|
1016
|
-
function
|
|
1017
|
-
let t =
|
|
1018
|
-
|
|
1017
|
+
function tt(p) {
|
|
1018
|
+
let t = p;
|
|
1019
|
+
p.classList.contains(k.item) && (t = A(p)), t !== null && I(t).length === 0 && t.remove();
|
|
1019
1020
|
}
|
|
1020
|
-
function
|
|
1021
|
-
return
|
|
1021
|
+
function K(p) {
|
|
1022
|
+
return p.querySelector(`.${k.itemContent}`);
|
|
1022
1023
|
}
|
|
1023
|
-
function
|
|
1024
|
-
const e =
|
|
1025
|
-
e &&
|
|
1024
|
+
function N(p, t = !0) {
|
|
1025
|
+
const e = K(p);
|
|
1026
|
+
e && ee(e, t);
|
|
1026
1027
|
}
|
|
1027
|
-
class
|
|
1028
|
+
class et {
|
|
1028
1029
|
get currentItem() {
|
|
1029
1030
|
const t = window.getSelection();
|
|
1030
1031
|
if (!t)
|
|
@@ -1070,7 +1071,7 @@ class Q {
|
|
|
1070
1071
|
return { tags: ["OL", "UL", "LI"] };
|
|
1071
1072
|
}
|
|
1072
1073
|
merge(t) {
|
|
1073
|
-
const e = this.block.holder.querySelectorAll(`.${k.item}`), i = e[e.length - 1], s =
|
|
1074
|
+
const e = this.block.holder.querySelectorAll(`.${k.item}`), i = e[e.length - 1], s = K(i);
|
|
1074
1075
|
if (i === null || s === null || (s.insertAdjacentHTML("beforeend", t.items[0].content), this.listWrapper === void 0))
|
|
1075
1076
|
return;
|
|
1076
1077
|
const n = I(this.listWrapper);
|
|
@@ -1100,9 +1101,9 @@ class Q {
|
|
|
1100
1101
|
const n = { style: s, meta: {}, items: [] };
|
|
1101
1102
|
s === "ordered" && (this.data.meta.counterType = "numeric", this.data.meta.start = 1);
|
|
1102
1103
|
const r = (o) => Array.from(o.querySelectorAll(":scope > li")).map((a) => {
|
|
1103
|
-
var
|
|
1104
|
+
var h;
|
|
1104
1105
|
const d = a.querySelector(`:scope > ${i}`), l = d ? r(d) : [];
|
|
1105
|
-
return { content: (
|
|
1106
|
+
return { content: (h = a.innerHTML) != null ? h : "", meta: {}, items: l };
|
|
1106
1107
|
});
|
|
1107
1108
|
return n.items = r(t), n;
|
|
1108
1109
|
}
|
|
@@ -1127,7 +1128,7 @@ class Q {
|
|
|
1127
1128
|
backspace(t) {
|
|
1128
1129
|
var i;
|
|
1129
1130
|
const e = this.currentItem;
|
|
1130
|
-
e !== null &&
|
|
1131
|
+
e !== null && ie(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());
|
|
1131
1132
|
}
|
|
1132
1133
|
shiftTab(t) {
|
|
1133
1134
|
t.stopPropagation(), t.preventDefault(), this.currentItem !== null && this.unshiftItem(this.currentItem);
|
|
@@ -1141,20 +1142,20 @@ class Q {
|
|
|
1141
1142
|
let i = A(t);
|
|
1142
1143
|
if (t.parentElement === null)
|
|
1143
1144
|
return;
|
|
1144
|
-
const s =
|
|
1145
|
+
const s = Z(t);
|
|
1145
1146
|
s !== null && (i === null && (i = this.renderer.renderWrapper(!1)), s.forEach((n) => {
|
|
1146
1147
|
i.appendChild(n);
|
|
1147
|
-
}), t.appendChild(i)), e.after(t),
|
|
1148
|
+
}), t.appendChild(i)), e.after(t), N(t, !1), tt(e);
|
|
1148
1149
|
}
|
|
1149
1150
|
splitList(t) {
|
|
1150
1151
|
const e = I(t), i = this.block, s = this.api.blocks.getCurrentBlockIndex();
|
|
1151
1152
|
if (e.length !== 0) {
|
|
1152
1153
|
const a = e[0];
|
|
1153
|
-
this.unshiftItem(a),
|
|
1154
|
+
this.unshiftItem(a), N(t, !1);
|
|
1154
1155
|
}
|
|
1155
1156
|
if (t.previousElementSibling === null && t.parentNode === this.listWrapper)
|
|
1156
1157
|
return void this.convertItemToDefaultBlock(s);
|
|
1157
|
-
const n =
|
|
1158
|
+
const n = Z(t);
|
|
1158
1159
|
if (n === null)
|
|
1159
1160
|
return;
|
|
1160
1161
|
const r = this.renderer.renderWrapper(!0);
|
|
@@ -1165,17 +1166,17 @@ class Q {
|
|
|
1165
1166
|
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();
|
|
1166
1167
|
}
|
|
1167
1168
|
splitItem(t) {
|
|
1168
|
-
const [e, i] =
|
|
1169
|
+
const [e, i] = se();
|
|
1169
1170
|
if (e === null)
|
|
1170
1171
|
return;
|
|
1171
|
-
const s =
|
|
1172
|
+
const s = K(t);
|
|
1172
1173
|
let n;
|
|
1173
|
-
n = s === null ? "" :
|
|
1174
|
+
n = s === null ? "" : ne(s, e, i, "right", !0);
|
|
1174
1175
|
const r = A(t), o = this.renderItem(n);
|
|
1175
|
-
t == null || t.after(o), r && o.appendChild(r),
|
|
1176
|
+
t == null || t.after(o), r && o.appendChild(r), N(o);
|
|
1176
1177
|
}
|
|
1177
1178
|
mergeItemWithPrevious(t) {
|
|
1178
|
-
var
|
|
1179
|
+
var h;
|
|
1179
1180
|
const e = t.previousElementSibling, i = t.parentNode;
|
|
1180
1181
|
if (i === null || !R(i))
|
|
1181
1182
|
return;
|
|
@@ -1184,26 +1185,26 @@ class Q {
|
|
|
1184
1185
|
return;
|
|
1185
1186
|
let n;
|
|
1186
1187
|
if (e) {
|
|
1187
|
-
const
|
|
1188
|
-
n =
|
|
1188
|
+
const c = I(e, !1);
|
|
1189
|
+
n = c.length !== 0 && c.length !== 0 ? c[c.length - 1] : e;
|
|
1189
1190
|
} else
|
|
1190
1191
|
n = s;
|
|
1191
1192
|
const r = this.renderer.getItemContent(t);
|
|
1192
1193
|
if (!n)
|
|
1193
1194
|
return;
|
|
1194
|
-
|
|
1195
|
-
const o =
|
|
1195
|
+
N(n, !1);
|
|
1196
|
+
const o = K(n);
|
|
1196
1197
|
if (o === null)
|
|
1197
1198
|
return;
|
|
1198
1199
|
o.insertAdjacentHTML("beforeend", r);
|
|
1199
1200
|
const a = I(t);
|
|
1200
1201
|
if (a.length === 0)
|
|
1201
|
-
return t.remove(), void
|
|
1202
|
-
const d = e || s, l = (
|
|
1203
|
-
e ? a.forEach((
|
|
1204
|
-
l.appendChild(
|
|
1205
|
-
}) : a.forEach((
|
|
1206
|
-
l.prepend(
|
|
1202
|
+
return t.remove(), void tt(n);
|
|
1203
|
+
const d = e || s, l = (h = A(d)) != null ? h : this.renderer.renderWrapper(!1);
|
|
1204
|
+
e ? a.forEach((c) => {
|
|
1205
|
+
l.appendChild(c);
|
|
1206
|
+
}) : a.forEach((c) => {
|
|
1207
|
+
l.prepend(c);
|
|
1207
1208
|
}), A(d) === null && n.appendChild(l), t.remove();
|
|
1208
1209
|
}
|
|
1209
1210
|
addTab(t) {
|
|
@@ -1231,7 +1232,7 @@ class Q {
|
|
|
1231
1232
|
r.appendChild(o);
|
|
1232
1233
|
}), i.appendChild(r);
|
|
1233
1234
|
}
|
|
1234
|
-
|
|
1235
|
+
tt(e), N(e, !1);
|
|
1235
1236
|
}
|
|
1236
1237
|
convertItemToDefaultBlock(t, e) {
|
|
1237
1238
|
let i;
|
|
@@ -1245,9 +1246,9 @@ class Q {
|
|
|
1245
1246
|
const e = I(t);
|
|
1246
1247
|
if (e.length !== 0) {
|
|
1247
1248
|
const r = e[0];
|
|
1248
|
-
this.unshiftItem(r),
|
|
1249
|
+
this.unshiftItem(r), N(t);
|
|
1249
1250
|
}
|
|
1250
|
-
const i =
|
|
1251
|
+
const i = Z(t), s = this.api.blocks.getCurrentBlockIndex(), n = i === null;
|
|
1251
1252
|
this.convertItemToDefaultBlock(s, n);
|
|
1252
1253
|
}
|
|
1253
1254
|
renderItem(t, e) {
|
|
@@ -1269,8 +1270,8 @@ class Q {
|
|
|
1269
1270
|
});
|
|
1270
1271
|
}
|
|
1271
1272
|
}
|
|
1272
|
-
const
|
|
1273
|
-
class
|
|
1273
|
+
const W = { 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"]]), Tt = /* @__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>']]);
|
|
1274
|
+
class X {
|
|
1274
1275
|
static get isReadOnlySupported() {
|
|
1275
1276
|
return !0;
|
|
1276
1277
|
}
|
|
@@ -1278,13 +1279,13 @@ class Y {
|
|
|
1278
1279
|
return !0;
|
|
1279
1280
|
}
|
|
1280
1281
|
static get toolbox() {
|
|
1281
|
-
return [{ icon:
|
|
1282
|
+
return [{ icon: bt, title: "Unordered List", data: { style: "unordered" } }, { icon: yt, title: "Ordered List", data: { style: "ordered" } }, { icon: kt, title: "Checklist", data: { style: "checklist" } }];
|
|
1282
1283
|
}
|
|
1283
1284
|
static get pasteConfig() {
|
|
1284
1285
|
return { tags: ["OL", "UL", "LI"] };
|
|
1285
1286
|
}
|
|
1286
1287
|
static get conversionConfig() {
|
|
1287
|
-
return { export: (t) =>
|
|
1288
|
+
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" }) };
|
|
1288
1289
|
}
|
|
1289
1290
|
get listStyle() {
|
|
1290
1291
|
return this.data.style || this.defaultListStyle;
|
|
@@ -1297,7 +1298,7 @@ class Y {
|
|
|
1297
1298
|
}
|
|
1298
1299
|
constructor({ data: t, config: e, api: i, readOnly: s, block: n }) {
|
|
1299
1300
|
var o;
|
|
1300
|
-
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(
|
|
1301
|
+
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());
|
|
1301
1302
|
const r = { style: this.defaultListStyle, meta: {}, items: [] };
|
|
1302
1303
|
this.data = Object.keys(t).length ? function(a) {
|
|
1303
1304
|
const d = [];
|
|
@@ -1315,7 +1316,7 @@ class Y {
|
|
|
1315
1316
|
}(t) : r, this.listStyle === "ordered" && this.data.meta.counterType === void 0 && (this.data.meta.counterType = "numeric"), this.changeTabulatorByStyle();
|
|
1316
1317
|
}
|
|
1317
1318
|
static joinRecursive(t) {
|
|
1318
|
-
return t.items.map((e) => `${e.content} ${
|
|
1319
|
+
return t.items.map((e) => `${e.content} ${X.joinRecursive(e)}`).join("");
|
|
1319
1320
|
}
|
|
1320
1321
|
render() {
|
|
1321
1322
|
return this.listElement = this.list.render(), this.listElement;
|
|
@@ -1326,6 +1327,37 @@ class Y {
|
|
|
1326
1327
|
merge(t) {
|
|
1327
1328
|
this.list.merge(t);
|
|
1328
1329
|
}
|
|
1330
|
+
renderSettings() {
|
|
1331
|
+
var e;
|
|
1332
|
+
const t = [{ label: this.api.i18n.t("Unordered"), icon: bt, closeOnActivate: !0, isActive: this.listStyle == "unordered", onActivate: () => {
|
|
1333
|
+
this.listStyle = "unordered";
|
|
1334
|
+
} }, { label: this.api.i18n.t("Ordered"), icon: yt, closeOnActivate: !0, isActive: this.listStyle == "ordered", onActivate: () => {
|
|
1335
|
+
this.listStyle = "ordered";
|
|
1336
|
+
} }, { label: this.api.i18n.t("Checklist"), icon: kt, closeOnActivate: !0, isActive: this.listStyle == "checklist", onActivate: () => {
|
|
1337
|
+
this.listStyle = "checklist";
|
|
1338
|
+
} }];
|
|
1339
|
+
if (this.listStyle === "ordered") {
|
|
1340
|
+
const i = function(r, { value: o, placeholder: a, attributes: d, sanitize: l }) {
|
|
1341
|
+
const h = ht.make("div", W.wrapper), c = ht.make("input", W.input, { placeholder: a, tabIndex: -1, value: o });
|
|
1342
|
+
for (const u in d)
|
|
1343
|
+
c.setAttribute(u, d[u]);
|
|
1344
|
+
return h.appendChild(c), c.addEventListener("input", () => {
|
|
1345
|
+
l !== void 0 && (c.value = l(c.value));
|
|
1346
|
+
const u = c.checkValidity();
|
|
1347
|
+
u || h.classList.contains(W.startWithElementWrapperInvalid) || h.classList.add(W.startWithElementWrapperInvalid), u && h.classList.contains(W.startWithElementWrapperInvalid) && h.classList.remove(W.startWithElementWrapperInvalid), u && r(c.value);
|
|
1348
|
+
}), h;
|
|
1349
|
+
}((r) => this.changeStartWith(Number(r)), { value: String((e = this.data.meta.start) != null ? e : 1), placeholder: "", attributes: { required: "true" }, sanitize: (r) => function(o) {
|
|
1350
|
+
return o.replace(/\D+/g, "");
|
|
1351
|
+
}(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>', children: { items: [{ element: i, type: "html" }] } }], n = { label: this.api.i18n.t("Counter type"), icon: Tt.get(this.data.meta.counterType), children: { items: [] } };
|
|
1352
|
+
j.forEach((r, o) => {
|
|
1353
|
+
const a = j.get(o);
|
|
1354
|
+
this.defaultCounterTypes.includes(a) && n.children.items.push({ title: this.api.i18n.t(o), icon: Tt.get(a), isActive: this.data.meta.counterType === j.get(o), closeOnActivate: !0, onActivate: () => {
|
|
1355
|
+
this.changeCounters(j.get(o));
|
|
1356
|
+
} });
|
|
1357
|
+
}), n.children.items.length > 1 && s.push(n), t.push({ type: "separator" }, ...s);
|
|
1358
|
+
}
|
|
1359
|
+
return t;
|
|
1360
|
+
}
|
|
1329
1361
|
onPaste(t) {
|
|
1330
1362
|
const { tagName: e } = t.detail.data;
|
|
1331
1363
|
switch (e) {
|
|
@@ -1341,20 +1373,28 @@ class Y {
|
|
|
1341
1373
|
pasteHandler(t) {
|
|
1342
1374
|
return this.list.pasteHandler(t);
|
|
1343
1375
|
}
|
|
1376
|
+
changeCounters(t) {
|
|
1377
|
+
var e;
|
|
1378
|
+
(e = this.list) == null || e.changeCounters(t), this.data.meta.counterType = t;
|
|
1379
|
+
}
|
|
1380
|
+
changeStartWith(t) {
|
|
1381
|
+
var e;
|
|
1382
|
+
(e = this.list) == null || e.changeStartWith(t), this.data.meta.start = t;
|
|
1383
|
+
}
|
|
1344
1384
|
changeTabulatorByStyle() {
|
|
1345
1385
|
switch (this.listStyle) {
|
|
1346
1386
|
case "ordered":
|
|
1347
|
-
this.list = new
|
|
1387
|
+
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));
|
|
1348
1388
|
break;
|
|
1349
1389
|
case "unordered":
|
|
1350
|
-
this.list = new
|
|
1390
|
+
this.list = new et({ data: this.data, readOnly: this.readOnly, api: this.api, config: this.config, block: this.block }, new M(this.readOnly, this.config));
|
|
1351
1391
|
break;
|
|
1352
1392
|
case "checklist":
|
|
1353
|
-
this.list = new
|
|
1393
|
+
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));
|
|
1354
1394
|
}
|
|
1355
1395
|
}
|
|
1356
1396
|
}
|
|
1357
|
-
class
|
|
1397
|
+
class me {
|
|
1358
1398
|
constructor(t, e, i) {
|
|
1359
1399
|
this.holder = e, this.observer = null, this.debounceTimer = i, this.mutationDebouncer = this.debounce(() => {
|
|
1360
1400
|
t();
|
|
@@ -1394,12 +1434,12 @@ class le {
|
|
|
1394
1434
|
document.dispatchEvent(t), (e = this.observer) == null || e.disconnect();
|
|
1395
1435
|
}
|
|
1396
1436
|
}
|
|
1397
|
-
class
|
|
1437
|
+
class fe {
|
|
1398
1438
|
constructor({ editor: t, config: e = {}, onUpdate: i, maxLength: s }) {
|
|
1399
1439
|
this.position = 0;
|
|
1400
1440
|
const n = { maxLength: 30, onUpdate() {
|
|
1401
|
-
}, 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,
|
|
1402
|
-
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
|
|
1441
|
+
}, 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, h = n.config.shortcuts, { shortcuts: c } = e, u = { ...h, ...c }, g = Array.isArray(u.undo) ? u.undo : [u.undo], m = Array.isArray(u.redo) ? u.redo : [u.redo], f = n.config.debounceTimer, { debounceTimer: v = f } = e;
|
|
1442
|
+
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 me(() => this.registerChange(), this.holder, this.config.debounceTimer).setMutationObserver(), this.setEventListeners(), this.initialItem = null, this.clear();
|
|
1403
1443
|
}
|
|
1404
1444
|
static get isReadOnlySupported() {
|
|
1405
1445
|
return !0;
|
|
@@ -1438,7 +1478,7 @@ class de {
|
|
|
1438
1478
|
}
|
|
1439
1479
|
getCaretIndex(t) {
|
|
1440
1480
|
const e = this.holder.getElementsByClassName("ce-block__content");
|
|
1441
|
-
return new
|
|
1481
|
+
return new ct(e[t].firstChild).getPos();
|
|
1442
1482
|
}
|
|
1443
1483
|
insertDeletedBlock(t, e, i) {
|
|
1444
1484
|
for (let s = 0; s < t.length; s += 1)
|
|
@@ -1490,7 +1530,7 @@ class de {
|
|
|
1490
1530
|
}
|
|
1491
1531
|
setCaretIndex(t, e) {
|
|
1492
1532
|
if (e && e !== -1) {
|
|
1493
|
-
const i = this.holder.getElementsByClassName("ce-block__content"), s = new
|
|
1533
|
+
const i = this.holder.getElementsByClassName("ce-block__content"), s = new ct(i[t].firstChild);
|
|
1494
1534
|
setTimeout(() => s.setPos(e), 50);
|
|
1495
1535
|
} else
|
|
1496
1536
|
this.caret.setToBlock(t, "end");
|
|
@@ -1530,13 +1570,13 @@ class de {
|
|
|
1530
1570
|
return i.push(s), i;
|
|
1531
1571
|
}
|
|
1532
1572
|
setEventListeners() {
|
|
1533
|
-
const { holder: t } = this, { shortcuts: e } = this.config, { undo: i, redo: s } = e, n = i.map((u) => u.replace(/ /g, "").split("+")), r = s.map((u) => u.replace(/ /g, "").split("+")), o = n.map((u) => this.parseKeys(u)), a = r.map((u) => this.parseKeys(u)), d = (u, g) => g.reduce((m, f) => m || ((v,
|
|
1573
|
+
const { holder: t } = this, { shortcuts: e } = this.config, { undo: i, redo: s } = e, n = i.map((u) => u.replace(/ /g, "").split("+")), r = s.map((u) => u.replace(/ /g, "").split("+")), o = n.map((u) => this.parseKeys(u)), a = r.map((u) => this.parseKeys(u)), d = (u, g) => g.reduce((m, f) => m || ((v, L) => L.length === 3 && v[L[0]] && v[L[1]] && v.key.toLowerCase() === L[2])(u, f), !1), l = (u, g, m) => !(!((f, v) => v.reduce((L, w) => L || ((_, B) => B.length === 2 && _[B[0]] && _.key.toLowerCase() === B[1])(f, w), !1))(u, g) || d(u, m)) || !!d(u, g), h = (u) => {
|
|
1534
1574
|
l(u, o, a) && (u.preventDefault(), this.undo());
|
|
1535
|
-
},
|
|
1575
|
+
}, c = (u) => {
|
|
1536
1576
|
l(u, a, o) && (u.preventDefault(), this.redo());
|
|
1537
1577
|
};
|
|
1538
|
-
t.addEventListener("keydown",
|
|
1539
|
-
t.removeEventListener("keydown",
|
|
1578
|
+
t.addEventListener("keydown", h), t.addEventListener("keydown", c), t.addEventListener("destroy", () => {
|
|
1579
|
+
t.removeEventListener("keydown", h), t.removeEventListener("keydown", c);
|
|
1540
1580
|
});
|
|
1541
1581
|
}
|
|
1542
1582
|
}
|
|
@@ -1621,7 +1661,7 @@ class H {
|
|
|
1621
1661
|
});
|
|
1622
1662
|
}), H.ALIGN_TYPES.map((s) => {
|
|
1623
1663
|
let n;
|
|
1624
|
-
return s === "left" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML =
|
|
1664
|
+
return s === "left" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = Nt), s === "right" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = Wt), s === "center" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = zt), n == null || n.setAttribute("data-align", s), this.api.tooltip.onHover(n, this.api.i18n.t(`align-${s}`), { placement: "top" }), i.appendChild(n), n;
|
|
1625
1665
|
}).forEach((s, n, r) => {
|
|
1626
1666
|
const o = s.getAttribute("data-align") || "";
|
|
1627
1667
|
s.addEventListener("click", () => {
|
|
@@ -1669,11 +1709,11 @@ class H {
|
|
|
1669
1709
|
return { message: !0, type: !1, alignType: !1 };
|
|
1670
1710
|
}
|
|
1671
1711
|
}
|
|
1672
|
-
const
|
|
1712
|
+
const Et = { orientation: !1 }, Y = class x {
|
|
1673
1713
|
constructor({ api: t, data: e, config: i, block: s, ...n }) {
|
|
1674
|
-
var o, a, d, l,
|
|
1714
|
+
var o, a, d, l, h, c;
|
|
1675
1715
|
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));
|
|
1676
|
-
const r = (
|
|
1716
|
+
const r = (c = (h = this.config.customBlockIndentLimits[(l = (d = this.block) == null ? void 0 : d.name) != null ? l : ""]) == null ? void 0 : h.min) != null ? c : this.config.minIndent;
|
|
1677
1717
|
this.data = { indentLevel: r, ...e != null ? e : {} }, this.config.multiblock && this.config.tuneName, window.addEventListener("resize", (u) => this.onResize.call(this, u)), this.api.events.on("block changed", ({ event: u }) => {
|
|
1678
1718
|
var f;
|
|
1679
1719
|
const g = u.detail.target.id;
|
|
@@ -1705,17 +1745,17 @@ const kt = { orientation: !1 }, V = class x {
|
|
|
1705
1745
|
t() && setTimeout(t, 300);
|
|
1706
1746
|
}), this.config.orientation === "vertical") {
|
|
1707
1747
|
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}`;
|
|
1708
|
-
return [{ title: this.rightText, hint: { title: this.api.i18n.t(this.rightText) }, onActivate: (l,
|
|
1748
|
+
return [{ title: this.rightText, hint: { title: this.api.i18n.t(this.rightText) }, onActivate: (l, h) => {
|
|
1709
1749
|
this.handleIndentRight(), l.title = this.rightText;
|
|
1710
|
-
}, icon:
|
|
1750
|
+
}, icon: xt, name: d }, { title: this.leftText, hint: { title: this.api.i18n.t(this.leftText) }, onActivate: (l, h) => {
|
|
1711
1751
|
this.handleIndentLeft(), l.title = this.leftText;
|
|
1712
|
-
}, icon:
|
|
1752
|
+
}, icon: Lt, name: a }];
|
|
1713
1753
|
}
|
|
1714
1754
|
const e = `
|
|
1715
1755
|
<div class="${this.CSS.popoverItem} ${this.CSS.customPopoverItem}" data-item-name='indent' version=${this.config.version}>
|
|
1716
|
-
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentLeft}>${
|
|
1756
|
+
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentLeft}>${Lt}</button>
|
|
1717
1757
|
<span class="${this.CSS.popoverItemTitle}">${this.api.sanitizer.clean(this.api.i18n.t("Indent"), {})}</span>
|
|
1718
|
-
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentRight} style="margin-left:10px;">${
|
|
1758
|
+
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentRight} style="margin-left:10px;">${xt}</button>
|
|
1719
1759
|
</div>
|
|
1720
1760
|
`, i = this.createElementFromTemplate(e), s = i.querySelector(`[data-${this.TuneNames.indentRight}]`), n = i.querySelector(`[data-${this.TuneNames.indentLeft}]`);
|
|
1721
1761
|
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;
|
|
@@ -1819,16 +1859,16 @@ const kt = { orientation: !1 }, V = class x {
|
|
|
1819
1859
|
if (!this.config.multiblock || s.length < 2)
|
|
1820
1860
|
return i ? this.indentBlock() : this.unIndentBlock(), void ((o = (r = this.block).dispatchChange) == null ? void 0 : o.call(r));
|
|
1821
1861
|
this.config.tuneName && s.forEach(async (a) => {
|
|
1822
|
-
var
|
|
1862
|
+
var c, u, g, m;
|
|
1823
1863
|
const d = await a.save();
|
|
1824
1864
|
if (!d || !("tunes" in d) || typeof d.tunes != "object" || !d.tunes)
|
|
1825
1865
|
return;
|
|
1826
|
-
const l = d.tunes[(
|
|
1866
|
+
const l = d.tunes[(c = this.config.tuneName) != null ? c : ""];
|
|
1827
1867
|
if (!l)
|
|
1828
1868
|
return;
|
|
1829
1869
|
l.indentLevel = i ? Math.min(this.config.maxIndent, ((u = l.indentLevel) != null ? u : 0) + 1) : Math.max(0, ((g = l.indentLevel) != null ? g : 0) - 1), (m = a.dispatchChange) == null || m.call(a);
|
|
1830
|
-
const
|
|
1831
|
-
|
|
1870
|
+
const h = this.getWrapperBlockById(a.id);
|
|
1871
|
+
h instanceof HTMLElement && this.applyStylesToWrapper(h, l.indentLevel);
|
|
1832
1872
|
});
|
|
1833
1873
|
}
|
|
1834
1874
|
handleIndentLeft() {
|
|
@@ -1880,8 +1920,8 @@ const kt = { orientation: !1 }, V = class x {
|
|
|
1880
1920
|
return void queueMicrotask(() => this.applyStylesToWrapper.bind(this)(t, e));
|
|
1881
1921
|
const o = (r - this.maxWidthForContent(t)) / 2, a = Math.max(0, Math.min(o, i)), d = 2 * a + "px", l = `${a}px`;
|
|
1882
1922
|
this.isDirectionInverted ? (t.style.paddingLeft = "0px", t.style.paddingRight = d) : (t.style.paddingLeft = d, t.style.paddingRight = "0px");
|
|
1883
|
-
const
|
|
1884
|
-
|
|
1923
|
+
const h = t.querySelector(`.${this.CSS.highlightIndent}`);
|
|
1924
|
+
h instanceof HTMLElement && (this.isDirectionInverted ? (h.style.width = l, h.style.left = "100%", h.style.right = "") : (h.style.width = l, h.style.left = "", h.style.right = "100%"));
|
|
1885
1925
|
}
|
|
1886
1926
|
onFocus(t) {
|
|
1887
1927
|
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.setAttribute(x.DATA_FOCUSED, "");
|
|
@@ -1926,7 +1966,7 @@ const kt = { orientation: !1 }, V = class x {
|
|
|
1926
1966
|
return new DOMParser().parseFromString(t, "text/html").body.firstChild;
|
|
1927
1967
|
}
|
|
1928
1968
|
changeConfigBasedOnVersionIfNeeded() {
|
|
1929
|
-
this.config.version && this.config.version < "2.27" && this.config.orientation === "vertical" && (this.config.orientation = "horizontal",
|
|
1969
|
+
this.config.version && this.config.version < "2.27" && this.config.orientation === "vertical" && (this.config.orientation = "horizontal", Et.orientation, Et.orientation = !0);
|
|
1930
1970
|
}
|
|
1931
1971
|
maxWidthForContent(t) {
|
|
1932
1972
|
const e = t.querySelector(`.${this.EditorCSS.content}`);
|
|
@@ -1938,11 +1978,11 @@ const kt = { orientation: !1 }, V = class x {
|
|
|
1938
1978
|
return this.cachedMaxWidthForContent !== null || (this.cachedMaxWidthForContent = 650), this.cachedMaxWidthForContent;
|
|
1939
1979
|
}
|
|
1940
1980
|
};
|
|
1941
|
-
|
|
1942
|
-
let
|
|
1981
|
+
Y.DATA_WRAPPER_NAME = "data-block-indent-wrapper", Y.DATA_FOCUSED = "data-focused", Y.DATA_INDENT_LEVEL = "data-indent-level";
|
|
1982
|
+
let Ce = Y;
|
|
1943
1983
|
class P {
|
|
1944
1984
|
static get toolboxIcon() {
|
|
1945
|
-
return
|
|
1985
|
+
return St;
|
|
1946
1986
|
}
|
|
1947
1987
|
static get CSS() {
|
|
1948
1988
|
return "cdx-marker";
|
|
@@ -1978,13 +2018,13 @@ class P {
|
|
|
1978
2018
|
(e = this.button) == null || e.classList.toggle(this.iconClasses.active, !!t);
|
|
1979
2019
|
}
|
|
1980
2020
|
get toolboxIcon() {
|
|
1981
|
-
return
|
|
2021
|
+
return St;
|
|
1982
2022
|
}
|
|
1983
2023
|
static get sanitize() {
|
|
1984
2024
|
return { mark: { class: P.CSS } };
|
|
1985
2025
|
}
|
|
1986
2026
|
}
|
|
1987
|
-
class
|
|
2027
|
+
class ve {
|
|
1988
2028
|
constructor(t) {
|
|
1989
2029
|
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;
|
|
1990
2030
|
const { api: e, config: i } = t;
|
|
@@ -2024,11 +2064,11 @@ class ce {
|
|
|
2024
2064
|
return { span: { style: { color: !0 } } };
|
|
2025
2065
|
}
|
|
2026
2066
|
}
|
|
2027
|
-
class
|
|
2067
|
+
class ke extends ve {
|
|
2028
2068
|
static get sanitize() {
|
|
2029
2069
|
}
|
|
2030
2070
|
}
|
|
2031
|
-
const
|
|
2071
|
+
const $t = class U {
|
|
2032
2072
|
constructor(t) {
|
|
2033
2073
|
this.tag = "U", this.api = t.api, this.iconClasses = { base: this.api.styles.inlineToolButton, active: this.api.styles.inlineToolButtonActive };
|
|
2034
2074
|
}
|
|
@@ -2041,12 +2081,12 @@ const Ot = class $ {
|
|
|
2041
2081
|
surround(t) {
|
|
2042
2082
|
if (!t)
|
|
2043
2083
|
return;
|
|
2044
|
-
const e = this.api.selection.findParentTag(this.tag,
|
|
2084
|
+
const e = this.api.selection.findParentTag(this.tag, U.CSS);
|
|
2045
2085
|
e ? this.unwrap(e) : this.wrap(t);
|
|
2046
2086
|
}
|
|
2047
2087
|
wrap(t) {
|
|
2048
2088
|
const e = document.createElement(this.tag);
|
|
2049
|
-
e.classList.add(
|
|
2089
|
+
e.classList.add(U.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
2050
2090
|
}
|
|
2051
2091
|
unwrap(t) {
|
|
2052
2092
|
var n;
|
|
@@ -2062,19 +2102,19 @@ const Ot = class $ {
|
|
|
2062
2102
|
}
|
|
2063
2103
|
checkState() {
|
|
2064
2104
|
var e;
|
|
2065
|
-
const t = this.api.selection.findParentTag(this.tag,
|
|
2105
|
+
const t = this.api.selection.findParentTag(this.tag, U.CSS);
|
|
2066
2106
|
return (e = this.button) == null || e.classList.toggle(this.iconClasses.active, !!t), !!t;
|
|
2067
2107
|
}
|
|
2068
2108
|
get toolboxIcon() {
|
|
2069
2109
|
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>';
|
|
2070
2110
|
}
|
|
2071
2111
|
static get sanitize() {
|
|
2072
|
-
return { u: { class:
|
|
2112
|
+
return { u: { class: U.CSS } };
|
|
2073
2113
|
}
|
|
2074
2114
|
};
|
|
2075
|
-
|
|
2076
|
-
let
|
|
2077
|
-
class
|
|
2115
|
+
$t.isInline = !0;
|
|
2116
|
+
let we = $t;
|
|
2117
|
+
class $ {
|
|
2078
2118
|
constructor({ api: t }) {
|
|
2079
2119
|
this.tag = "CODE", this.api = t, this.button = null, this.iconClasses = { base: this.api.styles.inlineToolButton, active: this.api.styles.inlineToolButtonActive };
|
|
2080
2120
|
}
|
|
@@ -2091,12 +2131,12 @@ class W {
|
|
|
2091
2131
|
var i;
|
|
2092
2132
|
if (!t)
|
|
2093
2133
|
return;
|
|
2094
|
-
let e = this.api.selection.findParentTag(this.tag,
|
|
2134
|
+
let e = this.api.selection.findParentTag(this.tag, $.CSS);
|
|
2095
2135
|
e ? this.unwrap(e) : (i = t.commonAncestorContainer.parentElement) != null && i.querySelector(this.tag) || this.wrap(t);
|
|
2096
2136
|
}
|
|
2097
2137
|
wrap(t) {
|
|
2098
2138
|
let e = document.createElement(this.tag);
|
|
2099
|
-
e.classList.add(
|
|
2139
|
+
e.classList.add($.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
2100
2140
|
}
|
|
2101
2141
|
unwrap(t) {
|
|
2102
2142
|
var n;
|
|
@@ -2108,40 +2148,40 @@ class W {
|
|
|
2108
2148
|
(n = t.parentNode) == null || n.removeChild(t), i.insertNode(s), e.removeAllRanges(), e.addRange(i);
|
|
2109
2149
|
}
|
|
2110
2150
|
checkState() {
|
|
2111
|
-
const t = this.api.selection.findParentTag(this.tag,
|
|
2151
|
+
const t = this.api.selection.findParentTag(this.tag, $.CSS);
|
|
2112
2152
|
return this.button && this.button.classList.toggle(this.iconClasses.active, !!t), !!t;
|
|
2113
2153
|
}
|
|
2114
2154
|
get toolboxIcon() {
|
|
2115
2155
|
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>';
|
|
2116
2156
|
}
|
|
2117
2157
|
static get sanitize() {
|
|
2118
|
-
return { code: { class:
|
|
2158
|
+
return { code: { class: $.CSS } };
|
|
2119
2159
|
}
|
|
2120
2160
|
}
|
|
2121
|
-
function T(
|
|
2122
|
-
const i = document.createElement(
|
|
2161
|
+
function T(p, t, e = {}) {
|
|
2162
|
+
const i = document.createElement(p);
|
|
2123
2163
|
Array.isArray(t) ? i.classList.add(...t) : t && i.classList.add(t);
|
|
2124
2164
|
for (const s in e)
|
|
2125
2165
|
Object.prototype.hasOwnProperty.call(e, s) && (i[s] = e[s]);
|
|
2126
2166
|
return i;
|
|
2127
2167
|
}
|
|
2128
|
-
function
|
|
2129
|
-
const t =
|
|
2168
|
+
function Mt(p) {
|
|
2169
|
+
const t = p.getBoundingClientRect();
|
|
2130
2170
|
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) };
|
|
2131
2171
|
}
|
|
2132
|
-
function
|
|
2133
|
-
const e =
|
|
2172
|
+
function it(p, t) {
|
|
2173
|
+
const e = Mt(p), i = Mt(t);
|
|
2134
2174
|
return { fromTopBorder: i.y1 - e.y1, fromLeftBorder: i.x1 - e.x1, fromRightBorder: e.x2 - i.x2, fromBottomBorder: e.y2 - i.y2 };
|
|
2135
2175
|
}
|
|
2136
|
-
function
|
|
2176
|
+
function _t(p, t) {
|
|
2137
2177
|
var e;
|
|
2138
|
-
return (e = t == null ? void 0 : t.parentNode) == null ? void 0 : e.insertBefore(
|
|
2178
|
+
return (e = t == null ? void 0 : t.parentNode) == null ? void 0 : e.insertBefore(p, t);
|
|
2139
2179
|
}
|
|
2140
|
-
function
|
|
2180
|
+
function It(p, t = !0) {
|
|
2141
2181
|
const e = document.createRange(), i = window.getSelection();
|
|
2142
|
-
e.selectNodeContents(
|
|
2182
|
+
e.selectNodeContents(p), e.collapse(t), i == null || i.removeAllRanges(), i == null || i.addRange(e);
|
|
2143
2183
|
}
|
|
2144
|
-
class
|
|
2184
|
+
class y {
|
|
2145
2185
|
constructor({ items: t }) {
|
|
2146
2186
|
this.items = t, this.wrapper = void 0, this.itemEls = [];
|
|
2147
2187
|
}
|
|
@@ -2149,16 +2189,16 @@ class b {
|
|
|
2149
2189
|
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" };
|
|
2150
2190
|
}
|
|
2151
2191
|
render() {
|
|
2152
|
-
return this.wrapper = T("div",
|
|
2192
|
+
return this.wrapper = T("div", y.CSS.popover), this.items.forEach((t, e) => {
|
|
2153
2193
|
var r;
|
|
2154
|
-
const i = T("div",
|
|
2194
|
+
const i = T("div", y.CSS.item), s = T("div", y.CSS.itemIcon, { innerHTML: t.icon }), n = T("div", y.CSS.itemLabel, { textContent: t.label });
|
|
2155
2195
|
i.dataset.index = e + "", i.appendChild(s), i.appendChild(n), (r = this.wrapper) == null || r.appendChild(i), this.itemEls.push(i);
|
|
2156
2196
|
}), this.wrapper.addEventListener("click", (t) => {
|
|
2157
2197
|
this.popoverClicked(t);
|
|
2158
2198
|
}), this.wrapper;
|
|
2159
2199
|
}
|
|
2160
2200
|
popoverClicked(t) {
|
|
2161
|
-
const e = t.target.closest(`.${
|
|
2201
|
+
const e = t.target.closest(`.${y.CSS.item}`);
|
|
2162
2202
|
if (!e)
|
|
2163
2203
|
return;
|
|
2164
2204
|
const i = e.dataset.index;
|
|
@@ -2168,27 +2208,27 @@ class b {
|
|
|
2168
2208
|
!s.confirmationRequired || this.hasConfirmationState(e) ? s.onClick() : this.setConfirmationState(e);
|
|
2169
2209
|
}
|
|
2170
2210
|
setConfirmationState(t) {
|
|
2171
|
-
t.classList.add(
|
|
2211
|
+
t.classList.add(y.CSS.itemConfirmState);
|
|
2172
2212
|
}
|
|
2173
2213
|
clearConfirmationState(t) {
|
|
2174
|
-
t.classList.remove(
|
|
2214
|
+
t.classList.remove(y.CSS.itemConfirmState);
|
|
2175
2215
|
}
|
|
2176
2216
|
hasConfirmationState(t) {
|
|
2177
|
-
return t.classList.contains(
|
|
2217
|
+
return t.classList.contains(y.CSS.itemConfirmState);
|
|
2178
2218
|
}
|
|
2179
2219
|
get opened() {
|
|
2180
2220
|
var t;
|
|
2181
|
-
return ((t = this.wrapper) == null ? void 0 : t.classList.contains(
|
|
2221
|
+
return ((t = this.wrapper) == null ? void 0 : t.classList.contains(y.CSS.popoverOpened)) || !1;
|
|
2182
2222
|
}
|
|
2183
2223
|
open() {
|
|
2184
2224
|
var t;
|
|
2185
2225
|
this.items.forEach((e, i) => {
|
|
2186
|
-
typeof e.hideIf == "function" && this.itemEls[i].classList.toggle(
|
|
2187
|
-
}), (t = this.wrapper) == null || t.classList.add(
|
|
2226
|
+
typeof e.hideIf == "function" && this.itemEls[i].classList.toggle(y.CSS.itemHidden, e.hideIf());
|
|
2227
|
+
}), (t = this.wrapper) == null || t.classList.add(y.CSS.popoverOpened);
|
|
2188
2228
|
}
|
|
2189
2229
|
close() {
|
|
2190
2230
|
var t;
|
|
2191
|
-
(t = this.wrapper) == null || t.classList.remove(
|
|
2231
|
+
(t = this.wrapper) == null || t.classList.remove(y.CSS.popoverOpened), this.itemEls.forEach((e) => {
|
|
2192
2232
|
this.clearConfirmationState(e);
|
|
2193
2233
|
});
|
|
2194
2234
|
}
|
|
@@ -2216,7 +2256,7 @@ class O {
|
|
|
2216
2256
|
}), t;
|
|
2217
2257
|
}
|
|
2218
2258
|
createPopover() {
|
|
2219
|
-
return this.popover = new
|
|
2259
|
+
return this.popover = new y({ items: this.items }), this.popover.render();
|
|
2220
2260
|
}
|
|
2221
2261
|
togglerClicked() {
|
|
2222
2262
|
var t, e;
|
|
@@ -2233,8 +2273,8 @@ class O {
|
|
|
2233
2273
|
(t = this.popover) == null || t.close(), this.wrapper.classList.remove(O.CSS.toolboxShowed);
|
|
2234
2274
|
}
|
|
2235
2275
|
}
|
|
2236
|
-
const
|
|
2237
|
-
class
|
|
2276
|
+
const Ht = "tc-wrap", be = "tc-wrap--readonly", Bt = "tc-table", D = "tc-row", At = "tc-table--heading", st = "tc-row--selected", z = "tc-cell", nt = "tc-cell--selected", rt = "tc-add-row", Ot = "tc-add-row--disabled", ot = "tc-add-column", Rt = "tc-add-column--disabled";
|
|
2277
|
+
class ye {
|
|
2238
2278
|
constructor(t, e, i, s) {
|
|
2239
2279
|
this.minCellWidhth = 50, this.defaultCellWidth = 100, this.handleDocumentMousedown = (n) => {
|
|
2240
2280
|
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);
|
|
@@ -2247,9 +2287,9 @@ class me {
|
|
|
2247
2287
|
this.updateToolboxesPosition(), this.isDragging = !1, this.table.classList.remove("table-resizing"), document.removeEventListener("mousemove", this.handleDocumentMousemove), document.removeEventListener("mouseup", this.handleDocumentMouseup);
|
|
2248
2288
|
}, 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.length > 0 && (this.colWidthArr = this.data.colWidth), this.updateColWidth(), this.fill(), this.focusedCell = { row: 0, column: 0 }, this.documentClicked = (n) => {
|
|
2249
2289
|
let r = n.target;
|
|
2250
|
-
const o = r.closest(`.${
|
|
2290
|
+
const o = r.closest(`.${Bt}`) !== null, a = r.closest(`.${Ht}`) === null;
|
|
2251
2291
|
(o || a) && this.hideToolboxes();
|
|
2252
|
-
const d = r.closest(`.${
|
|
2292
|
+
const d = r.closest(`.${rt}`), l = r.closest(`.${ot}`);
|
|
2253
2293
|
d && d.parentNode === this.wrapper ? (this.addRow(void 0, !0), this.hideToolboxes()) : l && l.parentNode === this.wrapper && (this.addColumn(void 0, !0), this.hideToolboxes());
|
|
2254
2294
|
}, this.readOnly || this.bindEvents();
|
|
2255
2295
|
}
|
|
@@ -2269,7 +2309,7 @@ class me {
|
|
|
2269
2309
|
getCellInCol(t) {
|
|
2270
2310
|
const e = [];
|
|
2271
2311
|
return this.table.querySelectorAll(`.${D}`).forEach((i) => {
|
|
2272
|
-
const s = i.querySelector(`.${
|
|
2312
|
+
const s = i.querySelector(`.${z}:nth-child(${t})`);
|
|
2273
2313
|
s && e.push(s);
|
|
2274
2314
|
}), e;
|
|
2275
2315
|
}
|
|
@@ -2278,7 +2318,7 @@ class me {
|
|
|
2278
2318
|
this.addColumn(this.selectedColumn, !0), this.hideToolboxes(), this.updateColWidth();
|
|
2279
2319
|
} }, { 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: () => {
|
|
2280
2320
|
this.addColumn(this.selectedColumn + 1, !0), this.hideToolboxes(), this.updateColWidth();
|
|
2281
|
-
} }, { label: this.api.i18n.t("Delete column"), icon:
|
|
2321
|
+
} }, { label: this.api.i18n.t("Delete column"), icon: wt, hideIf: () => this.numberOfColumns === 1, confirmationRequired: !0, onClick: () => {
|
|
2282
2322
|
this.deleteColumn(this.selectedColumn), this.hideToolboxes(), this.updateColWidth();
|
|
2283
2323
|
} }], onOpen: () => {
|
|
2284
2324
|
this.selectColumn(this.hoveredColumn), this.hideRowToolbox();
|
|
@@ -2291,7 +2331,7 @@ class me {
|
|
|
2291
2331
|
this.addRow(this.selectedRow, !0), this.hideToolboxes();
|
|
2292
2332
|
} }, { 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: () => {
|
|
2293
2333
|
this.addRow(this.selectedRow + 1, !0), this.hideToolboxes();
|
|
2294
|
-
} }, { label: this.api.i18n.t("Delete row"), icon:
|
|
2334
|
+
} }, { label: this.api.i18n.t("Delete row"), icon: wt, hideIf: () => this.numberOfRows === 1, confirmationRequired: !0, onClick: () => {
|
|
2295
2335
|
this.deleteRow(this.selectedRow), this.hideToolboxes();
|
|
2296
2336
|
} }], onOpen: () => {
|
|
2297
2337
|
this.selectRow(this.hoveredRow), this.hideColumnToolbox();
|
|
@@ -2303,7 +2343,7 @@ class me {
|
|
|
2303
2343
|
this.focusedCell.row !== this.numberOfRows ? (this.focusedCell.row += 1, this.focusCell()) : (this.addRow(), this.focusedCell.row += 1, this.focusCell(), this.updateToolboxesPosition(0, 0));
|
|
2304
2344
|
}
|
|
2305
2345
|
getCell(t, e) {
|
|
2306
|
-
return this.table.querySelectorAll(`.${D}:nth-child(${t}) .${
|
|
2346
|
+
return this.table.querySelectorAll(`.${D}:nth-child(${t}) .${z}`)[e - 1];
|
|
2307
2347
|
}
|
|
2308
2348
|
getRow(t) {
|
|
2309
2349
|
return this.table.querySelector(`.${D}:nth-child(${t})`);
|
|
@@ -2312,7 +2352,7 @@ class me {
|
|
|
2312
2352
|
return t.parentElement;
|
|
2313
2353
|
}
|
|
2314
2354
|
getRowFirstCell(t) {
|
|
2315
|
-
return t.querySelector(`.${
|
|
2355
|
+
return t.querySelector(`.${z}:first-child`);
|
|
2316
2356
|
}
|
|
2317
2357
|
setCellContent(t, e, i) {
|
|
2318
2358
|
this.getCell(t, e).innerHTML = i;
|
|
@@ -2325,13 +2365,13 @@ class me {
|
|
|
2325
2365
|
for (let r = 1; r <= this.numberOfRows; r++) {
|
|
2326
2366
|
let o;
|
|
2327
2367
|
const a = this.createCell();
|
|
2328
|
-
if (t > 0 && t <= i ? (o = this.getCell(r, t),
|
|
2368
|
+
if (t > 0 && t <= i ? (o = this.getCell(r, t), _t(a, o)) : o = this.getRow(r).appendChild(a), r === 1) {
|
|
2329
2369
|
const d = this.getCell(r, t > 0 ? t : i + 1);
|
|
2330
|
-
d && e &&
|
|
2370
|
+
d && e && It(d);
|
|
2331
2371
|
}
|
|
2332
2372
|
}
|
|
2333
|
-
const s = this.wrapper.querySelector(`.${
|
|
2334
|
-
(n = this.config) != null && n.maxcols && this.numberOfColumns > this.config.maxcols - 1 && s && s.classList.add(
|
|
2373
|
+
const s = this.wrapper.querySelector(`.${ot}`);
|
|
2374
|
+
(n = this.config) != null && n.maxcols && this.numberOfColumns > this.config.maxcols - 1 && s && s.classList.add(Rt), this.addHeadingAttrToFirstRow(), this.colWidthArr.splice(t - 1, 0, this.defaultCellWidth);
|
|
2335
2375
|
}
|
|
2336
2376
|
addRow(t = -1, e = !1) {
|
|
2337
2377
|
let i, s = T("div", D);
|
|
@@ -2339,11 +2379,11 @@ class me {
|
|
|
2339
2379
|
let n = this.numberOfColumns;
|
|
2340
2380
|
if (this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows)
|
|
2341
2381
|
return;
|
|
2342
|
-
t > 0 && t <= this.numberOfRows ? i =
|
|
2382
|
+
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();
|
|
2343
2383
|
const r = this.getRowFirstCell(i);
|
|
2344
|
-
r && e &&
|
|
2345
|
-
const o = this.wrapper.querySelector(`.${
|
|
2346
|
-
return this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows && o && o.classList.add(
|
|
2384
|
+
r && e && It(r);
|
|
2385
|
+
const o = this.wrapper.querySelector(`.${rt}`);
|
|
2386
|
+
return this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows && o && o.classList.add(Ot), i;
|
|
2347
2387
|
}
|
|
2348
2388
|
deleteColumn(t) {
|
|
2349
2389
|
for (let i = 1; i <= this.numberOfRows; i++) {
|
|
@@ -2352,16 +2392,16 @@ class me {
|
|
|
2352
2392
|
return;
|
|
2353
2393
|
s.remove();
|
|
2354
2394
|
}
|
|
2355
|
-
const e = this.wrapper.querySelector(`.${
|
|
2356
|
-
e && e.classList.remove(
|
|
2395
|
+
const e = this.wrapper.querySelector(`.${ot}`);
|
|
2396
|
+
e && e.classList.remove(Rt), this.colWidthArr.splice(t - 1, 1);
|
|
2357
2397
|
}
|
|
2358
2398
|
deleteRow(t) {
|
|
2359
2399
|
this.getRow(t).remove();
|
|
2360
|
-
const e = this.wrapper.querySelector(`.${
|
|
2361
|
-
e && e.classList.remove(
|
|
2400
|
+
const e = this.wrapper.querySelector(`.${rt}`);
|
|
2401
|
+
e && e.classList.remove(Ot), this.addHeadingAttrToFirstRow();
|
|
2362
2402
|
}
|
|
2363
2403
|
createTableWrapper() {
|
|
2364
|
-
this.wrapper = T("div",
|
|
2404
|
+
this.wrapper = T("div", Ht), this.table = T("div", Bt), this.readOnly && this.wrapper.classList.add(be), this.wrapper.appendChild(this.toolboxRow.element), this.wrapper.appendChild(this.toolboxColumn.element), this.wrapper.appendChild(this.table);
|
|
2365
2405
|
}
|
|
2366
2406
|
computeInitialSize() {
|
|
2367
2407
|
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;
|
|
@@ -2395,13 +2435,13 @@ class me {
|
|
|
2395
2435
|
}
|
|
2396
2436
|
}
|
|
2397
2437
|
createCell() {
|
|
2398
|
-
return T("div",
|
|
2438
|
+
return T("div", z, { contentEditable: !this.readOnly });
|
|
2399
2439
|
}
|
|
2400
2440
|
get numberOfRows() {
|
|
2401
2441
|
return this.table.childElementCount;
|
|
2402
2442
|
}
|
|
2403
2443
|
get numberOfColumns() {
|
|
2404
|
-
return this.numberOfRows ? this.table.querySelectorAll(`.${D}:first-child .${
|
|
2444
|
+
return this.numberOfRows ? this.table.querySelectorAll(`.${D}:first-child .${z}`).length : 0;
|
|
2405
2445
|
}
|
|
2406
2446
|
get isColumnMenuShowing() {
|
|
2407
2447
|
return this.selectedColumn !== 0;
|
|
@@ -2429,7 +2469,7 @@ class me {
|
|
|
2429
2469
|
}
|
|
2430
2470
|
focusInTableListener(t) {
|
|
2431
2471
|
const e = t.target, i = this.getRowByCell(e);
|
|
2432
|
-
i && (this.focusedCell = { row: Array.from(this.table.querySelectorAll(`.${D}`)).indexOf(i) + 1, column: Array.from(i.querySelectorAll(`.${
|
|
2472
|
+
i && (this.focusedCell = { row: Array.from(this.table.querySelectorAll(`.${D}`)).indexOf(i) + 1, column: Array.from(i.querySelectorAll(`.${z}`)).indexOf(e) + 1 });
|
|
2433
2473
|
}
|
|
2434
2474
|
hideToolboxes() {
|
|
2435
2475
|
this.hideRowToolbox(), this.hideColumnToolbox(), this.updateToolboxesPosition();
|
|
@@ -2449,12 +2489,12 @@ class me {
|
|
|
2449
2489
|
}
|
|
2450
2490
|
updateToolboxesPosition(t = this.hoveredRow, e = this.hoveredColumn) {
|
|
2451
2491
|
this.isColumnMenuShowing || e > 0 && e <= this.numberOfColumns && this.toolboxColumn.show(() => ({ left: `calc((100% - var(--cell-size)) / (${this.numberOfColumns} * 2) * (1 + (${e} - 1) * 2))` })), this.isRowMenuShowing || t > 0 && t <= this.numberOfRows && this.toolboxRow.show(() => {
|
|
2452
|
-
const i = this.getRow(t), { fromTopBorder: s } =
|
|
2492
|
+
const i = this.getRow(t), { fromTopBorder: s } = it(this.table, i), { height: n } = i.getBoundingClientRect();
|
|
2453
2493
|
return { top: `${Math.ceil(s + n / 2)}px` };
|
|
2454
2494
|
});
|
|
2455
2495
|
}
|
|
2456
2496
|
setHeadingsSetting(t) {
|
|
2457
|
-
this.tunes.withHeadings = t, t ? (this.table.classList.add(
|
|
2497
|
+
this.tunes.withHeadings = t, t ? (this.table.classList.add(At), this.addHeadingAttrToFirstRow()) : (this.table.classList.remove(At), this.removeHeadingAttrFromFirstRow());
|
|
2458
2498
|
}
|
|
2459
2499
|
addHeadingAttrToFirstRow() {
|
|
2460
2500
|
for (let t = 1; t <= this.numberOfColumns; t++) {
|
|
@@ -2470,55 +2510,55 @@ class me {
|
|
|
2470
2510
|
}
|
|
2471
2511
|
selectRow(t) {
|
|
2472
2512
|
const e = this.getRow(t);
|
|
2473
|
-
e && (this.selectedRow = t, e.classList.add(
|
|
2513
|
+
e && (this.selectedRow = t, e.classList.add(st));
|
|
2474
2514
|
}
|
|
2475
2515
|
unselectRow() {
|
|
2476
2516
|
if (this.selectedRow <= 0)
|
|
2477
2517
|
return;
|
|
2478
|
-
const t = this.table.querySelector(`.${
|
|
2479
|
-
t && t.classList.remove(
|
|
2518
|
+
const t = this.table.querySelector(`.${st}`);
|
|
2519
|
+
t && t.classList.remove(st), this.selectedRow = 0;
|
|
2480
2520
|
}
|
|
2481
2521
|
selectColumn(t) {
|
|
2482
2522
|
for (let e = 1; e <= this.numberOfRows; e++) {
|
|
2483
2523
|
const i = this.getCell(e, t);
|
|
2484
|
-
i && i.classList.add(
|
|
2524
|
+
i && i.classList.add(nt);
|
|
2485
2525
|
}
|
|
2486
2526
|
this.selectedColumn = t;
|
|
2487
2527
|
}
|
|
2488
2528
|
unselectColumn() {
|
|
2489
2529
|
if (this.selectedColumn <= 0)
|
|
2490
2530
|
return;
|
|
2491
|
-
let t = this.table.querySelectorAll(`.${
|
|
2531
|
+
let t = this.table.querySelectorAll(`.${nt}`);
|
|
2492
2532
|
Array.from(t).forEach((e) => {
|
|
2493
|
-
e.classList.remove(
|
|
2533
|
+
e.classList.remove(nt);
|
|
2494
2534
|
}), this.selectedColumn = 0;
|
|
2495
2535
|
}
|
|
2496
2536
|
getHoveredCell(t) {
|
|
2497
2537
|
let e = this.hoveredRow, i = this.hoveredColumn;
|
|
2498
|
-
const { width: s, height: n, x: r, y: o } = function(
|
|
2499
|
-
const g =
|
|
2500
|
-
return { width: m, height: f, x: w - v, y: _ -
|
|
2538
|
+
const { width: s, height: n, x: r, y: o } = function(c, u) {
|
|
2539
|
+
const g = c.getBoundingClientRect(), { width: m, height: f, x: v, y: L } = g, { clientX: w, clientY: _ } = u;
|
|
2540
|
+
return { width: m, height: f, x: w - v, y: _ - L };
|
|
2501
2541
|
}(this.table, t);
|
|
2502
2542
|
if (r >= 0) {
|
|
2503
|
-
const
|
|
2504
|
-
i = this.binSearch(this.numberOfColumns, (g) => this.getCell(1, g),
|
|
2543
|
+
const c = ({ fromLeftBorder: g }) => r < g, u = ({ fromRightBorder: g }) => r > s - g;
|
|
2544
|
+
i = this.binSearch(this.numberOfColumns, (g) => this.getCell(1, g), c, u);
|
|
2505
2545
|
}
|
|
2506
2546
|
if (o >= 0) {
|
|
2507
|
-
const
|
|
2508
|
-
e = this.binSearch(this.numberOfRows, (g) => this.getCell(g, 1),
|
|
2547
|
+
const c = ({ fromTopBorder: g }) => o < g, u = ({ fromBottomBorder: g }) => o > n - g;
|
|
2548
|
+
e = this.binSearch(this.numberOfRows, (g) => this.getCell(g, 1), c, u);
|
|
2509
2549
|
}
|
|
2510
|
-
const a = e || this.hoveredRow, d = i || this.hoveredColumn, { deltaXCell: l, deltaYCell:
|
|
2511
|
-
return { row: a, column: d, deltaXCell: l, deltaYCell:
|
|
2550
|
+
const a = e || this.hoveredRow, d = i || this.hoveredColumn, { deltaXCell: l, deltaYCell: h } = this.getMousePositionRelateToCell(a, d, r, o);
|
|
2551
|
+
return { row: a, column: d, deltaXCell: l, deltaYCell: h };
|
|
2512
2552
|
}
|
|
2513
2553
|
getMousePositionRelateToCell(t, e, i, s) {
|
|
2514
|
-
const n = this.getCell(t, e), { fromTopBorder: r, fromLeftBorder: o } =
|
|
2554
|
+
const n = this.getCell(t, e), { fromTopBorder: r, fromLeftBorder: o } = it(this.table, n);
|
|
2515
2555
|
return { deltaXCell: i - o, deltaYCell: s - r };
|
|
2516
2556
|
}
|
|
2517
2557
|
binSearch(t, e, i, s) {
|
|
2518
2558
|
let n, r = 0, o = t + 1, a = 0;
|
|
2519
2559
|
for (; r < o - 1 && a < 10; ) {
|
|
2520
2560
|
n = Math.ceil((r + o) / 2);
|
|
2521
|
-
const d = e(n), l =
|
|
2561
|
+
const d = e(n), l = it(this.table, d);
|
|
2522
2562
|
if (i(l))
|
|
2523
2563
|
o = n;
|
|
2524
2564
|
else {
|
|
@@ -2533,7 +2573,7 @@ class me {
|
|
|
2533
2573
|
getData() {
|
|
2534
2574
|
const t = [];
|
|
2535
2575
|
for (let e = 1; e <= this.numberOfRows; e++) {
|
|
2536
|
-
const i = this.table.querySelector(`.${D}:nth-child(${e})`), s = Array.from(i.querySelectorAll(`.${
|
|
2576
|
+
const i = this.table.querySelector(`.${D}:nth-child(${e})`), s = Array.from(i.querySelectorAll(`.${z}`));
|
|
2537
2577
|
s.every((n) => !n.textContent.trim()) || t.push(s.map((n) => n.innerHTML));
|
|
2538
2578
|
}
|
|
2539
2579
|
return t;
|
|
@@ -2542,7 +2582,7 @@ class me {
|
|
|
2542
2582
|
document.removeEventListener("click", this.documentClicked);
|
|
2543
2583
|
}
|
|
2544
2584
|
}
|
|
2545
|
-
class
|
|
2585
|
+
class Se {
|
|
2546
2586
|
static get isReadOnlySupported() {
|
|
2547
2587
|
return !0;
|
|
2548
2588
|
}
|
|
@@ -2556,7 +2596,7 @@ class fe {
|
|
|
2556
2596
|
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" };
|
|
2557
2597
|
}
|
|
2558
2598
|
render() {
|
|
2559
|
-
return this.table = new
|
|
2599
|
+
return this.table = new ye(this.readOnly, this.api, this.data, this.config), this.container = T("div", this.api.styles.block), this.container.appendChild(this.table.getWrapper()), this.table.setHeadingsSetting(this.data.withHeadings), this.container;
|
|
2560
2600
|
}
|
|
2561
2601
|
renderSettings() {
|
|
2562
2602
|
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: () => {
|
|
@@ -2586,15 +2626,15 @@ class fe {
|
|
|
2586
2626
|
}
|
|
2587
2627
|
}
|
|
2588
2628
|
}
|
|
2589
|
-
function F(
|
|
2590
|
-
const i = document.createElement(
|
|
2629
|
+
function F(p, t = null, e = {}) {
|
|
2630
|
+
const i = document.createElement(p);
|
|
2591
2631
|
Array.isArray(t) ? i.classList.add(...t) : t !== null && i.classList.add(t);
|
|
2592
2632
|
for (const s in e)
|
|
2593
2633
|
e.hasOwnProperty(s) && (i[s] = e[s]);
|
|
2594
2634
|
return i;
|
|
2595
2635
|
}
|
|
2596
|
-
var
|
|
2597
|
-
class
|
|
2636
|
+
var G = ((p) => (p.Empty = "empty", p.Uploading = "uploading", p.Filled = "filled", p))(G || {});
|
|
2637
|
+
class Le {
|
|
2598
2638
|
constructor({ api: t, config: e, onSelectFile: i, readOnly: s }) {
|
|
2599
2639
|
this.api = t, this.config = e, this.onSelectFile = i, this.readOnly = s, this.nodes = { wrapper: F("div", [this.CSS.baseClass, this.CSS.wrapper]), imageContainer: F("div", [this.CSS.imageContainer]), fileButton: this.createFileButton(), imageEl: void 0, imagePreloader: F("div", this.CSS.imagePreloader), caption: F("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);
|
|
2600
2640
|
}
|
|
@@ -2621,9 +2661,9 @@ class Ce {
|
|
|
2621
2661
|
this.nodes.caption !== void 0 && (this.nodes.caption.innerHTML = t);
|
|
2622
2662
|
}
|
|
2623
2663
|
toggleStatus(t) {
|
|
2624
|
-
for (const e in
|
|
2625
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
2626
|
-
const i =
|
|
2664
|
+
for (const e in G)
|
|
2665
|
+
if (Object.prototype.hasOwnProperty.call(G, e)) {
|
|
2666
|
+
const i = G[e];
|
|
2627
2667
|
this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${i}`, i === t);
|
|
2628
2668
|
}
|
|
2629
2669
|
}
|
|
@@ -2633,12 +2673,12 @@ class Ce {
|
|
|
2633
2673
|
createFileButton() {
|
|
2634
2674
|
var e;
|
|
2635
2675
|
const t = F("div", [this.CSS.button]);
|
|
2636
|
-
return t.innerHTML = (e = this.config.buttonContent) != null ? e : `${
|
|
2676
|
+
return t.innerHTML = (e = this.config.buttonContent) != null ? e : `${Ft} ${this.api.i18n.t("Select an Image")}`, t.addEventListener("click", () => {
|
|
2637
2677
|
this.onSelectFile();
|
|
2638
2678
|
}), t;
|
|
2639
2679
|
}
|
|
2640
2680
|
}
|
|
2641
|
-
class
|
|
2681
|
+
class xe {
|
|
2642
2682
|
constructor({ config: t, onUpload: e, onError: i }) {
|
|
2643
2683
|
this.config = t, this.onUpload = e, this.onError = i;
|
|
2644
2684
|
}
|
|
@@ -2647,7 +2687,7 @@ class ve {
|
|
|
2647
2687
|
let i = "", s = "";
|
|
2648
2688
|
const n = await function(m = {}) {
|
|
2649
2689
|
let f = !0;
|
|
2650
|
-
return new Promise((v,
|
|
2690
|
+
return new Promise((v, L) => {
|
|
2651
2691
|
let w = document.createElement("INPUT");
|
|
2652
2692
|
w.type = "file", m.multiple && w.setAttribute("multiple", "multiple"), m.accept && w.setAttribute("accept", m.accept), w.style.display = "none", document.body.appendChild(w), w.addEventListener("change", (_) => {
|
|
2653
2693
|
f = !1;
|
|
@@ -2678,13 +2718,13 @@ class ve {
|
|
|
2678
2718
|
m && f && (l[f] = v + " " + m);
|
|
2679
2719
|
}
|
|
2680
2720
|
l["Content-Type"] = "application/json";
|
|
2681
|
-
const
|
|
2682
|
-
if (
|
|
2683
|
-
return void this.onError(
|
|
2684
|
-
const u =
|
|
2721
|
+
const h = V.create({ timeout: 18e5, headers: l }), c = await h.post(this.config.endpoints.byFile, { fileName: r.name, contentType: r.type });
|
|
2722
|
+
if (c.status !== 200)
|
|
2723
|
+
return void this.onError(c.statusText);
|
|
2724
|
+
const u = c.data;
|
|
2685
2725
|
if (!u.success)
|
|
2686
2726
|
return void this.onError(u.message);
|
|
2687
|
-
i = u.data.cdn, s = u.data.objectKey,
|
|
2727
|
+
i = u.data.cdn, s = u.data.objectKey, V.create({ timeout: 18e5, headers: { "Content-Type": r.type } }).put(u.data.presignedUrl, r).then((m) => {
|
|
2688
2728
|
m.status === 200 && (m = { success: 1, file: { url: i + s } }), this.onUpload(m);
|
|
2689
2729
|
}).catch((m) => {
|
|
2690
2730
|
this.onError(m);
|
|
@@ -2696,7 +2736,7 @@ class ve {
|
|
|
2696
2736
|
const s = this.config.userStore.token, n = this.config.userStore.tokenName, r = this.config.userStore.tokenPrefix;
|
|
2697
2737
|
s && n && (i[n] = r + " " + s);
|
|
2698
2738
|
}
|
|
2699
|
-
e =
|
|
2739
|
+
e = V.create({ timeout: 18e5, headers: i }).post(this.config.endpoints.byUrl, { url: t, accept: ".jpg,.jpeg,.gif,.png,.webp" }), e.then((s) => {
|
|
2700
2740
|
if (s.status !== 200 || s.data.success === !1)
|
|
2701
2741
|
return void this.onError(s.data.message);
|
|
2702
2742
|
let n = { success: 1, file: { url: s.data.data.cdn + s.data.data.objectKey } };
|
|
@@ -2712,10 +2752,10 @@ class ve {
|
|
|
2712
2752
|
return void this.onError("文件类型不支持");
|
|
2713
2753
|
let r = {};
|
|
2714
2754
|
if (this.config.userStore) {
|
|
2715
|
-
const
|
|
2716
|
-
|
|
2755
|
+
const c = this.config.userStore.token, u = this.config.userStore.tokenName, g = this.config.userStore.tokenPrefix;
|
|
2756
|
+
c && u && (r[u] = g + " " + c);
|
|
2717
2757
|
}
|
|
2718
|
-
const o =
|
|
2758
|
+
const o = V.create({ timeout: 18e5, headers: r });
|
|
2719
2759
|
r["Content-Type"] = "application/json";
|
|
2720
2760
|
const a = await o.post(this.config.endpoints.byFile, { fileName: t.name, contentType: t.type });
|
|
2721
2761
|
if (a.status !== 200)
|
|
@@ -2723,18 +2763,18 @@ class ve {
|
|
|
2723
2763
|
const d = a.data;
|
|
2724
2764
|
if (!d.success)
|
|
2725
2765
|
return void this.onError(d.message);
|
|
2726
|
-
let l = d.data.cdn,
|
|
2727
|
-
r["Content-Type"] = t.type, o.put(d.data.presignedUrl, t).then((
|
|
2728
|
-
|
|
2729
|
-
}).catch((
|
|
2730
|
-
this.onError(
|
|
2766
|
+
let l = d.data.cdn, h = d.data.objectKey;
|
|
2767
|
+
r["Content-Type"] = t.type, o.put(d.data.presignedUrl, t).then((c) => {
|
|
2768
|
+
c.status === 200 && (c = { success: 1, file: { url: l + h } }), this.onUpload(c);
|
|
2769
|
+
}).catch((c) => {
|
|
2770
|
+
this.onError(c);
|
|
2731
2771
|
});
|
|
2732
2772
|
}
|
|
2733
2773
|
}
|
|
2734
|
-
class
|
|
2774
|
+
class J {
|
|
2735
2775
|
constructor({ data: t, config: e, api: i, readOnly: s, block: n }) {
|
|
2736
2776
|
var r;
|
|
2737
|
-
this.isCaptionEnabled = null, this.api = i, this.block = n, this.userStore = e == null ? void 0 : e.userStore, 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
|
|
2777
|
+
this.isCaptionEnabled = null, this.api = i, this.block = n, this.userStore = e == null ? void 0 : e.userStore, 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 xe({ config: this.config, onUpload: (o) => this.onUpload(o), onError: (o) => this.uploadingFailed(o) }), this.ui = new Le({ api: i, config: this.config, onSelectFile: () => {
|
|
2738
2778
|
this.uploader.uploadSelectedFile({ onPreview: (o) => {
|
|
2739
2779
|
this.ui.showPreloader(o);
|
|
2740
2780
|
}, noSelectedFile: () => {
|
|
@@ -2752,7 +2792,7 @@ class G {
|
|
|
2752
2792
|
return !0;
|
|
2753
2793
|
}
|
|
2754
2794
|
static get toolbox() {
|
|
2755
|
-
return { icon:
|
|
2795
|
+
return { icon: Ft, title: "Image" };
|
|
2756
2796
|
}
|
|
2757
2797
|
static get tunes() {
|
|
2758
2798
|
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 }];
|
|
@@ -2770,8 +2810,8 @@ class G {
|
|
|
2770
2810
|
}
|
|
2771
2811
|
renderSettings() {
|
|
2772
2812
|
var n;
|
|
2773
|
-
const t =
|
|
2774
|
-
((n = this.config.features) == null ? void 0 : n.caption) === "optional" && t.push({ name: "caption", icon:
|
|
2813
|
+
const t = J.tunes.concat(this.config.actions || []), e = { border: "withBorder", background: "withBackground", stretch: "stretched", caption: "caption" };
|
|
2814
|
+
((n = this.config.features) == null ? void 0 : n.caption) === "optional" && t.push({ name: "caption", icon: Pt, title: "With caption", toggle: !0 });
|
|
2775
2815
|
const i = t.filter((r) => {
|
|
2776
2816
|
var a, d;
|
|
2777
2817
|
const o = Object.keys(e).find((l) => e[l] === r.name);
|
|
@@ -2815,7 +2855,7 @@ class G {
|
|
|
2815
2855
|
}
|
|
2816
2856
|
set data(t) {
|
|
2817
2857
|
var e;
|
|
2818
|
-
this.image = t.file, this._data.caption = t.caption || "", this.ui.fillCaption(this._data.caption),
|
|
2858
|
+
this.image = t.file, this._data.caption = t.caption || "", this.ui.fillCaption(this._data.caption), J.tunes.forEach(({ name: i }) => {
|
|
2819
2859
|
const s = t[i] !== void 0 && (t[i] === !0 || t[i] === "true");
|
|
2820
2860
|
this.setTune(i, s);
|
|
2821
2861
|
}), (t.caption || ((e = this.config.features) == null ? void 0 : e.caption) === !0) && this.setTune("caption", !0);
|
|
@@ -2851,10 +2891,10 @@ class G {
|
|
|
2851
2891
|
this.ui.showPreloader(t), this.uploader.uploadByUrl(t);
|
|
2852
2892
|
}
|
|
2853
2893
|
}
|
|
2854
|
-
class
|
|
2894
|
+
class Te {
|
|
2855
2895
|
constructor({ api: t, data: e, config: i, block: s }) {
|
|
2856
|
-
var n, r, o, a, d, l,
|
|
2857
|
-
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: (
|
|
2896
|
+
var n, r, o, a, d, l, h, c, u, g, m, f, v, L, w, _, B;
|
|
2897
|
+
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 = (h = e == null ? void 0 : e.resize) != null ? h : i == null ? void 0 : i.resize) != null ? c : !1, resizeSize: (u = e == null ? void 0 : e.resizeSize) != null ? u : 0, crop: (m = (g = e == null ? void 0 : e.crop) != null ? g : i == null ? void 0 : i.crop) != null ? m : !1, cropperFrameHeight: (f = e == null ? void 0 : e.cropperFrameHeight) != null ? f : 0, cropperFrameWidth: (v = e == null ? void 0 : e.cropperFrameWidth) != null ? v : 0, cropperFrameLeft: (L = e == null ? void 0 : e.cropperFrameLeft) != null ? L : 0, cropperFrameTop: (w = e == null ? void 0 : e.cropperFrameTop) != null ? w : 0, cropperImageHeight: (_ = e == null ? void 0 : e.cropperImageHeight) != null ? _ : 0, cropperImageWidth: (B = e == null ? void 0 : e.cropperImageWidth) != null ? B : 0, cropperInterface: void 0 }, this.wrapper = void 0, this.buttons = [], this.styles = { settingsButton: "cdx-settings-button", settingsButtonActive: "cdx-settings-button--active", settingsButtonModifier: "", settingsButtonModifierActive: "" };
|
|
2858
2898
|
}
|
|
2859
2899
|
static get isTune() {
|
|
2860
2900
|
return !0;
|
|
@@ -3002,8 +3042,8 @@ class ke {
|
|
|
3002
3042
|
let n = 0, r = 0;
|
|
3003
3043
|
const o = (d) => {
|
|
3004
3044
|
const l = d.clientX - n;
|
|
3005
|
-
let
|
|
3006
|
-
e === "right" && (
|
|
3045
|
+
let h = r;
|
|
3046
|
+
e === "right" && (h += l), e === "left" && (h -= l), h > 50 && h < s && (t.style.width = h + "px");
|
|
3007
3047
|
}, a = () => {
|
|
3008
3048
|
const d = parseInt(window.getComputedStyle(t).width, 10);
|
|
3009
3049
|
d > 0 && (this.data.resizeSize = d), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", a), this.block.dispatchChange();
|
|
@@ -3060,49 +3100,50 @@ class ke {
|
|
|
3060
3100
|
this.setTune(t);
|
|
3061
3101
|
}
|
|
3062
3102
|
}
|
|
3063
|
-
const
|
|
3064
|
-
const i =
|
|
3103
|
+
const Ee = { class: "ebl-editor", id: "holder" }, Me = qt({ name: "EblEditor", inheritAttrs: !1, __name: "Editor", props: { readOnly: { type: Boolean, default: !1 }, placeholder: { default: "Enter something" }, data: { default: () => ({ blocks: [] }) }, locale: { default: {} }, userStore: {} }, emits: ["onReady", "onChange"], setup(p, { expose: t, emit: e }) {
|
|
3104
|
+
const i = Vt("EblEditorSettings");
|
|
3065
3105
|
let s = e;
|
|
3066
|
-
const n =
|
|
3067
|
-
let r = null;
|
|
3068
|
-
const
|
|
3069
|
-
return
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
s("onChange", d, l);
|
|
3106
|
+
const n = p;
|
|
3107
|
+
let r = Q(n.data), o = !1, a = null;
|
|
3108
|
+
const d = ["indent", "blockAlignment"];
|
|
3109
|
+
return Kt(() => {
|
|
3110
|
+
a = new Qt({ minHeight: 100, holder: "holder", autofocus: !0, defaultBlock: "paragraph", placeholder: n.placeholder, tunes: d, tools: { inlineCode: $, underline: we, Color: { class: ke }, marker: { class: P }, indent: { class: Ce }, alert: { class: H, inlineToolbar: !0 }, List: { class: X, inlineToolbar: !0, config: { defaultStyle: "checklist", maxLevel: 4 } }, h1: { class: ae, inlineToolbar: !0 }, h2: { class: le, inlineToolbar: !0 }, h3: { class: de, inlineToolbar: !0 }, h4: { class: he, inlineToolbar: !0 }, h5: { class: ce, inlineToolbar: !0 }, h6: { class: pe, inlineToolbar: !0 }, paragraph: { class: dt, inlineToolbar: !0 }, blockAlignment: { class: lt, inlineToolbar: !0 }, code: { class: q, config: { lang: "javascript", theme: "github-dark-dimmed" } }, quote: { class: ue, inlineToolbar: !0 }, delimiter: ge, table: { class: Se, inlineToolbar: !0, config: { rows: 2, cols: 3 } }, image: { class: J, inlineToolbar: !0, tunes: d.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: Te, config: { resize: !0, crop: !1 } } }, data: r, readOnly: n.readOnly, i18n: n.locale, onChange: (l, h) => {
|
|
3111
|
+
s("onChange", l, h);
|
|
3073
3112
|
}, onReady: () => {
|
|
3074
|
-
new
|
|
3075
|
-
} }).initialize(
|
|
3113
|
+
o = !0, new oe("holder", n.readOnly, a, "1px solid #999"), new fe({ editor: a, config: { debounceTimer: 200, maxLength: 100 }, onUpdate: () => {
|
|
3114
|
+
} }).initialize(r), s("onReady"), n.data && n.data.blocks && n.data.blocks.length > 0 && (r = Q(n.data), a.render(r));
|
|
3076
3115
|
} });
|
|
3077
|
-
}),
|
|
3078
|
-
|
|
3079
|
-
}),
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3116
|
+
}), Yt(() => {
|
|
3117
|
+
a !== null && (a.destroy(), a = null);
|
|
3118
|
+
}), Gt(() => n.data, (l, h) => {
|
|
3119
|
+
a != null && o && (r = Q(l), a.render(r));
|
|
3120
|
+
}, { deep: !0 }), t({ validate: function() {
|
|
3121
|
+
return new Promise((l, h) => {
|
|
3122
|
+
if (a === null)
|
|
3123
|
+
return l(!1);
|
|
3124
|
+
a.save().then((c) => c.blocks.length > 0 ? l(!0) : l(!1));
|
|
3084
3125
|
});
|
|
3085
3126
|
}, getData: function() {
|
|
3086
|
-
return new Promise((
|
|
3087
|
-
if (
|
|
3088
|
-
return
|
|
3089
|
-
|
|
3127
|
+
return new Promise((l, h) => {
|
|
3128
|
+
if (a === null)
|
|
3129
|
+
return l(null);
|
|
3130
|
+
a.save().then((c) => l(c));
|
|
3090
3131
|
});
|
|
3091
|
-
} }), (
|
|
3092
|
-
} }),
|
|
3093
|
-
let
|
|
3094
|
-
for (let
|
|
3095
|
-
const t =
|
|
3096
|
-
|
|
3132
|
+
} }), (l, h) => (Xt(), Jt("div", Ee));
|
|
3133
|
+
} }), Dt = [Me];
|
|
3134
|
+
let jt = [];
|
|
3135
|
+
for (let p in Dt) {
|
|
3136
|
+
const t = re(Dt[p]);
|
|
3137
|
+
jt.push(t);
|
|
3097
3138
|
}
|
|
3098
|
-
const
|
|
3099
|
-
t[
|
|
3100
|
-
} }))(
|
|
3139
|
+
const De = { messages: { ui: { blockTunes: { toggler: { "Click to tune": "可拖拽和点击" } }, toolbar: { toolbox: { Add: "添加", Filter: "过滤", "Nothing found": "无内容" }, popover: { Filter: "过滤", "Nothing found": "无内容" } }, popover: { Filter: "筛选", "Nothing found": "未找到任何内容", "Convert to": "转化为" } }, 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: "已复制" }, 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": "右对齐" } }, 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": "向左缩进" } } } }, Ut = ((p = []) => ({ version: "2.31.12", install: (t, e) => {
|
|
3140
|
+
t[pt] || (t[pt] = !0, p.forEach((i) => t.use(i)), t.provide("EblEditorSettings", e));
|
|
3141
|
+
} }))(jt), ze = Ut.install, Ne = Ut.version;
|
|
3101
3142
|
export {
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3143
|
+
Me as EblEditor,
|
|
3144
|
+
Ut as default,
|
|
3145
|
+
ze as install,
|
|
3146
|
+
Ne as version,
|
|
3147
|
+
De as zhCn
|
|
3107
3148
|
};
|
|
3108
3149
|
//# sourceMappingURL=index.mjs.map
|