@ebl-vue/editor-full 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +733 -440
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
- package/src/components/Editor/Editor.vue +34 -10
- package/src/i18n/zh-cn.ts +6 -1
- package/src/icons/index.ts +15 -0
- package/src/installer.ts +4 -3
- package/src/plugins/alert/index.ts +19 -27
- package/src/plugins/block-alignment/index.ts +4 -3
- package/src/plugins/code/index.ts +3 -2
- package/src/plugins/color-picker/index.ts +3 -11
- package/src/plugins/delimiter/index.ts +5 -6
- package/src/plugins/header/H1.ts +1 -1
- package/src/plugins/header/H2.ts +1 -1
- package/src/plugins/header/H3.ts +1 -1
- package/src/plugins/header/H4.ts +1 -2
- package/src/plugins/header/H5.ts +1 -3
- package/src/plugins/header/H6.ts +1 -3
- package/src/plugins/imageTool/index.css +145 -0
- package/src/plugins/imageTool/index.ts +519 -0
- package/src/plugins/imageTool/types/codexteam__ajax.d.ts +89 -0
- package/src/plugins/imageTool/types/types.ts +234 -0
- package/src/plugins/imageTool/ui.ts +312 -0
- package/src/plugins/imageTool/uploader.ts +234 -0
- package/src/plugins/imageTool/utils/dom.ts +24 -0
- package/src/plugins/imageTool/utils/isPromise.ts +10 -0
- package/src/plugins/indent/index.ts +5 -7
- package/src/plugins/inline-code/index.ts +2 -5
- package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +1 -4
- package/src/plugins/list/index.ts +20 -37
- package/src/plugins/list/types/OlCounterType.ts +1 -1
- package/src/plugins/marker/index.ts +28 -16
- package/src/plugins/paragraph/index.ts +3 -2
- package/src/plugins/quote/index.ts +1 -4
- package/src/plugins/table/plugin.ts +1 -1
- package/src/plugins/table/table.ts +40 -38
- package/src/plugins/table/toolbox.ts +5 -4
- package/src/plugins/table/utils/dom.ts +15 -14
- package/src/plugins/table/utils/popover.ts +28 -15
- package/src/plugins/underline/index.ts +2 -4
- package/src/plugins/undo/index.ts +48 -33
- package/src/plugins/undo/observer.ts +3 -3
- package/src/style.css +6 -0
- package/types/index.d.ts +5 -0
- package/vite.config.ts +3 -1
- package/src/plugins/list/styles/icons/index.ts +0 -10
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode(':root{--color-border: #EFF0F1}.ebl-editor-title{min-height:55px}.ebl-editor-title-wrap{min-height:55px;margin:0 auto}.ebl-editor-title-input{min-height:55px;width:100%;font-weight:600;border:none;background-color:transparent;font-size:34px}.ebl-editor-title-input:focus{outline:none}.ebl-editor-title-input:active{outline:none}.ebl-editor-time-wrap{white-space:nowrap;font-size:14px;font-weight:400;line-height:22px;padding-top:12px;padding-bottom:8px;color:#646a73}.ce-block__content{max-width:650px}@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:.25rem;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;z-index:12;border-bottom-style:solid;border-color:#9ca3af0d;padding:.5rem}.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;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;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}.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:#f5eb6f4a;padding:3px 0}.ce-popover--inline .ce-popover--nested .ce-popover__container{width:-webkit-min-content!important;width:-moz-min-content!important;width:min-content!important;min-width:0!important;min-width:initial!important}.ce-popover--inline .ce-popover--nested .ce-popover__items{width:-webkit-max-content;width:-moz-max-content;width:max-content}.editorjs__color-selector-container{display:grid;grid-gap:10px;padding:4px}.editorjs__color-selector__container-item{width:30px;height:30px;display:block;cursor:pointer;border-radius:100%;-webkit-transition:-webkit-transform .2s ease;transition:-webkit-transform .2s ease;transition:transform .2s ease;transition:transform .2s ease,-webkit-transform .2s ease}.editorjs__color-selector__container-item:hover{-webkit-transform:scale(1.1);transform:scale(1.1)}.cdx-underline{-webkit-text-decoration:underline;text-decoration:underline}.inline-code{background:#faeff0c7;color:#b44437;padding:3px 4px;border-radius:5px;margin:0 1px;font-family:inherit;font-size:.86em;font-weight:500;letter-spacing:.3px}.tc-wrap{--color-background: #f9f9fb;--color-text-secondary: #7b7e89;--color-border: #e8e8eb;--cell-size: 34px;--toolbox-icon-size: 18px;--toolbox-padding: 6px;--toolbox-aiming-field-size: calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);--col-width: 100px 100px 100px;position:relative;height:100%;margin-top:var(--toolbox-icon-size);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-grid;z-index:0}.tc-wrap svg{vertical-align:top}@media print{.tc-wrap{border-left-color:var(--color-border);border-left-style:solid;border-left-width:1px}}@media print{.tc-wrap .tc-row:after{display:none}}.tc-table{position:relative;width:100%;height:100%;display:grid;font-size:14px;border-top:1px solid var(--color-border);border-left:1px solid var(--color-border);line-height:1.4;overflow-x:auto}.tc-table:after{width:calc(var(--cell-size));height:100%;left:calc(var(--cell-size)*-1);top:0}.tc-table:after,.tc-table:before{position:absolute;content:""}.tc-table:before{width:100%;height:var(--toolbox-aiming-field-size);top:calc(var(--toolbox-aiming-field-size)*-1);left:0}.tc-table--heading .tc-row:first-child{font-weight:600;border-bottom:2px solid var(--color-border);position:sticky;top:0;z-index:2;background:var(--color-background)}.tc-table--heading .tc-row:first-child [contenteditable]:empty:before{content:attr(heading);color:var(--color-text-secondary)}.tc-table--heading .tc-row:first-child:after{bottom:-2px;border-bottom:2px solid var(--color-border)}.tc-add-column,.tc-add-row{display:-webkit-box;display:-ms-flexbox;display:flex;color:var(--color-text-secondary)}@media print{.tc-add{display:none}}.tc-add-column{display:grid;border-top:1px solid var(--color-border);grid-auto-rows:var(--cell-size);-webkit-box-align:center;-ms-flex-align:center;align-items:center;justify-items:center}.tc-add-column svg{padding:5px;position:sticky;top:0;background-color:var(--color-background)}.tc-add-column--disabled{visibility:hidden}@media print{.tc-add-column{display:none}}.tc-add-row{height:var(--cell-size);-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:4px;position:relative}.tc-add-row--disabled{display:none}.tc-add-row:before{content:"";position:absolute;right:calc(var(--cell-size)*-1);width:var(--cell-size);height:100%}@media print{.tc-add-row{display:none}}.tc-add-column,.tc-add-row{-webkit-transition:0s;transition:0s;cursor:pointer;will-change:background-color}.tc-add-column:hover,.tc-add-row:hover{-webkit-transition:background-color .1s ease;transition:background-color .1s ease;background-color:var(--color-background)}.tc-add-row{margin-top:1px}.tc-add-row:hover:before{-webkit-transition:.1s;transition:.1s;background-color:var(--color-background)}.tc-row{display:grid;grid-template-columns:var(--col-width);position:relative;border-bottom:1px solid var(--color-border)}.tc-row--selected{background:var(--color-background)}.tc-row--selected:after{background:var(--color-background)}.tc-cell{border-right:1px solid var(--color-border);padding:6px 12px;overflow:hidden;outline:none;line-break:normal}.tc-cell--selected{background:var(--color-background)}.tc-wrap--readonly .tc-row:after{display:none}.tc-toolbox{--toolbox-padding: 6px;--popover-margin: 30px;--toggler-click-zone-size: 30px;--toggler-dots-color: #7b7e89;--toggler-dots-color-hovered: #1d202b;position:absolute;cursor:pointer;z-index:1;opacity:0;-webkit-transition:opacity .1s;transition:opacity .1s;will-change:left,opacity}.tc-toolbox--column{top:calc(var(--toggler-click-zone-size)*-1);-webkit-transform:translate(calc(var(--toggler-click-zone-size)*-1/2));transform:translate(calc(var(--toggler-click-zone-size)*-1/2));will-change:left,opacity}.tc-toolbox--row{left:calc(var(--popover-margin)*-1);-webkit-transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));margin-top:-1px;will-change:top,opacity}.tc-toolbox--showed{opacity:1}.tc-toolbox .tc-popover{position:absolute;top:0;left:var(--popover-margin)}.tc-toolbox__toggler{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:var(--toggler-click-zone-size);height:var(--toggler-click-zone-size);color:var(--toggler-dots-color);opacity:0;-webkit-transition:opacity .15s ease;transition:opacity .15s ease;will-change:opacity}.tc-toolbox__toggler:hover{color:var(--toggler-dots-color-hovered)}.tc-toolbox__toggler svg{fill:currentColor}.tc-wrap:hover .tc-toolbox__toggler{opacity:1}.tc-settings .cdx-settings-button{width:50%;margin:0}.tc-popover{--color-border: #eaeaea;--color-background: #fff;--color-background-hover: rgba(232, 232, 235, .49);--color-background-confirm: #e24a4a;--color-background-confirm-hover: #d54040;--color-text-confirm: #fff;background:var(--color-background);border:1px solid var(--color-border);-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.12941);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;padding:6px;display:none;will-change:opacity,transform}.tc-popover--opened{display:block;-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}')),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 { make as
|
|
6
|
-
import { focus as
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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}.ebl-editor-title{min-height:55px}.ebl-editor-title-wrap{min-height:55px;margin:0 auto}.ebl-editor-title-input{min-height:55px;width:100%;font-weight:600;border:none;background-color:transparent;font-size:34px}.ebl-editor-title-input:focus{outline:none}.ebl-editor-title-input:active{outline:none}.ebl-editor-time-wrap{white-space:nowrap;font-size:14px;font-weight:400;line-height:22px;padding-top:12px;padding-bottom:8px;color:#646a73}.ce-block__content{max-width:650px}@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:.25rem;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;z-index:12;border-bottom-style:solid;border-color:#9ca3af0d;padding:.5rem}.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;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;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}.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:block;-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 }.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:inline-block}.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:-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}.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)}}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
import { defineComponent as Pt, inject as $t, ref as Wt, onMounted as Ft, toRaw as Ut, onUnmounted as qt, openBlock as zt, createElementBlock as jt, createElementVNode as W, withDirectives as Vt, vModelText as Kt, toDisplayString as Yt } from "vue";
|
|
3
|
+
import Gt from "@ebl-vue/editorjs";
|
|
4
|
+
import { bundledLanguagesInfo as Xt, codeToHtml as Jt } from "shiki";
|
|
5
|
+
import { make as v, isEmpty as ot } from "@editorjs/dom";
|
|
6
|
+
import { focus as Zt, isCaretAtStartOfInput as Qt, getCaretNodeAndOffset as te, getContenteditableSlice as ee } from "@editorjs/caret";
|
|
7
|
+
import dt from "vanilla-caret-js";
|
|
8
|
+
import H from "@codexteam/ajax";
|
|
9
|
+
import ie from "axios";
|
|
10
|
+
const ht = Symbol("INSTALLED_KEY"), se = (h, t) => {
|
|
11
|
+
if (h.install = (e) => {
|
|
12
|
+
for (const i of [h, ...Object.values(t != null ? t : {})])
|
|
13
|
+
e.component(i.name, i);
|
|
14
|
+
}, t)
|
|
15
|
+
for (const [e, i] of Object.entries(t))
|
|
16
|
+
h[e] = i;
|
|
17
|
+
return h;
|
|
18
|
+
};
|
|
19
|
+
class ne {
|
|
12
20
|
constructor(t, e, i, s) {
|
|
13
21
|
const { blocks: n, toolbar: r } = i;
|
|
14
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();
|
|
15
23
|
}
|
|
16
24
|
setElementCursor(t) {
|
|
17
|
-
if (!t)
|
|
25
|
+
if (!t)
|
|
26
|
+
return;
|
|
18
27
|
const e = document.createRange(), i = window.getSelection();
|
|
19
28
|
e.setStart(t.childNodes[0], 0), e.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(e), t.focus();
|
|
20
29
|
}
|
|
@@ -42,7 +51,8 @@ class Yt {
|
|
|
42
51
|
setBorderBlocks(t, e) {
|
|
43
52
|
Object.values(t).forEach((i) => {
|
|
44
53
|
const s = i.querySelector(".ce-block__content");
|
|
45
|
-
if (i !== e)
|
|
54
|
+
if (i !== e)
|
|
55
|
+
s == null || s.style.removeProperty("border-top"), s == null || s.style.removeProperty("border-bottom");
|
|
46
56
|
else {
|
|
47
57
|
const n = Object.keys(t).find((r) => t[Number(r)] === e);
|
|
48
58
|
n && Number(n) > this.startBlock ? s.style.borderBottom = this.borderStyle : s.style.borderTop = this.borderStyle;
|
|
@@ -78,8 +88,8 @@ class Yt {
|
|
|
78
88
|
this.isTheOnlyBlock() || this.api.move(this.endBlock, this.startBlock);
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
|
-
const
|
|
82
|
-
class
|
|
91
|
+
const 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="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>', 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="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>', 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="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>', 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="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>', 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 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>', 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="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>', It = '<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>', At = '<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>', Bt = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="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>', 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="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></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-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>', Ot = '<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>', wt = '<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>', kt = '<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 re {
|
|
83
93
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
84
94
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H1" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
85
95
|
}
|
|
@@ -147,7 +157,7 @@ class Gt {
|
|
|
147
157
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
148
158
|
}
|
|
149
159
|
get defaultLevel() {
|
|
150
|
-
return { number: 1, tag: "H1", svg:
|
|
160
|
+
return { number: 1, tag: "H1", svg: ct };
|
|
151
161
|
}
|
|
152
162
|
onPaste(t) {
|
|
153
163
|
const e = t.detail;
|
|
@@ -160,11 +170,10 @@ class Gt {
|
|
|
160
170
|
return { tags: ["H1"] };
|
|
161
171
|
}
|
|
162
172
|
static get toolbox() {
|
|
163
|
-
return { icon:
|
|
173
|
+
return { icon: ct, title: "H1" };
|
|
164
174
|
}
|
|
165
175
|
}
|
|
166
|
-
|
|
167
|
-
class Kt {
|
|
176
|
+
class oe {
|
|
168
177
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
169
178
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H2" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
170
179
|
}
|
|
@@ -232,7 +241,7 @@ class Kt {
|
|
|
232
241
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
233
242
|
}
|
|
234
243
|
get defaultLevel() {
|
|
235
|
-
return { number: 2, tag: "H2", svg:
|
|
244
|
+
return { number: 2, tag: "H2", svg: ut };
|
|
236
245
|
}
|
|
237
246
|
onPaste(t) {
|
|
238
247
|
const e = t.detail;
|
|
@@ -245,11 +254,10 @@ class Kt {
|
|
|
245
254
|
return { tags: ["H2"] };
|
|
246
255
|
}
|
|
247
256
|
static get toolbox() {
|
|
248
|
-
return { icon:
|
|
257
|
+
return { icon: ut, title: "H2" };
|
|
249
258
|
}
|
|
250
259
|
}
|
|
251
|
-
|
|
252
|
-
class Xt {
|
|
260
|
+
class ae {
|
|
253
261
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
254
262
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H3" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
255
263
|
}
|
|
@@ -317,7 +325,7 @@ class Xt {
|
|
|
317
325
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
318
326
|
}
|
|
319
327
|
get defaultLevel() {
|
|
320
|
-
return { number: 3, tag: "H3", svg:
|
|
328
|
+
return { number: 3, tag: "H3", svg: pt };
|
|
321
329
|
}
|
|
322
330
|
onPaste(t) {
|
|
323
331
|
const e = t.detail;
|
|
@@ -330,11 +338,10 @@ class Xt {
|
|
|
330
338
|
return { tags: ["H3"] };
|
|
331
339
|
}
|
|
332
340
|
static get toolbox() {
|
|
333
|
-
return { icon:
|
|
341
|
+
return { icon: pt, title: "H3" };
|
|
334
342
|
}
|
|
335
343
|
}
|
|
336
|
-
|
|
337
|
-
class Jt {
|
|
344
|
+
class le {
|
|
338
345
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
339
346
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H4" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
340
347
|
}
|
|
@@ -402,7 +409,7 @@ class Jt {
|
|
|
402
409
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
403
410
|
}
|
|
404
411
|
get defaultLevel() {
|
|
405
|
-
return { number: 4, tag: "H4", svg:
|
|
412
|
+
return { number: 4, tag: "H4", svg: gt };
|
|
406
413
|
}
|
|
407
414
|
onPaste(t) {
|
|
408
415
|
const e = t.detail;
|
|
@@ -415,11 +422,10 @@ class Jt {
|
|
|
415
422
|
return { tags: ["H4"] };
|
|
416
423
|
}
|
|
417
424
|
static get toolbox() {
|
|
418
|
-
return { icon:
|
|
425
|
+
return { icon: gt, title: "H4" };
|
|
419
426
|
}
|
|
420
427
|
}
|
|
421
|
-
|
|
422
|
-
class Zt {
|
|
428
|
+
class de {
|
|
423
429
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
424
430
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H5" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
425
431
|
}
|
|
@@ -487,7 +493,7 @@ class Zt {
|
|
|
487
493
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
488
494
|
}
|
|
489
495
|
get defaultLevel() {
|
|
490
|
-
return { number: 5, tag: "H5", svg:
|
|
496
|
+
return { number: 5, tag: "H5", svg: mt };
|
|
491
497
|
}
|
|
492
498
|
onPaste(t) {
|
|
493
499
|
const e = t.detail;
|
|
@@ -500,11 +506,10 @@ class Zt {
|
|
|
500
506
|
return { tags: ["H5"] };
|
|
501
507
|
}
|
|
502
508
|
static get toolbox() {
|
|
503
|
-
return { icon:
|
|
509
|
+
return { icon: mt, title: "H5" };
|
|
504
510
|
}
|
|
505
511
|
}
|
|
506
|
-
|
|
507
|
-
class Qt {
|
|
512
|
+
class he {
|
|
508
513
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
509
514
|
this.api = i, this.readOnly = s, this._settings = { placeholder: "H6" }, this._data = this.normalizeData(t), this._element = this.getTag();
|
|
510
515
|
}
|
|
@@ -572,7 +577,7 @@ class Qt {
|
|
|
572
577
|
t.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
|
|
573
578
|
}
|
|
574
579
|
get defaultLevel() {
|
|
575
|
-
return { number: 6, tag: "H6", svg:
|
|
580
|
+
return { number: 6, tag: "H6", svg: ft };
|
|
576
581
|
}
|
|
577
582
|
onPaste(t) {
|
|
578
583
|
const e = t.detail;
|
|
@@ -585,10 +590,10 @@ class Qt {
|
|
|
585
590
|
return { tags: ["H6"] };
|
|
586
591
|
}
|
|
587
592
|
static get toolbox() {
|
|
588
|
-
return { icon:
|
|
593
|
+
return { icon: ft, title: "H6" };
|
|
589
594
|
}
|
|
590
595
|
}
|
|
591
|
-
class
|
|
596
|
+
class at {
|
|
592
597
|
static get DEFAULT_ALIGNMENT() {
|
|
593
598
|
return "left";
|
|
594
599
|
}
|
|
@@ -597,10 +602,10 @@ class st {
|
|
|
597
602
|
}
|
|
598
603
|
getAlignment() {
|
|
599
604
|
var t, e;
|
|
600
|
-
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 : at.DEFAULT_ALIGNMENT;
|
|
601
606
|
}
|
|
602
607
|
constructor({ api: t, data: e, config: i, block: s }) {
|
|
603
|
-
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: At }, { name: "center", icon: It }, { name: "right", icon: Bt }], this._CSS = { alignment: { left: "ce-tune-alignment--left", center: "ce-tune-alignment--center", right: "ce-tune-alignment--right" } };
|
|
604
609
|
}
|
|
605
610
|
wrap(t) {
|
|
606
611
|
return this.wrapper = document.createElement("div"), this.wrapper.classList.toggle(this._CSS.alignment[this.data.alignment]), this.wrapper.append(t), this.wrapper;
|
|
@@ -625,16 +630,17 @@ class st {
|
|
|
625
630
|
return this.data;
|
|
626
631
|
}
|
|
627
632
|
}
|
|
628
|
-
class
|
|
633
|
+
class lt {
|
|
629
634
|
static get DEFAULT_PLACEHOLDER() {
|
|
630
635
|
return "";
|
|
631
636
|
}
|
|
632
637
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
633
638
|
var n;
|
|
634
|
-
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 : lt.DEFAULT_PLACEHOLDER, this._data = t != null ? t : {}, this._element = null, this._preserveBlank = (n = e.preserveBlank) != null ? n : !1;
|
|
635
640
|
}
|
|
636
641
|
onKeyUp(t) {
|
|
637
|
-
if (t.code !== "Backspace" && t.code !== "Delete" || !this._element)
|
|
642
|
+
if (t.code !== "Backspace" && t.code !== "Delete" || !this._element)
|
|
643
|
+
return;
|
|
638
644
|
const { textContent: e } = this._element;
|
|
639
645
|
e === "" && (this._element.innerHTML = "");
|
|
640
646
|
}
|
|
@@ -646,7 +652,8 @@ class nt {
|
|
|
646
652
|
return this._element = this.drawView(), this._element;
|
|
647
653
|
}
|
|
648
654
|
merge(t) {
|
|
649
|
-
if (!this._element)
|
|
655
|
+
if (!this._element)
|
|
656
|
+
return;
|
|
650
657
|
this._data.text += t.text;
|
|
651
658
|
const e = function(i) {
|
|
652
659
|
const s = document.createElement("div");
|
|
@@ -681,13 +688,13 @@ class nt {
|
|
|
681
688
|
return { tags: ["P"] };
|
|
682
689
|
}
|
|
683
690
|
static get toolbox() {
|
|
684
|
-
return { icon:
|
|
691
|
+
return { icon: Ot, title: "Text" };
|
|
685
692
|
}
|
|
686
693
|
}
|
|
687
|
-
class
|
|
694
|
+
class U {
|
|
688
695
|
constructor({ data: t, config: e, api: i, readOnly: s }) {
|
|
689
696
|
var n;
|
|
690
|
-
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 || U.DEFAULT_PLACEHOLDER), this._selectorLanguage = t.lang || e.lang || U.DEFAULT_LANGUAGE, this._selectorTheme = t.theme || e.theme || U.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();
|
|
691
698
|
}
|
|
692
699
|
static get isReadOnlySupported() {
|
|
693
700
|
return !0;
|
|
@@ -737,42 +744,45 @@ class $ {
|
|
|
737
744
|
const e = t.target, i = t.shiftKey, s = e.selectionStart, n = e.value, r = " ";
|
|
738
745
|
let o;
|
|
739
746
|
if (i) {
|
|
740
|
-
const a = function(
|
|
747
|
+
const a = function(d, l) {
|
|
741
748
|
let c = "";
|
|
742
749
|
for (; c !== `
|
|
743
|
-
` && l > 0; )
|
|
750
|
+
` && l > 0; )
|
|
751
|
+
l -= 1, c = d.substr(l, 1);
|
|
744
752
|
return c === `
|
|
745
753
|
` && (l += 1), l;
|
|
746
754
|
}(n, s);
|
|
747
|
-
if (n.substr(a, 2) !== r)
|
|
755
|
+
if (n.substr(a, 2) !== r)
|
|
756
|
+
return;
|
|
748
757
|
e.value = n.substring(0, a) + n.substring(a + 2), o = s - 2;
|
|
749
|
-
} else
|
|
758
|
+
} else
|
|
759
|
+
o = s + 2, e.value = n.substring(0, s) + r + n.substring(s);
|
|
750
760
|
e.setSelectionRange(o, o);
|
|
751
761
|
}
|
|
752
762
|
drawView() {
|
|
753
|
-
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"),
|
|
754
|
-
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"),
|
|
763
|
+
const t = document.createElement("div"), e = document.createElement("div"), i = document.createElement("div"), s = document.createElement("div"), n = document.createElement("div"), r = document.createElement("div"), o = document.createElement("select"), a = document.createElement("select"), d = document.createElement("span"), l = document.createElement("textarea");
|
|
764
|
+
return t.classList.add(this.CSS.baseClass, this.CSS.wrapper), e.classList.add("ce-editorjs-x-shiki__code"), i.classList.add("ce-editorjs-x-shiki__selector"), s.classList.add("ce-editorjs-x-shiki__lang"), n.classList.add("ce-editorjs-x-shiki__copy"), r.classList.add("ce-editorjs-x-shiki__copy_tip"), o.classList.add(this.CSS.selectorLanguage), l.classList.add(this.CSS.textarea, this.CSS.input), s.innerHTML = this.data.lang, n.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.25 8.5H10.25C9.2835 8.5 8.5 9.2835 8.5 10.25V17.25C8.5 18.2165 9.2835 19 10.25 19H17.25C18.2165 19 19 18.2165 19 17.25V10.25C19 9.2835 18.2165 8.5 17.25 8.5Z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.5 8.5V6.75C15.5 6.28587 15.3156 5.84075 14.9874 5.51256C14.6592 5.18437 14.2141 5 13.75 5H6.75C6.28587 5 5.84075 5.18437 5.51256 5.51256C5.18437 5.84075 5 6.28587 5 6.75V13.75C5 14.2141 5.18437 14.6592 5.51256 14.9874C5.84075 15.3156 6.28587 15.5 6.75 15.5H8.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 12L15.5 12"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15.5L15.5 15.5"/></svg>', r.innerText = this.api.i18n.t("Copied"), Xt.forEach((c) => {
|
|
755
765
|
const u = document.createElement("option");
|
|
756
766
|
u.value = c.id, u.text = c.name, o.appendChild(u);
|
|
757
|
-
}), 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(
|
|
758
|
-
|
|
767
|
+
}), o.value = this.data.lang, l.value = this.data.code, l.placeholder = this.placeholder, l.spellcheck = !1, l.autocomplete = "off", l.autocapitalize = "off", this.readOnly && (l.disabled = !0), e.appendChild(d), e.appendChild(l), this.readOnly ? i.appendChild(s) : i.appendChild(o), n.appendChild(r), i.appendChild(n), t.appendChild(i), t.appendChild(e), this.runShiki().then(({ html: c, preStyle: u }) => {
|
|
768
|
+
d.innerHTML = c, t == null || t.setAttribute("style", u), o.setAttribute("style", u), a.setAttribute("style", u);
|
|
759
769
|
}), o.addEventListener("change", (c) => {
|
|
760
770
|
const u = c.target.value;
|
|
761
771
|
this._selectorLanguage = u, this.runShiki().then(({ html: p, preStyle: g }) => {
|
|
762
|
-
|
|
772
|
+
d.innerHTML = p, s.innerHTML = u;
|
|
763
773
|
});
|
|
764
774
|
}), a.addEventListener("change", (c) => {
|
|
765
775
|
const u = c.target.value;
|
|
766
776
|
this._selectorTheme = u, this.runShiki().then(({ html: p, preStyle: g }) => {
|
|
767
|
-
|
|
777
|
+
d.innerHTML = p, t == null || t.setAttribute("style", g), o.setAttribute("style", g), a.setAttribute("style", g);
|
|
768
778
|
});
|
|
769
779
|
}), l.addEventListener("input", () => {
|
|
770
780
|
this.data.code = l.value, this.runShiki().then(({ html: c, preStyle: u }) => {
|
|
771
|
-
|
|
781
|
+
d.innerHTML = c, t == null || t.setAttribute("style", u), o.setAttribute("style", u), a.setAttribute("style", u);
|
|
772
782
|
});
|
|
773
783
|
}), l.addEventListener("keydown", (c) => {
|
|
774
784
|
c.code === "Tab" && (this.tabHandler(c), this.data.code = l.value, this.runShiki().then(({ html: u, preStyle: p }) => {
|
|
775
|
-
|
|
785
|
+
d.innerHTML = u;
|
|
776
786
|
}));
|
|
777
787
|
}), n.addEventListener("click", (c) => {
|
|
778
788
|
this.copyCode(this.data.code, c);
|
|
@@ -780,7 +790,7 @@ class $ {
|
|
|
780
790
|
}
|
|
781
791
|
async runShiki() {
|
|
782
792
|
let t = "";
|
|
783
|
-
return { html: await
|
|
793
|
+
return { html: await Jt(this.data.code, { lang: this._selectorLanguage, theme: this._selectorTheme, transformers: [{ preprocess: (e) => `${e}
|
|
784
794
|
`, pre(e) {
|
|
785
795
|
var i;
|
|
786
796
|
this.addClassToHast(e, "ce-editorjs-x-shiki__span"), t = ((i = e.properties) == null ? void 0 : i.style) || "";
|
|
@@ -802,7 +812,7 @@ class $ {
|
|
|
802
812
|
});
|
|
803
813
|
}
|
|
804
814
|
}
|
|
805
|
-
class
|
|
815
|
+
class ce {
|
|
806
816
|
constructor({ data: t, api: e, readOnly: i }) {
|
|
807
817
|
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 };
|
|
808
818
|
}
|
|
@@ -810,10 +820,7 @@ class te {
|
|
|
810
820
|
return !0;
|
|
811
821
|
}
|
|
812
822
|
static get toolbox() {
|
|
813
|
-
return { icon:
|
|
814
|
-
<path d="M10 10.8182L9 10.8182C8.80222 10.8182 8.60888 10.7649 8.44443 10.665C8.27998 10.5651 8.15181 10.4231 8.07612 10.257C8.00043 10.0909 7.98063 9.90808 8.01922 9.73174C8.0578 9.55539 8.15304 9.39341 8.29289 9.26627C8.43275 9.13913 8.61093 9.05255 8.80491 9.01747C8.99889 8.98239 9.19996 9.00039 9.38268 9.0692C9.56541 9.13801 9.72159 9.25453 9.83147 9.40403C9.94135 9.55353 10 9.72929 10 9.90909L10 12.1818C10 12.664 9.78929 13.1265 9.41421 13.4675C9.03914 13.8084 8.53043 14 8 14" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
815
|
-
<path d="M16 10.8182L15 10.8182C14.8022 10.8182 14.6089 10.7649 14.4444 10.665C14.28 10.5651 14.1518 10.4231 14.0761 10.257C14.0004 10.0909 13.9806 9.90808 14.0192 9.73174C14.0578 9.55539 14.153 9.39341 14.2929 9.26627C14.4327 9.13913 14.6109 9.05255 14.8049 9.01747C14.9989 8.98239 15.2 9.00039 15.3827 9.0692C15.5654 9.13801 15.7216 9.25453 15.8315 9.40403C15.9414 9.55353 16 9.72929 16 9.90909L16 12.1818C16 12.664 15.7893 13.1265 15.4142 13.4675C15.0391 13.8084 14.5304 14 14 14" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
816
|
-
</svg>`, title: "Quote" };
|
|
823
|
+
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-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 10.8182L9 10.8182C8.80222 10.8182 8.60888 10.7649 8.44443 10.665C8.27998 10.5651 8.15181 10.4231 8.07612 10.257C8.00043 10.0909 7.98063 9.90808 8.01922 9.73174C8.0578 9.55539 8.15304 9.39341 8.29289 9.26627C8.43275 9.13913 8.61093 9.05255 8.80491 9.01747C8.99889 8.98239 9.19996 9.00039 9.38268 9.0692C9.56541 9.13801 9.72159 9.25453 9.83147 9.40403C9.94135 9.55353 10 9.72929 10 9.90909L10 12.1818C10 12.664 9.78929 13.1265 9.41421 13.4675C9.03914 13.8084 8.53043 14 8 14"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 10.8182L15 10.8182C14.8022 10.8182 14.6089 10.7649 14.4444 10.665C14.28 10.5651 14.1518 10.4231 14.0761 10.257C14.0004 10.0909 13.9806 9.90808 14.0192 9.73174C14.0578 9.55539 14.153 9.39341 14.2929 9.26627C14.4327 9.13913 14.6109 9.05255 14.8049 9.01747C14.9989 8.98239 15.2 9.00039 15.3827 9.0692C15.5654 9.13801 15.7216 9.25453 15.8315 9.40403C15.9414 9.55353 16 9.72929 16 9.90909L16 12.1818C16 12.664 15.7893 13.1265 15.4142 13.4675C15.0391 13.8084 14.5304 14 14 14"/></svg>', title: "Quote" };
|
|
817
824
|
}
|
|
818
825
|
static get contentless() {
|
|
819
826
|
return !0;
|
|
@@ -830,8 +837,8 @@ class te {
|
|
|
830
837
|
return { baseClass: this.api.styles.block, wrapper: "cdx-quote", text: "cdx-quote__text", input: this.api.styles.input };
|
|
831
838
|
}
|
|
832
839
|
render() {
|
|
833
|
-
const t =
|
|
834
|
-
return this._quoteElement =
|
|
840
|
+
const t = v("div", [this._CSS.baseClass, this._CSS.wrapper]);
|
|
841
|
+
return this._quoteElement = v("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;
|
|
835
842
|
}
|
|
836
843
|
get currentItem() {
|
|
837
844
|
let t = window.getSelection().anchorNode;
|
|
@@ -858,7 +865,7 @@ class te {
|
|
|
858
865
|
return { text: { br: !0 } };
|
|
859
866
|
}
|
|
860
867
|
}
|
|
861
|
-
class
|
|
868
|
+
class ue {
|
|
862
869
|
static get isReadOnlySupported() {
|
|
863
870
|
return !0;
|
|
864
871
|
}
|
|
@@ -866,7 +873,7 @@ class ee {
|
|
|
866
873
|
return !0;
|
|
867
874
|
}
|
|
868
875
|
constructor({ data: t, config: e, api: i }) {
|
|
869
|
-
this.api = i, this._CSS = { block: this.api.styles.block, wrapper: "ce-delimiter" }, this._element = this.drawView();
|
|
876
|
+
this.api = i, this._CSS = { block: this.api.styles.block, wrapper: "ce-delimiter" }, this._element = this.drawView(), this.data = t;
|
|
870
877
|
}
|
|
871
878
|
drawView() {
|
|
872
879
|
let t = document.createElement("div"), e = document.createElement("div"), i = document.createElement("div");
|
|
@@ -879,11 +886,7 @@ class ee {
|
|
|
879
886
|
return {};
|
|
880
887
|
}
|
|
881
888
|
static get toolbox() {
|
|
882
|
-
return { icon:
|
|
883
|
-
<line x1="6" y1="12" x2="10" y2="12" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
884
|
-
<line x1="14" y1="12" x2="18" y2="12" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
885
|
-
</svg>
|
|
886
|
-
`, title: "Delimiter" };
|
|
889
|
+
return { icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="6" x2="10" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="14" x2="18" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>', title: "Delimiter" };
|
|
887
890
|
}
|
|
888
891
|
static get pasteConfig() {
|
|
889
892
|
return { tags: ["HR"] };
|
|
@@ -892,25 +895,25 @@ class ee {
|
|
|
892
895
|
this.data = {};
|
|
893
896
|
}
|
|
894
897
|
}
|
|
895
|
-
const w = "cdx-list",
|
|
896
|
-
class
|
|
898
|
+
const w = "cdx-list", f = { wrapper: w, item: `${w}__item`, itemContent: `${w}__item-content`, itemChildren: `${w}__item-children` };
|
|
899
|
+
class L {
|
|
897
900
|
static get CSS() {
|
|
898
|
-
return { ...
|
|
901
|
+
return { ...f, orderedList: `${w}-ordered` };
|
|
899
902
|
}
|
|
900
903
|
constructor(t, e) {
|
|
901
904
|
this.config = e, this.readOnly = t;
|
|
902
905
|
}
|
|
903
906
|
renderWrapper(t) {
|
|
904
907
|
let e;
|
|
905
|
-
return e =
|
|
908
|
+
return e = v("ol", t === !0 ? [L.CSS.wrapper, L.CSS.orderedList] : [L.CSS.orderedList, L.CSS.itemChildren]), e;
|
|
906
909
|
}
|
|
907
910
|
renderItem(t, e) {
|
|
908
|
-
const i =
|
|
911
|
+
const i = v("li", L.CSS.item), s = v("div", L.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() });
|
|
909
912
|
return i.appendChild(s), i;
|
|
910
913
|
}
|
|
911
914
|
getItemContent(t) {
|
|
912
|
-
const e = t.querySelector(`.${
|
|
913
|
-
return e ?
|
|
915
|
+
const e = t.querySelector(`.${L.CSS.itemContent}`);
|
|
916
|
+
return e ? ot(e) ? "" : e.innerHTML : "";
|
|
914
917
|
}
|
|
915
918
|
getItemMeta() {
|
|
916
919
|
return {};
|
|
@@ -921,22 +924,22 @@ class S {
|
|
|
921
924
|
}
|
|
922
925
|
class x {
|
|
923
926
|
static get CSS() {
|
|
924
|
-
return { ...
|
|
927
|
+
return { ...f, unorderedList: `${w}-unordered` };
|
|
925
928
|
}
|
|
926
929
|
constructor(t, e) {
|
|
927
930
|
this.config = e, this.readOnly = t;
|
|
928
931
|
}
|
|
929
932
|
renderWrapper(t) {
|
|
930
933
|
let e;
|
|
931
|
-
return e =
|
|
934
|
+
return e = v("ul", t === !0 ? [x.CSS.wrapper, x.CSS.unorderedList] : [x.CSS.unorderedList, x.CSS.itemChildren]), e;
|
|
932
935
|
}
|
|
933
936
|
renderItem(t, e) {
|
|
934
|
-
const i =
|
|
937
|
+
const i = v("li", x.CSS.item), s = v("div", x.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() });
|
|
935
938
|
return i.appendChild(s), i;
|
|
936
939
|
}
|
|
937
940
|
getItemContent(t) {
|
|
938
941
|
const e = t.querySelector(`.${x.CSS.itemContent}`);
|
|
939
|
-
return e ?
|
|
942
|
+
return e ? ot(e) ? "" : e.innerHTML : "";
|
|
940
943
|
}
|
|
941
944
|
getItemMeta() {
|
|
942
945
|
return {};
|
|
@@ -945,36 +948,33 @@ class x {
|
|
|
945
948
|
return {};
|
|
946
949
|
}
|
|
947
950
|
}
|
|
948
|
-
function
|
|
949
|
-
return
|
|
951
|
+
function B(h) {
|
|
952
|
+
return h.nodeType === Node.ELEMENT_NODE;
|
|
950
953
|
}
|
|
951
954
|
class m {
|
|
952
955
|
static get CSS() {
|
|
953
|
-
return { ...
|
|
956
|
+
return { ...f, checklist: `${w}-checklist`, itemChecked: `${w}__checkbox--checked`, noHover: `${w}__checkbox--no-hover`, checkbox: `${w}__checkbox-check`, checkboxContainer: `${w}__checkbox`, checkboxCheckDisabled: `${w}__checkbox-check--disabled` };
|
|
954
957
|
}
|
|
955
958
|
constructor(t, e) {
|
|
956
959
|
this.config = e, this.readOnly = t;
|
|
957
960
|
}
|
|
958
961
|
renderWrapper(t) {
|
|
959
962
|
let e;
|
|
960
|
-
return t === !0 ? (e =
|
|
963
|
+
return t === !0 ? (e = v("ul", [m.CSS.wrapper, m.CSS.checklist]), e.addEventListener("click", (i) => {
|
|
961
964
|
const s = i.target;
|
|
962
965
|
if (s) {
|
|
963
966
|
const n = s.closest(`.${m.CSS.checkboxContainer}`);
|
|
964
967
|
n && n.contains(s) && this.toggleCheckbox(n);
|
|
965
968
|
}
|
|
966
|
-
})) : e =
|
|
969
|
+
})) : e = v("ul", [m.CSS.checklist, m.CSS.itemChildren]), e;
|
|
967
970
|
}
|
|
968
971
|
renderItem(t, e) {
|
|
969
|
-
const i =
|
|
970
|
-
return e.checked === !0 && r.classList.add(m.CSS.itemChecked), this.readOnly && r.classList.add(m.CSS.checkboxCheckDisabled), n.innerHTML =
|
|
971
|
-
<path d="M7 12L10.4884 15.8372C10.5677 15.9245 10.705 15.9245 10.7844 15.8372L17 9" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
972
|
-
</svg>
|
|
973
|
-
`, r.appendChild(n), i.appendChild(r), i.appendChild(s), i;
|
|
972
|
+
const i = v("li", [m.CSS.item, m.CSS.item]), s = v("div", m.CSS.itemContent, { innerHTML: t, contentEditable: (!this.readOnly).toString() }), n = v("span", m.CSS.checkbox), r = v("div", m.CSS.checkboxContainer);
|
|
973
|
+
return e.checked === !0 && r.classList.add(m.CSS.itemChecked), this.readOnly && r.classList.add(m.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;
|
|
974
974
|
}
|
|
975
975
|
getItemContent(t) {
|
|
976
976
|
const e = t.querySelector(`.${m.CSS.itemContent}`);
|
|
977
|
-
return e ?
|
|
977
|
+
return e ? ot(e) ? "" : e.innerHTML : "";
|
|
978
978
|
}
|
|
979
979
|
getItemMeta(t) {
|
|
980
980
|
const e = t.querySelector(`.${m.CSS.checkboxContainer}`);
|
|
@@ -990,7 +990,7 @@ class m {
|
|
|
990
990
|
t.classList.remove(m.CSS.noHover);
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function J(h, t = "after") {
|
|
994
994
|
const e = [];
|
|
995
995
|
let i;
|
|
996
996
|
function s(n) {
|
|
@@ -1001,39 +1001,43 @@ function j(d, t = "after") {
|
|
|
1001
1001
|
return n.previousElementSibling;
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
|
-
for (i = s(
|
|
1004
|
+
for (i = s(h); i !== null; )
|
|
1005
|
+
e.push(i), i = s(i);
|
|
1005
1006
|
return e.length !== 0 ? e : null;
|
|
1006
1007
|
}
|
|
1007
|
-
function E(
|
|
1008
|
-
let e =
|
|
1009
|
-
return
|
|
1008
|
+
function E(h, t = !0) {
|
|
1009
|
+
let e = h;
|
|
1010
|
+
return h.classList.contains(f.item) && (e = h.querySelector(`.${f.itemChildren}`)), e === null ? [] : t ? Array.from(e.querySelectorAll(`:scope > .${f.item}`)) : Array.from(e.querySelectorAll(`.${f.item}`));
|
|
1010
1011
|
}
|
|
1011
|
-
function
|
|
1012
|
-
return
|
|
1012
|
+
function I(h) {
|
|
1013
|
+
return h.querySelector(`.${f.itemChildren}`);
|
|
1013
1014
|
}
|
|
1014
|
-
function
|
|
1015
|
-
let t =
|
|
1016
|
-
|
|
1015
|
+
function Z(h) {
|
|
1016
|
+
let t = h;
|
|
1017
|
+
h.classList.contains(f.item) && (t = I(h)), t !== null && E(t).length === 0 && t.remove();
|
|
1017
1018
|
}
|
|
1018
|
-
function
|
|
1019
|
-
return
|
|
1019
|
+
function z(h) {
|
|
1020
|
+
return h.querySelector(`.${f.itemContent}`);
|
|
1020
1021
|
}
|
|
1021
|
-
function R(
|
|
1022
|
-
const e =
|
|
1023
|
-
e &&
|
|
1022
|
+
function R(h, t = !0) {
|
|
1023
|
+
const e = z(h);
|
|
1024
|
+
e && Zt(e, t);
|
|
1024
1025
|
}
|
|
1025
|
-
class
|
|
1026
|
+
class Q {
|
|
1026
1027
|
get currentItem() {
|
|
1027
1028
|
const t = window.getSelection();
|
|
1028
|
-
if (!t)
|
|
1029
|
+
if (!t)
|
|
1030
|
+
return null;
|
|
1029
1031
|
let e = t.anchorNode;
|
|
1030
|
-
return e ? (
|
|
1032
|
+
return e ? (B(e) || (e = e.parentNode), e && B(e) ? e.closest(`.${f.item}`) : null) : null;
|
|
1031
1033
|
}
|
|
1032
1034
|
get currentItemLevel() {
|
|
1033
1035
|
const t = this.currentItem;
|
|
1034
|
-
if (t === null)
|
|
1036
|
+
if (t === null)
|
|
1037
|
+
return null;
|
|
1035
1038
|
let e = t.parentNode, i = 0;
|
|
1036
|
-
for (; e !== null && e !== this.listWrapper; )
|
|
1039
|
+
for (; e !== null && e !== this.listWrapper; )
|
|
1040
|
+
B(e) && e.classList.contains(f.item) && (i += 1), e = e.parentNode;
|
|
1037
1041
|
return i + 1;
|
|
1038
1042
|
}
|
|
1039
1043
|
constructor({ data: t, config: e, api: i, readOnly: s, block: n }, r) {
|
|
@@ -1055,7 +1059,7 @@ class G {
|
|
|
1055
1059
|
}
|
|
1056
1060
|
save(t) {
|
|
1057
1061
|
const e = t != null ? t : this.listWrapper, i = (r) => E(r).map((o) => {
|
|
1058
|
-
const a =
|
|
1062
|
+
const a = I(o);
|
|
1059
1063
|
return { content: this.renderer.getItemContent(o), meta: this.renderer.getItemMeta(o), items: a ? i(a) : [] };
|
|
1060
1064
|
}), s = e ? i(e) : [];
|
|
1061
1065
|
let n = { style: this.data.style, meta: {}, items: s };
|
|
@@ -1065,11 +1069,13 @@ class G {
|
|
|
1065
1069
|
return { tags: ["OL", "UL", "LI"] };
|
|
1066
1070
|
}
|
|
1067
1071
|
merge(t) {
|
|
1068
|
-
const e = this.block.holder.querySelectorAll(`.${
|
|
1069
|
-
if (i === null || s === null || (s.insertAdjacentHTML("beforeend", t.items[0].content), this.listWrapper === void 0))
|
|
1072
|
+
const e = this.block.holder.querySelectorAll(`.${f.item}`), i = e[e.length - 1], s = z(i);
|
|
1073
|
+
if (i === null || s === null || (s.insertAdjacentHTML("beforeend", t.items[0].content), this.listWrapper === void 0))
|
|
1074
|
+
return;
|
|
1070
1075
|
const n = E(this.listWrapper);
|
|
1071
|
-
if (n.length === 0)
|
|
1072
|
-
|
|
1076
|
+
if (n.length === 0)
|
|
1077
|
+
return;
|
|
1078
|
+
let r = I(n[n.length - 1]);
|
|
1073
1079
|
const o = t.items.shift();
|
|
1074
1080
|
o !== void 0 && (o.items.length !== 0 && (r === null && (r = this.renderer.renderWrapper(!1)), this.appendItems(o.items, r)), t.items.length > 0 && this.appendItems(t.items, this.listWrapper));
|
|
1075
1081
|
}
|
|
@@ -1094,7 +1100,7 @@ class G {
|
|
|
1094
1100
|
s === "ordered" && (this.data.meta.counterType = "numeric", this.data.meta.start = 1);
|
|
1095
1101
|
const r = (o) => Array.from(o.querySelectorAll(":scope > li")).map((a) => {
|
|
1096
1102
|
var c;
|
|
1097
|
-
const
|
|
1103
|
+
const d = a.querySelector(`:scope > ${i}`), l = d ? r(d) : [];
|
|
1098
1104
|
return { content: (c = a.innerHTML) != null ? c : "", meta: {}, items: l };
|
|
1099
1105
|
});
|
|
1100
1106
|
return n.items = r(t), n;
|
|
@@ -1108,31 +1114,36 @@ class G {
|
|
|
1108
1114
|
enterPressed(t) {
|
|
1109
1115
|
var o;
|
|
1110
1116
|
const e = this.currentItem;
|
|
1111
|
-
if (t.stopPropagation(), t.preventDefault(), t.isComposing || e === null)
|
|
1117
|
+
if (t.stopPropagation(), t.preventDefault(), t.isComposing || e === null)
|
|
1118
|
+
return;
|
|
1112
1119
|
const i = ((o = this.renderer) == null ? void 0 : o.getItemContent(e).trim().length) === 0, s = e.parentNode === this.listWrapper, n = e.previousElementSibling === null, r = this.api.blocks.getCurrentBlockIndex();
|
|
1113
|
-
if (s && i)
|
|
1114
|
-
return
|
|
1115
|
-
|
|
1120
|
+
if (s && i)
|
|
1121
|
+
return e.nextElementSibling !== null || function(a) {
|
|
1122
|
+
return a.querySelector(`.${f.itemChildren}`) !== null;
|
|
1123
|
+
}(e) ? void this.splitList(e) : void (n ? this.convertItemToDefaultBlock(r, !0) : this.convertItemToDefaultBlock());
|
|
1116
1124
|
i ? this.unshiftItem(e) : this.splitItem(e);
|
|
1117
1125
|
}
|
|
1118
1126
|
backspace(t) {
|
|
1119
1127
|
var i;
|
|
1120
1128
|
const e = this.currentItem;
|
|
1121
|
-
e !== null &&
|
|
1129
|
+
e !== null && Qt(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());
|
|
1122
1130
|
}
|
|
1123
1131
|
shiftTab(t) {
|
|
1124
1132
|
t.stopPropagation(), t.preventDefault(), this.currentItem !== null && this.unshiftItem(this.currentItem);
|
|
1125
1133
|
}
|
|
1126
1134
|
unshiftItem(t) {
|
|
1127
|
-
if (!t.parentNode || !
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1135
|
+
if (!t.parentNode || !B(t.parentNode))
|
|
1136
|
+
return;
|
|
1137
|
+
const e = t.parentNode.closest(`.${f.item}`);
|
|
1138
|
+
if (!e)
|
|
1139
|
+
return;
|
|
1140
|
+
let i = I(t);
|
|
1141
|
+
if (t.parentElement === null)
|
|
1142
|
+
return;
|
|
1143
|
+
const s = J(t);
|
|
1133
1144
|
s !== null && (i === null && (i = this.renderer.renderWrapper(!1)), s.forEach((n) => {
|
|
1134
1145
|
i.appendChild(n);
|
|
1135
|
-
}), t.appendChild(i)), e.after(t), R(t, !1),
|
|
1146
|
+
}), t.appendChild(i)), e.after(t), R(t, !1), Z(e);
|
|
1136
1147
|
}
|
|
1137
1148
|
splitList(t) {
|
|
1138
1149
|
const e = E(t), i = this.block, s = this.api.blocks.getCurrentBlockIndex();
|
|
@@ -1140,9 +1151,11 @@ class G {
|
|
|
1140
1151
|
const a = e[0];
|
|
1141
1152
|
this.unshiftItem(a), R(t, !1);
|
|
1142
1153
|
}
|
|
1143
|
-
if (t.previousElementSibling === null && t.parentNode === this.listWrapper)
|
|
1144
|
-
|
|
1145
|
-
|
|
1154
|
+
if (t.previousElementSibling === null && t.parentNode === this.listWrapper)
|
|
1155
|
+
return void this.convertItemToDefaultBlock(s);
|
|
1156
|
+
const n = J(t);
|
|
1157
|
+
if (n === null)
|
|
1158
|
+
return;
|
|
1146
1159
|
const r = this.renderer.renderWrapper(!0);
|
|
1147
1160
|
n.forEach((a) => {
|
|
1148
1161
|
r.appendChild(a);
|
|
@@ -1151,52 +1164,62 @@ class G {
|
|
|
1151
1164
|
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();
|
|
1152
1165
|
}
|
|
1153
1166
|
splitItem(t) {
|
|
1154
|
-
const [e, i] =
|
|
1155
|
-
if (e === null)
|
|
1156
|
-
|
|
1167
|
+
const [e, i] = te();
|
|
1168
|
+
if (e === null)
|
|
1169
|
+
return;
|
|
1170
|
+
const s = z(t);
|
|
1157
1171
|
let n;
|
|
1158
|
-
n = s === null ? "" :
|
|
1159
|
-
const r =
|
|
1172
|
+
n = s === null ? "" : ee(s, e, i, "right", !0);
|
|
1173
|
+
const r = I(t), o = this.renderItem(n);
|
|
1160
1174
|
t == null || t.after(o), r && o.appendChild(r), R(o);
|
|
1161
1175
|
}
|
|
1162
1176
|
mergeItemWithPrevious(t) {
|
|
1163
1177
|
var c;
|
|
1164
1178
|
const e = t.previousElementSibling, i = t.parentNode;
|
|
1165
|
-
if (i === null || !
|
|
1166
|
-
|
|
1167
|
-
|
|
1179
|
+
if (i === null || !B(i))
|
|
1180
|
+
return;
|
|
1181
|
+
const s = i.closest(`.${f.item}`);
|
|
1182
|
+
if (!e && !s || e && !B(e))
|
|
1183
|
+
return;
|
|
1168
1184
|
let n;
|
|
1169
1185
|
if (e) {
|
|
1170
1186
|
const u = E(e, !1);
|
|
1171
1187
|
n = u.length !== 0 && u.length !== 0 ? u[u.length - 1] : e;
|
|
1172
|
-
} else
|
|
1188
|
+
} else
|
|
1189
|
+
n = s;
|
|
1173
1190
|
const r = this.renderer.getItemContent(t);
|
|
1174
|
-
if (!n)
|
|
1191
|
+
if (!n)
|
|
1192
|
+
return;
|
|
1175
1193
|
R(n, !1);
|
|
1176
|
-
const o =
|
|
1177
|
-
if (o === null)
|
|
1194
|
+
const o = z(n);
|
|
1195
|
+
if (o === null)
|
|
1196
|
+
return;
|
|
1178
1197
|
o.insertAdjacentHTML("beforeend", r);
|
|
1179
1198
|
const a = E(t);
|
|
1180
|
-
if (a.length === 0)
|
|
1181
|
-
|
|
1199
|
+
if (a.length === 0)
|
|
1200
|
+
return t.remove(), void Z(n);
|
|
1201
|
+
const d = e || s, l = (c = I(d)) != null ? c : this.renderer.renderWrapper(!1);
|
|
1182
1202
|
e ? a.forEach((u) => {
|
|
1183
1203
|
l.appendChild(u);
|
|
1184
1204
|
}) : a.forEach((u) => {
|
|
1185
1205
|
l.prepend(u);
|
|
1186
|
-
}),
|
|
1206
|
+
}), I(d) === null && n.appendChild(l), t.remove();
|
|
1187
1207
|
}
|
|
1188
1208
|
addTab(t) {
|
|
1189
1209
|
var n;
|
|
1190
1210
|
t.stopPropagation(), t.preventDefault();
|
|
1191
1211
|
const e = this.currentItem;
|
|
1192
|
-
if (!e)
|
|
1212
|
+
if (!e)
|
|
1213
|
+
return;
|
|
1193
1214
|
if (((n = this.config) == null ? void 0 : n.maxLevel) !== void 0) {
|
|
1194
1215
|
const r = this.currentItemLevel;
|
|
1195
|
-
if (r !== null && r === this.config.maxLevel)
|
|
1216
|
+
if (r !== null && r === this.config.maxLevel)
|
|
1217
|
+
return;
|
|
1196
1218
|
}
|
|
1197
1219
|
const i = e.previousSibling;
|
|
1198
|
-
if (i === null || !
|
|
1199
|
-
|
|
1220
|
+
if (i === null || !B(i))
|
|
1221
|
+
return;
|
|
1222
|
+
const s = I(i);
|
|
1200
1223
|
if (s)
|
|
1201
1224
|
s.appendChild(e), E(e).forEach((r) => {
|
|
1202
1225
|
s.appendChild(r);
|
|
@@ -1207,7 +1230,7 @@ class G {
|
|
|
1207
1230
|
r.appendChild(o);
|
|
1208
1231
|
}), i.appendChild(r);
|
|
1209
1232
|
}
|
|
1210
|
-
|
|
1233
|
+
Z(e), R(e, !1);
|
|
1211
1234
|
}
|
|
1212
1235
|
convertItemToDefaultBlock(t, e) {
|
|
1213
1236
|
let i;
|
|
@@ -1216,19 +1239,20 @@ class G {
|
|
|
1216
1239
|
}
|
|
1217
1240
|
convertFirstItemToDefaultBlock() {
|
|
1218
1241
|
const t = this.currentItem;
|
|
1219
|
-
if (t === null)
|
|
1242
|
+
if (t === null)
|
|
1243
|
+
return;
|
|
1220
1244
|
const e = E(t);
|
|
1221
1245
|
if (e.length !== 0) {
|
|
1222
1246
|
const r = e[0];
|
|
1223
1247
|
this.unshiftItem(r), R(t);
|
|
1224
1248
|
}
|
|
1225
|
-
const i =
|
|
1249
|
+
const i = J(t), s = this.api.blocks.getCurrentBlockIndex(), n = i === null;
|
|
1226
1250
|
this.convertItemToDefaultBlock(s, n);
|
|
1227
1251
|
}
|
|
1228
1252
|
renderItem(t, e) {
|
|
1229
1253
|
const i = e != null ? e : this.renderer.composeDefaultMeta();
|
|
1230
1254
|
switch (!0) {
|
|
1231
|
-
case this.renderer instanceof
|
|
1255
|
+
case this.renderer instanceof L:
|
|
1232
1256
|
case this.renderer instanceof x:
|
|
1233
1257
|
}
|
|
1234
1258
|
return this.renderer.renderItem(t, i);
|
|
@@ -1244,8 +1268,8 @@ class G {
|
|
|
1244
1268
|
});
|
|
1245
1269
|
}
|
|
1246
1270
|
}
|
|
1247
|
-
const
|
|
1248
|
-
class
|
|
1271
|
+
const pe = /* @__PURE__ */ new Map([["Numeric", "numeric"], ["Lower Roman", "lower-roman"], ["Upper Roman", "upper-roman"], ["Lower Alpha", "lower-alpha"], ["Upper Alpha", "upper-alpha"]]);
|
|
1272
|
+
class K {
|
|
1249
1273
|
static get isReadOnlySupported() {
|
|
1250
1274
|
return !0;
|
|
1251
1275
|
}
|
|
@@ -1253,31 +1277,13 @@ class q {
|
|
|
1253
1277
|
return !0;
|
|
1254
1278
|
}
|
|
1255
1279
|
static get toolbox() {
|
|
1256
|
-
return [{ icon:
|
|
1257
|
-
<line x1="9" y1="7" x2="19" y2="7" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1258
|
-
<line x1="9" y1="12" x2="19" y2="12" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1259
|
-
<line x1="9" y1="17" x2="19" y2="17" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1260
|
-
<path d="M5.00001 17H4.99002" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1261
|
-
<path d="M5.00001 12H4.99002" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1262
|
-
<path d="M5.00001 7H4.99002" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1263
|
-
</svg>
|
|
1264
|
-
`, title: "Unordered List", data: { style: "unordered" } }, { icon: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1265
|
-
<line x1="12" y1="7" x2="19" y2="7" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1266
|
-
<line x1="12" y1="12" x2="19" y2="12" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1267
|
-
<line x1="12" y1="17" x2="19" y2="17" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1268
|
-
<path d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1269
|
-
</svg>
|
|
1270
|
-
`, title: "Ordered List", data: { style: "ordered" } }, { icon: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1271
|
-
<path d="M9.2 12L11.0586 13.8586C11.1367 13.9367 11.2633 13.9367 11.3414 13.8586L14.7 10.5" stroke="black" stroke-width="2" stroke-linecap="round"/>
|
|
1272
|
-
<rect x="5" y="5" width="14" height="14" rx="4" stroke="black" stroke-width="2"/>
|
|
1273
|
-
</svg>
|
|
1274
|
-
`, title: "Checklist", data: { style: "checklist" } }];
|
|
1280
|
+
return [{ icon: '<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>', title: "Unordered List", data: { style: "unordered" } }, { icon: '<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>', title: "Ordered List", data: { style: "ordered" } }, { icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="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>', title: "Checklist", data: { style: "checklist" } }];
|
|
1275
1281
|
}
|
|
1276
1282
|
static get pasteConfig() {
|
|
1277
1283
|
return { tags: ["OL", "UL", "LI"] };
|
|
1278
1284
|
}
|
|
1279
1285
|
static get conversionConfig() {
|
|
1280
|
-
return { export: (t) =>
|
|
1286
|
+
return { export: (t) => K.joinRecursive(t), import: (t, e) => ({ meta: {}, items: [{ content: t, meta: {}, items: [] }], style: (e == null ? void 0 : e.defaultStyle) !== void 0 ? e.defaultStyle : "unordered" }) };
|
|
1281
1287
|
}
|
|
1282
1288
|
get listStyle() {
|
|
1283
1289
|
return this.data.style || this.defaultListStyle;
|
|
@@ -1290,25 +1296,25 @@ class q {
|
|
|
1290
1296
|
}
|
|
1291
1297
|
constructor({ data: t, config: e, api: i, readOnly: s, block: n }) {
|
|
1292
1298
|
var o;
|
|
1293
|
-
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(
|
|
1299
|
+
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(pe.values());
|
|
1294
1300
|
const r = { style: this.defaultListStyle, meta: {}, items: [] };
|
|
1295
1301
|
this.data = Object.keys(t).length ? function(a) {
|
|
1296
|
-
const
|
|
1302
|
+
const d = [];
|
|
1297
1303
|
return function(l) {
|
|
1298
1304
|
return typeof l.items[0] == "string";
|
|
1299
1305
|
}(a) ? (a.items.forEach((l) => {
|
|
1300
|
-
|
|
1301
|
-
}), { style: a.style, meta: {}, items:
|
|
1306
|
+
d.push({ content: l, meta: {}, items: [] });
|
|
1307
|
+
}), { style: a.style, meta: {}, items: d }) : function(l) {
|
|
1302
1308
|
return typeof l.items[0] != "string" && "text" in l.items[0] && "checked" in l.items[0] && typeof l.items[0].text == "string" && typeof l.items[0].checked == "boolean";
|
|
1303
1309
|
}(a) ? (a.items.forEach((l) => {
|
|
1304
|
-
|
|
1305
|
-
}), { style: "checklist", meta: {}, items:
|
|
1310
|
+
d.push({ content: l.text, meta: { checked: l.checked }, items: [] });
|
|
1311
|
+
}), { style: "checklist", meta: {}, items: d }) : function(l) {
|
|
1306
1312
|
return !("meta" in l);
|
|
1307
1313
|
}(a) ? { style: a.style, meta: {}, items: a.items } : structuredClone(a);
|
|
1308
1314
|
}(t) : r, this.listStyle === "ordered" && this.data.meta.counterType === void 0 && (this.data.meta.counterType = "numeric"), this.changeTabulatorByStyle();
|
|
1309
1315
|
}
|
|
1310
1316
|
static joinRecursive(t) {
|
|
1311
|
-
return t.items.map((e) => `${e.content} ${
|
|
1317
|
+
return t.items.map((e) => `${e.content} ${K.joinRecursive(e)}`).join("");
|
|
1312
1318
|
}
|
|
1313
1319
|
render() {
|
|
1314
1320
|
return this.listElement = this.list.render(), this.listElement;
|
|
@@ -1334,28 +1340,20 @@ class q {
|
|
|
1334
1340
|
pasteHandler(t) {
|
|
1335
1341
|
return this.list.pasteHandler(t);
|
|
1336
1342
|
}
|
|
1337
|
-
changeCounters(t) {
|
|
1338
|
-
var e;
|
|
1339
|
-
(e = this.list) == null || e.changeCounters(t), this.data.meta.counterType = t;
|
|
1340
|
-
}
|
|
1341
|
-
changeStartWith(t) {
|
|
1342
|
-
var e;
|
|
1343
|
-
(e = this.list) == null || e.changeStartWith(t), this.data.meta.start = t;
|
|
1344
|
-
}
|
|
1345
1343
|
changeTabulatorByStyle() {
|
|
1346
1344
|
switch (this.listStyle) {
|
|
1347
1345
|
case "ordered":
|
|
1348
|
-
this.list = new
|
|
1346
|
+
this.list = new Q({ data: this.data, readOnly: this.readOnly, api: this.api, config: this.config, block: this.block }, new L(this.readOnly, this.config));
|
|
1349
1347
|
break;
|
|
1350
1348
|
case "unordered":
|
|
1351
|
-
this.list = new
|
|
1349
|
+
this.list = new Q({ data: this.data, readOnly: this.readOnly, api: this.api, config: this.config, block: this.block }, new x(this.readOnly, this.config));
|
|
1352
1350
|
break;
|
|
1353
1351
|
case "checklist":
|
|
1354
|
-
this.list = new
|
|
1352
|
+
this.list = new Q({ data: this.data, readOnly: this.readOnly, api: this.api, config: this.config, block: this.block }, new m(this.readOnly, this.config));
|
|
1355
1353
|
}
|
|
1356
1354
|
}
|
|
1357
1355
|
}
|
|
1358
|
-
class
|
|
1356
|
+
class ge {
|
|
1359
1357
|
constructor(t, e, i) {
|
|
1360
1358
|
this.holder = e, this.observer = null, this.debounceTimer = i, this.mutationDebouncer = this.debounce(() => {
|
|
1361
1359
|
t();
|
|
@@ -1395,17 +1393,19 @@ class se {
|
|
|
1395
1393
|
document.dispatchEvent(t), (e = this.observer) == null || e.disconnect();
|
|
1396
1394
|
}
|
|
1397
1395
|
}
|
|
1398
|
-
class
|
|
1396
|
+
class me {
|
|
1399
1397
|
constructor({ editor: t, config: e = {}, onUpdate: i, maxLength: s }) {
|
|
1398
|
+
this.position = 0;
|
|
1400
1399
|
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:
|
|
1402
|
-
this.holder = typeof
|
|
1400
|
+
}, 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, c = n.config.shortcuts, { shortcuts: u } = e, p = { ...c, ...u }, g = Array.isArray(p.undo) ? p.undo : [p.undo], k = Array.isArray(p.redo) ? p.redo : [p.redo], S = n.config.debounceTimer, { debounceTimer: T = S } = e;
|
|
1401
|
+
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: T, shortcuts: { undo: g, redo: k } }, new ge(() => this.registerChange(), this.holder, this.config.debounceTimer).setMutationObserver(), this.setEventListeners(), this.initialItem = null, this.clear();
|
|
1403
1402
|
}
|
|
1404
1403
|
static get isReadOnlySupported() {
|
|
1405
1404
|
return !0;
|
|
1406
1405
|
}
|
|
1407
1406
|
truncate(t, e) {
|
|
1408
|
-
for (; t.length > e; )
|
|
1407
|
+
for (; t.length > e; )
|
|
1408
|
+
t.shift();
|
|
1409
1409
|
}
|
|
1410
1410
|
initialize(t) {
|
|
1411
1411
|
const e = "blocks" in t ? t.blocks : t, i = { index: e.length - 1, state: e };
|
|
@@ -1437,13 +1437,14 @@ class ne {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
getCaretIndex(t) {
|
|
1439
1439
|
const e = this.holder.getElementsByClassName("ce-block__content");
|
|
1440
|
-
return new
|
|
1440
|
+
return new dt(e[t].firstChild).getPos();
|
|
1441
1441
|
}
|
|
1442
1442
|
insertDeletedBlock(t, e, i) {
|
|
1443
|
-
for (let s = 0; s < t.length; s += 1)
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1443
|
+
for (let s = 0; s < t.length; s += 1)
|
|
1444
|
+
if (!e[s] || t[s].id !== e[s].id) {
|
|
1445
|
+
this.blocks.insert(t[s].type, t[s].data, {}, s, !0), this.caret.setToBlock(i, "end");
|
|
1446
|
+
break;
|
|
1447
|
+
}
|
|
1447
1448
|
}
|
|
1448
1449
|
blockWasDropped(t, e) {
|
|
1449
1450
|
return t.length === e.length && t.some((i, s) => i.id !== e[s].id);
|
|
@@ -1468,11 +1469,16 @@ class ne {
|
|
|
1468
1469
|
const { state: s, caretIndex: n } = this.stack[this.position];
|
|
1469
1470
|
this.onUpdate();
|
|
1470
1471
|
const r = this.blocks.getBlocksCount();
|
|
1471
|
-
if (s[i] || (i -= 1, this.stack[this.position].index = i), this.blockWasDeleted(s, e))
|
|
1472
|
-
|
|
1473
|
-
else if (
|
|
1474
|
-
|
|
1475
|
-
else if (
|
|
1472
|
+
if (s[i] || (i -= 1, this.stack[this.position].index = i), this.blockWasDeleted(s, e))
|
|
1473
|
+
this.insertDeletedBlock(s, e, i);
|
|
1474
|
+
else if (this.contentWasCopied(s, e, i))
|
|
1475
|
+
await this.blocks.render({ blocks: s }), this.caret.setToBlock(i, "end");
|
|
1476
|
+
else if (i < t && this.blockWasSkipped(s, e))
|
|
1477
|
+
await this.blocks.delete(t), this.caret.setToBlock(i, "end");
|
|
1478
|
+
else if (r > s.length)
|
|
1479
|
+
await this.blocks.render({ blocks: s }), this.setCaretIndex(i, n);
|
|
1480
|
+
else if (this.blockWasDropped(s, e))
|
|
1481
|
+
await this.blocks.render({ blocks: s }), this.caret.setToBlock(i, "end");
|
|
1476
1482
|
else if (this.contentChangedInNoFocusBlock(i, t)) {
|
|
1477
1483
|
const { id: a } = this.blocks.getBlockByIndex(t);
|
|
1478
1484
|
await this.blocks.update(a, s[t].data), this.setCaretIndex(i, n);
|
|
@@ -1483,15 +1489,17 @@ class ne {
|
|
|
1483
1489
|
}
|
|
1484
1490
|
setCaretIndex(t, e) {
|
|
1485
1491
|
if (e && e !== -1) {
|
|
1486
|
-
const i = this.holder.getElementsByClassName("ce-block__content"), s = new
|
|
1492
|
+
const i = this.holder.getElementsByClassName("ce-block__content"), s = new dt(i[t].firstChild);
|
|
1487
1493
|
setTimeout(() => s.setPos(e), 50);
|
|
1488
|
-
} else
|
|
1494
|
+
} else
|
|
1495
|
+
this.caret.setToBlock(t, "end");
|
|
1489
1496
|
}
|
|
1490
1497
|
async insertBlock(t, e) {
|
|
1491
1498
|
await this.blocks.insert(t[e].type, t[e].data, {}, e, !0);
|
|
1492
1499
|
}
|
|
1493
1500
|
async insertSkippedBlocks(t, e, i) {
|
|
1494
|
-
for (let s = t.length; s < e.length; s += 1)
|
|
1501
|
+
for (let s = t.length; s < e.length; s += 1)
|
|
1502
|
+
this.insertBlock(e, s);
|
|
1495
1503
|
JSON.stringify(t[i - 1]) !== JSON.stringify(e[i - 1]) && await this.updateModifiedBlock(e, i);
|
|
1496
1504
|
}
|
|
1497
1505
|
async updateModifiedBlock(t, e) {
|
|
@@ -1521,7 +1529,7 @@ class ne {
|
|
|
1521
1529
|
return i.push(s), i;
|
|
1522
1530
|
}
|
|
1523
1531
|
setEventListeners() {
|
|
1524
|
-
const { holder: t } = this, { shortcuts: e } = this.config, { undo: i, redo: s } = e, n = i.map((p) => p.replace(/ /g, "").split("+")), r = s.map((p) => p.replace(/ /g, "").split("+")), o = n.map((p) => this.parseKeys(p)), a = r.map((p) => this.parseKeys(p)),
|
|
1532
|
+
const { holder: t } = this, { shortcuts: e } = this.config, { undo: i, redo: s } = e, n = i.map((p) => p.replace(/ /g, "").split("+")), r = s.map((p) => p.replace(/ /g, "").split("+")), o = n.map((p) => this.parseKeys(p)), a = r.map((p) => this.parseKeys(p)), d = (p, g) => g.reduce((k, S) => k || ((T, _) => _.length === 3 && T[_[0]] && T[_[1]] && T.key.toLowerCase() === _[2])(p, S), !1), l = (p, g, k) => !(!((S, T) => T.reduce((_, G) => _ || ((q, X) => X.length === 2 && q[X[0]] && q.key.toLowerCase() === X[1])(S, G), !1))(p, g) || d(p, k)) || !!d(p, g), c = (p) => {
|
|
1525
1533
|
l(p, o, a) && (p.preventDefault(), this.undo());
|
|
1526
1534
|
}, u = (p) => {
|
|
1527
1535
|
l(p, a, o) && (p.preventDefault(), this.redo());
|
|
@@ -1603,20 +1611,20 @@ class M {
|
|
|
1603
1611
|
let n = this._getSettingIconStyle(s);
|
|
1604
1612
|
return n.setAttribute("data-type", s), this.api.tooltip.onHover(n, this.api.i18n.t(`alert-${s}`), { placement: "top" }), n.innerText = "A", e.appendChild(n), n;
|
|
1605
1613
|
}).forEach((s, n, r) => {
|
|
1606
|
-
const o = s.getAttribute("data-type");
|
|
1614
|
+
const o = s.getAttribute("data-type") || "";
|
|
1607
1615
|
s.addEventListener("click", () => {
|
|
1608
|
-
this._changeAlertType(o), r.forEach((a,
|
|
1616
|
+
this._changeAlertType(o), r.forEach((a, d) => {
|
|
1609
1617
|
const l = a.getAttribute("data-type");
|
|
1610
1618
|
a.classList.toggle("cdx-alert_setting__icon_active", l === this.data.type);
|
|
1611
1619
|
});
|
|
1612
1620
|
});
|
|
1613
1621
|
}), M.ALIGN_TYPES.map((s) => {
|
|
1614
1622
|
let n;
|
|
1615
|
-
return s === "left" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML =
|
|
1623
|
+
return s === "left" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = At), s === "right" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = Bt), s === "center" && (n = document.createElement("div"), n.classList.add("cdx-alert_setting__icon"), n.innerHTML = It), n == null || n.setAttribute("data-align", s), this.api.tooltip.onHover(n, this.api.i18n.t(`align-${s}`), { placement: "top" }), i.appendChild(n), n;
|
|
1616
1624
|
}).forEach((s, n, r) => {
|
|
1617
|
-
const o = s.getAttribute("data-align");
|
|
1625
|
+
const o = s.getAttribute("data-align") || "";
|
|
1618
1626
|
s.addEventListener("click", () => {
|
|
1619
|
-
this._changeAlignType(o), r.forEach((a,
|
|
1627
|
+
this._changeAlignType(o), r.forEach((a, d) => {
|
|
1620
1628
|
const l = a == null ? void 0 : a.getAttribute("data-align");
|
|
1621
1629
|
a == null || a.classList.toggle("cdx-alert_setting__icon_active", l === this.data.align);
|
|
1622
1630
|
});
|
|
@@ -1640,12 +1648,13 @@ class M {
|
|
|
1640
1648
|
}
|
|
1641
1649
|
save(t) {
|
|
1642
1650
|
const e = t.querySelector(`.${this.CSS.message}`);
|
|
1643
|
-
return { ...this.data, message: e.innerHTML };
|
|
1651
|
+
return { ...this.data, message: (e == null ? void 0 : e.innerHTML) || "" };
|
|
1644
1652
|
}
|
|
1645
|
-
_make(t, e
|
|
1653
|
+
_make(t, e, i = {}) {
|
|
1646
1654
|
let s = document.createElement(t);
|
|
1647
1655
|
Array.isArray(e) ? s.classList.add(...e) : e && s.classList.add(e);
|
|
1648
|
-
for (let n in i)
|
|
1656
|
+
for (let n in i)
|
|
1657
|
+
s.setAttribute(n, i[n]);
|
|
1649
1658
|
return s;
|
|
1650
1659
|
}
|
|
1651
1660
|
onPaste(t) {
|
|
@@ -1659,15 +1668,15 @@ class M {
|
|
|
1659
1668
|
return { message: !0, type: !1, alignType: !1 };
|
|
1660
1669
|
}
|
|
1661
1670
|
}
|
|
1662
|
-
const
|
|
1671
|
+
const bt = { orientation: !1 }, j = class b {
|
|
1663
1672
|
constructor({ api: t, data: e, config: i, block: s, ...n }) {
|
|
1664
|
-
var o, a,
|
|
1673
|
+
var o, a, d, l, c, u;
|
|
1665
1674
|
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));
|
|
1666
|
-
const r = (u = (c = this.config.customBlockIndentLimits[(l = (
|
|
1675
|
+
const r = (u = (c = this.config.customBlockIndentLimits[(l = (d = this.block) == null ? void 0 : d.name) != null ? l : ""]) == null ? void 0 : c.min) != null ? u : this.config.minIndent;
|
|
1667
1676
|
this.data = { indentLevel: r, ...e != null ? e : {} }, this.config.multiblock && this.config.tuneName, window.addEventListener("resize", (p) => this.onResize.call(this, p)), this.api.events.on("block changed", ({ event: p }) => {
|
|
1668
|
-
var
|
|
1677
|
+
var S;
|
|
1669
1678
|
const g = p.detail.target.id;
|
|
1670
|
-
((
|
|
1679
|
+
((S = this.block) == null ? void 0 : S.id) === g && this.shouldApplyAutoIndent && queueMicrotask(() => this.autoIndentBlock());
|
|
1671
1680
|
});
|
|
1672
1681
|
}
|
|
1673
1682
|
static get isTune() {
|
|
@@ -1682,42 +1691,44 @@ const pt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version=
|
|
|
1682
1691
|
const t = () => {
|
|
1683
1692
|
if (this.data.indentLevel == this.maxIndent) {
|
|
1684
1693
|
const a = this.getTuneButton("indent");
|
|
1685
|
-
if (a == null || a.classList.add(this.CSS.disabledItem), !a)
|
|
1694
|
+
if (a == null || a.classList.add(this.CSS.disabledItem), !a)
|
|
1695
|
+
return !0;
|
|
1686
1696
|
}
|
|
1687
1697
|
if (this.data.indentLevel == this.minIndent) {
|
|
1688
1698
|
const a = this.getTuneButton("unindent");
|
|
1689
|
-
if (a == null || a.classList.add(this.CSS.disabledItem), !a)
|
|
1699
|
+
if (a == null || a.classList.add(this.CSS.disabledItem), !a)
|
|
1700
|
+
return !0;
|
|
1690
1701
|
}
|
|
1691
1702
|
};
|
|
1692
1703
|
if (queueMicrotask(() => {
|
|
1693
1704
|
t() && setTimeout(t, 300);
|
|
1694
1705
|
}), this.config.orientation === "vertical") {
|
|
1695
|
-
const a = `${this.TuneNames.indentLeft}-${(r = this.block) == null ? void 0 : r.id}`,
|
|
1706
|
+
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}`;
|
|
1696
1707
|
return [{ title: this.rightText, hint: { title: this.api.i18n.t(this.rightText) }, onActivate: (l, c) => {
|
|
1697
1708
|
this.handleIndentRight(), l.title = this.rightText;
|
|
1698
|
-
}, icon:
|
|
1709
|
+
}, icon: kt, name: d }, { title: this.leftText, hint: { title: this.api.i18n.t(this.leftText) }, onActivate: (l, c) => {
|
|
1699
1710
|
this.handleIndentLeft(), l.title = this.leftText;
|
|
1700
|
-
}, icon:
|
|
1711
|
+
}, icon: wt, name: a }];
|
|
1701
1712
|
}
|
|
1702
1713
|
const e = `
|
|
1703
1714
|
<div class="${this.CSS.popoverItem} ${this.CSS.customPopoverItem}" data-item-name='indent' version=${this.config.version}>
|
|
1704
|
-
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentLeft}>${
|
|
1715
|
+
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentLeft}>${wt}</button>
|
|
1705
1716
|
<span class="${this.CSS.popoverItemTitle}">${this.api.sanitizer.clean(this.api.i18n.t("Indent"), {})}</span>
|
|
1706
|
-
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentRight} style="margin-left:10px;">${
|
|
1717
|
+
<button type="button" class="${this.CSS.popoverItemIcon}" data-${this.TuneNames.indentRight} style="margin-left:10px;">${kt}</button>
|
|
1707
1718
|
</div>
|
|
1708
1719
|
`, i = this.createElementFromTemplate(e), s = i.querySelector(`[data-${this.TuneNames.indentRight}]`), n = i.querySelector(`[data-${this.TuneNames.indentLeft}]`);
|
|
1709
1720
|
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;
|
|
1710
1721
|
}
|
|
1711
1722
|
wrap(t) {
|
|
1712
1723
|
var i, s, n, r, o;
|
|
1713
|
-
this.wrapper.appendChild(t), this.wrapper.setAttribute(
|
|
1724
|
+
this.wrapper.appendChild(t), this.wrapper.setAttribute(b.DATA_WRAPPER_NAME, "");
|
|
1714
1725
|
let e = !!this.config.highlightIndent;
|
|
1715
1726
|
if ((i = this.config.highlightIndent) != null && i.tuneNames && !this.config.highlightIndent.tuneNames.includes((n = (s = this.block) == null ? void 0 : s.name) != null ? n : "") && (e = !1), e) {
|
|
1716
1727
|
const a = this.createElementFromTemplate(`
|
|
1717
1728
|
<div class="${(o = (r = this.config.highlightIndent) == null ? void 0 : r.className) != null ? o : ""} ${this.CSS.highlightIndent}">
|
|
1718
1729
|
</div>
|
|
1719
|
-
`),
|
|
1720
|
-
|
|
1730
|
+
`), d = t.classList.contains(this.EditorCSS.content) ? t : t.querySelector(`.${this.EditorCSS.content}`);
|
|
1731
|
+
d == null || d.appendChild(a);
|
|
1721
1732
|
}
|
|
1722
1733
|
return this.applyStylesToWrapper(this.wrapper, this.data.indentLevel), this.wrapper.addEventListener("keydown", (...a) => this.onKeyDown.apply(this, a), { capture: !0 }), this.wrapper.addEventListener("focus", (a) => this.onFocus.call(this, a), { capture: !0 }), this.wrapper.addEventListener("blur", (a) => this.onBlur.call(this, a), { capture: !0 }), this.wrapper;
|
|
1723
1734
|
}
|
|
@@ -1756,22 +1767,29 @@ const pt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version=
|
|
|
1756
1767
|
}
|
|
1757
1768
|
get shouldApplyAutoIndent() {
|
|
1758
1769
|
var s;
|
|
1759
|
-
if (!this.config.autoIndent)
|
|
1760
|
-
|
|
1770
|
+
if (!this.config.autoIndent)
|
|
1771
|
+
return !1;
|
|
1772
|
+
if (typeof this.config.autoIndent == "boolean")
|
|
1773
|
+
return this.config.autoIndent;
|
|
1761
1774
|
const t = this.api.blocks.getCurrentBlockIndex();
|
|
1762
|
-
if (t < 0)
|
|
1775
|
+
if (t < 0)
|
|
1776
|
+
return !1;
|
|
1763
1777
|
const e = this.api.blocks.getBlockByIndex(t);
|
|
1764
|
-
if (!e)
|
|
1778
|
+
if (!e)
|
|
1779
|
+
return !1;
|
|
1765
1780
|
const i = e.name;
|
|
1766
1781
|
return !((s = this.config.autoIndent.tuneNames) != null && s.length) || this.config.autoIndent.tuneNames.includes(i);
|
|
1767
1782
|
}
|
|
1768
1783
|
handlePropagationForKeyEvent(t) {
|
|
1769
1784
|
var r, o, a;
|
|
1770
|
-
if (!((r = this.block) != null && r.id) || this.config.handleShortcut === !1)
|
|
1785
|
+
if (!((r = this.block) != null && r.id) || this.config.handleShortcut === !1)
|
|
1786
|
+
return null;
|
|
1771
1787
|
const e = t.key == this.DEFAULT_INDENT_KEY, i = typeof this.config.handleShortcut == "function";
|
|
1772
|
-
if (!i && !e)
|
|
1788
|
+
if (!i && !e)
|
|
1789
|
+
return null;
|
|
1773
1790
|
const s = (a = (o = this.config).handleShortcut) == null ? void 0 : a.call(o, t, this.block.id);
|
|
1774
|
-
if (!s && i)
|
|
1791
|
+
if (!s && i)
|
|
1792
|
+
return null;
|
|
1775
1793
|
let n;
|
|
1776
1794
|
switch (s) {
|
|
1777
1795
|
case "indent":
|
|
@@ -1781,27 +1799,33 @@ const pt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version=
|
|
|
1781
1799
|
n = !1;
|
|
1782
1800
|
break;
|
|
1783
1801
|
default:
|
|
1784
|
-
if (!e)
|
|
1802
|
+
if (!e)
|
|
1803
|
+
return null;
|
|
1785
1804
|
n = !t.shiftKey;
|
|
1786
1805
|
}
|
|
1787
1806
|
return t.stopPropagation(), t.preventDefault(), { isIndent: n };
|
|
1788
1807
|
}
|
|
1789
1808
|
onKeyDown(t) {
|
|
1790
1809
|
var n, r, o;
|
|
1791
|
-
if (!((n = this.block) != null && n.id))
|
|
1810
|
+
if (!((n = this.block) != null && n.id))
|
|
1811
|
+
return;
|
|
1792
1812
|
const e = this.handlePropagationForKeyEvent(t);
|
|
1793
|
-
if (!e)
|
|
1813
|
+
if (!e)
|
|
1814
|
+
return;
|
|
1794
1815
|
const { isIndent: i } = e;
|
|
1795
1816
|
this.api.inlineToolbar.close();
|
|
1796
1817
|
const s = this.getGlobalSelectedBlocks();
|
|
1797
|
-
if (!this.config.multiblock || s.length < 2)
|
|
1818
|
+
if (!this.config.multiblock || s.length < 2)
|
|
1819
|
+
return i ? this.indentBlock() : this.unIndentBlock(), void ((o = (r = this.block).dispatchChange) == null ? void 0 : o.call(r));
|
|
1798
1820
|
this.config.tuneName && s.forEach(async (a) => {
|
|
1799
|
-
var u, p, g,
|
|
1800
|
-
const
|
|
1801
|
-
if (!
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1821
|
+
var u, p, g, k;
|
|
1822
|
+
const d = await a.save();
|
|
1823
|
+
if (!d || !("tunes" in d) || typeof d.tunes != "object" || !d.tunes)
|
|
1824
|
+
return;
|
|
1825
|
+
const l = d.tunes[(u = this.config.tuneName) != null ? u : ""];
|
|
1826
|
+
if (!l)
|
|
1827
|
+
return;
|
|
1828
|
+
l.indentLevel = i ? Math.min(this.config.maxIndent, ((p = l.indentLevel) != null ? p : 0) + 1) : Math.max(0, ((g = l.indentLevel) != null ? g : 0) - 1), (k = a.dispatchChange) == null || k.call(a);
|
|
1805
1829
|
const c = this.getWrapperBlockById(a.id);
|
|
1806
1830
|
c instanceof HTMLElement && this.applyStylesToWrapper(c, l.indentLevel);
|
|
1807
1831
|
});
|
|
@@ -1823,8 +1847,9 @@ const pt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version=
|
|
|
1823
1847
|
autoIndentBlock() {
|
|
1824
1848
|
var r, o;
|
|
1825
1849
|
const t = this.api.blocks.getBlockIndex(this.block.id), e = this.api.blocks.getBlockByIndex(t - 1);
|
|
1826
|
-
if (!e)
|
|
1827
|
-
|
|
1850
|
+
if (!e)
|
|
1851
|
+
return;
|
|
1852
|
+
const i = (o = (r = e.holder) == null ? void 0 : r.querySelector(`[${b.DATA_WRAPPER_NAME}]`)) == null ? void 0 : o.getAttribute(b.DATA_INDENT_LEVEL), s = Number(i != null ? i : 0), n = Math.min(Math.max(s, this.minIndent), this.maxIndent);
|
|
1828
1853
|
this.data.indentLevel = n, this.applyStylesToWrapper(this.wrapper, this.data.indentLevel);
|
|
1829
1854
|
}
|
|
1830
1855
|
toggleDisableStateForButtons() {
|
|
@@ -1843,27 +1868,29 @@ const pt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version=
|
|
|
1843
1868
|
var e;
|
|
1844
1869
|
return (e = this.getTuneByName(t)) == null ? void 0 : e.querySelector(`.${this.CSS.popoverItemTitle}`);
|
|
1845
1870
|
}
|
|
1846
|
-
applyStylesToWrapper(t, e = parseInt(t.getAttribute(
|
|
1871
|
+
applyStylesToWrapper(t, e = parseInt(t.getAttribute(b.DATA_INDENT_LEVEL) || "0")) {
|
|
1847
1872
|
const i = e * this.config.indentSize;
|
|
1848
|
-
t.setAttribute(
|
|
1873
|
+
t.setAttribute(b.DATA_INDENT_LEVEL, e.toString());
|
|
1849
1874
|
const s = t.querySelector(`.${this.EditorCSS.content}`), n = this.getBlockForWrapper(t) || document.querySelector(`.${this.EditorCSS.redactor}`);
|
|
1850
|
-
if (!(s instanceof HTMLElement && n))
|
|
1875
|
+
if (!(s instanceof HTMLElement && n))
|
|
1876
|
+
return;
|
|
1851
1877
|
const r = n.getBoundingClientRect().width;
|
|
1852
|
-
if (r === 0)
|
|
1853
|
-
|
|
1854
|
-
|
|
1878
|
+
if (r === 0)
|
|
1879
|
+
return void queueMicrotask(() => this.applyStylesToWrapper.bind(this)(t, e));
|
|
1880
|
+
const o = (r - this.maxWidthForContent(t)) / 2, a = Math.max(0, Math.min(o, i)), d = 2 * a + "px", l = `${a}px`;
|
|
1881
|
+
this.isDirectionInverted ? (t.style.paddingLeft = "0px", t.style.paddingRight = d) : (t.style.paddingLeft = d, t.style.paddingRight = "0px");
|
|
1855
1882
|
const c = t.querySelector(`.${this.CSS.highlightIndent}`);
|
|
1856
1883
|
c instanceof HTMLElement && (this.isDirectionInverted ? (c.style.width = l, c.style.left = "100%", c.style.right = "") : (c.style.width = l, c.style.left = "", c.style.right = "100%"));
|
|
1857
1884
|
}
|
|
1858
1885
|
onFocus(t) {
|
|
1859
|
-
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.setAttribute(
|
|
1886
|
+
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.setAttribute(b.DATA_FOCUSED, "");
|
|
1860
1887
|
}
|
|
1861
1888
|
onBlur(t) {
|
|
1862
|
-
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.removeAttribute(
|
|
1889
|
+
t.target instanceof HTMLElement && this.wrapper.contains(t.target) && this.wrapper.removeAttribute(b.DATA_FOCUSED);
|
|
1863
1890
|
}
|
|
1864
1891
|
onResize(t) {
|
|
1865
1892
|
this.lastResizeTimeout && clearTimeout(this.lastResizeTimeout), this.lastResizeTimeout = setTimeout(() => {
|
|
1866
|
-
document.querySelectorAll(`[${
|
|
1893
|
+
document.querySelectorAll(`[${b.DATA_WRAPPER_NAME}]`).forEach((e) => {
|
|
1867
1894
|
e instanceof HTMLElement && this.applyStylesToWrapper(e);
|
|
1868
1895
|
});
|
|
1869
1896
|
}, 500);
|
|
@@ -1873,13 +1900,14 @@ const pt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version=
|
|
|
1873
1900
|
}
|
|
1874
1901
|
getWrapperBlockById(t) {
|
|
1875
1902
|
var i, s, n;
|
|
1876
|
-
const e = `.${this.EditorCSS.block}[data-id="${t}"] [${
|
|
1877
|
-
return (n = (s = document.querySelector(e)) != null ? s : (i = this.api.blocks.getById(t)) == null ? void 0 : i.holder.querySelector(`[${
|
|
1903
|
+
const e = `.${this.EditorCSS.block}[data-id="${t}"] [${b.DATA_WRAPPER_NAME}]`;
|
|
1904
|
+
return (n = (s = document.querySelector(e)) != null ? s : (i = this.api.blocks.getById(t)) == null ? void 0 : i.holder.querySelector(`[${b.DATA_WRAPPER_NAME}]`)) != null ? n : null;
|
|
1878
1905
|
}
|
|
1879
1906
|
getBlockForWrapper(t) {
|
|
1880
1907
|
let e = t;
|
|
1881
1908
|
for (; !e.classList.contains(this.EditorCSS.block); ) {
|
|
1882
|
-
if (!e.parentElement || e instanceof HTMLHtmlElement)
|
|
1909
|
+
if (!e.parentElement || e instanceof HTMLHtmlElement)
|
|
1910
|
+
return null;
|
|
1883
1911
|
e = e.parentElement;
|
|
1884
1912
|
}
|
|
1885
1913
|
return e;
|
|
@@ -1897,20 +1925,24 @@ const pt = '<svg t="1763708081701" class="icon" viewBox="0 0 1024 1024" version=
|
|
|
1897
1925
|
return new DOMParser().parseFromString(t, "text/html").body.firstChild;
|
|
1898
1926
|
}
|
|
1899
1927
|
changeConfigBasedOnVersionIfNeeded() {
|
|
1900
|
-
this.config.version && this.config.version < "2.27" && this.config.orientation === "vertical" && (this.config.orientation = "horizontal",
|
|
1928
|
+
this.config.version && this.config.version < "2.27" && this.config.orientation === "vertical" && (this.config.orientation = "horizontal", bt.orientation, bt.orientation = !0);
|
|
1901
1929
|
}
|
|
1902
1930
|
maxWidthForContent(t) {
|
|
1903
1931
|
const e = t.querySelector(`.${this.EditorCSS.content}`);
|
|
1904
1932
|
if (e instanceof HTMLElement) {
|
|
1905
1933
|
const { maxWidth: i } = window.getComputedStyle(e);
|
|
1906
|
-
if (i)
|
|
1934
|
+
if (i)
|
|
1935
|
+
return this.cachedMaxWidthForContent = parseInt(i), this.cachedMaxWidthForContent;
|
|
1907
1936
|
}
|
|
1908
1937
|
return this.cachedMaxWidthForContent !== null || (this.cachedMaxWidthForContent = 650), this.cachedMaxWidthForContent;
|
|
1909
1938
|
}
|
|
1910
1939
|
};
|
|
1911
|
-
|
|
1912
|
-
let
|
|
1913
|
-
class
|
|
1940
|
+
j.DATA_WRAPPER_NAME = "data-block-indent-wrapper", j.DATA_FOCUSED = "data-focused", j.DATA_INDENT_LEVEL = "data-indent-level";
|
|
1941
|
+
let fe = j;
|
|
1942
|
+
class P {
|
|
1943
|
+
static get toolboxIcon() {
|
|
1944
|
+
return vt;
|
|
1945
|
+
}
|
|
1914
1946
|
static get CSS() {
|
|
1915
1947
|
return "cdx-marker";
|
|
1916
1948
|
}
|
|
@@ -1921,34 +1953,37 @@ class N {
|
|
|
1921
1953
|
return !0;
|
|
1922
1954
|
}
|
|
1923
1955
|
render() {
|
|
1924
|
-
return this.button = document.createElement("button"), this.button.type
|
|
1956
|
+
return this.button = document.createElement("button"), this.button.setAttribute("type", "button"), this.button.classList.add(this.iconClasses.base), this.button.innerHTML = this.toolboxIcon, this.button;
|
|
1925
1957
|
}
|
|
1926
1958
|
surround(t) {
|
|
1927
|
-
if (!t)
|
|
1928
|
-
|
|
1959
|
+
if (!t)
|
|
1960
|
+
return;
|
|
1961
|
+
let e = this.api.selection.findParentTag(this.tag, P.CSS);
|
|
1929
1962
|
e ? this.unwrap(e) : this.wrap(t);
|
|
1930
1963
|
}
|
|
1931
1964
|
wrap(t) {
|
|
1932
1965
|
let e = document.createElement(this.tag);
|
|
1933
|
-
e.classList.add(
|
|
1966
|
+
e.classList.add(P.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
1934
1967
|
}
|
|
1935
1968
|
unwrap(t) {
|
|
1969
|
+
var n;
|
|
1936
1970
|
this.api.selection.expandToTag(t);
|
|
1937
|
-
let e = window.getSelection(), i = e.getRangeAt(0), s = i.extractContents();
|
|
1938
|
-
t.parentNode.removeChild(t), i.insertNode(s), e.removeAllRanges(), e.addRange(i);
|
|
1971
|
+
let e = window.getSelection(), i = e == null ? void 0 : e.getRangeAt(0), s = i == null ? void 0 : i.extractContents();
|
|
1972
|
+
(n = t == null ? void 0 : t.parentNode) == null || n.removeChild(t), s && (i == null || i.insertNode(s)), e == null || e.removeAllRanges(), i && (e == null || e.addRange(i));
|
|
1939
1973
|
}
|
|
1940
1974
|
checkState() {
|
|
1941
|
-
|
|
1942
|
-
this.
|
|
1975
|
+
var e;
|
|
1976
|
+
const t = this.api.selection.findParentTag(this.tag, P.CSS);
|
|
1977
|
+
(e = this.button) == null || e.classList.toggle(this.iconClasses.active, !!t);
|
|
1943
1978
|
}
|
|
1944
1979
|
get toolboxIcon() {
|
|
1945
|
-
return
|
|
1980
|
+
return vt;
|
|
1946
1981
|
}
|
|
1947
1982
|
static get sanitize() {
|
|
1948
|
-
return { mark: { class:
|
|
1983
|
+
return { mark: { class: P.CSS } };
|
|
1949
1984
|
}
|
|
1950
1985
|
}
|
|
1951
|
-
class
|
|
1986
|
+
class Ce {
|
|
1952
1987
|
constructor(t) {
|
|
1953
1988
|
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;
|
|
1954
1989
|
const { api: e, config: i } = t;
|
|
@@ -1962,8 +1997,7 @@ class re {
|
|
|
1962
1997
|
}
|
|
1963
1998
|
render() {
|
|
1964
1999
|
const t = document.createElement("button");
|
|
1965
|
-
return t.type = "button", t.innerHTML =
|
|
1966
|
-
<path d="M20 17.4615C20 18.3112 19.3284 19 18.5 19C17.6716 19 17 18.3112 17 17.4615C17 16.6119 17.9 15.6154 18.5 15C19.1 15.6154 20 16.6119 20 17.4615Z" stroke="black" stroke-width="2"/></svg>`, t.classList.add(this.api.styles.inlineToolButton), t.addEventListener("mousedown", (e) => {
|
|
2000
|
+
return t.type = "button", t.innerHTML = '<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.24296 11.4075C5.23167 10.6253 5.52446 9.8395 6.12132 9.24264L9.65686 5.70711C10.0474 5.31658 10.6809 5.31693 11.0714 5.70745L16.0205 10.6565C16.2268 10.8629 16.3243 11.1371 16.3126 11.4075M5.24296 11.4075C5.25382 12.1607 5.54661 12.9106 6.12132 13.4853L8 15.364M5.24296 11.4075H11.9565M16.3126 11.4075C16.3022 11.6487 16.205 11.8869 16.0208 12.0711L12.4853 15.6066C11.3137 16.7782 9.41421 16.7782 8.24264 15.6066L8 15.364M16.3126 11.4075H11.9565M8 15.364L11.9565 11.4075"/><path stroke="currentColor" stroke-width="2" d="M20 17.4615C20 18.3112 19.3284 19 18.5 19C17.6716 19 17 18.3112 17 17.4615C17 16.6119 17.9 15.6154 18.5 15C19.1 15.6154 20 16.6119 20 17.4615Z"/></svg>', t.classList.add(this.api.styles.inlineToolButton), t.addEventListener("mousedown", (e) => {
|
|
1967
2001
|
e.preventDefault();
|
|
1968
2002
|
}), t;
|
|
1969
2003
|
}
|
|
@@ -1971,7 +2005,8 @@ class re {
|
|
|
1971
2005
|
this.lastRange = t;
|
|
1972
2006
|
}
|
|
1973
2007
|
wrapAndColor(t, e) {
|
|
1974
|
-
if (!t)
|
|
2008
|
+
if (!t)
|
|
2009
|
+
return;
|
|
1975
2010
|
const i = t.extractContents(), s = document.createElement(this.tag);
|
|
1976
2011
|
s.classList.add(this.class), s.appendChild(i), s.style.color = e, s.innerHTML = s.textContent || "", t.insertNode(s), this.api.selection.expandToTag(s);
|
|
1977
2012
|
}
|
|
@@ -1988,11 +2023,11 @@ class re {
|
|
|
1988
2023
|
return { span: { style: { color: !0 } } };
|
|
1989
2024
|
}
|
|
1990
2025
|
}
|
|
1991
|
-
class
|
|
2026
|
+
class ve extends Ce {
|
|
1992
2027
|
static get sanitize() {
|
|
1993
2028
|
}
|
|
1994
2029
|
}
|
|
1995
|
-
const
|
|
2030
|
+
const Dt = class F {
|
|
1996
2031
|
constructor(t) {
|
|
1997
2032
|
this.tag = "U", this.api = t.api, this.iconClasses = { base: this.api.styles.inlineToolButton, active: this.api.styles.inlineToolButtonActive };
|
|
1998
2033
|
}
|
|
@@ -2003,42 +2038,42 @@ const O = class O {
|
|
|
2003
2038
|
return this.button = document.createElement("button"), this.button.type = "button", this.button.classList.add(this.iconClasses.base), this.button.innerHTML = this.toolboxIcon, this.button;
|
|
2004
2039
|
}
|
|
2005
2040
|
surround(t) {
|
|
2006
|
-
if (!t)
|
|
2007
|
-
|
|
2041
|
+
if (!t)
|
|
2042
|
+
return;
|
|
2043
|
+
const e = this.api.selection.findParentTag(this.tag, F.CSS);
|
|
2008
2044
|
e ? this.unwrap(e) : this.wrap(t);
|
|
2009
2045
|
}
|
|
2010
2046
|
wrap(t) {
|
|
2011
2047
|
const e = document.createElement(this.tag);
|
|
2012
|
-
e.classList.add(
|
|
2048
|
+
e.classList.add(F.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
2013
2049
|
}
|
|
2014
2050
|
unwrap(t) {
|
|
2015
2051
|
var n;
|
|
2016
2052
|
this.api.selection.expandToTag(t);
|
|
2017
2053
|
const e = window.getSelection();
|
|
2018
|
-
if (!e)
|
|
2054
|
+
if (!e)
|
|
2055
|
+
return;
|
|
2019
2056
|
const i = e.getRangeAt(0);
|
|
2020
|
-
if (!i)
|
|
2057
|
+
if (!i)
|
|
2058
|
+
return;
|
|
2021
2059
|
const s = i.extractContents();
|
|
2022
2060
|
s && ((n = t.parentNode) == null || n.removeChild(t), i.insertNode(s), e.removeAllRanges(), e.addRange(i));
|
|
2023
2061
|
}
|
|
2024
2062
|
checkState() {
|
|
2025
2063
|
var e;
|
|
2026
|
-
const t = this.api.selection.findParentTag(this.tag,
|
|
2064
|
+
const t = this.api.selection.findParentTag(this.tag, F.CSS);
|
|
2027
2065
|
return (e = this.button) == null || e.classList.toggle(this.iconClasses.active, !!t), !!t;
|
|
2028
2066
|
}
|
|
2029
2067
|
get toolboxIcon() {
|
|
2030
|
-
return
|
|
2031
|
-
<path 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" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2032
|
-
<path d="M7.71429 18H16.2857" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2033
|
-
</svg>`;
|
|
2068
|
+
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>';
|
|
2034
2069
|
}
|
|
2035
2070
|
static get sanitize() {
|
|
2036
|
-
return { u: { class:
|
|
2071
|
+
return { u: { class: F.CSS } };
|
|
2037
2072
|
}
|
|
2038
2073
|
};
|
|
2039
|
-
|
|
2040
|
-
let
|
|
2041
|
-
class
|
|
2074
|
+
Dt.isInline = !0;
|
|
2075
|
+
let we = Dt;
|
|
2076
|
+
class $ {
|
|
2042
2077
|
constructor({ api: t }) {
|
|
2043
2078
|
this.tag = "CODE", this.api = t, this.button = null, this.iconClasses = { base: this.api.styles.inlineToolButton, active: this.api.styles.inlineToolButtonActive };
|
|
2044
2079
|
}
|
|
@@ -2053,57 +2088,57 @@ class W {
|
|
|
2053
2088
|
}
|
|
2054
2089
|
surround(t) {
|
|
2055
2090
|
var i;
|
|
2056
|
-
if (!t)
|
|
2057
|
-
|
|
2091
|
+
if (!t)
|
|
2092
|
+
return;
|
|
2093
|
+
let e = this.api.selection.findParentTag(this.tag, $.CSS);
|
|
2058
2094
|
e ? this.unwrap(e) : (i = t.commonAncestorContainer.parentElement) != null && i.querySelector(this.tag) || this.wrap(t);
|
|
2059
2095
|
}
|
|
2060
2096
|
wrap(t) {
|
|
2061
2097
|
let e = document.createElement(this.tag);
|
|
2062
|
-
e.classList.add(
|
|
2098
|
+
e.classList.add($.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
2063
2099
|
}
|
|
2064
2100
|
unwrap(t) {
|
|
2065
2101
|
var n;
|
|
2066
2102
|
this.api.selection.expandToTag(t);
|
|
2067
2103
|
const e = window.getSelection();
|
|
2068
|
-
if (!e)
|
|
2104
|
+
if (!e)
|
|
2105
|
+
return;
|
|
2069
2106
|
const i = e.getRangeAt(0), s = i.extractContents();
|
|
2070
2107
|
(n = t.parentNode) == null || n.removeChild(t), i.insertNode(s), e.removeAllRanges(), e.addRange(i);
|
|
2071
2108
|
}
|
|
2072
2109
|
checkState() {
|
|
2073
|
-
const t = this.api.selection.findParentTag(this.tag,
|
|
2110
|
+
const t = this.api.selection.findParentTag(this.tag, $.CSS);
|
|
2074
2111
|
return this.button && this.button.classList.toggle(this.iconClasses.active, !!t), !!t;
|
|
2075
2112
|
}
|
|
2076
2113
|
get toolboxIcon() {
|
|
2077
|
-
return
|
|
2078
|
-
<path d="M9 8L5 12L9 16" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2079
|
-
<path d="M15 8L19 12L15 16" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2080
|
-
</svg>
|
|
2081
|
-
`;
|
|
2114
|
+
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>';
|
|
2082
2115
|
}
|
|
2083
2116
|
static get sanitize() {
|
|
2084
|
-
return { code: { class:
|
|
2117
|
+
return { code: { class: $.CSS } };
|
|
2085
2118
|
}
|
|
2086
2119
|
}
|
|
2087
|
-
function y(
|
|
2088
|
-
const i = document.createElement(
|
|
2120
|
+
function y(h, t, e = {}) {
|
|
2121
|
+
const i = document.createElement(h);
|
|
2089
2122
|
Array.isArray(t) ? i.classList.add(...t) : t && i.classList.add(t);
|
|
2090
|
-
for (const s in e)
|
|
2123
|
+
for (const s in e)
|
|
2124
|
+
Object.prototype.hasOwnProperty.call(e, s) && i.setAttribute(s, e[s]);
|
|
2091
2125
|
return i;
|
|
2092
2126
|
}
|
|
2093
|
-
function
|
|
2094
|
-
const t =
|
|
2127
|
+
function yt(h) {
|
|
2128
|
+
const t = h.getBoundingClientRect();
|
|
2095
2129
|
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) };
|
|
2096
2130
|
}
|
|
2097
|
-
function
|
|
2098
|
-
const e =
|
|
2131
|
+
function tt(h, t) {
|
|
2132
|
+
const e = yt(h), i = yt(t);
|
|
2099
2133
|
return { fromTopBorder: i.y1 - e.y1, fromLeftBorder: i.x1 - e.x1, fromRightBorder: e.x2 - i.x2, fromBottomBorder: e.y2 - i.y2 };
|
|
2100
2134
|
}
|
|
2101
|
-
function
|
|
2102
|
-
|
|
2135
|
+
function St(h, t) {
|
|
2136
|
+
var e;
|
|
2137
|
+
return (e = t == null ? void 0 : t.parentNode) == null ? void 0 : e.insertBefore(h, t);
|
|
2103
2138
|
}
|
|
2104
|
-
function
|
|
2139
|
+
function Lt(h, t = !0) {
|
|
2105
2140
|
const e = document.createRange(), i = window.getSelection();
|
|
2106
|
-
e.selectNodeContents(
|
|
2141
|
+
e.selectNodeContents(h), e.collapse(t), i == null || i.removeAllRanges(), i == null || i.addRange(e);
|
|
2107
2142
|
}
|
|
2108
2143
|
class C {
|
|
2109
2144
|
constructor({ items: t }) {
|
|
@@ -2114,16 +2149,21 @@ class C {
|
|
|
2114
2149
|
}
|
|
2115
2150
|
render() {
|
|
2116
2151
|
return this.wrapper = y("div", C.CSS.popover), this.items.forEach((t, e) => {
|
|
2152
|
+
var r;
|
|
2117
2153
|
const i = y("div", C.CSS.item), s = y("div", C.CSS.itemIcon, { innerHTML: t.icon }), n = y("div", C.CSS.itemLabel, { textContent: t.label });
|
|
2118
|
-
i.dataset.index = e, i.appendChild(s), i.appendChild(n), this.wrapper.appendChild(i), this.itemEls.push(i);
|
|
2154
|
+
i.dataset.index = e + "", i.appendChild(s), i.appendChild(n), (r = this.wrapper) == null || r.appendChild(i), this.itemEls.push(i);
|
|
2119
2155
|
}), this.wrapper.addEventListener("click", (t) => {
|
|
2120
2156
|
this.popoverClicked(t);
|
|
2121
2157
|
}), this.wrapper;
|
|
2122
2158
|
}
|
|
2123
2159
|
popoverClicked(t) {
|
|
2124
2160
|
const e = t.target.closest(`.${C.CSS.item}`);
|
|
2125
|
-
if (!e)
|
|
2126
|
-
|
|
2161
|
+
if (!e)
|
|
2162
|
+
return;
|
|
2163
|
+
const i = e.dataset.index;
|
|
2164
|
+
if (!i)
|
|
2165
|
+
return;
|
|
2166
|
+
const s = this.items[parseInt(i)];
|
|
2127
2167
|
!s.confirmationRequired || this.hasConfirmationState(e) ? s.onClick() : this.setConfirmationState(e);
|
|
2128
2168
|
}
|
|
2129
2169
|
setConfirmationState(t) {
|
|
@@ -2136,23 +2176,25 @@ class C {
|
|
|
2136
2176
|
return t.classList.contains(C.CSS.itemConfirmState);
|
|
2137
2177
|
}
|
|
2138
2178
|
get opened() {
|
|
2139
|
-
|
|
2179
|
+
var t;
|
|
2180
|
+
return ((t = this.wrapper) == null ? void 0 : t.classList.contains(C.CSS.popoverOpened)) || !1;
|
|
2140
2181
|
}
|
|
2141
2182
|
open() {
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2183
|
+
var t;
|
|
2184
|
+
this.items.forEach((e, i) => {
|
|
2185
|
+
typeof e.hideIf == "function" && this.itemEls[i].classList.toggle(C.CSS.itemHidden, e.hideIf());
|
|
2186
|
+
}), (t = this.wrapper) == null || t.classList.add(C.CSS.popoverOpened);
|
|
2145
2187
|
}
|
|
2146
2188
|
close() {
|
|
2147
|
-
|
|
2148
|
-
|
|
2189
|
+
var t;
|
|
2190
|
+
(t = this.wrapper) == null || t.classList.remove(C.CSS.popoverOpened), this.itemEls.forEach((e) => {
|
|
2191
|
+
this.clearConfirmationState(e);
|
|
2149
2192
|
});
|
|
2150
2193
|
}
|
|
2151
2194
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
this.api = t, this.items = e, this.onOpen = i, this.onClose = s, this.cssModifier = n, this.popover = null, this.wrapper = this.createToolbox();
|
|
2195
|
+
class A {
|
|
2196
|
+
constructor({ items: t, onOpen: e, onClose: i, cssModifier: s = "" }) {
|
|
2197
|
+
this.items = t, this.onOpen = e, this.onClose = i, this.cssModifier = s, this.popover = null, this.wrapper = this.createToolbox();
|
|
2156
2198
|
}
|
|
2157
2199
|
static get CSS() {
|
|
2158
2200
|
return { toolbox: "tc-toolbox", toolboxShowed: "tc-toolbox--showed", toggler: "tc-toolbox__toggler" };
|
|
@@ -2161,13 +2203,13 @@ class I {
|
|
|
2161
2203
|
return this.wrapper;
|
|
2162
2204
|
}
|
|
2163
2205
|
createToolbox() {
|
|
2164
|
-
const t = y("div", [
|
|
2206
|
+
const t = y("div", [A.CSS.toolbox, this.cssModifier ? `${A.CSS.toolbox}--${this.cssModifier}` : ""]);
|
|
2165
2207
|
t.dataset.mutationFree = "true";
|
|
2166
2208
|
const e = this.createPopover(), i = this.createToggler();
|
|
2167
2209
|
return t.appendChild(i), t.appendChild(e), t;
|
|
2168
2210
|
}
|
|
2169
2211
|
createToggler() {
|
|
2170
|
-
const t = y("div",
|
|
2212
|
+
const t = y("div", A.CSS.toggler, { innerHTML: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.41 9.66H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 9.66H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.31 14.36H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 14.36H14.59"/></svg>' });
|
|
2171
2213
|
return t.addEventListener("click", () => {
|
|
2172
2214
|
this.togglerClicked();
|
|
2173
2215
|
}), t;
|
|
@@ -2182,57 +2224,60 @@ class I {
|
|
|
2182
2224
|
show(t) {
|
|
2183
2225
|
const e = t();
|
|
2184
2226
|
Object.entries(e).forEach(([i, s]) => {
|
|
2185
|
-
this.wrapper.style
|
|
2186
|
-
}), this.wrapper.classList.add(
|
|
2227
|
+
this.wrapper.style.setProperty(i, s);
|
|
2228
|
+
}), this.wrapper.classList.add(A.CSS.toolboxShowed);
|
|
2187
2229
|
}
|
|
2188
2230
|
hide() {
|
|
2189
2231
|
var t;
|
|
2190
|
-
(t = this.popover) == null || t.close(), this.wrapper.classList.remove(
|
|
2232
|
+
(t = this.popover) == null || t.close(), this.wrapper.classList.remove(A.CSS.toolboxShowed);
|
|
2191
2233
|
}
|
|
2192
2234
|
}
|
|
2193
|
-
const
|
|
2194
|
-
class
|
|
2235
|
+
const xt = "tc-wrap", ke = "tc-wrap--readonly", Tt = "tc-table", O = "tc-row", Et = "tc-table--heading", et = "tc-row--selected", D = "tc-cell", it = "tc-cell--selected", st = "tc-add-row", Mt = "tc-add-row--disabled", nt = "tc-add-column", _t = "tc-add-column--disabled";
|
|
2236
|
+
class be {
|
|
2195
2237
|
constructor(t, e, i, s) {
|
|
2196
2238
|
this.minCellWidhth = 50, this.defaultCellWidth = 100, this.handleDocumentMousedown = (n) => {
|
|
2197
|
-
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.
|
|
2239
|
+
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);
|
|
2198
2240
|
}, this.handleDocumentMousemove = (n) => {
|
|
2199
|
-
if (!this.isDragging)
|
|
2241
|
+
if (!this.isDragging)
|
|
2242
|
+
return;
|
|
2200
2243
|
const r = n.clientX - this.mouseStartX, o = Math.max(this.startWidth + r, this.minCellWidhth);
|
|
2201
2244
|
this.colWidthArr[this.draggingColumn - 1] = o, this.updateColWidth();
|
|
2202
|
-
}, this.handleDocumentMouseup = (
|
|
2245
|
+
}, this.handleDocumentMouseup = () => {
|
|
2203
2246
|
this.updateToolboxesPosition(), this.isDragging = !1, this.table.classList.remove("table-resizing"), document.removeEventListener("mousemove", this.handleDocumentMousemove), document.removeEventListener("mouseup", this.handleDocumentMouseup);
|
|
2204
|
-
}, 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.
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2247
|
+
}, 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) => {
|
|
2248
|
+
let r = n.target;
|
|
2249
|
+
const o = r.closest(`.${Tt}`) !== null, a = r.closest(`.${xt}`) === null;
|
|
2250
|
+
(o || a) && this.hideToolboxes();
|
|
2251
|
+
const d = r.closest(`.${st}`), l = r.closest(`.${nt}`);
|
|
2252
|
+
d && d.parentNode === this.wrapper ? (this.addRow(void 0, !0), this.hideToolboxes()) : l && l.parentNode === this.wrapper && (this.addColumn(void 0, !0), this.hideToolboxes());
|
|
2209
2253
|
}, this.readOnly || this.bindEvents();
|
|
2210
2254
|
}
|
|
2211
2255
|
getWrapper() {
|
|
2212
2256
|
return this.wrapper;
|
|
2213
2257
|
}
|
|
2214
2258
|
bindEvents() {
|
|
2215
|
-
document.addEventListener("click", this.documentClicked), document.addEventListener("mousedown", (t) => this.handleDocumentMousedown(t)), this.table.addEventListener("mousemove",
|
|
2259
|
+
document.addEventListener("click", this.documentClicked), document.addEventListener("mousedown", (t) => this.handleDocumentMousedown(t)), this.table.addEventListener("mousemove", function(t, e) {
|
|
2216
2260
|
let i = 0;
|
|
2217
2261
|
return function(...s) {
|
|
2218
2262
|
const n = (/* @__PURE__ */ new Date()).getTime();
|
|
2219
|
-
if (!(n - i < t))
|
|
2263
|
+
if (!(n - i < t))
|
|
2264
|
+
return i = n, e(...s);
|
|
2220
2265
|
};
|
|
2221
2266
|
}(150, (t) => this.onMouseMoveInTable(t)), { passive: !0 }), this.table.onkeypress = (t) => this.onKeyPressListener(t), this.table.addEventListener("keydown", (t) => this.onKeyDownListener(t)), this.table.addEventListener("focusin", (t) => this.focusInTableListener(t));
|
|
2222
2267
|
}
|
|
2223
2268
|
getCellInCol(t) {
|
|
2224
2269
|
const e = [];
|
|
2225
|
-
return this.table.querySelectorAll(`.${
|
|
2270
|
+
return this.table.querySelectorAll(`.${O}`).forEach((i) => {
|
|
2226
2271
|
const s = i.querySelector(`.${D}:nth-child(${t})`);
|
|
2227
2272
|
s && e.push(s);
|
|
2228
2273
|
}), e;
|
|
2229
2274
|
}
|
|
2230
2275
|
createColumnToolbox() {
|
|
2231
|
-
return new
|
|
2276
|
+
return new A({ api: this.api, cssModifier: "column", items: [{ label: this.api.i18n.t("Add column to left"), icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.9167 14.9167L11.5833 18.25M11.5833 18.25L8.25 14.9167M11.5833 18.25L11.5833 10.0833C11.5833 9.19928 11.9345 8.35143 12.5596 7.72631C13.1848 7.10119 14.0326 6.75 14.9167 6.75"/></svg>', hideIf: () => this.numberOfColumns === this.config.maxcols, onClick: () => {
|
|
2232
2277
|
this.addColumn(this.selectedColumn, !0), this.hideToolboxes(), this.updateColWidth();
|
|
2233
2278
|
} }, { 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: () => {
|
|
2234
2279
|
this.addColumn(this.selectedColumn + 1, !0), this.hideToolboxes(), this.updateColWidth();
|
|
2235
|
-
} }, { label: this.api.i18n.t("Delete column"), icon:
|
|
2280
|
+
} }, { label: this.api.i18n.t("Delete column"), icon: Ct, hideIf: () => this.numberOfColumns === 1, confirmationRequired: !0, onClick: () => {
|
|
2236
2281
|
this.deleteColumn(this.selectedColumn), this.hideToolboxes(), this.updateColWidth();
|
|
2237
2282
|
} }], onOpen: () => {
|
|
2238
2283
|
this.selectColumn(this.hoveredColumn), this.hideRowToolbox();
|
|
@@ -2241,11 +2286,11 @@ class le {
|
|
|
2241
2286
|
} });
|
|
2242
2287
|
}
|
|
2243
2288
|
createRowToolbox() {
|
|
2244
|
-
return new
|
|
2289
|
+
return new A({ api: this.api, cssModifier: "row", items: [{ label: this.api.i18n.t("Add row above"), icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 15.8333L18.2167 12.5M18.2167 12.5L14.8833 9.16667M18.2167 12.5L10.05 12.5C9.16595 12.5 8.31811 12.8512 7.69299 13.4763C7.06787 14.1014 6.71667 14.9493 6.71667 15.8333"/></svg>', hideIf: () => this.numberOfRows === this.config.maxrows, onClick: () => {
|
|
2245
2290
|
this.addRow(this.selectedRow, !0), this.hideToolboxes();
|
|
2246
2291
|
} }, { 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: () => {
|
|
2247
2292
|
this.addRow(this.selectedRow + 1, !0), this.hideToolboxes();
|
|
2248
|
-
} }, { label: this.api.i18n.t("Delete row"), icon:
|
|
2293
|
+
} }, { label: this.api.i18n.t("Delete row"), icon: Ct, hideIf: () => this.numberOfRows === 1, confirmationRequired: !0, onClick: () => {
|
|
2249
2294
|
this.deleteRow(this.selectedRow), this.hideToolboxes();
|
|
2250
2295
|
} }], onOpen: () => {
|
|
2251
2296
|
this.selectRow(this.hoveredRow), this.hideColumnToolbox();
|
|
@@ -2257,10 +2302,10 @@ class le {
|
|
|
2257
2302
|
this.focusedCell.row !== this.numberOfRows ? (this.focusedCell.row += 1, this.focusCell()) : (this.addRow(), this.focusedCell.row += 1, this.focusCell(), this.updateToolboxesPosition(0, 0));
|
|
2258
2303
|
}
|
|
2259
2304
|
getCell(t, e) {
|
|
2260
|
-
return this.table.querySelectorAll(`.${
|
|
2305
|
+
return this.table.querySelectorAll(`.${O}:nth-child(${t}) .${D}`)[e - 1];
|
|
2261
2306
|
}
|
|
2262
2307
|
getRow(t) {
|
|
2263
|
-
return this.table.querySelector(`.${
|
|
2308
|
+
return this.table.querySelector(`.${O}:nth-child(${t})`);
|
|
2264
2309
|
}
|
|
2265
2310
|
getRowByCell(t) {
|
|
2266
2311
|
return t.parentElement;
|
|
@@ -2274,63 +2319,73 @@ class le {
|
|
|
2274
2319
|
addColumn(t = -1, e = !1) {
|
|
2275
2320
|
var n;
|
|
2276
2321
|
let i = this.numberOfColumns;
|
|
2277
|
-
if (this.config && this.config.maxcols && this.numberOfColumns >= this.config.maxcols)
|
|
2322
|
+
if (this.config && this.config.maxcols && this.numberOfColumns >= this.config.maxcols)
|
|
2323
|
+
return;
|
|
2278
2324
|
for (let r = 1; r <= this.numberOfRows; r++) {
|
|
2279
2325
|
let o;
|
|
2280
2326
|
const a = this.createCell();
|
|
2281
|
-
if (t > 0 && t <= i ? (o = this.getCell(r, t),
|
|
2282
|
-
const
|
|
2283
|
-
|
|
2327
|
+
if (t > 0 && t <= i ? (o = this.getCell(r, t), St(a, o)) : o = this.getRow(r).appendChild(a), r === 1) {
|
|
2328
|
+
const d = this.getCell(r, t > 0 ? t : i + 1);
|
|
2329
|
+
d && e && Lt(d);
|
|
2284
2330
|
}
|
|
2285
2331
|
}
|
|
2286
|
-
const s = this.wrapper.querySelector(`.${
|
|
2287
|
-
(n = this.config) != null && n.maxcols && this.numberOfColumns > this.config.maxcols - 1 && s && s.classList.add(
|
|
2332
|
+
const s = this.wrapper.querySelector(`.${nt}`);
|
|
2333
|
+
(n = this.config) != null && n.maxcols && this.numberOfColumns > this.config.maxcols - 1 && s && s.classList.add(_t), this.addHeadingAttrToFirstRow(), this.colWidthArr.splice(t - 1, 0, this.defaultCellWidth);
|
|
2288
2334
|
}
|
|
2289
2335
|
addRow(t = -1, e = !1) {
|
|
2290
|
-
let i, s = y("div",
|
|
2336
|
+
let i, s = y("div", O);
|
|
2291
2337
|
this.tunes.withHeadings && this.removeHeadingAttrFromFirstRow();
|
|
2292
2338
|
let n = this.numberOfColumns;
|
|
2293
|
-
if (this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows
|
|
2294
|
-
|
|
2339
|
+
if (this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows)
|
|
2340
|
+
return;
|
|
2341
|
+
t > 0 && t <= this.numberOfRows ? i = St(s, this.getRow(t)) : i = this.table.appendChild(s), this.fillRow(i, n), this.tunes.withHeadings && this.addHeadingAttrToFirstRow();
|
|
2295
2342
|
const r = this.getRowFirstCell(i);
|
|
2296
|
-
r && e &&
|
|
2297
|
-
const o = this.wrapper.querySelector(`.${
|
|
2298
|
-
return this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows && o && o.classList.add(
|
|
2343
|
+
r && e && Lt(r);
|
|
2344
|
+
const o = this.wrapper.querySelector(`.${st}`);
|
|
2345
|
+
return this.config && this.config.maxrows && this.numberOfRows >= this.config.maxrows && o && o.classList.add(Mt), i;
|
|
2299
2346
|
}
|
|
2300
2347
|
deleteColumn(t) {
|
|
2301
2348
|
for (let i = 1; i <= this.numberOfRows; i++) {
|
|
2302
2349
|
const s = this.getCell(i, t);
|
|
2303
|
-
if (!s)
|
|
2350
|
+
if (!s)
|
|
2351
|
+
return;
|
|
2304
2352
|
s.remove();
|
|
2305
2353
|
}
|
|
2306
|
-
const e = this.wrapper.querySelector(`.${
|
|
2307
|
-
e && e.classList.remove(
|
|
2354
|
+
const e = this.wrapper.querySelector(`.${nt}`);
|
|
2355
|
+
e && e.classList.remove(_t), this.colWidthArr.splice(t - 1, 1);
|
|
2308
2356
|
}
|
|
2309
2357
|
deleteRow(t) {
|
|
2310
2358
|
this.getRow(t).remove();
|
|
2311
|
-
const e = this.wrapper.querySelector(`.${
|
|
2312
|
-
e && e.classList.remove(
|
|
2359
|
+
const e = this.wrapper.querySelector(`.${st}`);
|
|
2360
|
+
e && e.classList.remove(Mt), this.addHeadingAttrToFirstRow();
|
|
2313
2361
|
}
|
|
2314
2362
|
createTableWrapper() {
|
|
2315
|
-
this.wrapper = y("div",
|
|
2363
|
+
this.wrapper = y("div", xt), this.table = y("div", Tt), this.readOnly && this.wrapper.classList.add(ke), this.wrapper.appendChild(this.toolboxRow.element), this.wrapper.appendChild(this.toolboxColumn.element), this.wrapper.appendChild(this.table);
|
|
2316
2364
|
}
|
|
2317
2365
|
computeInitialSize() {
|
|
2318
|
-
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,
|
|
2319
|
-
return { rows: s || a || 2, cols: n ||
|
|
2366
|
+
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;
|
|
2367
|
+
return { rows: s || a || 2, cols: n || d || 2 };
|
|
2320
2368
|
}
|
|
2321
2369
|
resize() {
|
|
2322
2370
|
const { rows: t, cols: e } = this.computeInitialSize();
|
|
2323
|
-
for (let i = 0; i < t; i++)
|
|
2324
|
-
|
|
2371
|
+
for (let i = 0; i < t; i++)
|
|
2372
|
+
this.addRow();
|
|
2373
|
+
for (let i = 0; i < e; i++)
|
|
2374
|
+
this.addColumn();
|
|
2325
2375
|
}
|
|
2326
2376
|
updateColWidth() {
|
|
2327
2377
|
let t = "";
|
|
2328
|
-
if (this.colWidthArr && this.colWidthArr.length > 0)
|
|
2378
|
+
if (this.colWidthArr && this.colWidthArr.length > 0)
|
|
2379
|
+
for (let e = 0; e < this.colWidthArr.length; e++)
|
|
2380
|
+
t += " " + this.colWidthArr[e] + "px";
|
|
2329
2381
|
t && this.wrapper.style.setProperty("--col-width", t);
|
|
2330
2382
|
}
|
|
2331
2383
|
fill() {
|
|
2332
2384
|
const t = this.data;
|
|
2333
|
-
if (t && t.content)
|
|
2385
|
+
if (t && t.content)
|
|
2386
|
+
for (let e = 0; e < t.content.length; e++)
|
|
2387
|
+
for (let i = 0; i < t.content[e].length; i++)
|
|
2388
|
+
this.setCellContent(e + 1, i + 1, t.content[e][i]);
|
|
2334
2389
|
}
|
|
2335
2390
|
fillRow(t, e) {
|
|
2336
2391
|
for (let i = 1; i <= e; i++) {
|
|
@@ -2345,7 +2400,7 @@ class le {
|
|
|
2345
2400
|
return this.table.childElementCount;
|
|
2346
2401
|
}
|
|
2347
2402
|
get numberOfColumns() {
|
|
2348
|
-
return this.numberOfRows ? this.table.querySelectorAll(`.${
|
|
2403
|
+
return this.numberOfRows ? this.table.querySelectorAll(`.${O}:first-child .${D}`).length : 0;
|
|
2349
2404
|
}
|
|
2350
2405
|
get isColumnMenuShowing() {
|
|
2351
2406
|
return this.selectedColumn !== 0;
|
|
@@ -2354,7 +2409,7 @@ class le {
|
|
|
2354
2409
|
return this.selectedRow !== 0;
|
|
2355
2410
|
}
|
|
2356
2411
|
onMouseMoveInTable(t) {
|
|
2357
|
-
const { row: e, column: i, deltaXCell: s
|
|
2412
|
+
const { row: e, column: i, deltaXCell: s } = this.getHoveredCell(t);
|
|
2358
2413
|
this.hoveredColumn = i, this.hoveredRow = e, this.updateToolboxesPosition(), this.hoveredCell !== null && this.hoveredCell.classList.contains("cell-resizable") && this.hoveredCell.classList.remove("cell-resizable"), this.hoveredCell = this.getCell(e, i), this.cellIsResizable(this.hoveredCell, s) && (this.hoveredCell.classList.contains("cell-resizable") || this.hoveredCell.classList.add("cell-resizable"));
|
|
2359
2414
|
}
|
|
2360
2415
|
cellIsResizable(t, e) {
|
|
@@ -2362,7 +2417,8 @@ class le {
|
|
|
2362
2417
|
}
|
|
2363
2418
|
onKeyPressListener(t) {
|
|
2364
2419
|
if (t.key === "Enter") {
|
|
2365
|
-
if (t.shiftKey)
|
|
2420
|
+
if (t.shiftKey)
|
|
2421
|
+
return !0;
|
|
2366
2422
|
this.moveCursorToNextRow();
|
|
2367
2423
|
}
|
|
2368
2424
|
return t.key !== "Enter";
|
|
@@ -2372,7 +2428,7 @@ class le {
|
|
|
2372
2428
|
}
|
|
2373
2429
|
focusInTableListener(t) {
|
|
2374
2430
|
const e = t.target, i = this.getRowByCell(e);
|
|
2375
|
-
this.focusedCell = { row: Array.from(this.table.querySelectorAll(`.${
|
|
2431
|
+
i && (this.focusedCell = { row: Array.from(this.table.querySelectorAll(`.${O}`)).indexOf(i) + 1, column: Array.from(i.querySelectorAll(`.${D}`)).indexOf(e) + 1 });
|
|
2376
2432
|
}
|
|
2377
2433
|
hideToolboxes() {
|
|
2378
2434
|
this.hideRowToolbox(), this.hideColumnToolbox(), this.updateToolboxesPosition();
|
|
@@ -2392,12 +2448,12 @@ class le {
|
|
|
2392
2448
|
}
|
|
2393
2449
|
updateToolboxesPosition(t = this.hoveredRow, e = this.hoveredColumn) {
|
|
2394
2450
|
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(() => {
|
|
2395
|
-
const i = this.getRow(t), { fromTopBorder: s } =
|
|
2451
|
+
const i = this.getRow(t), { fromTopBorder: s } = tt(this.table, i), { height: n } = i.getBoundingClientRect();
|
|
2396
2452
|
return { top: `${Math.ceil(s + n / 2)}px` };
|
|
2397
2453
|
});
|
|
2398
2454
|
}
|
|
2399
2455
|
setHeadingsSetting(t) {
|
|
2400
|
-
this.tunes.withHeadings = t, t ? (this.table.classList.add(
|
|
2456
|
+
this.tunes.withHeadings = t, t ? (this.table.classList.add(Et), this.addHeadingAttrToFirstRow()) : (this.table.classList.remove(Et), this.removeHeadingAttrFromFirstRow());
|
|
2401
2457
|
}
|
|
2402
2458
|
addHeadingAttrToFirstRow() {
|
|
2403
2459
|
for (let t = 1; t <= this.numberOfColumns; t++) {
|
|
@@ -2413,32 +2469,34 @@ class le {
|
|
|
2413
2469
|
}
|
|
2414
2470
|
selectRow(t) {
|
|
2415
2471
|
const e = this.getRow(t);
|
|
2416
|
-
e && (this.selectedRow = t, e.classList.add(
|
|
2472
|
+
e && (this.selectedRow = t, e.classList.add(et));
|
|
2417
2473
|
}
|
|
2418
2474
|
unselectRow() {
|
|
2419
|
-
if (this.selectedRow <= 0)
|
|
2420
|
-
|
|
2421
|
-
t
|
|
2475
|
+
if (this.selectedRow <= 0)
|
|
2476
|
+
return;
|
|
2477
|
+
const t = this.table.querySelector(`.${et}`);
|
|
2478
|
+
t && t.classList.remove(et), this.selectedRow = 0;
|
|
2422
2479
|
}
|
|
2423
2480
|
selectColumn(t) {
|
|
2424
2481
|
for (let e = 1; e <= this.numberOfRows; e++) {
|
|
2425
2482
|
const i = this.getCell(e, t);
|
|
2426
|
-
i && i.classList.add(
|
|
2483
|
+
i && i.classList.add(it);
|
|
2427
2484
|
}
|
|
2428
2485
|
this.selectedColumn = t;
|
|
2429
2486
|
}
|
|
2430
2487
|
unselectColumn() {
|
|
2431
|
-
if (this.selectedColumn <= 0)
|
|
2432
|
-
|
|
2488
|
+
if (this.selectedColumn <= 0)
|
|
2489
|
+
return;
|
|
2490
|
+
let t = this.table.querySelectorAll(`.${it}`);
|
|
2433
2491
|
Array.from(t).forEach((e) => {
|
|
2434
|
-
e.classList.remove(
|
|
2492
|
+
e.classList.remove(it);
|
|
2435
2493
|
}), this.selectedColumn = 0;
|
|
2436
2494
|
}
|
|
2437
2495
|
getHoveredCell(t) {
|
|
2438
2496
|
let e = this.hoveredRow, i = this.hoveredColumn;
|
|
2439
2497
|
const { width: s, height: n, x: r, y: o } = function(u, p) {
|
|
2440
|
-
const g = u.getBoundingClientRect(), { width:
|
|
2441
|
-
return { width:
|
|
2498
|
+
const g = u.getBoundingClientRect(), { width: k, height: S, x: T, y: _ } = g, { clientX: G, clientY: q } = p;
|
|
2499
|
+
return { width: k, height: S, x: G - T, y: q - _ };
|
|
2442
2500
|
}(this.table, t);
|
|
2443
2501
|
if (r >= 0) {
|
|
2444
2502
|
const u = ({ fromLeftBorder: g }) => r < g, p = ({ fromRightBorder: g }) => r > s - g;
|
|
@@ -2448,21 +2506,23 @@ class le {
|
|
|
2448
2506
|
const u = ({ fromTopBorder: g }) => o < g, p = ({ fromBottomBorder: g }) => o > n - g;
|
|
2449
2507
|
e = this.binSearch(this.numberOfRows, (g) => this.getCell(g, 1), u, p);
|
|
2450
2508
|
}
|
|
2451
|
-
const a = e || this.hoveredRow,
|
|
2452
|
-
return { row: a, column:
|
|
2509
|
+
const a = e || this.hoveredRow, d = i || this.hoveredColumn, { deltaXCell: l, deltaYCell: c } = this.getMousePositionRelateToCell(a, d, r, o);
|
|
2510
|
+
return { row: a, column: d, deltaXCell: l, deltaYCell: c };
|
|
2453
2511
|
}
|
|
2454
2512
|
getMousePositionRelateToCell(t, e, i, s) {
|
|
2455
|
-
const n = this.getCell(t, e), { fromTopBorder: r, fromLeftBorder: o } =
|
|
2513
|
+
const n = this.getCell(t, e), { fromTopBorder: r, fromLeftBorder: o } = tt(this.table, n);
|
|
2456
2514
|
return { deltaXCell: i - o, deltaYCell: s - r };
|
|
2457
2515
|
}
|
|
2458
2516
|
binSearch(t, e, i, s) {
|
|
2459
2517
|
let n, r = 0, o = t + 1, a = 0;
|
|
2460
2518
|
for (; r < o - 1 && a < 10; ) {
|
|
2461
2519
|
n = Math.ceil((r + o) / 2);
|
|
2462
|
-
const
|
|
2463
|
-
if (i(l))
|
|
2520
|
+
const d = e(n), l = tt(this.table, d);
|
|
2521
|
+
if (i(l))
|
|
2522
|
+
o = n;
|
|
2464
2523
|
else {
|
|
2465
|
-
if (!s(l))
|
|
2524
|
+
if (!s(l))
|
|
2525
|
+
break;
|
|
2466
2526
|
r = n;
|
|
2467
2527
|
}
|
|
2468
2528
|
a++;
|
|
@@ -2472,7 +2532,7 @@ class le {
|
|
|
2472
2532
|
getData() {
|
|
2473
2533
|
const t = [];
|
|
2474
2534
|
for (let e = 1; e <= this.numberOfRows; e++) {
|
|
2475
|
-
const i = this.table.querySelector(`.${
|
|
2535
|
+
const i = this.table.querySelector(`.${O}:nth-child(${e})`), s = Array.from(i.querySelectorAll(`.${D}`));
|
|
2476
2536
|
s.every((n) => !n.textContent.trim()) || t.push(s.map((n) => n.innerHTML));
|
|
2477
2537
|
}
|
|
2478
2538
|
return t;
|
|
@@ -2481,7 +2541,7 @@ class le {
|
|
|
2481
2541
|
document.removeEventListener("click", this.documentClicked);
|
|
2482
2542
|
}
|
|
2483
2543
|
}
|
|
2484
|
-
class
|
|
2544
|
+
class ye {
|
|
2485
2545
|
static get isReadOnlySupported() {
|
|
2486
2546
|
return !0;
|
|
2487
2547
|
}
|
|
@@ -2495,7 +2555,7 @@ class he {
|
|
|
2495
2555
|
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" };
|
|
2496
2556
|
}
|
|
2497
2557
|
render() {
|
|
2498
|
-
return this.table = new
|
|
2558
|
+
return this.table = new be(this.readOnly, this.api, this.data, this.config), this.container = y("div", this.api.styles.block), this.container.appendChild(this.table.getWrapper()), this.table.setHeadingsSetting(this.data.withHeadings), this.container;
|
|
2499
2559
|
}
|
|
2500
2560
|
renderSettings() {
|
|
2501
2561
|
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: () => {
|
|
@@ -2525,42 +2585,275 @@ class he {
|
|
|
2525
2585
|
}
|
|
2526
2586
|
}
|
|
2527
2587
|
}
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2588
|
+
function N(h, t = null, e = {}) {
|
|
2589
|
+
const i = document.createElement(h);
|
|
2590
|
+
Array.isArray(t) ? i.classList.add(...t) : t !== null && i.classList.add(t);
|
|
2591
|
+
for (const s in e)
|
|
2592
|
+
e.hasOwnProperty(s) && (i[s] = e[s]);
|
|
2593
|
+
return i;
|
|
2594
|
+
}
|
|
2595
|
+
var V = ((h) => (h.Empty = "empty", h.Uploading = "uploading", h.Filled = "filled", h))(V || {});
|
|
2596
|
+
class Se {
|
|
2597
|
+
constructor({ api: t, config: e, onSelectFile: i, readOnly: s }) {
|
|
2598
|
+
this.api = t, this.config = e, this.onSelectFile = i, this.readOnly = s, this.nodes = { wrapper: N("div", [this.CSS.baseClass, this.CSS.wrapper]), imageContainer: N("div", [this.CSS.imageContainer]), fileButton: this.createFileButton(), imageEl: void 0, imagePreloader: N("div", this.CSS.imagePreloader), caption: N("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);
|
|
2599
|
+
}
|
|
2600
|
+
applyTune(t, e) {
|
|
2601
|
+
this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${t}`, e);
|
|
2602
|
+
}
|
|
2603
|
+
render() {
|
|
2604
|
+
return this.toggleStatus("empty"), this.nodes.wrapper;
|
|
2605
|
+
}
|
|
2606
|
+
showPreloader(t) {
|
|
2607
|
+
this.nodes.imagePreloader.style.backgroundImage = `url(${t})`, this.toggleStatus("uploading");
|
|
2608
|
+
}
|
|
2609
|
+
hidePreloader() {
|
|
2610
|
+
this.nodes.imagePreloader.style.backgroundImage = "", this.toggleStatus("empty");
|
|
2611
|
+
}
|
|
2612
|
+
fillImage(t) {
|
|
2613
|
+
const e = /\.mp4$/.test(t) ? "VIDEO" : "IMG", i = { src: t };
|
|
2614
|
+
let s = "load";
|
|
2615
|
+
e === "VIDEO" && (i.autoplay = !0, i.loop = !0, i.muted = !0, i.playsinline = !0, s = "loadeddata"), this.nodes.imageEl = N(e, this.CSS.imageEl, i), this.nodes.imageEl.addEventListener(s, () => {
|
|
2616
|
+
this.toggleStatus("filled"), this.nodes.imagePreloader !== void 0 && (this.nodes.imagePreloader.style.backgroundImage = "");
|
|
2617
|
+
}), this.nodes.imageContainer.appendChild(this.nodes.imageEl);
|
|
2618
|
+
}
|
|
2619
|
+
fillCaption(t) {
|
|
2620
|
+
this.nodes.caption !== void 0 && (this.nodes.caption.innerHTML = t);
|
|
2621
|
+
}
|
|
2622
|
+
toggleStatus(t) {
|
|
2623
|
+
for (const e in V)
|
|
2624
|
+
if (Object.prototype.hasOwnProperty.call(V, e)) {
|
|
2625
|
+
const i = V[e];
|
|
2626
|
+
this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${i}`, i === t);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
get CSS() {
|
|
2630
|
+
return { baseClass: this.api.styles.block, loading: this.api.styles.loader, input: this.api.styles.input, button: this.api.styles.button, wrapper: "image-tool", imageContainer: "image-tool__image", imagePreloader: "image-tool__image-preloader", imageEl: "image-tool__image-picture", caption: "image-tool__caption" };
|
|
2631
|
+
}
|
|
2632
|
+
createFileButton() {
|
|
2633
|
+
var e;
|
|
2634
|
+
const t = N("div", [this.CSS.button]);
|
|
2635
|
+
return t.innerHTML = (e = this.config.buttonContent) != null ? e : `<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> ${this.api.i18n.t("Select an Image")}`, t.addEventListener("click", () => {
|
|
2636
|
+
this.onSelectFile();
|
|
2637
|
+
}), t;
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
function rt(h) {
|
|
2641
|
+
return h !== void 0 && typeof h.then == "function";
|
|
2642
|
+
}
|
|
2643
|
+
class Le {
|
|
2644
|
+
constructor({ config: t, onUpload: e, onError: i }) {
|
|
2645
|
+
this.config = t, this.onUpload = e, this.onError = i;
|
|
2646
|
+
}
|
|
2647
|
+
async uploadSelectedFile({ onPreview: t }) {
|
|
2648
|
+
var r, o;
|
|
2649
|
+
const e = function(a) {
|
|
2650
|
+
const d = new FileReader();
|
|
2651
|
+
d.readAsDataURL(a), d.onload = (l) => {
|
|
2652
|
+
t(l.target.result);
|
|
2653
|
+
};
|
|
2654
|
+
};
|
|
2655
|
+
let i, s = "", n = "";
|
|
2656
|
+
if (this.config.uploader && typeof this.config.uploader.uploadByFile == "function") {
|
|
2657
|
+
const a = this.config.uploader.uploadByFile;
|
|
2658
|
+
i = H.selectFiles({ accept: (r = this.config.types) != null ? r : "image/*" }).then((d) => {
|
|
2659
|
+
e(d[0]);
|
|
2660
|
+
const l = a(d[0]);
|
|
2661
|
+
return rt(l), l;
|
|
2662
|
+
});
|
|
2663
|
+
} else {
|
|
2664
|
+
const a = await H.selectFiles({ accept: (o = this.config.types) != null ? o : "image/*" });
|
|
2665
|
+
a && a.length > 0 && e(a[0]);
|
|
2666
|
+
const d = a[0], l = (await H.post({ url: this.config.endpoints.byFile, data: Object.assign({ fileName: d.name, contentType: d.type }, this.config.additionalRequestData), type: H.contentType.JSON })).body;
|
|
2667
|
+
if (!l.success)
|
|
2668
|
+
return void this.onError(l.message);
|
|
2669
|
+
s = l.data.cdn, n = l.data.objectKey, i = ie.create({ timeout: 18e5, headers: { "Content-Type": d.type } }).put(l.data.presignedUrl, d);
|
|
2670
|
+
}
|
|
2671
|
+
i.then((a) => {
|
|
2672
|
+
a.status === 200 && (a = { success: 1, file: { url: s + n } }), this.onUpload(a);
|
|
2673
|
+
}).catch((a) => {
|
|
2674
|
+
this.onError(a);
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
uploadByUrl(t) {
|
|
2678
|
+
let e;
|
|
2679
|
+
this.config.uploader && typeof this.config.uploader.uploadByUrl == "function" ? (e = this.config.uploader.uploadByUrl(t), rt(e)) : e = H.post({ url: this.config.endpoints.byUrl, data: Object.assign({ url: t }, this.config.additionalRequestData), type: H.contentType.JSON, headers: this.config.additionalRequestHeaders }).then((i) => i.body), e.then((i) => {
|
|
2680
|
+
this.onUpload(i);
|
|
2681
|
+
}).catch((i) => {
|
|
2682
|
+
this.onError(i);
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
uploadByFile(t, { onPreview: e }) {
|
|
2686
|
+
var n;
|
|
2687
|
+
const i = new FileReader();
|
|
2688
|
+
let s;
|
|
2689
|
+
if (i.readAsDataURL(t), i.onload = (r) => {
|
|
2690
|
+
e(r.target.result);
|
|
2691
|
+
}, this.config.uploader && typeof this.config.uploader.uploadByFile == "function")
|
|
2692
|
+
s = this.config.uploader.uploadByFile(t), rt(s);
|
|
2693
|
+
else {
|
|
2694
|
+
const r = new FormData();
|
|
2695
|
+
r.append((n = this.config.field) != null ? n : "image", t), this.config.additionalRequestData && Object.keys(this.config.additionalRequestData).length && Object.entries(this.config.additionalRequestData).forEach(([o, a]) => {
|
|
2696
|
+
r.append(o, a);
|
|
2697
|
+
}), s = H.post({ url: this.config.endpoints.byFile, data: r, type: H.contentType.JSON, headers: this.config.additionalRequestHeaders }).then((o) => o.body);
|
|
2698
|
+
}
|
|
2699
|
+
s.then((r) => {
|
|
2700
|
+
this.onUpload(r);
|
|
2701
|
+
}).catch((r) => {
|
|
2702
|
+
this.onError(r);
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
class Y {
|
|
2707
|
+
constructor({ data: t, config: e, api: i, readOnly: s, block: n }) {
|
|
2708
|
+
var r;
|
|
2709
|
+
this.isCaptionEnabled = null, this.api = i, this.block = n, this.config = { endpoints: e.endpoints, additionalRequestData: e.additionalRequestData, additionalRequestHeaders: e.additionalRequestHeaders, field: e.field, types: e.types, captionPlaceholder: this.api.i18n.t((r = e.captionPlaceholder) != null ? r : "Caption"), buttonContent: e.buttonContent, uploader: e.uploader, actions: e.actions, features: e.features || {} }, this.uploader = new Le({ config: this.config, onUpload: (o) => this.onUpload(o), onError: (o) => this.uploadingFailed(o) }), this.ui = new Se({ api: i, config: this.config, onSelectFile: () => {
|
|
2710
|
+
this.uploader.uploadSelectedFile({ onPreview: (o) => {
|
|
2711
|
+
this.ui.showPreloader(o);
|
|
2712
|
+
} });
|
|
2713
|
+
}, readOnly: s }), this._data = { caption: "", withBorder: !1, withBackground: !1, stretched: !1, file: { url: "" } }, this.data = t;
|
|
2714
|
+
}
|
|
2715
|
+
static get isReadOnlySupported() {
|
|
2716
|
+
return !0;
|
|
2717
|
+
}
|
|
2718
|
+
static get toolbox() {
|
|
2719
|
+
return { icon: '<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>', title: "Image" };
|
|
2720
|
+
}
|
|
2721
|
+
static get tunes() {
|
|
2722
|
+
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 }];
|
|
2723
|
+
}
|
|
2724
|
+
render() {
|
|
2725
|
+
var t, e, i;
|
|
2726
|
+
return (((t = this.config.features) == null ? void 0 : t.caption) === !0 || ((e = this.config.features) == null ? void 0 : e.caption) === void 0 || ((i = this.config.features) == null ? void 0 : i.caption) === "optional" && this.data.caption) && (this.isCaptionEnabled = !0, this.ui.applyTune("caption", !0)), this.ui.render();
|
|
2727
|
+
}
|
|
2728
|
+
validate(t) {
|
|
2729
|
+
return !!t.file.url;
|
|
2730
|
+
}
|
|
2731
|
+
save() {
|
|
2732
|
+
const t = this.ui.nodes.caption;
|
|
2733
|
+
return this._data.caption = t.innerHTML, this.data;
|
|
2734
|
+
}
|
|
2735
|
+
renderSettings() {
|
|
2736
|
+
var n;
|
|
2737
|
+
const t = Y.tunes.concat(this.config.actions || []), e = { border: "withBorder", background: "withBackground", stretch: "stretched", caption: "caption" };
|
|
2738
|
+
((n = this.config.features) == null ? void 0 : n.caption) === "optional" && t.push({ name: "caption", icon: Ot, title: "With caption", toggle: !0 });
|
|
2739
|
+
const i = t.filter((r) => {
|
|
2740
|
+
var a, d;
|
|
2741
|
+
const o = Object.keys(e).find((l) => e[l] === r.name);
|
|
2742
|
+
return o === "caption" ? ((a = this.config.features) == null ? void 0 : a.caption) !== !1 : o == null || ((d = this.config.features) == null ? void 0 : d[o]) !== !1;
|
|
2743
|
+
}), s = (r) => {
|
|
2744
|
+
var a;
|
|
2745
|
+
let o = this.data[r.name];
|
|
2746
|
+
return r.name === "caption" && (o = (a = this.isCaptionEnabled) != null ? a : o), o;
|
|
2747
|
+
};
|
|
2748
|
+
return i.map((r) => ({ icon: r.icon, label: this.api.i18n.t(r.title), name: r.name, toggle: r.toggle, isActive: s(r), onActivate: () => {
|
|
2749
|
+
if (typeof r.action == "function")
|
|
2750
|
+
return void r.action(r.name);
|
|
2751
|
+
let o = !s(r);
|
|
2752
|
+
r.name === "caption" && (this.isCaptionEnabled = !this.isCaptionEnabled, o = this.isCaptionEnabled), this.tuneToggled(r.name, o);
|
|
2753
|
+
} }));
|
|
2754
|
+
}
|
|
2755
|
+
appendCallback() {
|
|
2756
|
+
this.ui.nodes.fileButton.click();
|
|
2757
|
+
}
|
|
2758
|
+
static get pasteConfig() {
|
|
2759
|
+
return { tags: [{ img: { src: !0 } }], patterns: { image: /https?:\/\/\S+\.(gif|jpe?g|tiff|png|svg|webp)(\?[a-z0-9=]*)?$/i }, files: { mimeTypes: ["image/*"] } };
|
|
2760
|
+
}
|
|
2761
|
+
async onPaste(t) {
|
|
2762
|
+
switch (t.type) {
|
|
2763
|
+
case "tag": {
|
|
2764
|
+
const e = t.detail.data;
|
|
2765
|
+
if (/^blob:/.test(e.src)) {
|
|
2766
|
+
const i = await fetch(e.src), s = await i.blob();
|
|
2767
|
+
this.uploadFile(s);
|
|
2768
|
+
break;
|
|
2769
|
+
}
|
|
2770
|
+
this.uploadUrl(e.src);
|
|
2771
|
+
break;
|
|
2772
|
+
}
|
|
2773
|
+
case "pattern": {
|
|
2774
|
+
const e = t.detail.data;
|
|
2775
|
+
this.uploadUrl(e);
|
|
2776
|
+
break;
|
|
2777
|
+
}
|
|
2778
|
+
case "file": {
|
|
2779
|
+
const e = t.detail.file;
|
|
2780
|
+
this.uploadFile(e);
|
|
2781
|
+
break;
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
set data(t) {
|
|
2786
|
+
var e;
|
|
2787
|
+
this.image = t.file, this._data.caption = t.caption || "", this.ui.fillCaption(this._data.caption), Y.tunes.forEach(({ name: i }) => {
|
|
2788
|
+
const s = t[i] !== void 0 && (t[i] === !0 || t[i] === "true");
|
|
2789
|
+
this.setTune(i, s);
|
|
2790
|
+
}), (t.caption || ((e = this.config.features) == null ? void 0 : e.caption) === !0) && this.setTune("caption", !0);
|
|
2791
|
+
}
|
|
2792
|
+
get data() {
|
|
2793
|
+
return this._data;
|
|
2794
|
+
}
|
|
2795
|
+
set image(t) {
|
|
2796
|
+
this._data.file = t || { url: "" }, t && t.url && this.ui.fillImage(t.url);
|
|
2797
|
+
}
|
|
2798
|
+
onUpload(t) {
|
|
2799
|
+
t.success && t.file ? this.image = t.file : this.uploadingFailed("incorrect response: " + JSON.stringify(t));
|
|
2800
|
+
}
|
|
2801
|
+
uploadingFailed(t) {
|
|
2802
|
+
this.api.notifier.show({ message: this.api.i18n.t("Couldn’t upload image. Please try another."), style: "error" }), this.ui.hidePreloader();
|
|
2803
|
+
}
|
|
2804
|
+
tuneToggled(t, e) {
|
|
2805
|
+
t === "caption" ? (this.ui.applyTune(t, e), e == 0 && (this._data.caption = "", this.ui.fillCaption(""))) : this.setTune(t, e);
|
|
2806
|
+
}
|
|
2807
|
+
setTune(t, e) {
|
|
2808
|
+
this._data[t] = e, this.ui.applyTune(t, e), t === "stretched" && Promise.resolve().then(() => {
|
|
2809
|
+
this.block.stretched = e;
|
|
2810
|
+
}).catch((i) => {
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
uploadFile(t) {
|
|
2814
|
+
this.uploader.uploadByFile(t, { onPreview: (e) => {
|
|
2815
|
+
this.ui.showPreloader(e);
|
|
2816
|
+
} });
|
|
2817
|
+
}
|
|
2818
|
+
uploadUrl(t) {
|
|
2819
|
+
this.ui.showPreloader(t), this.uploader.uploadByUrl(t);
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
const xe = { class: "ebl-editor", id: "holder" }, Te = { class: "ce-block__content ebl-editor-title-wrap" }, Ee = { class: "ce-block__content ebl-editor-time-wrap" }, Me = { class: "ebl-editor-time" }, _e = Pt({ name: "EblEditor", inheritAttrs: !1, __name: "Editor", props: { readOnly: { type: Boolean, default: !1 }, placeholder: { default: "Enter something" }, title: { default: "" }, lastUpdateTime: { default: "" }, data: { default: () => ({ blocks: [] }) }, locale: { default: {} } }, emits: ["onReady", "onChange"], setup(h, { emit: t }) {
|
|
2823
|
+
const e = $t("EblEditorSettings");
|
|
2531
2824
|
let i = t;
|
|
2532
|
-
const s =
|
|
2825
|
+
const s = h, n = Wt(s.title);
|
|
2533
2826
|
let r = null;
|
|
2534
2827
|
function o() {
|
|
2535
2828
|
r !== null && r.save().then((a) => {
|
|
2536
2829
|
}).catch((a) => {
|
|
2537
2830
|
});
|
|
2538
2831
|
}
|
|
2539
|
-
return
|
|
2540
|
-
const a =
|
|
2541
|
-
r = new
|
|
2542
|
-
i("onChange",
|
|
2832
|
+
return Ft(() => {
|
|
2833
|
+
const a = Ut(s.data);
|
|
2834
|
+
r = new Gt({ holder: "holder", autofocus: !0, defaultBlock: "paragraph", placeholder: s.placeholder, tunes: ["indent", "blockAlignment"], tools: { inlineCode: $, underline: we, Color: { class: ve }, marker: { class: P }, indent: { class: fe }, alert: { class: M, inlineToolbar: !0 }, List: { class: K, inlineToolbar: !0, config: { defaultStyle: "unordered" } }, h1: { class: re, inlineToolbar: !0 }, h2: { class: oe, inlineToolbar: !0 }, h3: { class: ae, inlineToolbar: !0 }, h4: { class: le, inlineToolbar: !0 }, h5: { class: de, inlineToolbar: !0 }, h6: { class: he, inlineToolbar: !0 }, paragraph: { class: lt, inlineToolbar: !0 }, blockAlignment: { class: at, inlineToolbar: !0 }, code: { class: U, config: { lang: "javascript", theme: "catppuccin-latte" } }, quote: { class: ce, inlineToolbar: !0 }, delimiter: ue, table: { class: ye, inlineToolbar: !0, config: { rows: 2, cols: 3 } }, image: { class: Y, inlineToolbar: !0, config: { endpoints: { byFile: e == null ? void 0 : e.fileUploadEndpoint, byUrl: e == null ? void 0 : e.urlUploadEndpoint }, features: { caption: !1, stretch: !1, border: !1, background: !1 } } } }, data: a, readOnly: s.readOnly, i18n: s.locale, onChange: (d, l) => {
|
|
2835
|
+
i("onChange", d, l);
|
|
2543
2836
|
}, onReady: () => {
|
|
2544
|
-
new
|
|
2837
|
+
new ne("holder", s.readOnly, r, "1px solid #999"), new me({ editor: r, config: { debounceTimer: 200, maxLength: 100 }, onUpdate: () => {
|
|
2545
2838
|
} }).initialize(a), i("onReady");
|
|
2546
2839
|
} });
|
|
2547
|
-
}),
|
|
2840
|
+
}), qt(() => {
|
|
2548
2841
|
r !== null && (r.destroy(), r = null);
|
|
2549
|
-
}), (a,
|
|
2550
|
-
} }),
|
|
2551
|
-
let
|
|
2552
|
-
for (let
|
|
2553
|
-
const t =
|
|
2554
|
-
|
|
2842
|
+
}), (a, d) => (zt(), jt("div", xe, [W("div", Te, [Vt(W("input", { type: "text", "onUpdate:modelValue": d[0] || (d[0] = (l) => n.value = l), placeholder: "请输入标题", class: "ebl-editor-title-input" }, null, 512), [[Kt, n.value]])]), W("div", Ee, [W("span", Me, "最后修改时间:" + Yt(a.lastUpdateTime), 1)]), W("button", { onClick: o }, "保存")]));
|
|
2843
|
+
} }), Ht = [_e];
|
|
2844
|
+
let Rt = [];
|
|
2845
|
+
for (let h in Ht) {
|
|
2846
|
+
const t = se(Ht[h]);
|
|
2847
|
+
Rt.push(t);
|
|
2555
2848
|
}
|
|
2556
|
-
const
|
|
2557
|
-
t[
|
|
2558
|
-
} }))(
|
|
2849
|
+
const Pe = { 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": "向左缩进" } } } }, Nt = ((h = []) => ({ version: "1.0.12", install: (t, e) => {
|
|
2850
|
+
t[ht] || (t[ht] = !0, h.forEach((i) => t.use(i)), e && t.provide("EblEditorSettings", e));
|
|
2851
|
+
} }))(Rt), $e = Nt.install, We = Nt.version;
|
|
2559
2852
|
export {
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2853
|
+
_e as EblEditor,
|
|
2854
|
+
Nt as default,
|
|
2855
|
+
$e as install,
|
|
2856
|
+
We as version,
|
|
2857
|
+
Pe as zhCn
|
|
2565
2858
|
};
|
|
2566
2859
|
//# sourceMappingURL=index.mjs.map
|