bto-md-editor 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +57 -0
- package/README.md +60 -0
- package/dist/App.vue.d.ts +50 -0
- package/dist/index.d.ts +7 -0
- package/dist/lib/Editor/components/Header/components/BackgroundColorSelect/index.vue.d.ts +8 -0
- package/dist/lib/Editor/components/Header/components/BlockquoteButton/index.vue.d.ts +5 -0
- package/dist/lib/Editor/components/Header/components/ColorSelect/index.vue.d.ts +8 -0
- package/dist/lib/Editor/components/Header/components/FontSizeSelect/index.vue.d.ts +7 -0
- package/dist/lib/Editor/components/Header/components/HeadingSelect/index.vue.d.ts +7 -0
- package/dist/lib/Editor/components/Header/components/InsertImg/index.vue.d.ts +17 -0
- package/dist/lib/Editor/components/Header/components/InsertLink/index.vue.d.ts +7 -0
- package/dist/lib/Editor/components/Header/components/InsertTable/index.vue.d.ts +5 -0
- package/dist/lib/Editor/components/Header/components/InsertVideo/index.vue.d.ts +17 -0
- package/dist/lib/Editor/components/Header/components/TableTools/index.vue.d.ts +5 -0
- package/dist/lib/Editor/components/Header/components/TaskListButton/index.vue.d.ts +5 -0
- package/dist/lib/Editor/components/Header/components/index.d.ts +11 -0
- package/dist/lib/Editor/components/Header/index.d.ts +1 -0
- package/dist/lib/Editor/components/Header/index.vue.d.ts +21 -0
- package/dist/lib/Editor/components/Outline/index.d.ts +2 -0
- package/dist/lib/Editor/components/Outline/index.vue.d.ts +30 -0
- package/dist/lib/Editor/index.vue.d.ts +33 -0
- package/dist/lib/components/SvgIcon.vue.d.ts +11 -0
- package/dist/lib/components/Tooltip.d.ts +1 -0
- package/dist/lib/components/Tooltip.vue.d.ts +61 -0
- package/dist/lib/extensions/dragHandle.d.ts +2 -0
- package/dist/lib/extensions/resizableImage.d.ts +2 -0
- package/dist/lib/extensions/tableCellBackground.d.ts +2 -0
- package/dist/lib/extensions/taskItemCustom.d.ts +2 -0
- package/dist/lib/extensions/video.d.ts +1 -0
- package/dist/lib/extensions/youtubeFixed.d.ts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/md-editor.es.js +3385 -0
- package/dist/md-editor.umd.js +8 -0
- package/dist/style.css +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,3385 @@
|
|
|
1
|
+
import "./style.css";
|
|
2
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.tooltip-wrapper[data-v-8b180ffc]{position:relative;display:inline-block}.tooltip[data-v-8b180ffc]{position:absolute;left:50%;transform:translate(-50%);background:#3c3c3cf2;color:#fff;border-radius:8px;padding:6px 8px;font-size:12px;line-height:1.2;box-shadow:0 6px 20px #0003;white-space:nowrap;opacity:0;visibility:hidden;transition:opacity .12s ease,visibility .12s ease;pointer-events:none;z-index:1000}.tooltip.visible[data-v-8b180ffc]{opacity:1;visibility:visible}.tooltip.bottom[data-v-8b180ffc]{top:calc(100% + 6px)}.tooltip.top[data-v-8b180ffc]{bottom:calc(100% + 6px)}.shortcut[data-v-8b180ffc]{display:inline-block;margin-top:4px;opacity:.9;z-index:1000}.icon[data-v-6882ea42]{cursor:pointer;width:27px;height:27px;border-radius:4px;display:flex;align-items:center;font-size:12px;transition:all .2s ease-in-out;position:relative;padding:0 6px;min-width:50px;justify-content:space-between;background:#fff}.icon[data-v-6882ea42]:hover{background:#0000000d}.font-size[data-v-6882ea42]{position:relative;margin:0 4px;-webkit-user-select:none;user-select:none}.label[data-v-6882ea42]{font-size:15px;color:#333}.dropdown[data-v-6882ea42]{position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);min-width:160px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;box-shadow:0 6px 24px #00000014;z-index:10;-webkit-user-select:none;user-select:none;will-change:opacity,transform}.dropdown-slide-enter-from[data-v-6882ea42],.dropdown-slide-leave-to[data-v-6882ea42]{opacity:0;transform:translate(-50%) translateY(-6px) scale(.98)}.dropdown-slide-enter-active[data-v-6882ea42],.dropdown-slide-leave-active[data-v-6882ea42]{transition:opacity .18s ease,transform .18s ease}.dropdown-item[data-v-6882ea42]{display:flex;align-items:center;gap:8px;padding:6px 12px;cursor:pointer;font-size:14px}.dropdown-item[data-v-6882ea42]:hover{background:#0000000d}.text[data-v-6882ea42]{flex:1}.icon[data-v-570f2a96]{cursor:default;width:27px;height:27px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:16px;transition:all .2s ease-in-out;position:relative}.icon-dropdown[data-v-570f2a96]{width:auto;justify-content:space-between;background:#fff}.icon-stack[data-v-570f2a96]{display:flex;flex-direction:column;align-items:center;line-height:1;border-radius:6px;padding:2px;cursor:pointer}.arrow[data-v-570f2a96]{display:flex;align-items:center;justify-content:center;width:16px;height:27px;border-radius:4px;cursor:pointer}.hoverable[data-v-570f2a96]:hover{background:#0000000d}.underline[data-v-570f2a96]{width:16px;height:2px;border-radius:2px;margin-top:2px;background:#000}.color-select[data-v-570f2a96]{position:relative;margin:0 4px;-webkit-user-select:none;user-select:none}.dropdown[data-v-570f2a96]{position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);min-width:280px;max-width:320px;background:#fff;border-radius:8px;box-shadow:0 6px 24px #00000014;padding:8px;z-index:20;will-change:opacity,transform}.dropdown-slide-enter-from[data-v-570f2a96],.dropdown-slide-leave-to[data-v-570f2a96]{opacity:0;transform:translate(-50%) translateY(-6px) scale(.98)}.dropdown-slide-enter-active[data-v-570f2a96],.dropdown-slide-leave-active[data-v-570f2a96]{transition:opacity .18s ease,transform .18s ease}.section[data-v-570f2a96]{margin-bottom:8px}.section-title[data-v-570f2a96]{font-size:12px;color:#666;margin-bottom:6px}.swatches[data-v-570f2a96]{display:flex;flex-wrap:wrap;gap:6px}.swatches.grid[data-v-570f2a96]{grid-template-columns:repeat(10,1fr)}.swatch[data-v-570f2a96]{width:18px;height:18px;border-radius:4px;cursor:pointer;position:relative;border:1px solid rgba(0,0,0,.08);display:flex;align-items:center;font-size:12px;justify-content:center}.swatch .check[data-v-570f2a96]{position:absolute;top:0;right:2px;font-size:12px;color:#000;text-shadow:0 1px 2px rgba(255,255,255,.8)}.inline-actions[data-v-570f2a96]{display:flex;justify-content:space-between;gap:8px}.btn[data-v-570f2a96]{padding:4px 8px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;cursor:pointer;font-size:12px}.advanced[data-v-570f2a96]{display:grid;grid-template-columns:auto 1fr auto;gap:4px;align-items:center;margin-top:8px}.hex[data-v-570f2a96]{border:1px solid #e5e7eb;border-radius:8px;padding:4px 6px;font-size:12px}.apply[data-v-570f2a96]{justify-self:end;flex-shrink:1}.svg-icon[data-v-c83ef2e3]{display:inline-block;line-height:0;vertical-align:middle}.svg-icon svg[data-v-c83ef2e3]{width:1em;height:1em;display:block}.icon[data-v-5ec8a99f]{cursor:default;width:19px;height:19px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:16px;transition:all .2s ease-in-out;position:relative}.icon-dropdown[data-v-5ec8a99f]{width:auto;padding:0 2px;min-width:20px;justify-content:space-between;background:#fff}.icon-stack[data-v-5ec8a99f]{display:flex;flex-direction:column;align-items:center;line-height:1;border-radius:6px;padding:2px;cursor:pointer}.arrow[data-v-5ec8a99f]{display:flex;align-items:center;justify-content:center;width:16px;height:27px;border-radius:4px;cursor:pointer}.hoverable[data-v-5ec8a99f]:hover{background:#0000000d}.underline[data-v-5ec8a99f]{width:16px;height:2px;border-radius:2px;margin-top:2px;background:#fff}.bg-color-select[data-v-5ec8a99f]{position:relative;-webkit-user-select:none;user-select:none}.dropdown[data-v-5ec8a99f]{position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);min-width:280px;max-width:320px;background:#fff;border-radius:8px;box-shadow:0 6px 24px #00000014;padding:8px;z-index:20;will-change:opacity,transform}.section[data-v-5ec8a99f]{margin-bottom:8px}.section-title[data-v-5ec8a99f]{font-size:12px;color:#666;margin-bottom:6px}.swatches[data-v-5ec8a99f]{display:flex;flex-wrap:wrap;gap:6px}.swatches.grid[data-v-5ec8a99f]{grid-template-columns:repeat(10,1fr)}.swatch[data-v-5ec8a99f]{width:18px;height:18px;border-radius:4px;cursor:pointer;position:relative;border:1px solid rgba(0,0,0,.08);display:flex;align-items:center;font-size:12px;justify-content:center}.swatch .check[data-v-5ec8a99f]{position:absolute;top:0;right:2px;font-size:12px;color:#000;text-shadow:0 1px 2px rgba(255,255,255,.8)}.inline-actions[data-v-5ec8a99f]{display:flex;justify-content:space-between;gap:8px}.btn[data-v-5ec8a99f]{padding:4px 8px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;cursor:pointer;font-size:12px}.advanced[data-v-5ec8a99f]{display:grid;grid-template-columns:auto 1fr auto;gap:4px;align-items:center;margin-top:8px}.hex[data-v-5ec8a99f]{border:1px solid #e5e7eb;border-radius:8px;padding:4px 6px;font-size:12px}.apply[data-v-5ec8a99f]{justify-self:end;flex-shrink:1}.dropdown-slide-enter-from[data-v-5ec8a99f],.dropdown-slide-leave-to[data-v-5ec8a99f]{opacity:0;transform:translate(-50%) translateY(-6px) scale(.98)}.dropdown-slide-enter-active[data-v-5ec8a99f],.dropdown-slide-leave-active[data-v-5ec8a99f]{transition:opacity .18s ease,transform .18s ease}.image-icon[data-v-3208357f]{position:relative}.image-input-panel[data-v-3208357f]{position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);min-width:320px;padding:10px;border:1px solid rgba(0,0,0,.1);background:#fff;border-radius:8px;box-shadow:0 6px 24px #0000001f;z-index:20;will-change:opacity,transform}.image-input[data-v-3208357f]{width:100%;padding:8px 10px;box-sizing:border-box;max-width:100%;border:1px solid #e5e7eb;border-radius:8px;outline:none;font-size:14px}.image-actions[data-v-3208357f]{margin-top:8px;display:flex;gap:8px;justify-content:flex-end}.btn[data-v-3208357f]{padding:6px 10px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;cursor:pointer;font-size:13px}.btn[data-v-3208357f]:hover{background:#0000000d}.btn-primary[data-v-3208357f]{border:none;background:#1677ff;color:#fff}.btn-primary[data-v-3208357f]:hover{background:#1677ff;opacity:.92}.img-panel-enter-active[data-v-3208357f],.img-panel-leave-active[data-v-3208357f]{transition:opacity .18s ease,transform .18s ease}.img-panel-enter-from[data-v-3208357f],.img-panel-leave-to[data-v-3208357f]{opacity:0;transform:translate(-50%) translateY(-6px) scale(.98)}.img-panel-enter-to[data-v-3208357f],.img-panel-leave-from[data-v-3208357f]{opacity:1;transform:translate(-50%) translateY(0) scale(1)}.video-icon[data-v-eef6665b]{position:relative}.video-input-panel[data-v-eef6665b]{position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);min-width:320px;padding:10px;border:1px solid rgba(0,0,0,.1);background:#fff;border-radius:8px;box-shadow:0 6px 24px #0000001f;z-index:20;will-change:opacity,transform}.video-input[data-v-eef6665b]{width:100%;padding:8px 10px;box-sizing:border-box;max-width:100%;border:1px solid #e5e7eb;border-radius:8px;outline:none;font-size:14px}.video-actions[data-v-eef6665b]{margin-top:8px;display:flex;gap:8px;justify-content:flex-end}.btn[data-v-eef6665b]{padding:6px 10px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;cursor:pointer;font-size:13px}.btn[data-v-eef6665b]:hover{background:#0000000d}.btn-primary[data-v-eef6665b]{border:none;background:#1677ff;color:#fff}.btn-primary[data-v-eef6665b]:hover{background:#1677ff;opacity:.92}.video-panel-enter-active[data-v-eef6665b],.video-panel-leave-active[data-v-eef6665b]{transition:opacity .18s ease,transform .18s ease}.video-panel-enter-from[data-v-eef6665b],.video-panel-leave-to[data-v-eef6665b]{opacity:0;transform:translate(-50%) translateY(-6px) scale(.98)}.video-panel-enter-to[data-v-eef6665b],.video-panel-leave-from[data-v-eef6665b]{opacity:1;transform:translate(-50%) translateY(0) scale(1)}.link-icon[data-v-b5bf35e2]{position:relative}.link-input-panel[data-v-b5bf35e2]{position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);min-width:320px;padding:10px;border:1px solid rgba(0,0,0,.1);background:#fff;border-radius:8px;box-shadow:0 6px 24px #0000001f;z-index:20;will-change:opacity,transform}.field[data-v-b5bf35e2]{margin-bottom:8px}.label[data-v-b5bf35e2]{font-size:12px;color:#666;margin-bottom:6px}.input[data-v-b5bf35e2]{width:100%;padding:8px 10px;box-sizing:border-box;max-width:100%;border:1px solid #e5e7eb;border-radius:8px;outline:none;font-size:14px}.actions[data-v-b5bf35e2]{display:flex;justify-content:flex-end;gap:8px}.btn[data-v-b5bf35e2]{padding:6px 10px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;cursor:pointer;font-size:13px}.btn-primary[data-v-b5bf35e2]{border:none;background:#1677ff;color:#fff}.btn-primary[data-v-b5bf35e2]:hover{background:#1677ff;opacity:.92}.link-panel-enter-active[data-v-b5bf35e2],.link-panel-leave-active[data-v-b5bf35e2]{transition:opacity .18s ease,transform .18s ease}.link-panel-enter-from[data-v-b5bf35e2],.link-panel-leave-to[data-v-b5bf35e2]{opacity:0;transform:translate(-50%) translateY(-6px) scale(.98)}.link-panel-enter-to[data-v-b5bf35e2],.link-panel-leave-from[data-v-b5bf35e2]{opacity:1;transform:translate(-50%) translateY(0) scale(1)}.table-icon[data-v-ad6f66b7]{position:relative}.table-panel[data-v-ad6f66b7]{position:absolute;top:32px;right:0;min-width:220px;padding:10px;border:1px solid rgba(0,0,0,.1);background:#fff;border-radius:8px;box-shadow:0 6px 24px #0000001f;z-index:20}.panel-title[data-v-ad6f66b7]{font-size:12px;color:#666;margin-bottom:6px}.grid[data-v-ad6f66b7]{display:flex;flex-direction:column;gap:4px;padding:8px;background:#f7f8fa;border-radius:8px}.row[data-v-ad6f66b7]{display:flex;gap:4px}.cell[data-v-ad6f66b7]{width:18px;height:18px;background:#fff;border:1px solid #e5e7eb;border-radius:3px;cursor:pointer}.cell.active[data-v-ad6f66b7]{background:#e8f1ff;border-color:#1677ff}.size[data-v-ad6f66b7]{margin-top:6px;font-size:12px;color:#333}.table-tools[data-v-89ddb4db]{position:relative}.tools-panel[data-v-89ddb4db]{position:absolute;top:32px;right:0;min-width:280px;padding:10px;border:1px solid rgba(0,0,0,.1);background:#fff;border-radius:8px;box-shadow:0 6px 24px #0000001f;z-index:20}.tools-grid[data-v-89ddb4db]{display:grid;grid-template-columns:1fr 1fr;gap:8px}.btn[data-v-89ddb4db]{padding:6px 10px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;cursor:pointer;font-size:13px}.icon[data-v-0b74c17c]{cursor:default;border-radius:6px;display:flex;align-items:center;justify-content:center;transition:all .2s ease-in-out;position:relative}.icon[data-v-0b74c17c]:hover{background:#0000000d}.icon[data-v-bf6f40c3]{cursor:pointer;width:27px;height:27px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:16px;transition:all .2s ease-in-out;color:#404040;position:relative}.icon[data-v-bf6f40c3]:hover{background:#0000000d}.heading-select[data-v-fceb28df]{position:relative;margin:0 4px;-webkit-user-select:none;user-select:none}.icon[data-v-fceb28df]{cursor:pointer;width:27px;height:27px;border-radius:4px;display:flex;align-items:center;font-size:12px;transition:all .2s ease-in-out;position:relative;padding:0 6px;min-width:60px;justify-content:space-between;background:#fff}.icon[data-v-fceb28df]:hover{background:#0000000d}.label[data-v-fceb28df]{font-size:15px;color:#333}.dropdown[data-v-fceb28df]{position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);min-width:220px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;box-shadow:0 6px 24px #00000014;z-index:10;-webkit-user-select:none;user-select:none;will-change:opacity,transform}.dropdown-slide-enter-from[data-v-fceb28df],.dropdown-slide-leave-to[data-v-fceb28df]{opacity:0;transform:translate(-50%) translateY(-6px) scale(.98)}.dropdown-slide-enter-active[data-v-fceb28df],.dropdown-slide-leave-active[data-v-fceb28df]{transition:opacity .18s ease,transform .18s ease}.dropdown-item[data-v-fceb28df]{display:flex;align-items:center;gap:8px;padding:10px 12px;cursor:pointer;font-size:14px}.dropdown-item[data-v-fceb28df]:hover{background:#0000000d}.item-label[data-v-fceb28df]{flex:1;color:#222}.item-label.paragraph[data-v-fceb28df]{font-size:15px}.item-label.level-1[data-v-fceb28df]{font-size:22px;font-weight:600}.item-label.level-2[data-v-fceb28df]{font-size:20px;font-weight:600}.item-label.level-3[data-v-fceb28df]{font-size:18px;font-weight:600}.item-label.level-4[data-v-fceb28df]{font-size:16px}.item-label.level-5[data-v-fceb28df]{font-size:15px}.item-label.level-6[data-v-fceb28df]{font-size:14px}.shortcut[data-v-fceb28df]{color:#999;font-size:12px}.header_box[data-v-6cce30ab]{display:flex;align-items:center;gap:3px;padding:8px;border-bottom:1px solid rgba(0,0,0,.1)}.header_box .icon[data-v-6cce30ab]{cursor:pointer;width:27px;height:27px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:16px;transition:all .2s ease-in-out;position:relative}.header_box .icon[data-v-6cce30ab]:hover{background:#0000000d}.header_box .icon.active[data-v-6cce30ab]{background:#0000001a}.header_box .icon[aria-disabled=true][data-v-6cce30ab]{cursor:not-allowed;opacity:.5}.outline-wrapper[data-v-b5f802fc]{position:relative;-webkit-user-select:none;user-select:none}.outline[data-v-b5f802fc]{border-left:1px solid #e5e7eb;padding:8px;font-size:14px;position:sticky;top:0;align-self:start;max-height:100%;background:#fff;display:flex;flex-direction:column;width:0;opacity:0;overflow:hidden;transform:scaleX(0);transform-origin:right center;transition:width .2s ease,transform .2s ease,opacity .2s ease;border-left:none}.outline.isOpen[data-v-b5f802fc]{width:240px;opacity:1;transform:scaleX(1);border-left:1px solid #e5e7eb}.outline__listWrap[data-v-b5f802fc]{overflow-y:auto;overflow-x:hidden;flex:1 1 auto;min-height:0}.outline__listWrap[data-v-b5f802fc]::-webkit-scrollbar{width:6px;height:1px}.outline__listWrap[data-v-b5f802fc]::-webkit-scrollbar-thumb{border-radius:10px;box-shadow:inset 0 0 5px #1118181a;background:#787878}.outline__listWrap[data-v-b5f802fc]::-webkit-scrollbar-track{border-radius:10px;background:transparent}.outline__header[data-v-b5f802fc]{display:flex;align-items:center;font-weight:600;margin-bottom:8px}.outline__header[data-v-b5f802fc]>*{display:inline-flex;gap:6px}.outline__list[data-v-b5f802fc]{list-style:none;padding:0;margin:0}.outline__item[data-v-b5f802fc]{cursor:pointer;padding:4px 0;color:#333}.outline__caret[data-v-b5f802fc]{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:4px;color:#666;transition:transform .12s ease}.outline__caret.collapsed[data-v-b5f802fc]{transform:rotate(0)}.outline__caret.expanded[data-v-b5f802fc]{transform:rotate(90deg)}.outline__item[data-v-b5f802fc]:hover{color:#6366f1}.outline__item.lv-1[data-v-b5f802fc]{padding-left:0}.outline__item.lv-2[data-v-b5f802fc]{padding-left:8px}.outline__item.lv-3[data-v-b5f802fc]{padding-left:16px}.outline__item.lv-4[data-v-b5f802fc]{padding-left:24px}.outline__item.lv-5[data-v-b5f802fc]{padding-left:32px}.outline__item.lv-6[data-v-b5f802fc]{padding-left:40px}.outline__text[data-v-b5f802fc]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.outline__close[data-v-b5f802fc]{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #e5e7eb;background:#fff;border-radius:50%;box-shadow:0 2px 10px #00000014;color:#666;cursor:pointer}.outline__close[data-v-b5f802fc]:hover{color:#6366f1}.outline__title[data-v-b5f802fc]{display:inline-flex;align-items:center;gap:6px}.outline__pinIcon[data-v-b5f802fc]{display:inline-flex;width:16px;height:16px;color:#666;cursor:pointer}.outline-drawer-mask[data-v-b5f802fc]{display:none}@media (max-width: 900px){.outline[data-v-b5f802fc]{position:absolute;right:0;top:0;bottom:0;width:0;max-width:85vw;box-shadow:-6px 0 24px #00000014;z-index:10}.outline.isOpen[data-v-b5f802fc]{width:min(85vw,280px)}.outline-drawer-mask[data-v-b5f802fc]{display:block;position:absolute;left:0;right:0;top:0;bottom:0;background:#00000029;z-index:10}}.outline-slide-enter-active[data-v-b5f802fc],.outline-slide-leave-active[data-v-b5f802fc]{transition:transform .18s ease,opacity .18s ease}.outline-slide-enter-from[data-v-b5f802fc],.outline-slide-leave-to[data-v-b5f802fc]{opacity:0;transform:translate(16px)}@media (max-width: 900px){.outline-slide-enter-from[data-v-b5f802fc],.outline-slide-leave-to[data-v-b5f802fc]{transform:translate(100%)}}.outline-mask-enter-active[data-v-b5f802fc],.outline-mask-leave-active[data-v-b5f802fc]{transition:opacity .18s ease}.outline-mask-enter-from[data-v-b5f802fc],.outline-mask-leave-to[data-v-b5f802fc]{opacity:0}.simple-editor[data-v-c9ed96a6]{height:var(--editor-height, auto);min-height:var(--editor-min-height, 100px);display:flex;flex-direction:column;border-radius:8px;background:#fff;box-sizing:border-box;border:1px solid #e5e7eb}.editor_wrapper[data-v-c9ed96a6]{position:relative;overflow-y:auto;color:#333;align-items:stretch;flex:1 1 auto;min-height:0}.editor_wrapper[data-v-c9ed96a6]::-webkit-scrollbar{width:6px;height:1px}.editor_wrapper[data-v-c9ed96a6]::-webkit-scrollbar-thumb{border-radius:10px;box-shadow:inset 0 0 5px #1118181a;background:#787878}.editor_wrapper[data-v-c9ed96a6]::-webkit-scrollbar-track{border-radius:10px;background:transparent}.editor_main[data-v-c9ed96a6]{display:grid;grid-template-columns:1fr auto;align-items:stretch;flex:1 1 auto;min-height:0;position:relative}.outline-toggle-row[data-v-c9ed96a6]{position:sticky;top:12px;z-index:3;display:flex;justify-content:flex-end;padding-right:12px}.outline-markers[data-v-c9ed96a6]{position:absolute;right:0;top:0;bottom:0;width:18px;z-index:4}.outline-pin[data-v-c9ed96a6]{position:absolute;right:3px;top:8px;width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #e5e7eb;background:#fff;border-radius:50%;box-shadow:0 2px 10px #00000014;color:#666;cursor:pointer}.outline-marker[data-v-c9ed96a6]{position:absolute;right:3px;width:12px;height:2px;background:#d0d5dd;border-radius:2px}.outline-marker.active[data-v-c9ed96a6]{background:#22c55e}.content[data-v-c9ed96a6]{padding:12px 24px}.content[data-v-c9ed96a6] img{max-width:100%;height:auto;display:inline-block}.content[data-v-c9ed96a6] .ProseMirror{outline:none;caret-color:var(--editor-caret-color)}.content[data-v-c9ed96a6] .drag-hover-target{background:#eef5ff;border-radius:8px}.content[data-v-c9ed96a6] ul[data-type=taskList]{list-style:none;padding-left:0;margin:12px 0}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem]{display:flex;align-items:flex-start;gap:8px;margin:6px 0}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .todo-box{width:16px;height:16px;border-radius:4px;border:1px solid #e5e7eb;background:#fff;box-shadow:inset 0 1px 2px #0000000f;margin-top:2px;flex-shrink:0;cursor:pointer;position:relative;display:inline-flex;align-items:center;justify-content:center;transition:background-color .16s ease,border-color .16s ease}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .todo-box:after{content:"✓";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(.3);opacity:0;color:#fff;font-size:12px;font-weight:700;transition:transform .18s ease,opacity .18s ease;animation:todo-check-out-c9ed96a6 .18s ease both}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem][data-checked=true] .todo-box{background:#22c55e;border-color:#22c55e}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem][data-checked=true] .todo-box:after{transform:translate(-50%,-50%) scale(1);opacity:1;animation:todo-check-in-c9ed96a6 .22s cubic-bezier(.2,.7,.3,1.2) both}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .todo-box:focus{outline:2px solid #1677ff44}@keyframes todo-check-in-c9ed96a6{0%{transform:translate(-50%,-50%) scale(.3);opacity:0}60%{transform:translate(-50%,-50%) scale(1.15);opacity:1}to{transform:translate(-50%,-50%) scale(1);opacity:1}}@keyframes todo-check-out-c9ed96a6{0%{transform:translate(-50%,-50%) scale(1);opacity:1}to{transform:translate(-50%,-50%) scale(.3);opacity:0}}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem]>label,.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .task-item__label{display:inline-flex;align-items:center;margin-right:6px}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] input[type=checkbox]{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto;position:static;opacity:1;pointer-events:auto;width:16px;height:16px;border-radius:4px;border:1px solid #e5e7eb;margin-top:2px}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem][data-checked=true] input[type=checkbox]{accent-color:#22c55e}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .task-content,.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .task-item__content{flex:1;min-width:1px}.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .task-content p,.content[data-v-c9ed96a6] ul[data-type=taskList] li[data-type=taskItem] .task-item__content p{margin:0}.content[data-v-c9ed96a6] img.ProseMirror-selectednode{outline:2px solid #6366f1;border-radius:4px}.content[data-v-c9ed96a6] [data-resize-wrapper]{display:inline-block}.content[data-v-c9ed96a6] .tiptap-resize-handle{width:10px;height:10px;background:#1677ffd9;border-radius:2px;box-shadow:0 0 0 1px #fff;cursor:nwse-resize;z-index:4;opacity:0;pointer-events:none;transition:opacity .12s ease}.content[data-v-c9ed96a6] .tiptap-resize-handle[data-resize-handle=top-left],.content[data-v-c9ed96a6] .tiptap-resize-handle[data-resize-handle=bottom-right]{cursor:nwse-resize}.content[data-v-c9ed96a6] .tiptap-resize-handle[data-resize-handle=top-right],.content[data-v-c9ed96a6] .tiptap-resize-handle[data-resize-handle=bottom-left]{cursor:nesw-resize}.content[data-v-c9ed96a6] .tiptap-resize-wrapper:hover .tiptap-resize-handle,.content[data-v-c9ed96a6] .tiptap-resize-container[data-resize-state=true] .tiptap-resize-handle{opacity:1;pointer-events:auto}.content[data-v-c9ed96a6] .tiptap-resize-wrapper:hover>img,.content[data-v-c9ed96a6] .tiptap-resize-wrapper:hover>video{outline:2px solid #6366f1;border-radius:4px}.content[data-v-c9ed96a6] .tiptap-resize-wrapper{position:relative}.content[data-v-c9ed96a6] .tiptap-resize-wrapper[data-uploading=true] .tiptap-upload-mask{pointer-events:auto}.content[data-v-c9ed96a6] .tiptap-upload-mask{position:absolute;top:0;right:0;bottom:0;left:0;background:transparent;display:flex;align-items:center;justify-content:center;color:#1677ff;font-size:12px;border-radius:4px;opacity:0;pointer-events:none;transition:opacity .2s ease;z-index:2}.content[data-v-c9ed96a6] .tiptap-resize-wrapper[data-uploading=true] .tiptap-upload-mask{opacity:1}.content[data-v-c9ed96a6] .tiptap-upload-progress{width:66%;max-width:360px;height:6px;background:#0003;border-radius:4px;overflow:hidden;position:relative}.content[data-v-c9ed96a6] .tiptap-upload-progress:before{content:"";position:absolute;left:-40%;width:40%;height:100%;background:#1677ff;border-radius:4px;animation:tiptap-upload-indeterminate-c9ed96a6 1.1s ease-in-out infinite}@keyframes tiptap-upload-indeterminate-c9ed96a6{0%{left:-40%}50%{left:60%}to{left:100%}}.content[data-v-c9ed96a6] .tiptap-resize-container.is-resizing .tiptap-resize-handle{background:#1677ff}.content[data-v-c9ed96a6] .ProseMirror table{border-collapse:collapse;margin:12px 0;width:100%}.content[data-v-c9ed96a6] .ProseMirror table th,.content[data-v-c9ed96a6] .ProseMirror table td{border:1px solid #e5e7eb;padding:8px;text-align:left;position:relative}.content[data-v-c9ed96a6] .ProseMirror table thead th{background:#f7f9fc;font-weight:600}.content[data-v-c9ed96a6] .ProseMirror table .selectedCell{background:#1677ff0f;outline:2px solid #1677ff;outline-offset:-2px}.content[data-v-c9ed96a6] .ProseMirror table .column-resize-handle{position:absolute;right:-3px;top:0;bottom:0;width:8px;background:transparent;cursor:col-resize;z-index:3;-webkit-user-select:none;user-select:none;pointer-events:auto}.content[data-v-c9ed96a6] .ProseMirror table .column-resize-handle:hover{background:#1677ff40}.content[data-v-c9ed96a6] .ProseMirror p.is-editor-empty:first-child:before{content:attr(data-placeholder);color:#999;pointer-events:none;float:left;height:0;white-space:pre-line}.content[data-v-c9ed96a6] code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;background:#f2f4f7;padding:2px 4px;border-radius:4px}.content[data-v-c9ed96a6] blockquote{border-left:3px solid #e5e7eb;margin:12px 0;padding:4px 12px;color:#6b7280}.content[data-v-c9ed96a6] pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;background:#f6f8fa;padding:12px;border-radius:6px;border:1px solid #e5e7eb;overflow:auto}.content[data-v-c9ed96a6] p{margin:12px 0}[data-v-c9ed96a6] .md-drag-handle{width:22px;height:22px;border-radius:4px;display:inline-flex;align-items:center;justify-content:center;box-shadow:0 2px 10px #00000014;background:#fff;border:1px solid #e5e7eb;cursor:grab;z-index:5}[data-v-c9ed96a6] .md-drag-handle:before{content:"···";letter-spacing:2px;color:#888;font-weight:700}@media (max-width: 900px){.editor_main[data-v-c9ed96a6]{grid-template-columns:1fr}.outline-markers[data-v-c9ed96a6]{display:none}}.link-modal-backdrop[data-v-c9ed96a6]{position:fixed;top:0;right:0;bottom:0;left:0;background:#0003}.link-modal[data-v-c9ed96a6]{position:fixed;left:50%;top:20%;transform:translate(-50%);z-index:1000}.link-modal__content[data-v-c9ed96a6]{background:#fff;border:1px solid #e5e7eb;border-radius:8px;min-width:360px;padding:12px;box-shadow:0 6px 24px #00000014}.link-modal__title[data-v-c9ed96a6]{font-weight:600;margin-bottom:8px}.link-modal__input[data-v-c9ed96a6]{width:100%;padding:8px;border:1px solid #e5e7eb;border-radius:8px;margin-bottom:10px}.link-modal__actions[data-v-c9ed96a6]{display:flex;gap:8px;justify-content:flex-end}.link-modal__actions button[data-v-c9ed96a6]{padding:6px 10px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;cursor:pointer}.tiptap-video[data-v-c9ed96a6]{display:block;width:640px;height:auto}')),document.head.appendChild(e)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
3
|
+
import { inject as Je, createVNode as l, defineComponent as K, ref as H, onMounted as ue, watch as be, nextTick as me, createElementBlock as F, openBlock as S, renderSlot as Xe, createElementVNode as h, normalizeClass as N, createCommentVNode as O, toDisplayString as re, computed as de, onBeforeUnmount as ve, withModifiers as j, unref as z, Transition as Ce, withCtx as P, Fragment as ie, renderList as se, createBlock as ye, normalizeStyle as oe, withDirectives as ge, vModelText as we, useAttrs as Qe } from "vue";
|
|
4
|
+
import { Editor as et, EditorContent as tt } from "@tiptap/vue-3";
|
|
5
|
+
import { StarterKit as ot } from "@tiptap/starter-kit";
|
|
6
|
+
import { Markdown as nt } from "@tiptap/markdown";
|
|
7
|
+
import { Image as it } from "@tiptap/extension-image";
|
|
8
|
+
import * as Ae from "@tiptap/core";
|
|
9
|
+
import { ResizableNodeView as Ye } from "@tiptap/core";
|
|
10
|
+
import { Placeholder as st } from "@tiptap/extension-placeholder";
|
|
11
|
+
import { Link as lt } from "@tiptap/extension-link";
|
|
12
|
+
import { TextAlign as rt } from "@tiptap/extension-text-align";
|
|
13
|
+
import { TextStyle as Be } from "@tiptap/extension-text-style";
|
|
14
|
+
import { Color as at } from "@tiptap/extension-color";
|
|
15
|
+
import { Underline as ct } from "@tiptap/extension-underline";
|
|
16
|
+
import { TableCell as dt, TableKit as ut } from "@tiptap/extension-table";
|
|
17
|
+
import { Dropcursor as ht } from "@tiptap/extensions";
|
|
18
|
+
import { TaskItem as vt, TaskList as ft } from "@tiptap/extension-list";
|
|
19
|
+
const kt = it.extend({
|
|
20
|
+
addAttributes() {
|
|
21
|
+
var e;
|
|
22
|
+
return {
|
|
23
|
+
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
24
|
+
uploading: {
|
|
25
|
+
default: null,
|
|
26
|
+
parseHTML: (r) => r.getAttribute("data-uploading") ? !0 : null,
|
|
27
|
+
renderHTML: (r) => r.uploading ? { "data-uploading": "true" } : {}
|
|
28
|
+
},
|
|
29
|
+
width: {
|
|
30
|
+
default: null,
|
|
31
|
+
parseHTML: (r) => {
|
|
32
|
+
const o = r.getAttribute("width") || r.style.width || "", t = String(o).match(/^(\d+)(px)?$/);
|
|
33
|
+
return t ? Number(t[1]) : null;
|
|
34
|
+
},
|
|
35
|
+
renderHTML: (r) => r.width ? { width: r.width } : {}
|
|
36
|
+
},
|
|
37
|
+
height: {
|
|
38
|
+
default: null,
|
|
39
|
+
parseHTML: (r) => {
|
|
40
|
+
const o = r.getAttribute("height") || r.style.height || "", t = String(o).match(/^(\d+)(px)?$/);
|
|
41
|
+
return t ? Number(t[1]) : null;
|
|
42
|
+
},
|
|
43
|
+
renderHTML: (r) => r.height ? { height: r.height } : {}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
addNodeView() {
|
|
48
|
+
return ({ node: e, getPos: r, editor: o }) => {
|
|
49
|
+
const t = document.createElement("img"), s = e.attrs;
|
|
50
|
+
t.src = s.src || "", s.alt && (t.alt = s.alt), s.title && (t.title = s.title), typeof s.width == "number" && (t.style.width = `${s.width}px`), typeof s.height == "number" && (t.style.height = `${s.height}px`), t.style.maxWidth = "100%", t.style.height = t.style.height || "auto", t.style.display = "inline-block";
|
|
51
|
+
const f = new Ye({
|
|
52
|
+
element: t,
|
|
53
|
+
node: e,
|
|
54
|
+
getPos: r,
|
|
55
|
+
onResize: (L, b) => {
|
|
56
|
+
t.style.width = `${L}px`, t.style.height = `${b}px`;
|
|
57
|
+
},
|
|
58
|
+
onCommit: (L, b) => {
|
|
59
|
+
try {
|
|
60
|
+
const k = o, w = r();
|
|
61
|
+
if (w !== void 0) {
|
|
62
|
+
const { state: y } = k, g = y.schema.nodes.image, a = y.doc.nodeAt(w);
|
|
63
|
+
if (g && a) {
|
|
64
|
+
const u = { ...a.attrs || {}, width: L, height: b }, c = y.tr.setNodeMarkup(w, g, u, a.marks);
|
|
65
|
+
k.view.dispatch(c);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
onUpdate: (L) => {
|
|
72
|
+
const b = L.attrs;
|
|
73
|
+
return typeof b.src == "string" && b.src && t.src !== b.src && (t.src = b.src), typeof b.width == "number" && (t.style.width = `${b.width}px`), typeof b.height == "number" && (t.style.height = `${b.height}px`), b.uploading ? f.wrapper.setAttribute("data-uploading", "true") : f.wrapper.removeAttribute("data-uploading"), !0;
|
|
74
|
+
},
|
|
75
|
+
options: {
|
|
76
|
+
directions: ["bottom-right", "bottom-left", "top-right", "top-left"],
|
|
77
|
+
min: { width: 32, height: 32 },
|
|
78
|
+
preserveAspectRatio: !0,
|
|
79
|
+
className: {
|
|
80
|
+
container: "tiptap-resize-container",
|
|
81
|
+
wrapper: "tiptap-resize-wrapper",
|
|
82
|
+
handle: "tiptap-resize-handle",
|
|
83
|
+
resizing: "is-resizing"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
try {
|
|
88
|
+
f.container.style.display = "inline-block", f.wrapper.style.display = "inline-block";
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
const _ = document.createElement("div");
|
|
92
|
+
_.className = "tiptap-upload-mask";
|
|
93
|
+
const d = document.createElement("div");
|
|
94
|
+
return d.className = "tiptap-upload-progress", _.appendChild(d), f.wrapper.appendChild(_), s.uploading && f.wrapper.setAttribute("data-uploading", "true"), f;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}), pt = dt.extend({
|
|
98
|
+
addAttributes() {
|
|
99
|
+
var e;
|
|
100
|
+
return {
|
|
101
|
+
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
102
|
+
backgroundColor: {
|
|
103
|
+
default: null,
|
|
104
|
+
parseHTML: (r) => r.getAttribute("data-background-color"),
|
|
105
|
+
renderHTML: (r) => {
|
|
106
|
+
const o = r.backgroundColor;
|
|
107
|
+
return o ? {
|
|
108
|
+
"data-background-color": o,
|
|
109
|
+
style: `background-color: ${o}`
|
|
110
|
+
} : {};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var Ge;
|
|
117
|
+
const mt = ((Ge = Ae == null ? void 0 : Ae.Node) == null ? void 0 : Ge.create) ?? ((e) => e), gt = mt({
|
|
118
|
+
name: "video",
|
|
119
|
+
inline: !0,
|
|
120
|
+
group: "inline",
|
|
121
|
+
atom: !0,
|
|
122
|
+
draggable: !0,
|
|
123
|
+
selectable: !0,
|
|
124
|
+
addAttributes() {
|
|
125
|
+
return {
|
|
126
|
+
src: { default: null },
|
|
127
|
+
controls: { default: !0 },
|
|
128
|
+
autoplay: { default: !1 },
|
|
129
|
+
loop: { default: !1 },
|
|
130
|
+
muted: { default: !1 },
|
|
131
|
+
poster: { default: null },
|
|
132
|
+
playsinline: { default: !0 },
|
|
133
|
+
uploading: {
|
|
134
|
+
default: null,
|
|
135
|
+
parseHTML: (e) => e.getAttribute("data-uploading") ? !0 : null,
|
|
136
|
+
renderHTML: (e) => e.uploading ? { "data-uploading": "true" } : {}
|
|
137
|
+
},
|
|
138
|
+
width: {
|
|
139
|
+
default: null,
|
|
140
|
+
parseHTML: (e) => {
|
|
141
|
+
const r = e.getAttribute("width") || e.style.width || "", o = String(r).match(/^(\d+)(px)?$/);
|
|
142
|
+
return o ? Number(o[1]) : null;
|
|
143
|
+
},
|
|
144
|
+
renderHTML: (e) => e.width ? { width: e.width } : {}
|
|
145
|
+
},
|
|
146
|
+
height: {
|
|
147
|
+
default: null,
|
|
148
|
+
parseHTML: (e) => {
|
|
149
|
+
const r = e.getAttribute("height") || e.style.height || "", o = String(r).match(/^(\d+)(px)?$/);
|
|
150
|
+
return o ? Number(o[1]) : null;
|
|
151
|
+
},
|
|
152
|
+
renderHTML: (e) => e.height ? { height: e.height } : {}
|
|
153
|
+
},
|
|
154
|
+
// 允许外部自定义类名等 HTML 属性
|
|
155
|
+
class: { default: "tiptap-video" }
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
parseHTML() {
|
|
159
|
+
return [
|
|
160
|
+
{ tag: "video[data-tiptap-video]" },
|
|
161
|
+
{ tag: "video" }
|
|
162
|
+
];
|
|
163
|
+
},
|
|
164
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
165
|
+
return ["video", { "data-tiptap-video": "", ...e }];
|
|
166
|
+
},
|
|
167
|
+
renderMarkdown(e) {
|
|
168
|
+
const r = (e == null ? void 0 : e.attrs) || {}, o = typeof r.src == "string" ? r.src : "";
|
|
169
|
+
return o ? `[video](${o})` : "";
|
|
170
|
+
},
|
|
171
|
+
// Markdown → Node: 支持自定义语法 [video](url)
|
|
172
|
+
markdownTokenizer: {
|
|
173
|
+
name: "video",
|
|
174
|
+
level: "inline",
|
|
175
|
+
start: (e) => e.indexOf("[video]("),
|
|
176
|
+
tokenize: (e) => {
|
|
177
|
+
const r = /^\[video\]\(([^)]+)\)/.exec(e);
|
|
178
|
+
if (r)
|
|
179
|
+
return { type: "video", raw: r[0], href: r[1] };
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
parseMarkdown(e) {
|
|
183
|
+
const r = (e == null ? void 0 : e.href) || (e == null ? void 0 : e.src) || "";
|
|
184
|
+
return r ? { type: "video", attrs: { src: r, controls: !0 } } : { type: "paragraph" };
|
|
185
|
+
},
|
|
186
|
+
addNodeView() {
|
|
187
|
+
return ({ node: e, getPos: r, editor: o }) => {
|
|
188
|
+
var L;
|
|
189
|
+
const t = document.createElement("video"), s = e.attrs;
|
|
190
|
+
t.src = s.src || "", t.controls = s.controls !== !1, t.autoplay = !1, t.loop = !!s.loop, t.muted = !!s.muted, s.poster && (t.poster = s.poster), t.setAttribute("playsinline", "true"), s.class && (t.className = String(s.class)), typeof s.width == "number" && (t.style.width = `${s.width}px`), typeof s.height == "number" && (t.style.height = `${s.height}px`), t.style.display = "inline-block";
|
|
191
|
+
const f = new Ye({
|
|
192
|
+
element: t,
|
|
193
|
+
node: e,
|
|
194
|
+
getPos: r,
|
|
195
|
+
onResize: (b, k) => {
|
|
196
|
+
t.style.width = `${b}px`, t.style.height = `${k}px`;
|
|
197
|
+
},
|
|
198
|
+
onCommit: (b, k) => {
|
|
199
|
+
try {
|
|
200
|
+
const w = o, y = r();
|
|
201
|
+
if (y !== void 0) {
|
|
202
|
+
const { state: g } = w, a = g.schema.nodes.video, u = g.doc.nodeAt(y);
|
|
203
|
+
if (a && u) {
|
|
204
|
+
const c = { ...u.attrs || {}, width: b, height: k }, x = g.tr.setNodeMarkup(y, a, c, u.marks);
|
|
205
|
+
w.view.dispatch(x);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} catch {
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
onUpdate: (b) => {
|
|
212
|
+
const k = b.attrs || {};
|
|
213
|
+
if (typeof k.src == "string" && k.src && t.src !== k.src && (t.src = k.src), typeof k.width == "number" && (t.style.width = `${k.width}px`), typeof k.height == "number" && (t.style.height = `${k.height}px`), k.uploading) {
|
|
214
|
+
f.wrapper.setAttribute("data-uploading", "true"), t.controls = !1;
|
|
215
|
+
try {
|
|
216
|
+
t.pause();
|
|
217
|
+
} catch {
|
|
218
|
+
}
|
|
219
|
+
t.style.pointerEvents = "none";
|
|
220
|
+
} else
|
|
221
|
+
f.wrapper.removeAttribute("data-uploading"), t.controls = k.controls !== !1, t.style.pointerEvents = "";
|
|
222
|
+
return !0;
|
|
223
|
+
},
|
|
224
|
+
options: {
|
|
225
|
+
directions: ["bottom-right", "bottom-left", "top-right", "top-left"],
|
|
226
|
+
min: { width: 120, height: 80 },
|
|
227
|
+
preserveAspectRatio: !0,
|
|
228
|
+
className: {
|
|
229
|
+
container: "tiptap-resize-container",
|
|
230
|
+
wrapper: "tiptap-resize-wrapper",
|
|
231
|
+
handle: "tiptap-resize-handle",
|
|
232
|
+
resizing: "is-resizing"
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
try {
|
|
237
|
+
f.container.style.display = "inline-block", f.wrapper.style.display = "inline-block";
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
const _ = document.createElement("div");
|
|
241
|
+
_.className = "tiptap-upload-mask";
|
|
242
|
+
const d = document.createElement("div");
|
|
243
|
+
if (d.className = "tiptap-upload-progress", _.appendChild(d), f.wrapper.appendChild(_), (L = e.attrs) != null && L.uploading) {
|
|
244
|
+
f.wrapper.setAttribute("data-uploading", "true"), t.controls = !1;
|
|
245
|
+
try {
|
|
246
|
+
t.pause();
|
|
247
|
+
} catch {
|
|
248
|
+
}
|
|
249
|
+
t.style.pointerEvents = "none";
|
|
250
|
+
}
|
|
251
|
+
return f;
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
addCommands() {
|
|
255
|
+
return {
|
|
256
|
+
setVideo: (e) => ({ chain: r }) => {
|
|
257
|
+
const { src: o, HTMLAttributes: t = {} } = e || {};
|
|
258
|
+
return r().insertContent({ type: this.name, attrs: { src: o, ...t } }).run();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}), wt = vt.extend({
|
|
263
|
+
addOptions() {
|
|
264
|
+
var e;
|
|
265
|
+
return { ...(e = this.parent) == null ? void 0 : e.call(this), nested: !0 };
|
|
266
|
+
},
|
|
267
|
+
addNodeView() {
|
|
268
|
+
return ({ node: e, editor: r, getPos: o }) => {
|
|
269
|
+
const t = document.createElement("li");
|
|
270
|
+
t.setAttribute("data-type", "taskItem"), t.setAttribute("data-checked", e.attrs.checked ? "true" : "false");
|
|
271
|
+
const s = document.createElement("span");
|
|
272
|
+
s.className = "todo-box", s.tabIndex = 0, s.setAttribute("role", "checkbox"), s.setAttribute("aria-checked", e.attrs.checked ? "true" : "false"), s.addEventListener("mousedown", (d) => d.preventDefault());
|
|
273
|
+
const f = () => {
|
|
274
|
+
const d = typeof o == "function" ? o() : null;
|
|
275
|
+
if (d == null) return { pos: null, n: null };
|
|
276
|
+
const L = r.view.state.doc.nodeAt(d);
|
|
277
|
+
return { pos: d, n: L };
|
|
278
|
+
};
|
|
279
|
+
s.addEventListener("click", () => {
|
|
280
|
+
var g;
|
|
281
|
+
const { pos: d, n: L } = f();
|
|
282
|
+
if (d == null || !L) return;
|
|
283
|
+
const b = r.view.state, k = b.schema.nodes.taskItem, w = !!((g = L.attrs) != null && g.checked), y = b.tr.setNodeMarkup(d, k, { ...L.attrs || {}, checked: !w });
|
|
284
|
+
r.view.dispatch(y);
|
|
285
|
+
}), s.addEventListener("keydown", (d) => {
|
|
286
|
+
var L;
|
|
287
|
+
if (d.key === "Enter" || d.key === " ") {
|
|
288
|
+
d.preventDefault();
|
|
289
|
+
const { pos: b, n: k } = f();
|
|
290
|
+
if (b == null || !k) return;
|
|
291
|
+
const w = r.view.state, y = w.schema.nodes.taskItem, g = !!((L = k.attrs) != null && L.checked), a = w.tr.setNodeMarkup(b, y, { ...k.attrs || {}, checked: !g });
|
|
292
|
+
r.view.dispatch(a);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
const _ = document.createElement("div");
|
|
296
|
+
return _.className = "task-content", t.appendChild(s), t.appendChild(_), {
|
|
297
|
+
dom: t,
|
|
298
|
+
contentDOM: _,
|
|
299
|
+
update(d) {
|
|
300
|
+
return d.type !== e.type ? !1 : (t.setAttribute("data-checked", d.attrs.checked ? "true" : "false"), s.setAttribute("aria-checked", d.attrs.checked ? "true" : "false"), !0);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
var Ct = {
|
|
307
|
+
size: "1em",
|
|
308
|
+
strokeWidth: 4,
|
|
309
|
+
strokeLinecap: "round",
|
|
310
|
+
strokeLinejoin: "round",
|
|
311
|
+
rtl: !1,
|
|
312
|
+
theme: "outline",
|
|
313
|
+
colors: {
|
|
314
|
+
outline: {
|
|
315
|
+
fill: "#333",
|
|
316
|
+
background: "transparent"
|
|
317
|
+
},
|
|
318
|
+
filled: {
|
|
319
|
+
fill: "#333",
|
|
320
|
+
background: "#FFF"
|
|
321
|
+
},
|
|
322
|
+
twoTone: {
|
|
323
|
+
fill: "#333",
|
|
324
|
+
twoTone: "#2F88FF"
|
|
325
|
+
},
|
|
326
|
+
multiColor: {
|
|
327
|
+
outStrokeColor: "#333",
|
|
328
|
+
outFillColor: "#2F88FF",
|
|
329
|
+
innerStrokeColor: "#FFF",
|
|
330
|
+
innerFillColor: "#43CCF8"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
prefix: "i"
|
|
334
|
+
};
|
|
335
|
+
function bt() {
|
|
336
|
+
return "icon-" + ((1 + Math.random()) * 4294967296 | 0).toString(16).substring(1);
|
|
337
|
+
}
|
|
338
|
+
function yt(e, r, o) {
|
|
339
|
+
var t = typeof r.fill == "string" ? [r.fill] : r.fill || [], s = [], f = r.theme || o.theme;
|
|
340
|
+
switch (f) {
|
|
341
|
+
case "outline":
|
|
342
|
+
s.push(typeof t[0] == "string" ? t[0] : "currentColor"), s.push("none"), s.push(typeof t[0] == "string" ? t[0] : "currentColor"), s.push("none");
|
|
343
|
+
break;
|
|
344
|
+
case "filled":
|
|
345
|
+
s.push(typeof t[0] == "string" ? t[0] : "currentColor"), s.push(typeof t[0] == "string" ? t[0] : "currentColor"), s.push("#FFF"), s.push("#FFF");
|
|
346
|
+
break;
|
|
347
|
+
case "two-tone":
|
|
348
|
+
s.push(typeof t[0] == "string" ? t[0] : "currentColor"), s.push(typeof t[1] == "string" ? t[1] : o.colors.twoTone.twoTone), s.push(typeof t[0] == "string" ? t[0] : "currentColor"), s.push(typeof t[1] == "string" ? t[1] : o.colors.twoTone.twoTone);
|
|
349
|
+
break;
|
|
350
|
+
case "multi-color":
|
|
351
|
+
s.push(typeof t[0] == "string" ? t[0] : "currentColor"), s.push(typeof t[1] == "string" ? t[1] : o.colors.multiColor.outFillColor), s.push(typeof t[2] == "string" ? t[2] : o.colors.multiColor.innerStrokeColor), s.push(typeof t[3] == "string" ? t[3] : o.colors.multiColor.innerFillColor);
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
return {
|
|
355
|
+
size: r.size || o.size,
|
|
356
|
+
strokeWidth: r.strokeWidth || o.strokeWidth,
|
|
357
|
+
strokeLinecap: r.strokeLinecap || o.strokeLinecap,
|
|
358
|
+
strokeLinejoin: r.strokeLinejoin || o.strokeLinejoin,
|
|
359
|
+
colors: s,
|
|
360
|
+
id: e
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
var xt = Symbol("icon-context");
|
|
364
|
+
function Z(e, r, o) {
|
|
365
|
+
var t = {
|
|
366
|
+
name: "icon-" + e,
|
|
367
|
+
props: ["size", "strokeWidth", "strokeLinecap", "strokeLinejoin", "theme", "fill", "spin"],
|
|
368
|
+
setup: function(f) {
|
|
369
|
+
var _ = bt(), d = Je(xt, Ct);
|
|
370
|
+
return function() {
|
|
371
|
+
var L = f.size, b = f.strokeWidth, k = f.strokeLinecap, w = f.strokeLinejoin, y = f.theme, g = f.fill, a = f.spin, u = yt(_, {
|
|
372
|
+
size: L,
|
|
373
|
+
strokeWidth: b,
|
|
374
|
+
strokeLinecap: k,
|
|
375
|
+
strokeLinejoin: w,
|
|
376
|
+
theme: y,
|
|
377
|
+
fill: g
|
|
378
|
+
}, d), c = [d.prefix + "-icon"];
|
|
379
|
+
return c.push(d.prefix + "-icon-" + e), r && d.rtl && c.push(d.prefix + "-icon-rtl"), a && c.push(d.prefix + "-icon-spin"), l("span", {
|
|
380
|
+
class: c.join(" ")
|
|
381
|
+
}, [o(u)]);
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
return t;
|
|
386
|
+
}
|
|
387
|
+
const Lt = Z("align-text-both", !1, function(e) {
|
|
388
|
+
return l("svg", {
|
|
389
|
+
width: e.size,
|
|
390
|
+
height: e.size,
|
|
391
|
+
viewBox: "0 0 48 48",
|
|
392
|
+
fill: "none"
|
|
393
|
+
}, [l("path", {
|
|
394
|
+
d: "M42 19H6",
|
|
395
|
+
stroke: e.colors[0],
|
|
396
|
+
"stroke-width": e.strokeWidth,
|
|
397
|
+
"stroke-linecap": e.strokeLinecap,
|
|
398
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
399
|
+
}, null), l("path", {
|
|
400
|
+
d: "M42 9H6",
|
|
401
|
+
stroke: e.colors[0],
|
|
402
|
+
"stroke-width": e.strokeWidth,
|
|
403
|
+
"stroke-linecap": e.strokeLinecap,
|
|
404
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
405
|
+
}, null), l("path", {
|
|
406
|
+
d: "M42 29H6",
|
|
407
|
+
stroke: e.colors[0],
|
|
408
|
+
"stroke-width": e.strokeWidth,
|
|
409
|
+
"stroke-linecap": e.strokeLinecap,
|
|
410
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
411
|
+
}, null), l("path", {
|
|
412
|
+
d: "M42 39H6",
|
|
413
|
+
stroke: e.colors[0],
|
|
414
|
+
"stroke-width": e.strokeWidth,
|
|
415
|
+
"stroke-linecap": e.strokeLinecap,
|
|
416
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
417
|
+
}, null)]);
|
|
418
|
+
}), _t = Z("align-text-center", !0, function(e) {
|
|
419
|
+
return l("svg", {
|
|
420
|
+
width: e.size,
|
|
421
|
+
height: e.size,
|
|
422
|
+
viewBox: "0 0 48 48",
|
|
423
|
+
fill: "none"
|
|
424
|
+
}, [l("path", {
|
|
425
|
+
d: "M36 19H12",
|
|
426
|
+
stroke: e.colors[0],
|
|
427
|
+
"stroke-width": e.strokeWidth,
|
|
428
|
+
"stroke-linecap": e.strokeLinecap,
|
|
429
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
430
|
+
}, null), l("path", {
|
|
431
|
+
d: "M42 9H6",
|
|
432
|
+
stroke: e.colors[0],
|
|
433
|
+
"stroke-width": e.strokeWidth,
|
|
434
|
+
"stroke-linecap": e.strokeLinecap,
|
|
435
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
436
|
+
}, null), l("path", {
|
|
437
|
+
d: "M42 29H6",
|
|
438
|
+
stroke: e.colors[0],
|
|
439
|
+
"stroke-width": e.strokeWidth,
|
|
440
|
+
"stroke-linecap": e.strokeLinecap,
|
|
441
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
442
|
+
}, null), l("path", {
|
|
443
|
+
d: "M36 39H12",
|
|
444
|
+
stroke: e.colors[0],
|
|
445
|
+
"stroke-width": e.strokeWidth,
|
|
446
|
+
"stroke-linecap": e.strokeLinecap,
|
|
447
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
448
|
+
}, null)]);
|
|
449
|
+
}), Mt = Z("align-text-left", !0, function(e) {
|
|
450
|
+
return l("svg", {
|
|
451
|
+
width: e.size,
|
|
452
|
+
height: e.size,
|
|
453
|
+
viewBox: "0 0 48 48",
|
|
454
|
+
fill: "none"
|
|
455
|
+
}, [l("path", {
|
|
456
|
+
d: "M42 9H6",
|
|
457
|
+
stroke: e.colors[0],
|
|
458
|
+
"stroke-width": e.strokeWidth,
|
|
459
|
+
"stroke-linecap": e.strokeLinecap,
|
|
460
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
461
|
+
}, null), l("path", {
|
|
462
|
+
d: "M34 19H6",
|
|
463
|
+
stroke: e.colors[0],
|
|
464
|
+
"stroke-width": e.strokeWidth,
|
|
465
|
+
"stroke-linecap": e.strokeLinecap,
|
|
466
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
467
|
+
}, null), l("path", {
|
|
468
|
+
d: "M42 29H6",
|
|
469
|
+
stroke: e.colors[0],
|
|
470
|
+
"stroke-width": e.strokeWidth,
|
|
471
|
+
"stroke-linecap": e.strokeLinecap,
|
|
472
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
473
|
+
}, null), l("path", {
|
|
474
|
+
d: "M34 39H6",
|
|
475
|
+
stroke: e.colors[0],
|
|
476
|
+
"stroke-width": e.strokeWidth,
|
|
477
|
+
"stroke-linecap": e.strokeLinecap,
|
|
478
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
479
|
+
}, null)]);
|
|
480
|
+
}), $t = Z("align-text-right", !0, function(e) {
|
|
481
|
+
return l("svg", {
|
|
482
|
+
width: e.size,
|
|
483
|
+
height: e.size,
|
|
484
|
+
viewBox: "0 0 48 48",
|
|
485
|
+
fill: "none"
|
|
486
|
+
}, [l("path", {
|
|
487
|
+
d: "M42 9H6",
|
|
488
|
+
stroke: e.colors[0],
|
|
489
|
+
"stroke-width": e.strokeWidth,
|
|
490
|
+
"stroke-linecap": e.strokeLinecap,
|
|
491
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
492
|
+
}, null), l("path", {
|
|
493
|
+
d: "M42 19H14",
|
|
494
|
+
stroke: e.colors[0],
|
|
495
|
+
"stroke-width": e.strokeWidth,
|
|
496
|
+
"stroke-linecap": e.strokeLinecap,
|
|
497
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
498
|
+
}, null), l("path", {
|
|
499
|
+
d: "M42 29H6",
|
|
500
|
+
stroke: e.colors[0],
|
|
501
|
+
"stroke-width": e.strokeWidth,
|
|
502
|
+
"stroke-linecap": e.strokeLinecap,
|
|
503
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
504
|
+
}, null), l("path", {
|
|
505
|
+
d: "M42 39H14",
|
|
506
|
+
stroke: e.colors[0],
|
|
507
|
+
"stroke-width": e.strokeWidth,
|
|
508
|
+
"stroke-linecap": e.strokeLinecap,
|
|
509
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
510
|
+
}, null)]);
|
|
511
|
+
}), ze = Z("check", !0, function(e) {
|
|
512
|
+
return l("svg", {
|
|
513
|
+
width: e.size,
|
|
514
|
+
height: e.size,
|
|
515
|
+
viewBox: "0 0 48 48",
|
|
516
|
+
fill: "none"
|
|
517
|
+
}, [l("path", {
|
|
518
|
+
d: "M43 11L16.875 37L5 25.1818",
|
|
519
|
+
stroke: e.colors[0],
|
|
520
|
+
"stroke-width": e.strokeWidth,
|
|
521
|
+
"stroke-linecap": e.strokeLinecap,
|
|
522
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
523
|
+
}, null)]);
|
|
524
|
+
}), Fe = Z("down-one", !1, function(e) {
|
|
525
|
+
return l("svg", {
|
|
526
|
+
width: e.size,
|
|
527
|
+
height: e.size,
|
|
528
|
+
viewBox: "0 0 48 48",
|
|
529
|
+
fill: "none"
|
|
530
|
+
}, [l("path", {
|
|
531
|
+
d: "M36 19L24 31L12 19H36Z",
|
|
532
|
+
fill: e.colors[1],
|
|
533
|
+
stroke: e.colors[0],
|
|
534
|
+
"stroke-width": e.strokeWidth,
|
|
535
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
536
|
+
}, null)]);
|
|
537
|
+
}), zt = Z("font-size-two", !0, function(e) {
|
|
538
|
+
return l("svg", {
|
|
539
|
+
width: e.size,
|
|
540
|
+
height: e.size,
|
|
541
|
+
viewBox: "0 0 48 48",
|
|
542
|
+
fill: "none"
|
|
543
|
+
}, [l("path", {
|
|
544
|
+
d: "M4 44L24 4L44 44",
|
|
545
|
+
stroke: e.colors[0],
|
|
546
|
+
"stroke-width": e.strokeWidth,
|
|
547
|
+
"stroke-linecap": e.strokeLinecap,
|
|
548
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
549
|
+
}, null), l("path", {
|
|
550
|
+
d: "M12 28H36",
|
|
551
|
+
stroke: e.colors[0],
|
|
552
|
+
"stroke-width": e.strokeWidth,
|
|
553
|
+
"stroke-linecap": e.strokeLinecap,
|
|
554
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
555
|
+
}, null)]);
|
|
556
|
+
}), St = Z("go-on", !0, function(e) {
|
|
557
|
+
return l("svg", {
|
|
558
|
+
width: e.size,
|
|
559
|
+
height: e.size,
|
|
560
|
+
viewBox: "0 0 48 48",
|
|
561
|
+
fill: "none"
|
|
562
|
+
}, [l("path", {
|
|
563
|
+
d: "M36 7L43 13.4615L36 21",
|
|
564
|
+
stroke: e.colors[0],
|
|
565
|
+
"stroke-width": e.strokeWidth,
|
|
566
|
+
"stroke-linecap": e.strokeLinecap,
|
|
567
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
568
|
+
}, null), l("path", {
|
|
569
|
+
d: "M40 14H17.0062C10.1232 14 4.27787 19.6204 4.00964 26.5C3.72612 33.7696 9.73291 40 17.0062 40H34.0016",
|
|
570
|
+
stroke: e.colors[0],
|
|
571
|
+
"stroke-width": e.strokeWidth,
|
|
572
|
+
"stroke-linecap": e.strokeLinecap,
|
|
573
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
574
|
+
}, null)]);
|
|
575
|
+
}), Tt = Z("list-two", !0, function(e) {
|
|
576
|
+
return l("svg", {
|
|
577
|
+
width: e.size,
|
|
578
|
+
height: e.size,
|
|
579
|
+
viewBox: "0 0 48 48",
|
|
580
|
+
fill: "none"
|
|
581
|
+
}, [l("path", {
|
|
582
|
+
d: "M9 42C11.2091 42 13 40.2091 13 38C13 35.7909 11.2091 34 9 34C6.79086 34 5 35.7909 5 38C5 40.2091 6.79086 42 9 42Z",
|
|
583
|
+
stroke: e.colors[0],
|
|
584
|
+
"stroke-width": e.strokeWidth,
|
|
585
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
586
|
+
}, null), l("path", {
|
|
587
|
+
d: "M9 14C11.2091 14 13 12.2092 13 10C13 7.79086 11.2091 6 9 6C6.79086 6 5 7.79086 5 10C5 12.2092 6.79086 14 9 14Z",
|
|
588
|
+
stroke: e.colors[0],
|
|
589
|
+
"stroke-width": e.strokeWidth,
|
|
590
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
591
|
+
}, null), l("path", {
|
|
592
|
+
d: "M9 28C11.2091 28 13 26.2092 13 24C13 21.7908 11.2091 20 9 20C6.79086 20 5 21.7908 5 24C5 26.2092 6.79086 28 9 28Z",
|
|
593
|
+
stroke: e.colors[0],
|
|
594
|
+
"stroke-width": e.strokeWidth,
|
|
595
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
596
|
+
}, null), l("path", {
|
|
597
|
+
d: "M21 24H43",
|
|
598
|
+
stroke: e.colors[0],
|
|
599
|
+
"stroke-width": e.strokeWidth,
|
|
600
|
+
"stroke-linecap": e.strokeLinecap,
|
|
601
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
602
|
+
}, null), l("path", {
|
|
603
|
+
d: "M21 38H43",
|
|
604
|
+
stroke: e.colors[0],
|
|
605
|
+
"stroke-width": e.strokeWidth,
|
|
606
|
+
"stroke-linecap": e.strokeLinecap,
|
|
607
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
608
|
+
}, null), l("path", {
|
|
609
|
+
d: "M21 10H43",
|
|
610
|
+
stroke: e.colors[0],
|
|
611
|
+
"stroke-width": e.strokeWidth,
|
|
612
|
+
"stroke-linecap": e.strokeLinecap,
|
|
613
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
614
|
+
}, null)]);
|
|
615
|
+
}), Ft = Z("ordered-list", !0, function(e) {
|
|
616
|
+
return l("svg", {
|
|
617
|
+
width: e.size,
|
|
618
|
+
height: e.size,
|
|
619
|
+
viewBox: "0 0 48 48",
|
|
620
|
+
fill: "none"
|
|
621
|
+
}, [l("path", {
|
|
622
|
+
d: "M9 4V13",
|
|
623
|
+
stroke: e.colors[0],
|
|
624
|
+
"stroke-width": e.strokeWidth,
|
|
625
|
+
"stroke-linecap": e.strokeLinecap,
|
|
626
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
627
|
+
}, null), l("path", {
|
|
628
|
+
d: "M12 13H6",
|
|
629
|
+
stroke: e.colors[0],
|
|
630
|
+
"stroke-width": e.strokeWidth,
|
|
631
|
+
"stroke-linecap": e.strokeLinecap,
|
|
632
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
633
|
+
}, null), l("path", {
|
|
634
|
+
d: "M12 27H6",
|
|
635
|
+
stroke: e.colors[0],
|
|
636
|
+
"stroke-width": e.strokeWidth,
|
|
637
|
+
"stroke-linecap": e.strokeLinecap,
|
|
638
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
639
|
+
}, null), l("path", {
|
|
640
|
+
d: "M6 19.9998C6 19.9998 9 16.9998 11 19.9998C13 22.9999 6 26.9998 6 26.9998",
|
|
641
|
+
stroke: e.colors[0],
|
|
642
|
+
"stroke-width": e.strokeWidth,
|
|
643
|
+
"stroke-linecap": e.strokeLinecap,
|
|
644
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
645
|
+
}, null), l("path", {
|
|
646
|
+
d: "M6.00016 34.5001C6.00016 34.5001 8.00016 31.5 11.0002 33.5C14.0002 35.5 11.0002 38 11.0002 38C11.0002 38 14.0002 40.5 11.0002 42.5C8.00015 44.5 6.00015 41.5 6.00015 41.5",
|
|
647
|
+
stroke: e.colors[0],
|
|
648
|
+
"stroke-width": e.strokeWidth,
|
|
649
|
+
"stroke-linecap": e.strokeLinecap,
|
|
650
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
651
|
+
}, null), l("path", {
|
|
652
|
+
d: "M11 38H9",
|
|
653
|
+
stroke: e.colors[0],
|
|
654
|
+
"stroke-width": e.strokeWidth,
|
|
655
|
+
"stroke-linecap": e.strokeLinecap,
|
|
656
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
657
|
+
}, null), l("path", {
|
|
658
|
+
d: "M9 4L6 6",
|
|
659
|
+
stroke: e.colors[0],
|
|
660
|
+
"stroke-width": e.strokeWidth,
|
|
661
|
+
"stroke-linecap": e.strokeLinecap,
|
|
662
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
663
|
+
}, null), l("path", {
|
|
664
|
+
d: "M21 24H43",
|
|
665
|
+
stroke: e.colors[0],
|
|
666
|
+
"stroke-width": e.strokeWidth,
|
|
667
|
+
"stroke-linecap": e.strokeLinecap,
|
|
668
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
669
|
+
}, null), l("path", {
|
|
670
|
+
d: "M21 38H43",
|
|
671
|
+
stroke: e.colors[0],
|
|
672
|
+
"stroke-width": e.strokeWidth,
|
|
673
|
+
"stroke-linecap": e.strokeLinecap,
|
|
674
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
675
|
+
}, null), l("path", {
|
|
676
|
+
d: "M21 10H43",
|
|
677
|
+
stroke: e.colors[0],
|
|
678
|
+
"stroke-width": e.strokeWidth,
|
|
679
|
+
"stroke-linecap": e.strokeLinecap,
|
|
680
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
681
|
+
}, null)]);
|
|
682
|
+
}), jt = Z("preview-close-one", !0, function(e) {
|
|
683
|
+
return l("svg", {
|
|
684
|
+
width: e.size,
|
|
685
|
+
height: e.size,
|
|
686
|
+
viewBox: "0 0 48 48",
|
|
687
|
+
fill: "none"
|
|
688
|
+
}, [l("path", {
|
|
689
|
+
d: "M9.85786 18C6.23858 21 4 24 4 24C4 24 12.9543 36 24 36C25.3699 36 26.7076 35.8154 28 35.4921M20.0318 12.5C21.3144 12.1816 22.6414 12 24 12C35.0457 12 44 24 44 24C44 24 41.7614 27 38.1421 30",
|
|
690
|
+
stroke: e.colors[0],
|
|
691
|
+
"stroke-width": e.strokeWidth,
|
|
692
|
+
"stroke-linecap": e.strokeLinecap,
|
|
693
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
694
|
+
}, null), l("path", {
|
|
695
|
+
d: "M20.3142 20.6211C19.4981 21.5109 19 22.6972 19 23.9998C19 26.7612 21.2386 28.9998 24 28.9998C25.3627 28.9998 26.5981 28.4546 27.5 27.5705",
|
|
696
|
+
stroke: e.colors[0],
|
|
697
|
+
"stroke-width": e.strokeWidth,
|
|
698
|
+
"stroke-linecap": e.strokeLinecap,
|
|
699
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
700
|
+
}, null), l("path", {
|
|
701
|
+
d: "M42 42L6 6",
|
|
702
|
+
stroke: e.colors[0],
|
|
703
|
+
"stroke-width": e.strokeWidth,
|
|
704
|
+
"stroke-linecap": e.strokeLinecap,
|
|
705
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
706
|
+
}, null)]);
|
|
707
|
+
}), Ht = Z("pushpin", !1, function(e) {
|
|
708
|
+
return l("svg", {
|
|
709
|
+
width: e.size,
|
|
710
|
+
height: e.size,
|
|
711
|
+
viewBox: "0 0 48 48",
|
|
712
|
+
fill: "none"
|
|
713
|
+
}, [l("path", {
|
|
714
|
+
d: "M32 4H16L20 7L16 20C16 20 10 24 10 28H20L24 44L28 28H38C38 24 34 21.1667 32 20L28 7L32 4Z",
|
|
715
|
+
fill: e.colors[1],
|
|
716
|
+
stroke: e.colors[0],
|
|
717
|
+
"stroke-width": e.strokeWidth,
|
|
718
|
+
"stroke-linecap": e.strokeLinecap,
|
|
719
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
720
|
+
}, null)]);
|
|
721
|
+
}), At = Z("return", !0, function(e) {
|
|
722
|
+
return l("svg", {
|
|
723
|
+
width: e.size,
|
|
724
|
+
height: e.size,
|
|
725
|
+
viewBox: "0 0 48 48",
|
|
726
|
+
fill: "none"
|
|
727
|
+
}, [l("path", {
|
|
728
|
+
d: "M12.9998 8L6 14L12.9998 21",
|
|
729
|
+
stroke: e.colors[0],
|
|
730
|
+
"stroke-width": e.strokeWidth,
|
|
731
|
+
"stroke-linecap": e.strokeLinecap,
|
|
732
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
733
|
+
}, null), l("path", {
|
|
734
|
+
d: "M6 14H28.9938C35.8768 14 41.7221 19.6204 41.9904 26.5C42.2739 33.7696 36.2671 40 28.9938 40H11.9984",
|
|
735
|
+
stroke: e.colors[0],
|
|
736
|
+
"stroke-width": e.strokeWidth,
|
|
737
|
+
"stroke-linecap": e.strokeLinecap,
|
|
738
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
739
|
+
}, null)]);
|
|
740
|
+
}), Bt = Z("strikethrough", !0, function(e) {
|
|
741
|
+
return l("svg", {
|
|
742
|
+
width: e.size,
|
|
743
|
+
height: e.size,
|
|
744
|
+
viewBox: "0 0 48 48",
|
|
745
|
+
fill: "none"
|
|
746
|
+
}, [l("path", {
|
|
747
|
+
d: "M5 24H43",
|
|
748
|
+
stroke: e.colors[0],
|
|
749
|
+
"stroke-width": e.strokeWidth,
|
|
750
|
+
"stroke-linecap": e.strokeLinecap,
|
|
751
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
752
|
+
}, null), l("path", {
|
|
753
|
+
d: "M24 24C40 30 34 44 24 44C13.9999 44 12 36 12 36",
|
|
754
|
+
stroke: e.colors[0],
|
|
755
|
+
"stroke-width": e.strokeWidth,
|
|
756
|
+
"stroke-linecap": e.strokeLinecap,
|
|
757
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
758
|
+
}, null), l("path", {
|
|
759
|
+
d: "M35.9999 12C35.9999 12 33 4 23.9999 4C14.9999 4 11.4359 11.5995 15.6096 18",
|
|
760
|
+
stroke: e.colors[0],
|
|
761
|
+
"stroke-width": e.strokeWidth,
|
|
762
|
+
"stroke-linecap": e.strokeLinecap,
|
|
763
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
764
|
+
}, null), l("path", {
|
|
765
|
+
d: "M12 36C12 36 15.9999 44 24 44C32 44 36.564 36.4005 32.3903 30",
|
|
766
|
+
stroke: e.colors[0],
|
|
767
|
+
"stroke-width": e.strokeWidth,
|
|
768
|
+
"stroke-linecap": e.strokeLinecap,
|
|
769
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
770
|
+
}, null)]);
|
|
771
|
+
}), Et = Z("text-bold", !0, function(e) {
|
|
772
|
+
return l("svg", {
|
|
773
|
+
width: e.size,
|
|
774
|
+
height: e.size,
|
|
775
|
+
viewBox: "0 0 48 48",
|
|
776
|
+
fill: "none"
|
|
777
|
+
}, [l("path", {
|
|
778
|
+
"fill-rule": "evenodd",
|
|
779
|
+
"clip-rule": "evenodd",
|
|
780
|
+
d: "M24 24C29.5056 24 33.9688 19.5228 33.9688 14C33.9688 8.47715 29.5056 4 24 4H11V24H24Z",
|
|
781
|
+
stroke: e.colors[0],
|
|
782
|
+
"stroke-width": e.strokeWidth,
|
|
783
|
+
"stroke-linecap": e.strokeLinecap,
|
|
784
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
785
|
+
}, null), l("path", {
|
|
786
|
+
"fill-rule": "evenodd",
|
|
787
|
+
"clip-rule": "evenodd",
|
|
788
|
+
d: "M28.0312 44C33.5368 44 38 39.5228 38 34C38 28.4772 33.5368 24 28.0312 24H11V44H28.0312Z",
|
|
789
|
+
stroke: e.colors[0],
|
|
790
|
+
"stroke-width": e.strokeWidth,
|
|
791
|
+
"stroke-linecap": e.strokeLinecap,
|
|
792
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
793
|
+
}, null)]);
|
|
794
|
+
}), Dt = Z("text-italic", !0, function(e) {
|
|
795
|
+
return l("svg", {
|
|
796
|
+
width: e.size,
|
|
797
|
+
height: e.size,
|
|
798
|
+
viewBox: "0 0 48 48",
|
|
799
|
+
fill: "none"
|
|
800
|
+
}, [l("path", {
|
|
801
|
+
d: "M20 6H36",
|
|
802
|
+
stroke: e.colors[0],
|
|
803
|
+
"stroke-width": e.strokeWidth,
|
|
804
|
+
"stroke-linecap": e.strokeLinecap,
|
|
805
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
806
|
+
}, null), l("path", {
|
|
807
|
+
d: "M12 42H28",
|
|
808
|
+
stroke: e.colors[0],
|
|
809
|
+
"stroke-width": e.strokeWidth,
|
|
810
|
+
"stroke-linecap": e.strokeLinecap,
|
|
811
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
812
|
+
}, null), l("path", {
|
|
813
|
+
d: "M29 5.95215L19 41.9998",
|
|
814
|
+
stroke: e.colors[0],
|
|
815
|
+
"stroke-width": e.strokeWidth,
|
|
816
|
+
"stroke-linecap": e.strokeLinecap,
|
|
817
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
818
|
+
}, null)]);
|
|
819
|
+
}), Ut = Z("text-underline", !0, function(e) {
|
|
820
|
+
return l("svg", {
|
|
821
|
+
width: e.size,
|
|
822
|
+
height: e.size,
|
|
823
|
+
viewBox: "0 0 48 48",
|
|
824
|
+
fill: "none"
|
|
825
|
+
}, [l("path", {
|
|
826
|
+
d: "M8 44H40",
|
|
827
|
+
stroke: e.colors[0],
|
|
828
|
+
"stroke-width": e.strokeWidth,
|
|
829
|
+
"stroke-linecap": e.strokeLinecap,
|
|
830
|
+
"stroke-linejoin": e.strokeLinejoin
|
|
831
|
+
}, null), l("path", {
|
|
832
|
+
d: "M37 6.09717C37 12.7638 37 15.3335 37 22.0002C37 29.1799 31.1797 35.0002 24 35.0002C16.8203 35.0002 11 29.1799 11 22.0002C11 15.3335 11 12.7638 11 6.09717",
|
|
833
|
+
stroke: e.colors[0],
|
|
834
|
+
"stroke-width": e.strokeWidth,
|
|
835
|
+
"stroke-linecap": e.strokeLinecap
|
|
836
|
+
}, null)]);
|
|
837
|
+
}), Wt = { class: "label" }, Vt = {
|
|
838
|
+
key: 0,
|
|
839
|
+
class: "shortcut"
|
|
840
|
+
}, It = /* @__PURE__ */ K({
|
|
841
|
+
__name: "Tooltip",
|
|
842
|
+
props: {
|
|
843
|
+
text: { type: String, required: !0 },
|
|
844
|
+
shortcut: { type: String, default: "" },
|
|
845
|
+
placement: { type: String, default: "bottom" },
|
|
846
|
+
offset: { type: Number, default: 6 }
|
|
847
|
+
},
|
|
848
|
+
setup(e) {
|
|
849
|
+
const r = e, o = H(null), t = H(null), s = H(!1), f = H(r.placement);
|
|
850
|
+
function _() {
|
|
851
|
+
const b = o.value, k = t.value;
|
|
852
|
+
if (!b || !k) return;
|
|
853
|
+
let w = r.placement;
|
|
854
|
+
const y = k.getBoundingClientRect(), g = y.top, a = window.innerHeight - y.bottom, u = b.offsetHeight + r.offset;
|
|
855
|
+
w === "bottom" ? a < u && g >= u && (w = "top") : g < u && a >= u && (w = "bottom"), f.value = w;
|
|
856
|
+
}
|
|
857
|
+
function d() {
|
|
858
|
+
s.value = !0, me(_);
|
|
859
|
+
}
|
|
860
|
+
function L() {
|
|
861
|
+
s.value = !1;
|
|
862
|
+
}
|
|
863
|
+
return ue(() => {
|
|
864
|
+
window.addEventListener("resize", _);
|
|
865
|
+
}), be(
|
|
866
|
+
() => r.text,
|
|
867
|
+
() => me(_)
|
|
868
|
+
), (b, k) => (S(), F("div", {
|
|
869
|
+
ref_key: "wrapperRef",
|
|
870
|
+
ref: t,
|
|
871
|
+
class: "tooltip-wrapper",
|
|
872
|
+
onMouseenter: d,
|
|
873
|
+
onMouseleave: L,
|
|
874
|
+
onFocusin: d,
|
|
875
|
+
onFocusout: L
|
|
876
|
+
}, [
|
|
877
|
+
Xe(b.$slots, "default", {}, void 0, !0),
|
|
878
|
+
h("div", {
|
|
879
|
+
ref_key: "tipRef",
|
|
880
|
+
ref: o,
|
|
881
|
+
class: N(["tooltip", [f.value, { visible: s.value }]])
|
|
882
|
+
}, [
|
|
883
|
+
h("div", Wt, re(e.text), 1),
|
|
884
|
+
e.shortcut ? (S(), F("div", Vt, re(e.shortcut), 1)) : O("", !0)
|
|
885
|
+
], 2)
|
|
886
|
+
], 544));
|
|
887
|
+
}
|
|
888
|
+
}), J = (e, r) => {
|
|
889
|
+
const o = e.__vccOpts || e;
|
|
890
|
+
for (const [t, s] of r)
|
|
891
|
+
o[t] = s;
|
|
892
|
+
return o;
|
|
893
|
+
}, ne = /* @__PURE__ */ J(It, [["__scopeId", "data-v-8b180ffc"]]), Ot = ["aria-expanded"], Rt = { class: "label" }, Nt = {
|
|
894
|
+
key: 0,
|
|
895
|
+
class: "dropdown",
|
|
896
|
+
role: "listbox"
|
|
897
|
+
}, Pt = ["aria-selected", "onClick"], Gt = { class: "text" }, Ee = "md-toolbar-dropdown-open", Oe = "font-size-select", Yt = /* @__PURE__ */ K({
|
|
898
|
+
__name: "index",
|
|
899
|
+
props: {
|
|
900
|
+
editor: {}
|
|
901
|
+
},
|
|
902
|
+
setup(e) {
|
|
903
|
+
const r = e, o = [
|
|
904
|
+
"12px",
|
|
905
|
+
"13px",
|
|
906
|
+
"14px",
|
|
907
|
+
"15px",
|
|
908
|
+
"16px",
|
|
909
|
+
"19px",
|
|
910
|
+
"22px",
|
|
911
|
+
"24px",
|
|
912
|
+
"29px",
|
|
913
|
+
"32px",
|
|
914
|
+
"40px",
|
|
915
|
+
"48px"
|
|
916
|
+
], t = de(() => {
|
|
917
|
+
var y, g;
|
|
918
|
+
const w = (g = (y = r.editor) == null ? void 0 : y.getAttributes("textStyle")) == null ? void 0 : g.fontSize;
|
|
919
|
+
return typeof w == "string" && w ? w : "15px";
|
|
920
|
+
}), s = H(!1), f = H(null);
|
|
921
|
+
function _() {
|
|
922
|
+
s.value || window.dispatchEvent(new CustomEvent(Ee, { detail: { id: Oe } })), s.value = !s.value;
|
|
923
|
+
}
|
|
924
|
+
function d() {
|
|
925
|
+
s.value = !1;
|
|
926
|
+
}
|
|
927
|
+
function L(w) {
|
|
928
|
+
var y;
|
|
929
|
+
(y = r.editor) == null || y.chain().focus().setMark("textStyle", { fontSize: w }).run(), d();
|
|
930
|
+
}
|
|
931
|
+
function b(w) {
|
|
932
|
+
const y = w.target, g = f.value;
|
|
933
|
+
g && !g.contains(y) && d();
|
|
934
|
+
}
|
|
935
|
+
ue(() => {
|
|
936
|
+
document.addEventListener("click", b), window.addEventListener(Ee, k);
|
|
937
|
+
}), ve(() => {
|
|
938
|
+
document.removeEventListener("click", b), window.removeEventListener(Ee, k);
|
|
939
|
+
});
|
|
940
|
+
function k(w) {
|
|
941
|
+
var g;
|
|
942
|
+
((g = w.detail) == null ? void 0 : g.id) !== Oe && (s.value = !1);
|
|
943
|
+
}
|
|
944
|
+
return (w, y) => (S(), F("div", {
|
|
945
|
+
class: "font-size",
|
|
946
|
+
ref_key: "rootRef",
|
|
947
|
+
ref: f
|
|
948
|
+
}, [
|
|
949
|
+
h("div", {
|
|
950
|
+
class: "icon",
|
|
951
|
+
onClick: j(_, ["stop"]),
|
|
952
|
+
"aria-expanded": s.value
|
|
953
|
+
}, [
|
|
954
|
+
h("div", Rt, re(t.value), 1),
|
|
955
|
+
l(z(Fe), {
|
|
956
|
+
theme: "filled",
|
|
957
|
+
strokeWidth: 3
|
|
958
|
+
})
|
|
959
|
+
], 8, Ot),
|
|
960
|
+
l(Ce, { name: "dropdown-slide" }, {
|
|
961
|
+
default: P(() => [
|
|
962
|
+
s.value ? (S(), F("div", Nt, [
|
|
963
|
+
(S(), F(ie, null, se(o, (g) => h("div", {
|
|
964
|
+
key: g,
|
|
965
|
+
class: "dropdown-item",
|
|
966
|
+
"aria-selected": g === t.value,
|
|
967
|
+
onClick: j((a) => L(g), ["stop"])
|
|
968
|
+
}, [
|
|
969
|
+
g === t.value ? (S(), ye(z(ze), {
|
|
970
|
+
key: 0,
|
|
971
|
+
theme: "filled",
|
|
972
|
+
strokeWidth: 3
|
|
973
|
+
})) : O("", !0),
|
|
974
|
+
h("span", Gt, re(g), 1)
|
|
975
|
+
], 8, Pt)), 64))
|
|
976
|
+
])) : O("", !0)
|
|
977
|
+
]),
|
|
978
|
+
_: 1
|
|
979
|
+
})
|
|
980
|
+
], 512));
|
|
981
|
+
}
|
|
982
|
+
}), qt = /* @__PURE__ */ J(Yt, [["__scopeId", "data-v-6882ea42"]]), Zt = ["aria-expanded"], Kt = {
|
|
983
|
+
key: 0,
|
|
984
|
+
class: "dropdown"
|
|
985
|
+
}, Jt = { class: "section" }, Xt = { class: "swatches" }, Qt = ["onClick"], eo = { class: "section" }, to = { class: "swatches grid" }, oo = ["onClick"], no = {
|
|
986
|
+
key: 0,
|
|
987
|
+
class: "section"
|
|
988
|
+
}, io = { class: "swatches" }, so = ["onClick"], lo = { class: "section inline-actions" }, ro = {
|
|
989
|
+
key: 1,
|
|
990
|
+
class: "advanced"
|
|
991
|
+
}, De = "md-toolbar-dropdown-open", Re = "color-select", ao = /* @__PURE__ */ K({
|
|
992
|
+
__name: "index",
|
|
993
|
+
props: {
|
|
994
|
+
editor: {},
|
|
995
|
+
currentColor: {}
|
|
996
|
+
},
|
|
997
|
+
setup(e) {
|
|
998
|
+
const r = e, o = [
|
|
999
|
+
"#000000",
|
|
1000
|
+
"#262626",
|
|
1001
|
+
"#595959",
|
|
1002
|
+
"#8C8C8C",
|
|
1003
|
+
"#BFBFBF",
|
|
1004
|
+
"#D9D9D9",
|
|
1005
|
+
"#E9E9E9",
|
|
1006
|
+
"#F5F5F5",
|
|
1007
|
+
"#FFFFFF",
|
|
1008
|
+
"#F5222D",
|
|
1009
|
+
"#FA541C",
|
|
1010
|
+
"#FA8C16",
|
|
1011
|
+
"#FADB14",
|
|
1012
|
+
"#52C41A",
|
|
1013
|
+
"#13C2C2",
|
|
1014
|
+
"#1677FF",
|
|
1015
|
+
"#2F54EB",
|
|
1016
|
+
"#722ED1",
|
|
1017
|
+
"#EB2F96",
|
|
1018
|
+
"#FF4D4F",
|
|
1019
|
+
"#FF7A45",
|
|
1020
|
+
"#FFA940",
|
|
1021
|
+
"#FFD666",
|
|
1022
|
+
"#73D13D",
|
|
1023
|
+
"#36CFC9",
|
|
1024
|
+
"#69C0FF",
|
|
1025
|
+
"#85A5FF",
|
|
1026
|
+
"#B37FEB",
|
|
1027
|
+
"#F759AB"
|
|
1028
|
+
], t = H(!1), s = H(!1), f = H(null), _ = H(r.currentColor || "#000000"), d = H(c()), L = H("#F5222D");
|
|
1029
|
+
function b() {
|
|
1030
|
+
t.value || window.dispatchEvent(new CustomEvent(De, { detail: { id: Re } })), t.value = !t.value;
|
|
1031
|
+
}
|
|
1032
|
+
function k() {
|
|
1033
|
+
t.value = !1;
|
|
1034
|
+
}
|
|
1035
|
+
function w() {
|
|
1036
|
+
s.value = !s.value;
|
|
1037
|
+
}
|
|
1038
|
+
function y(i) {
|
|
1039
|
+
var n;
|
|
1040
|
+
(n = r.editor) == null || n.chain().focus().setColor(i).run(), L.value = i, x(i), k();
|
|
1041
|
+
}
|
|
1042
|
+
function g() {
|
|
1043
|
+
var i;
|
|
1044
|
+
(i = r.editor) == null || i.chain().focus().unsetColor().run(), k();
|
|
1045
|
+
}
|
|
1046
|
+
function a(i) {
|
|
1047
|
+
const n = i.target, v = f.value;
|
|
1048
|
+
v && !v.contains(n) && k();
|
|
1049
|
+
}
|
|
1050
|
+
function u() {
|
|
1051
|
+
}
|
|
1052
|
+
function c() {
|
|
1053
|
+
try {
|
|
1054
|
+
const i = localStorage.getItem("md_color_recent");
|
|
1055
|
+
if (!i) return [];
|
|
1056
|
+
const n = JSON.parse(i);
|
|
1057
|
+
return Array.isArray(n) ? n.slice(0, 12) : [];
|
|
1058
|
+
} catch {
|
|
1059
|
+
return [];
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
function x(i) {
|
|
1063
|
+
const n = [i, ...d.value.filter((v) => v !== i)];
|
|
1064
|
+
d.value = n.slice(0, 12);
|
|
1065
|
+
try {
|
|
1066
|
+
localStorage.setItem("md_color_recent", JSON.stringify(d.value));
|
|
1067
|
+
} catch {
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
let m = [];
|
|
1071
|
+
function T() {
|
|
1072
|
+
const i = r.editor;
|
|
1073
|
+
i && (m = [
|
|
1074
|
+
{ event: "selectionUpdate", handler: u },
|
|
1075
|
+
{ event: "transaction", handler: u },
|
|
1076
|
+
{ event: "update", handler: u }
|
|
1077
|
+
], m.forEach(({ event: n, handler: v }) => {
|
|
1078
|
+
i.on(n, v);
|
|
1079
|
+
}));
|
|
1080
|
+
}
|
|
1081
|
+
ue(() => {
|
|
1082
|
+
document.addEventListener("click", a), window.addEventListener(De, M), T();
|
|
1083
|
+
}), ve(() => {
|
|
1084
|
+
document.removeEventListener("click", a), window.removeEventListener(De, M);
|
|
1085
|
+
const i = r.editor;
|
|
1086
|
+
i && m.forEach(({ event: n, handler: v }) => {
|
|
1087
|
+
i.off(n, v);
|
|
1088
|
+
}), m = [];
|
|
1089
|
+
}), be(
|
|
1090
|
+
() => r.editor,
|
|
1091
|
+
(i, n) => {
|
|
1092
|
+
n && m.forEach(({ event: v, handler: A }) => {
|
|
1093
|
+
n.off(v, A);
|
|
1094
|
+
}), m = [], T();
|
|
1095
|
+
}
|
|
1096
|
+
);
|
|
1097
|
+
function M(i) {
|
|
1098
|
+
var v;
|
|
1099
|
+
((v = i.detail) == null ? void 0 : v.id) !== Re && (t.value = !1);
|
|
1100
|
+
}
|
|
1101
|
+
return (i, n) => (S(), F("div", {
|
|
1102
|
+
class: "color-select",
|
|
1103
|
+
ref_key: "rootRef",
|
|
1104
|
+
ref: f
|
|
1105
|
+
}, [
|
|
1106
|
+
h("div", {
|
|
1107
|
+
class: "icon icon-dropdown",
|
|
1108
|
+
"aria-expanded": t.value
|
|
1109
|
+
}, [
|
|
1110
|
+
h("div", {
|
|
1111
|
+
class: "icon-stack hoverable",
|
|
1112
|
+
onClick: n[0] || (n[0] = j((v) => y(L.value), ["stop"]))
|
|
1113
|
+
}, [
|
|
1114
|
+
l(z(zt), {
|
|
1115
|
+
theme: "filled",
|
|
1116
|
+
size: "14",
|
|
1117
|
+
fill: "#000",
|
|
1118
|
+
strokeWidth: 3
|
|
1119
|
+
}),
|
|
1120
|
+
h("div", {
|
|
1121
|
+
class: "underline",
|
|
1122
|
+
style: oe({ background: L.value })
|
|
1123
|
+
}, null, 4)
|
|
1124
|
+
]),
|
|
1125
|
+
h("div", {
|
|
1126
|
+
class: "arrow hoverable",
|
|
1127
|
+
onClick: j(b, ["stop"])
|
|
1128
|
+
}, [
|
|
1129
|
+
l(z(Fe), {
|
|
1130
|
+
theme: "filled",
|
|
1131
|
+
strokeWidth: 3,
|
|
1132
|
+
size: "12"
|
|
1133
|
+
})
|
|
1134
|
+
])
|
|
1135
|
+
], 8, Zt),
|
|
1136
|
+
l(Ce, { name: "dropdown-slide" }, {
|
|
1137
|
+
default: P(() => [
|
|
1138
|
+
t.value ? (S(), F("div", Kt, [
|
|
1139
|
+
h("div", Jt, [
|
|
1140
|
+
n[4] || (n[4] = h("div", { class: "section-title" }, "默认", -1)),
|
|
1141
|
+
h("div", Xt, [
|
|
1142
|
+
(S(!0), F(ie, null, se(o.slice(0, 9), (v) => (S(), F("div", {
|
|
1143
|
+
key: v,
|
|
1144
|
+
class: "swatch",
|
|
1145
|
+
style: oe({ background: v }),
|
|
1146
|
+
onClick: j((A) => y(v), ["stop"])
|
|
1147
|
+
}, [
|
|
1148
|
+
v === L.value ? (S(), ye(z(ze), {
|
|
1149
|
+
key: 0,
|
|
1150
|
+
theme: "filled",
|
|
1151
|
+
strokeWidth: 3
|
|
1152
|
+
})) : O("", !0)
|
|
1153
|
+
], 12, Qt))), 128))
|
|
1154
|
+
])
|
|
1155
|
+
]),
|
|
1156
|
+
h("div", eo, [
|
|
1157
|
+
n[5] || (n[5] = h("div", { class: "section-title" }, "常用颜色", -1)),
|
|
1158
|
+
h("div", to, [
|
|
1159
|
+
(S(!0), F(ie, null, se(o.slice(9), (v) => (S(), F("div", {
|
|
1160
|
+
key: v,
|
|
1161
|
+
class: "swatch",
|
|
1162
|
+
style: oe({ background: v }),
|
|
1163
|
+
onClick: j((A) => y(v), ["stop"])
|
|
1164
|
+
}, [
|
|
1165
|
+
v === L.value ? (S(), ye(z(ze), {
|
|
1166
|
+
key: 0,
|
|
1167
|
+
theme: "filled",
|
|
1168
|
+
strokeWidth: 3
|
|
1169
|
+
})) : O("", !0)
|
|
1170
|
+
], 12, oo))), 128))
|
|
1171
|
+
])
|
|
1172
|
+
]),
|
|
1173
|
+
d.value.length ? (S(), F("div", no, [
|
|
1174
|
+
n[6] || (n[6] = h("div", { class: "section-title" }, "最近使用自定义颜色", -1)),
|
|
1175
|
+
h("div", io, [
|
|
1176
|
+
(S(!0), F(ie, null, se(d.value, (v) => (S(), F("div", {
|
|
1177
|
+
key: v,
|
|
1178
|
+
class: "swatch",
|
|
1179
|
+
style: oe({ background: v }),
|
|
1180
|
+
onClick: j((A) => y(v), ["stop"])
|
|
1181
|
+
}, null, 12, so))), 128))
|
|
1182
|
+
])
|
|
1183
|
+
])) : O("", !0),
|
|
1184
|
+
h("div", lo, [
|
|
1185
|
+
h("button", {
|
|
1186
|
+
class: "btn",
|
|
1187
|
+
onClick: j(g, ["stop"])
|
|
1188
|
+
}, "暂无"),
|
|
1189
|
+
h("button", {
|
|
1190
|
+
class: "btn",
|
|
1191
|
+
onClick: j(w, ["stop"])
|
|
1192
|
+
}, "更多颜色")
|
|
1193
|
+
]),
|
|
1194
|
+
s.value ? (S(), F("div", ro, [
|
|
1195
|
+
ge(h("input", {
|
|
1196
|
+
type: "color",
|
|
1197
|
+
"onUpdate:modelValue": n[1] || (n[1] = (v) => _.value = v)
|
|
1198
|
+
}, null, 512), [
|
|
1199
|
+
[we, _.value]
|
|
1200
|
+
]),
|
|
1201
|
+
ge(h("input", {
|
|
1202
|
+
class: "hex",
|
|
1203
|
+
"onUpdate:modelValue": n[2] || (n[2] = (v) => _.value = v)
|
|
1204
|
+
}, null, 512), [
|
|
1205
|
+
[we, _.value]
|
|
1206
|
+
]),
|
|
1207
|
+
h("button", {
|
|
1208
|
+
class: "btn apply",
|
|
1209
|
+
onClick: n[3] || (n[3] = j((v) => y(_.value), ["stop"]))
|
|
1210
|
+
}, "应用")
|
|
1211
|
+
])) : O("", !0)
|
|
1212
|
+
])) : O("", !0)
|
|
1213
|
+
]),
|
|
1214
|
+
_: 1
|
|
1215
|
+
})
|
|
1216
|
+
], 512));
|
|
1217
|
+
}
|
|
1218
|
+
}), co = /* @__PURE__ */ J(ao, [["__scopeId", "data-v-570f2a96"]]), uo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763479929532" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="52528" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M621.568 208.299a38.101 38.101 0 0 0-73.941-18.518L386.773 833.28a38.101 38.101 0 0 0 73.899 18.475l160.853-643.456zM325.632 294.4a38.101 38.101 0 0 1 0 53.888L162.347 511.573 325.632 674.86a38.101 38.101 0 0 1-53.845 53.888L81.493 538.539a38.101 38.101 0 0 1 0-53.931L271.787 294.4a38.101 38.101 0 0 1 53.888 0z m372.736 0a38.101 38.101 0 0 0 0 53.888l163.285 163.285L698.368 674.86a38.101 38.101 0 0 0 53.888 53.888l190.25-190.208a38.101 38.101 0 0 0 0-53.931L752.257 294.4a38.101 38.101 0 0 0-53.888 0z" fill="#333333" p-id="52529"></path></svg>', ho = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763480012496" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="54461" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M338.986667 59.413333h52.586666a21.333333 21.333333 0 0 1 21.333334 21.333334V115.84a21.333333 21.333333 0 0 1-21.333334 21.333333H356.266667c-36.48 0-53.76 20.16-53.76 62.4v188.16c0 59.52-27.84 99.84-82.56 120 54.72 23.04 82.56 62.4 82.56 120v189.12c0 40.32 17.28 61.44 53.76 61.44h35.306666a21.333333 21.333333 0 0 1 21.333334 21.333334v35.093333a21.333333 21.333333 0 0 1-21.333334 21.333333H338.986667c-42.24 0-74.88-14.4-97.92-41.28-21.12-24.96-31.68-59.52-31.68-101.76v-180.48c0-27.84-5.76-48-17.28-60.48-11.178667-12.778667-29.653333-20.245333-55.466667-23.488a18.901333 18.901333 0 0 1-16.533333-18.773333v-43.221333c0-10.005333 7.381333-18.474667 17.28-19.84 25.408-3.498667 43.648-11.456 54.72-23.317334 11.52-13.44 17.28-33.6 17.28-60.48V203.413333c0-43.2 10.56-77.76 31.68-102.72 23.04-27.84 55.68-41.28 97.92-41.28z m292.48 0h52.586666c42.24 0 74.88 13.44 97.92 41.28 21.12 24.96 31.68 59.52 31.68 102.72v179.52c0 26.88 5.76 48 18.24 61.44 10.24 11.029333 28.224 18.816 53.418667 22.314667 10.112 1.408 17.621333 10.026667 17.621333 20.245333v40.746667a21.333333 21.333333 0 0 1-18.88 21.184c-24.576 3.413333-42.282667 10.794667-53.12 23.189333-11.52 12.48-17.28 32.64-17.28 60.48v180.48c0 42.24-10.56 76.8-31.68 101.76-23.04 26.88-55.68 41.28-97.92 41.28H631.466667a21.333333 21.333333 0 0 1-21.333334-21.333333V899.626667a21.333333 21.333333 0 0 1 21.333334-21.333334h35.306666c35.52 0 53.76-21.12 53.76-61.44v-189.12c0-57.6 26.88-96.96 82.56-120-55.68-20.16-82.56-60.48-82.56-120v-188.16c0-42.24-18.24-62.4-53.76-62.4H631.466667a21.333333 21.333333 0 0 1-21.333334-21.333333V80.746667a21.333333 21.333333 0 0 1 21.333334-21.333334z" fill="#000000" p-id="54462"></path></svg>', vo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763473363174" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="28322" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M957.610667 507.434667L603.221333 158.293333a7.893333 7.893333 0 0 0-11.221333 0L353.28 393.386667a8.021333 8.021333 0 0 0-0.085333 11.306666l0.085333 0.128 40.021333 39.381334-117.205333 115.285333a8.021333 8.021333 0 0 0-0.085333 11.306667l0.085333 0.128 39.509333 38.869333-189.098666 187.008H72.106667a8.106667 8.106667 0 0 0-8.106667 8.021333v55.168c0 4.394667 3.584 8.021333 8.021333 8.021334H416.853333c2.133333 0 4.096-0.810667 5.589334-2.304l76.117333-75.605334 40.405333 39.808a7.936 7.936 0 0 0 11.178667 0l117.12-115.626666 40.106667 39.509333a7.893333 7.893333 0 0 0 11.178666 0l238.72-235.178667a7.68 7.68 0 0 0 0.298667-11.221333z m-567.808 288.853333H229.546667l134.4-133.034667 80.128 78.933334-54.314667 54.058666z m154.794666-62.122667l-171.392-168.917333 68.608-67.584 171.392 168.874667-68.608 67.626666z m168.533334-76.117333l-262.826667-258.901333 147.285333-145.066667 262.826667 258.986667-147.328 144.981333z" fill="#999999" p-id="28323"></path></svg>', fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763480451042" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="58395" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M938.666667 553.92V768c0 64.8-52.533333 117.333333-117.333334 117.333333H202.666667c-64.8 0-117.333333-52.533333-117.333334-117.333333V256c0-64.8 52.533333-117.333333 117.333334-117.333333h618.666666c64.8 0 117.333333 52.533333 117.333334 117.333333v297.92z m-64-74.624V256a53.333333 53.333333 0 0 0-53.333334-53.333333H202.666667a53.333333 53.333333 0 0 0-53.333334 53.333333v344.48A290.090667 290.090667 0 0 1 192 597.333333a286.88 286.88 0 0 1 183.296 65.845334C427.029333 528.384 556.906667 437.333333 704 437.333333c65.706667 0 126.997333 16.778667 170.666667 41.962667z m0 82.24c-5.333333-8.32-21.130667-21.653333-43.648-32.917333C796.768 511.488 753.045333 501.333333 704 501.333333c-121.770667 0-229.130667 76.266667-270.432 188.693334-2.730667 7.445333-7.402667 20.32-13.994667 38.581333-7.68 21.301333-34.453333 28.106667-51.370666 13.056-16.437333-14.634667-28.554667-25.066667-36.138667-31.146667A222.890667 222.890667 0 0 0 192 661.333333c-14.464 0-28.725333 1.365333-42.666667 4.053334V768a53.333333 53.333333 0 0 0 53.333334 53.333333h618.666666a53.333333 53.333333 0 0 0 53.333334-53.333333V561.525333zM320 480a96 96 0 1 1 0-192 96 96 0 0 1 0 192z m0-64a32 32 0 1 0 0-64 32 32 0 0 0 0 64z" fill="#000000" p-id="58396"></path></svg>', ko = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763480387136" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="57289" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M213.972 214.906l0.934-0.934c27.606-27.606 68.674-30.581 92.168-7.087l225.23 225.23c29.72-40.254 30.733-93.311-0.599-124.643L345.639 121.406c-35.132-35.132-97.076-30.148-138.356 11.132l-74.744 74.744c-41.28 41.28-46.264 103.224-11.132 138.356l186.065 186.065c31.332 31.332 84.389 30.319 124.643 0.599l-225.23-225.23c-23.494-23.492-20.519-64.56 7.087-92.166zM808.745 809.679l0.934-0.934c27.606-27.606 31.18-68.074 7.686-91.568l-225.23-225.23c40.254-29.72 93.311-30.733 124.643 0.599l186.065 186.065c35.132 35.132 29.548 96.477-11.732 137.757l-74.744 74.744c-41.28 41.28-102.625 46.863-137.757 11.732L492.546 716.779c-31.332-31.332-31.909-82.799-0.599-124.643l225.23 225.23c23.494 23.494 63.962 19.92 91.568-7.687z" fill="#666666" p-id="57290"></path><path d="M627.123 628.713c-12.296 12.296-32.232 12.296-44.528 0L394.938 441.057c-12.296-12.296-12.296-32.232 0-44.528s32.232-12.296 44.528 0l187.656 187.656c12.297 12.296 12.297 32.232 0.001 44.528z" fill="#666666" p-id="57291"></path></svg>', po = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763480239307" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="56277" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M849.6 231v109.5c-46.4 14.9-84.6 41.5-114.4 81.3-29.9 36.5-44.8 76.3-43.1 116.1 8.3-5 21.6-6.6 41.5-6.6 34.8 0 64.7 11.6 91.2 36.5 23.2 24.9 36.5 56.4 36.5 94.5S848 732 821.5 756.8C795 780 761.8 793.3 722 793.3c-46.4 0-82.9-19.9-112.8-56.4s-43.1-84.6-43.1-141c0-89.6 24.9-165.8 76.3-230.5C692 299 761.7 254.2 849.6 231z m-403 0v109.5c-46.4 14.9-82.9 41.5-112.8 81.3-31.5 36.5-46.4 76.3-44.8 116.1 8.3-5 21.6-6.6 41.5-6.6 34.8 0 64.7 11.6 89.6 36.5 24.9 24.9 38.1 56.4 38.1 94.5s-13.3 69.7-38.1 94.5c-26.5 23.2-61.4 36.5-101.2 36.5-46.4 0-82.9-19.9-111.1-56.4-29.9-36.5-44.8-84.6-44.8-141 0-89.6 24.9-165.8 76.3-230.5C289 299 358.7 254.2 446.6 231z" p-id="56278"></path></svg>', mo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763480808376" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="61532" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M959.825 384.002V191.94c0-70.692-57.308-128-128-128H191.94c-70.692 0-128 57.308-128 128v639.885c0 70.692 57.308 128 128 128h639.885c70.692 0 128-57.308 128-128V384.002z m-813.16-237.337a63.738 63.738 0 0 1 45.336-18.785H832a63.962 63.962 0 0 1 63.886 64.121v128.061H127.88v-128.06a63.738 63.738 0 0 1 18.785-45.337z m269.127 461.308v-223.97h192.181v223.97H415.792z m192.181 63.94v223.972H415.792V671.914h192.181z m-256.121-63.94H127.88v-223.97h223.972v223.97zM146.665 877.21a63.467 63.467 0 0 1-18.785-45.21V671.914h223.972v223.97h-159.85a63.626 63.626 0 0 1-45.337-18.675z m749.22-45.21a63.763 63.763 0 0 1-63.886 63.886H671.914V671.914h223.97v160.085z m0-224.026H671.914v-223.97h223.97v223.97z" p-id="61533"></path></svg>', go = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763480994147" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="73821" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M933.529779 1022.701142H87.673207c-48.357498 0-87.523075-39.165577-87.523075-87.523076V1.798419h729.259049c48.357498 0 87.523075 39.165577 87.523076 87.523076v320.818031h204.220509V935.178066c-0.099912 48.357498-39.265489 87.523075-87.622987 87.523076z m-175.046151-904.205289c0-32.171724-26.077081-58.348717-58.348717-58.348717H58.498849v845.856572c0 32.171724 26.077081 58.348717 58.348717 58.348717h583.387257c32.171724 0 58.348717-26.077081 58.348717-58.348717V118.495853zM962.704137 468.588155h-145.871792v495.864182h87.523075c32.171724 0 58.348717-26.077081 58.348717-58.348717V468.588155z m-729.25905 0h379.166748v58.348717H233.445087V468.588155z m0-233.394868h379.166748v58.348717H233.445087v-58.348717z m262.569227 525.03854H233.445087v-58.348716h262.469314v58.348716z m0 0" p-id="73822"></path></svg>', wo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763477549677" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="31202" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M828.6 75C889.572 75 939 124.428 939 185.4v676.2c0 60.972-49.428 110.4-110.4 110.4H152.4C91.428 972 42 922.572 42 861.6V185.4C42 124.428 91.428 75 152.4 75z m0 59.8H152.4c-27.946 0-50.6 22.654-50.6 50.6v676.2c0 27.946 22.654 50.6 50.6 50.6h676.2c27.946 0 50.6-22.654 50.6-50.6V185.4c0-27.946-22.654-50.6-50.6-50.6z m-20.56 167.48c11.48 11.504 11.641 30.022 0.502 41.725l-0.548 0.56L477.473 674.37c-11.251 11.227-29.274 11.663-41.05 1.123l-0.574-0.527L260.695 509.93c-12.018-11.325-12.581-30.248-1.257-42.266 11.145-11.828 29.65-12.56 41.69-1.788l0.577 0.53L455.756 611.56l310-309.325c11.689-11.664 30.62-11.644 42.284 0.045z" fill="#333333" p-id="31203"></path></svg>', Co = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1763480631673" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="60480" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M960 192h-28.384c-16.8 0-32.928 6.624-44.928 18.432L800 295.936V256a96 96 0 0 0-96-96H96C43.072 160 0 203.04 0 256v512a96 96 0 0 0 96 96h608c52.992 0 96-43.008 96-96v-39.072l86.688 85.504c12 11.808 28.128 18.432 44.928 18.432H960a64 64 0 0 0 64-64V256a64 64 0 0 0-64-64zM96 800c-17.664 0-32-14.368-32-32V256a32 32 0 0 1 32-32h608c17.632 0 32 14.336 32 32v512c0 17.632-14.368 32-32 32H96z m864-31.136h-32l-128-128V640l-32-32v-192l160-160h32v512.864z" fill="#333333" p-id="60481"></path></svg>', bo = ["innerHTML"], yo = /* @__PURE__ */ K({
|
|
1219
|
+
__name: "SvgIcon",
|
|
1220
|
+
props: {
|
|
1221
|
+
name: {},
|
|
1222
|
+
color: {},
|
|
1223
|
+
size: {}
|
|
1224
|
+
},
|
|
1225
|
+
setup(e) {
|
|
1226
|
+
const r = e, o = Qe(), t = /* @__PURE__ */ Object.assign({
|
|
1227
|
+
"/src/svg/code.svg": uo,
|
|
1228
|
+
"/src/svg/codeBlock.svg": ho,
|
|
1229
|
+
"/src/svg/highBg.svg": vo,
|
|
1230
|
+
"/src/svg/img.svg": fo,
|
|
1231
|
+
"/src/svg/link.svg": ko,
|
|
1232
|
+
"/src/svg/quote.svg": po,
|
|
1233
|
+
"/src/svg/table.svg": mo,
|
|
1234
|
+
"/src/svg/tableTools.svg": go,
|
|
1235
|
+
"/src/svg/task.svg": wo,
|
|
1236
|
+
"/src/svg/video.svg": Co
|
|
1237
|
+
}), s = (() => {
|
|
1238
|
+
const k = {};
|
|
1239
|
+
return Object.entries(t).forEach(([w, y]) => {
|
|
1240
|
+
const a = (w.split("/src/svg/")[1] || w).replace(/\.svg$/i, "");
|
|
1241
|
+
k[a] = y;
|
|
1242
|
+
const u = a.split("/").pop();
|
|
1243
|
+
u && (k[u] = y);
|
|
1244
|
+
}), k;
|
|
1245
|
+
})(), f = de(() => {
|
|
1246
|
+
const k = r.name.replace(/\.svg$/i, "");
|
|
1247
|
+
return s[k] || "";
|
|
1248
|
+
});
|
|
1249
|
+
function _(k) {
|
|
1250
|
+
if (!k) return "";
|
|
1251
|
+
let w = k.replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<!DOCTYPE[\s\S]*?>/gi, "");
|
|
1252
|
+
return w = w.replace(/<svg([^>]*)>/i, (y, g) => `<svg${g.replace(/\s(width|height)="[^"]*"/gi, "").replace(/\s(fill|stroke)="[^"]*"/gi, "")} width="1em" height="1em" preserveAspectRatio="xMidYMid meet">`), w = w.replace(/fill="(?!none)[^"]*"/gi, 'fill="currentColor"'), w = w.replace(/stroke="(?!none)[^"]*"/gi, 'stroke="currentColor"'), w;
|
|
1253
|
+
}
|
|
1254
|
+
const d = de(() => _(f.value));
|
|
1255
|
+
function L(k) {
|
|
1256
|
+
if (k != null)
|
|
1257
|
+
return typeof k == "number" ? `${k}px` : k;
|
|
1258
|
+
}
|
|
1259
|
+
const b = de(() => {
|
|
1260
|
+
const k = {}, w = L(r.size);
|
|
1261
|
+
w && (k.fontSize = w), r.color && (k.color = r.color);
|
|
1262
|
+
const y = o.style ?? void 0;
|
|
1263
|
+
return [k, y].filter(Boolean);
|
|
1264
|
+
});
|
|
1265
|
+
return (k, w) => (S(), F("span", {
|
|
1266
|
+
class: N(["svg-icon", z(o).class]),
|
|
1267
|
+
style: oe(b.value),
|
|
1268
|
+
innerHTML: d.value
|
|
1269
|
+
}, null, 14, bo));
|
|
1270
|
+
}
|
|
1271
|
+
}), he = /* @__PURE__ */ J(yo, [["__scopeId", "data-v-c83ef2e3"]]), xo = ["aria-expanded"], Lo = {
|
|
1272
|
+
key: 0,
|
|
1273
|
+
class: "dropdown"
|
|
1274
|
+
}, _o = { class: "section" }, Mo = { class: "swatches" }, $o = { class: "section" }, zo = { class: "swatches" }, So = ["onClick"], To = {
|
|
1275
|
+
key: 0,
|
|
1276
|
+
class: "check"
|
|
1277
|
+
}, Fo = { class: "section" }, jo = { class: "swatches grid" }, Ho = ["onClick"], Ao = {
|
|
1278
|
+
key: 0,
|
|
1279
|
+
class: "section"
|
|
1280
|
+
}, Bo = { class: "swatches" }, Eo = ["onClick"], Do = { class: "section inline-actions" }, Uo = {
|
|
1281
|
+
key: 1,
|
|
1282
|
+
class: "advanced"
|
|
1283
|
+
}, Ue = "md-toolbar-dropdown-open", Ne = "bg-color-select", Wo = /* @__PURE__ */ K({
|
|
1284
|
+
__name: "index",
|
|
1285
|
+
props: {
|
|
1286
|
+
editor: {},
|
|
1287
|
+
currentBg: {}
|
|
1288
|
+
},
|
|
1289
|
+
setup(e) {
|
|
1290
|
+
const r = e, o = [
|
|
1291
|
+
"#000000",
|
|
1292
|
+
"#262626",
|
|
1293
|
+
"#595959",
|
|
1294
|
+
"#8C8C8C",
|
|
1295
|
+
"#BFBFBF",
|
|
1296
|
+
"#D9D9D9",
|
|
1297
|
+
"#E9E9E9",
|
|
1298
|
+
"#F5F5F5",
|
|
1299
|
+
"#FFFFFF",
|
|
1300
|
+
"#F5222D",
|
|
1301
|
+
"#FA541C",
|
|
1302
|
+
"#FA8C16",
|
|
1303
|
+
"#FADB14",
|
|
1304
|
+
"#52C41A",
|
|
1305
|
+
"#13C2C2",
|
|
1306
|
+
"#1677FF",
|
|
1307
|
+
"#2F54EB",
|
|
1308
|
+
"#722ED1",
|
|
1309
|
+
"#EB2F96",
|
|
1310
|
+
"#FF4D4F",
|
|
1311
|
+
"#FF7A45",
|
|
1312
|
+
"#FFA940",
|
|
1313
|
+
"#FFD666",
|
|
1314
|
+
"#73D13D",
|
|
1315
|
+
"#36CFC9",
|
|
1316
|
+
"#69C0FF",
|
|
1317
|
+
"#85A5FF",
|
|
1318
|
+
"#B37FEB",
|
|
1319
|
+
"#F759AB"
|
|
1320
|
+
], t = H(!1), s = H(!1), f = H(null), _ = H(r.currentBg || "#ffffff"), d = H(c()), L = H("#FADB14");
|
|
1321
|
+
function b() {
|
|
1322
|
+
t.value || window.dispatchEvent(new CustomEvent(Ue, { detail: { id: Ne } })), t.value = !t.value;
|
|
1323
|
+
}
|
|
1324
|
+
function k() {
|
|
1325
|
+
t.value = !1;
|
|
1326
|
+
}
|
|
1327
|
+
function w() {
|
|
1328
|
+
s.value = !s.value;
|
|
1329
|
+
}
|
|
1330
|
+
function y(i) {
|
|
1331
|
+
var n;
|
|
1332
|
+
(n = r.editor) == null || n.chain().focus().setMark("textStyle", { backgroundColor: i }).run(), L.value = i, x(i), k();
|
|
1333
|
+
}
|
|
1334
|
+
function g() {
|
|
1335
|
+
var i;
|
|
1336
|
+
(i = r.editor) == null || i.chain().focus().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run(), k();
|
|
1337
|
+
}
|
|
1338
|
+
function a(i) {
|
|
1339
|
+
const n = i.target, v = f.value;
|
|
1340
|
+
v && !v.contains(n) && k();
|
|
1341
|
+
}
|
|
1342
|
+
function u() {
|
|
1343
|
+
}
|
|
1344
|
+
function c() {
|
|
1345
|
+
try {
|
|
1346
|
+
const i = localStorage.getItem("md_bg_recent");
|
|
1347
|
+
if (!i) return [];
|
|
1348
|
+
const n = JSON.parse(i);
|
|
1349
|
+
return Array.isArray(n) ? n.slice(0, 12) : [];
|
|
1350
|
+
} catch {
|
|
1351
|
+
return [];
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
function x(i) {
|
|
1355
|
+
const n = [i, ...d.value.filter((v) => v !== i)];
|
|
1356
|
+
d.value = n.slice(0, 12);
|
|
1357
|
+
try {
|
|
1358
|
+
localStorage.setItem("md_bg_recent", JSON.stringify(d.value));
|
|
1359
|
+
} catch {
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
let m = [];
|
|
1363
|
+
function T() {
|
|
1364
|
+
const i = r.editor;
|
|
1365
|
+
i && (m = [
|
|
1366
|
+
{ event: "selectionUpdate", handler: u },
|
|
1367
|
+
{ event: "transaction", handler: u },
|
|
1368
|
+
{ event: "update", handler: u }
|
|
1369
|
+
], m.forEach(({ event: n, handler: v }) => {
|
|
1370
|
+
i.on(n, v);
|
|
1371
|
+
}));
|
|
1372
|
+
}
|
|
1373
|
+
ue(() => {
|
|
1374
|
+
document.addEventListener("click", a), window.addEventListener(Ue, M), T();
|
|
1375
|
+
}), ve(() => {
|
|
1376
|
+
document.removeEventListener("click", a), window.removeEventListener(Ue, M);
|
|
1377
|
+
const i = r.editor;
|
|
1378
|
+
i && m.forEach(({ event: n, handler: v }) => {
|
|
1379
|
+
i.off(n, v);
|
|
1380
|
+
}), m = [];
|
|
1381
|
+
}), be(
|
|
1382
|
+
() => r.editor,
|
|
1383
|
+
(i, n) => {
|
|
1384
|
+
n && m.forEach(({ event: v, handler: A }) => {
|
|
1385
|
+
n.off(v, A);
|
|
1386
|
+
}), m = [], T();
|
|
1387
|
+
}
|
|
1388
|
+
);
|
|
1389
|
+
function M(i) {
|
|
1390
|
+
var v;
|
|
1391
|
+
((v = i.detail) == null ? void 0 : v.id) !== Ne && (t.value = !1);
|
|
1392
|
+
}
|
|
1393
|
+
return (i, n) => (S(), F("div", {
|
|
1394
|
+
class: "bg-color-select",
|
|
1395
|
+
ref_key: "rootRef",
|
|
1396
|
+
ref: f
|
|
1397
|
+
}, [
|
|
1398
|
+
h("div", {
|
|
1399
|
+
class: "icon icon-dropdown",
|
|
1400
|
+
"aria-expanded": t.value
|
|
1401
|
+
}, [
|
|
1402
|
+
h("div", {
|
|
1403
|
+
class: "icon-stack hoverable",
|
|
1404
|
+
onClick: n[0] || (n[0] = j((v) => y(L.value), ["stop"]))
|
|
1405
|
+
}, [
|
|
1406
|
+
l(he, {
|
|
1407
|
+
name: "highBg",
|
|
1408
|
+
size: 18
|
|
1409
|
+
}),
|
|
1410
|
+
h("div", {
|
|
1411
|
+
class: "underline",
|
|
1412
|
+
style: oe({ background: L.value })
|
|
1413
|
+
}, null, 4)
|
|
1414
|
+
]),
|
|
1415
|
+
h("div", {
|
|
1416
|
+
class: "arrow hoverable",
|
|
1417
|
+
onClick: j(b, ["stop"])
|
|
1418
|
+
}, [
|
|
1419
|
+
l(z(Fe), {
|
|
1420
|
+
theme: "filled",
|
|
1421
|
+
strokeWidth: 3,
|
|
1422
|
+
size: "12"
|
|
1423
|
+
})
|
|
1424
|
+
])
|
|
1425
|
+
], 8, xo),
|
|
1426
|
+
l(Ce, { name: "dropdown-slide" }, {
|
|
1427
|
+
default: P(() => [
|
|
1428
|
+
t.value ? (S(), F("div", Lo, [
|
|
1429
|
+
h("div", _o, [
|
|
1430
|
+
n[4] || (n[4] = h("div", { class: "section-title" }, "无填充色", -1)),
|
|
1431
|
+
h("div", Mo, [
|
|
1432
|
+
h("div", {
|
|
1433
|
+
class: "swatch",
|
|
1434
|
+
style: { background: `linear-gradient(
|
|
1435
|
+
45deg,
|
|
1436
|
+
#fff 45%,
|
|
1437
|
+
transparent 45%,
|
|
1438
|
+
transparent 55%,
|
|
1439
|
+
#fff 55%
|
|
1440
|
+
)`, border: "1px dashed #ccc" },
|
|
1441
|
+
onClick: j(g, ["stop"])
|
|
1442
|
+
})
|
|
1443
|
+
])
|
|
1444
|
+
]),
|
|
1445
|
+
h("div", $o, [
|
|
1446
|
+
n[5] || (n[5] = h("div", { class: "section-title" }, "默认", -1)),
|
|
1447
|
+
h("div", zo, [
|
|
1448
|
+
(S(!0), F(ie, null, se(o.slice(0, 9), (v) => (S(), F("div", {
|
|
1449
|
+
key: v,
|
|
1450
|
+
class: "swatch",
|
|
1451
|
+
style: oe({ background: v }),
|
|
1452
|
+
onClick: j((A) => y(v), ["stop"])
|
|
1453
|
+
}, [
|
|
1454
|
+
v === L.value ? (S(), F("span", To, "✓")) : O("", !0)
|
|
1455
|
+
], 12, So))), 128))
|
|
1456
|
+
])
|
|
1457
|
+
]),
|
|
1458
|
+
h("div", Fo, [
|
|
1459
|
+
n[6] || (n[6] = h("div", { class: "section-title" }, "常用颜色", -1)),
|
|
1460
|
+
h("div", jo, [
|
|
1461
|
+
(S(!0), F(ie, null, se(o.slice(9), (v) => (S(), F("div", {
|
|
1462
|
+
key: v,
|
|
1463
|
+
class: "swatch",
|
|
1464
|
+
style: oe({ background: v }),
|
|
1465
|
+
onClick: j((A) => y(v), ["stop"])
|
|
1466
|
+
}, [
|
|
1467
|
+
v === L.value ? (S(), ye(z(ze), {
|
|
1468
|
+
key: 0,
|
|
1469
|
+
theme: "filled",
|
|
1470
|
+
strokeWidth: 3
|
|
1471
|
+
})) : O("", !0)
|
|
1472
|
+
], 12, Ho))), 128))
|
|
1473
|
+
])
|
|
1474
|
+
]),
|
|
1475
|
+
d.value.length ? (S(), F("div", Ao, [
|
|
1476
|
+
n[7] || (n[7] = h("div", { class: "section-title" }, "最近使用自定义颜色", -1)),
|
|
1477
|
+
h("div", Bo, [
|
|
1478
|
+
(S(!0), F(ie, null, se(d.value, (v) => (S(), F("div", {
|
|
1479
|
+
key: v,
|
|
1480
|
+
class: "swatch",
|
|
1481
|
+
style: oe({ background: v }),
|
|
1482
|
+
onClick: j((A) => y(v), ["stop"])
|
|
1483
|
+
}, null, 12, Eo))), 128))
|
|
1484
|
+
])
|
|
1485
|
+
])) : O("", !0),
|
|
1486
|
+
h("div", Do, [
|
|
1487
|
+
h("button", {
|
|
1488
|
+
class: "btn",
|
|
1489
|
+
onClick: j(g, ["stop"])
|
|
1490
|
+
}, "暂无"),
|
|
1491
|
+
h("button", {
|
|
1492
|
+
class: "btn",
|
|
1493
|
+
onClick: j(w, ["stop"])
|
|
1494
|
+
}, "更多颜色")
|
|
1495
|
+
]),
|
|
1496
|
+
s.value ? (S(), F("div", Uo, [
|
|
1497
|
+
ge(h("input", {
|
|
1498
|
+
type: "color",
|
|
1499
|
+
"onUpdate:modelValue": n[1] || (n[1] = (v) => _.value = v)
|
|
1500
|
+
}, null, 512), [
|
|
1501
|
+
[we, _.value]
|
|
1502
|
+
]),
|
|
1503
|
+
ge(h("input", {
|
|
1504
|
+
class: "hex",
|
|
1505
|
+
"onUpdate:modelValue": n[2] || (n[2] = (v) => _.value = v)
|
|
1506
|
+
}, null, 512), [
|
|
1507
|
+
[we, _.value]
|
|
1508
|
+
]),
|
|
1509
|
+
h("button", {
|
|
1510
|
+
class: "btn apply",
|
|
1511
|
+
onClick: n[3] || (n[3] = j((v) => y(_.value), ["stop"]))
|
|
1512
|
+
}, "应用")
|
|
1513
|
+
])) : O("", !0)
|
|
1514
|
+
])) : O("", !0)
|
|
1515
|
+
]),
|
|
1516
|
+
_: 1
|
|
1517
|
+
})
|
|
1518
|
+
], 512));
|
|
1519
|
+
}
|
|
1520
|
+
}), Vo = /* @__PURE__ */ J(Wo, [["__scopeId", "data-v-5ec8a99f"]]), Io = { class: "image-actions" }, Oo = ["aria-disabled", "disabled"], Ro = /* @__PURE__ */ K({
|
|
1521
|
+
__name: "index",
|
|
1522
|
+
props: {
|
|
1523
|
+
editor: {},
|
|
1524
|
+
imageUploader: { type: Function },
|
|
1525
|
+
uploadSizeLimit: {}
|
|
1526
|
+
},
|
|
1527
|
+
setup(e) {
|
|
1528
|
+
const r = e, o = H(!1), t = H(""), s = H(!1), f = H(null), _ = () => {
|
|
1529
|
+
o.value = !o.value;
|
|
1530
|
+
}, d = () => {
|
|
1531
|
+
var a, u, c, x, m, T;
|
|
1532
|
+
const g = t.value.trim();
|
|
1533
|
+
g && ((T = (m = ((x = (u = (a = r.editor) == null ? void 0 : a.chain) == null ? void 0 : (c = u.call(a)).focus) == null ? void 0 : x.call(c)).setImage({ src: g })).run) == null || T.call(m), o.value = !1, t.value = "");
|
|
1534
|
+
}, L = (g) => {
|
|
1535
|
+
g.key === "Enter" && d(), g.key === "Escape" && (o.value = !1, t.value = "");
|
|
1536
|
+
}, b = () => {
|
|
1537
|
+
var g;
|
|
1538
|
+
r.imageUploader && ((g = f.value) == null || g.click());
|
|
1539
|
+
}, k = async (g) => {
|
|
1540
|
+
var x, m, T, M, i, n, v, A;
|
|
1541
|
+
const a = g.target, u = (x = a.files) == null ? void 0 : x[0];
|
|
1542
|
+
if (a.value = "", !u || !r.imageUploader) return;
|
|
1543
|
+
const c = (m = r.uploadSizeLimit) == null ? void 0 : m.image;
|
|
1544
|
+
if (typeof c == "number" && c > 0) {
|
|
1545
|
+
const W = Math.max(1, c) * 1024 * 1024;
|
|
1546
|
+
if (u.size > W) {
|
|
1547
|
+
try {
|
|
1548
|
+
window.alert(`图片文件大小超限(${(u.size / 1024 / 1024).toFixed(2)}MB > ${c}MB)`);
|
|
1549
|
+
} catch {
|
|
1550
|
+
}
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
try {
|
|
1555
|
+
s.value = !0;
|
|
1556
|
+
let W = null;
|
|
1557
|
+
W = URL.createObjectURL(u), (A = (v = ((n = (M = (T = r.editor) == null ? void 0 : T.chain) == null ? void 0 : (i = M.call(T)).focus) == null ? void 0 : n.call(i)).setImage({ src: W, uploading: !0 })).run) == null || A.call(v);
|
|
1558
|
+
const V = await r.imageUploader(u);
|
|
1559
|
+
if (typeof V == "string" && V) {
|
|
1560
|
+
const X = r.editor, { state: G } = X, { doc: Q } = G;
|
|
1561
|
+
let fe = null;
|
|
1562
|
+
if (Q.descendants((ee, ae) => {
|
|
1563
|
+
var le, xe;
|
|
1564
|
+
return ((le = ee == null ? void 0 : ee.type) == null ? void 0 : le.name) === "image" && ((xe = ee == null ? void 0 : ee.attrs) == null ? void 0 : xe.src) === W ? (fe = ae, !1) : !0;
|
|
1565
|
+
}), fe != null) {
|
|
1566
|
+
const ee = Q.nodeAt(fe), ae = G.schema.nodes.image;
|
|
1567
|
+
if (ee && ae) {
|
|
1568
|
+
const le = { ...ee.attrs || {}, src: V, uploading: null }, xe = G.tr.setNodeMarkup(fe, ae, le, ee.marks);
|
|
1569
|
+
X.view.dispatch(xe);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
o.value = !1, t.value = "";
|
|
1573
|
+
}
|
|
1574
|
+
} finally {
|
|
1575
|
+
s.value = !1;
|
|
1576
|
+
try {
|
|
1577
|
+
objectUrl && URL.revokeObjectURL(objectUrl);
|
|
1578
|
+
} catch {
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
}, w = H(null);
|
|
1582
|
+
let y = null;
|
|
1583
|
+
return ue(() => {
|
|
1584
|
+
y = (g) => {
|
|
1585
|
+
if (!o.value) return;
|
|
1586
|
+
const a = w.value, u = g.target;
|
|
1587
|
+
a && u && !a.contains(u) && (o.value = !1);
|
|
1588
|
+
}, document.addEventListener("mousedown", y, !0);
|
|
1589
|
+
}), ve(() => {
|
|
1590
|
+
y && (document.removeEventListener("mousedown", y, !0), y = null);
|
|
1591
|
+
}), (g, a) => (S(), F("div", {
|
|
1592
|
+
class: "icon image-icon",
|
|
1593
|
+
onClick: _,
|
|
1594
|
+
ref_key: "rootRef",
|
|
1595
|
+
ref: w
|
|
1596
|
+
}, [
|
|
1597
|
+
l(he, {
|
|
1598
|
+
name: "img",
|
|
1599
|
+
size: 18
|
|
1600
|
+
}),
|
|
1601
|
+
l(Ce, {
|
|
1602
|
+
name: "img-panel",
|
|
1603
|
+
appear: ""
|
|
1604
|
+
}, {
|
|
1605
|
+
default: P(() => [
|
|
1606
|
+
o.value ? (S(), F("div", {
|
|
1607
|
+
key: 0,
|
|
1608
|
+
class: "image-input-panel",
|
|
1609
|
+
onClick: a[1] || (a[1] = j(() => {
|
|
1610
|
+
}, ["stop"]))
|
|
1611
|
+
}, [
|
|
1612
|
+
ge(h("input", {
|
|
1613
|
+
class: "image-input",
|
|
1614
|
+
type: "text",
|
|
1615
|
+
placeholder: "粘贴图片链接(png/jpg/webp/svg 等)",
|
|
1616
|
+
"onUpdate:modelValue": a[0] || (a[0] = (u) => t.value = u),
|
|
1617
|
+
onKeydown: L
|
|
1618
|
+
}, null, 544), [
|
|
1619
|
+
[we, t.value]
|
|
1620
|
+
]),
|
|
1621
|
+
h("input", {
|
|
1622
|
+
ref_key: "imageUploadInput",
|
|
1623
|
+
ref: f,
|
|
1624
|
+
type: "file",
|
|
1625
|
+
accept: "image/*",
|
|
1626
|
+
style: { display: "none" },
|
|
1627
|
+
onChange: k
|
|
1628
|
+
}, null, 544),
|
|
1629
|
+
h("div", Io, [
|
|
1630
|
+
h("button", {
|
|
1631
|
+
class: "btn btn-primary",
|
|
1632
|
+
onClick: j(d, ["stop"])
|
|
1633
|
+
}, "插入"),
|
|
1634
|
+
h("button", {
|
|
1635
|
+
class: "btn",
|
|
1636
|
+
"aria-disabled": !r.imageUploader || s.value,
|
|
1637
|
+
disabled: !r.imageUploader || s.value,
|
|
1638
|
+
onClick: j(b, ["stop"])
|
|
1639
|
+
}, re(s.value ? "上传中…" : "上传文件"), 9, Oo)
|
|
1640
|
+
])
|
|
1641
|
+
])) : O("", !0)
|
|
1642
|
+
]),
|
|
1643
|
+
_: 1
|
|
1644
|
+
})
|
|
1645
|
+
], 512));
|
|
1646
|
+
}
|
|
1647
|
+
}), No = /* @__PURE__ */ J(Ro, [["__scopeId", "data-v-3208357f"]]), Po = { class: "video-actions" }, Go = ["aria-disabled", "disabled"], Yo = /* @__PURE__ */ K({
|
|
1648
|
+
__name: "index",
|
|
1649
|
+
props: {
|
|
1650
|
+
editor: {},
|
|
1651
|
+
videoUploader: { type: Function },
|
|
1652
|
+
uploadSizeLimit: {}
|
|
1653
|
+
},
|
|
1654
|
+
setup(e) {
|
|
1655
|
+
const r = e, o = H(!1), t = H(""), s = H(!1), f = H(null), _ = () => {
|
|
1656
|
+
o.value = !o.value;
|
|
1657
|
+
}, d = () => {
|
|
1658
|
+
const a = t.value.trim();
|
|
1659
|
+
if (!a) return;
|
|
1660
|
+
const u = r.editor, c = u == null ? void 0 : u.commands;
|
|
1661
|
+
if (/youtube\.com|youtu\.be|youtube-nocookie\.com/i.test(a)) {
|
|
1662
|
+
const m = String(a).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1663
|
+
try {
|
|
1664
|
+
u.chain().focus().insertContent(
|
|
1665
|
+
`<p><a href="${m}" target="_blank" rel="noopener noreferrer">${m}</a></p>`
|
|
1666
|
+
).run();
|
|
1667
|
+
} catch {
|
|
1668
|
+
u.chain().focus().insertContent(m).run();
|
|
1669
|
+
}
|
|
1670
|
+
} else if (typeof (c == null ? void 0 : c.setVideo) == "function")
|
|
1671
|
+
u.chain().focus().setVideo({ src: a, HTMLAttributes: { controls: !0, width: 640 } }).run();
|
|
1672
|
+
else {
|
|
1673
|
+
const m = String(a).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1674
|
+
try {
|
|
1675
|
+
u.chain().focus().insertContent(
|
|
1676
|
+
`<p><a href="${m}" target="_blank" rel="noopener noreferrer">${m}</a></p>`
|
|
1677
|
+
).run();
|
|
1678
|
+
} catch {
|
|
1679
|
+
u.chain().focus().insertContent(m).run();
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
o.value = !1, t.value = "";
|
|
1683
|
+
}, L = (a) => {
|
|
1684
|
+
a.key === "Enter" && d(), a.key === "Escape" && (o.value = !1, t.value = "");
|
|
1685
|
+
}, b = () => {
|
|
1686
|
+
var a;
|
|
1687
|
+
r.videoUploader && ((a = f.value) == null || a.click());
|
|
1688
|
+
}, k = async (a) => {
|
|
1689
|
+
var T, M;
|
|
1690
|
+
const u = a.target, c = (T = u.files) == null ? void 0 : T[0];
|
|
1691
|
+
if (u.value = "", !c || !r.videoUploader) return;
|
|
1692
|
+
const x = (M = r.uploadSizeLimit) == null ? void 0 : M.video;
|
|
1693
|
+
if (typeof x == "number" && x > 0) {
|
|
1694
|
+
const i = Math.max(1, x) * 1024 * 1024;
|
|
1695
|
+
if (c.size > i) {
|
|
1696
|
+
try {
|
|
1697
|
+
window.alert(`视频文件大小超限(${(c.size / 1024 / 1024).toFixed(2)}MB > ${x}MB)`);
|
|
1698
|
+
} catch {
|
|
1699
|
+
}
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
let m = null;
|
|
1704
|
+
try {
|
|
1705
|
+
s.value = !0;
|
|
1706
|
+
const i = r.editor, n = i == null ? void 0 : i.commands;
|
|
1707
|
+
m = URL.createObjectURL(c);
|
|
1708
|
+
try {
|
|
1709
|
+
if (typeof (n == null ? void 0 : n.setVideo) == "function")
|
|
1710
|
+
i.chain().focus().setVideo({
|
|
1711
|
+
src: m,
|
|
1712
|
+
HTMLAttributes: { controls: !0, width: 640, uploading: !0 }
|
|
1713
|
+
}).run();
|
|
1714
|
+
else {
|
|
1715
|
+
const A = String(m).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1716
|
+
try {
|
|
1717
|
+
i.chain().focus().insertContent(
|
|
1718
|
+
`<p><a href="${A}" target="_blank" rel="noopener noreferrer">${A}</a></p>`
|
|
1719
|
+
).run();
|
|
1720
|
+
} catch {
|
|
1721
|
+
i.chain().focus().insertContent(A).run();
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
} catch {
|
|
1725
|
+
}
|
|
1726
|
+
const v = await r.videoUploader(c);
|
|
1727
|
+
m && w(m, v), o.value = !1, t.value = "";
|
|
1728
|
+
} finally {
|
|
1729
|
+
s.value = !1;
|
|
1730
|
+
try {
|
|
1731
|
+
m && URL.revokeObjectURL(m);
|
|
1732
|
+
} catch {
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
function w(a, u) {
|
|
1737
|
+
const c = r.editor;
|
|
1738
|
+
if (!c) return;
|
|
1739
|
+
const { state: x } = c, { doc: m } = x;
|
|
1740
|
+
let T = null;
|
|
1741
|
+
if (m.descendants((M, i) => {
|
|
1742
|
+
var n, v;
|
|
1743
|
+
return ((n = M.type) == null ? void 0 : n.name) === "video" && ((v = M.attrs) == null ? void 0 : v.src) === a ? (T = i, !1) : !0;
|
|
1744
|
+
}), T != null) {
|
|
1745
|
+
const M = m.nodeAt(T), i = x.schema.nodes.video;
|
|
1746
|
+
if (!M || !i) return;
|
|
1747
|
+
const n = { ...M.attrs || {}, src: u, uploading: null }, v = x.tr.setNodeMarkup(T, i, n, M.marks);
|
|
1748
|
+
c.view.dispatch(v);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
const y = H(null);
|
|
1752
|
+
let g = null;
|
|
1753
|
+
return ue(() => {
|
|
1754
|
+
g = (a) => {
|
|
1755
|
+
if (!o.value) return;
|
|
1756
|
+
const u = y.value, c = a.target;
|
|
1757
|
+
u && c && !u.contains(c) && (o.value = !1);
|
|
1758
|
+
}, document.addEventListener("mousedown", g, !0);
|
|
1759
|
+
}), ve(() => {
|
|
1760
|
+
g && (document.removeEventListener("mousedown", g, !0), g = null);
|
|
1761
|
+
}), (a, u) => (S(), F("div", {
|
|
1762
|
+
class: "icon video-icon",
|
|
1763
|
+
onClick: _,
|
|
1764
|
+
ref_key: "rootRef",
|
|
1765
|
+
ref: y
|
|
1766
|
+
}, [
|
|
1767
|
+
l(he, {
|
|
1768
|
+
name: "video",
|
|
1769
|
+
size: 16
|
|
1770
|
+
}),
|
|
1771
|
+
l(Ce, {
|
|
1772
|
+
name: "video-panel",
|
|
1773
|
+
appear: ""
|
|
1774
|
+
}, {
|
|
1775
|
+
default: P(() => [
|
|
1776
|
+
o.value ? (S(), F("div", {
|
|
1777
|
+
key: 0,
|
|
1778
|
+
class: "video-input-panel",
|
|
1779
|
+
onClick: u[1] || (u[1] = j(() => {
|
|
1780
|
+
}, ["stop"]))
|
|
1781
|
+
}, [
|
|
1782
|
+
ge(h("input", {
|
|
1783
|
+
class: "video-input",
|
|
1784
|
+
type: "text",
|
|
1785
|
+
placeholder: "粘贴视频链接(mp4/webm/m3u8等)",
|
|
1786
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => t.value = c),
|
|
1787
|
+
onKeydown: L
|
|
1788
|
+
}, null, 544), [
|
|
1789
|
+
[we, t.value]
|
|
1790
|
+
]),
|
|
1791
|
+
h("input", {
|
|
1792
|
+
ref_key: "videoUploadInput",
|
|
1793
|
+
ref: f,
|
|
1794
|
+
type: "file",
|
|
1795
|
+
accept: "video/*,application/x-mpegURL",
|
|
1796
|
+
style: { display: "none" },
|
|
1797
|
+
onChange: k
|
|
1798
|
+
}, null, 544),
|
|
1799
|
+
h("div", Po, [
|
|
1800
|
+
h("button", {
|
|
1801
|
+
class: "btn btn-primary",
|
|
1802
|
+
onClick: j(d, ["stop"])
|
|
1803
|
+
}, "插入"),
|
|
1804
|
+
h("button", {
|
|
1805
|
+
class: "btn",
|
|
1806
|
+
"aria-disabled": !r.videoUploader || s.value,
|
|
1807
|
+
disabled: !r.videoUploader || s.value,
|
|
1808
|
+
onClick: j(b, ["stop"])
|
|
1809
|
+
}, re(s.value ? "上传中…" : "上传文件"), 9, Go)
|
|
1810
|
+
])
|
|
1811
|
+
])) : O("", !0)
|
|
1812
|
+
]),
|
|
1813
|
+
_: 1
|
|
1814
|
+
})
|
|
1815
|
+
], 512));
|
|
1816
|
+
}
|
|
1817
|
+
}), qo = /* @__PURE__ */ J(Yo, [["__scopeId", "data-v-eef6665b"]]), Zo = { class: "field" }, Ko = { class: "field" }, Jo = { class: "actions" }, Xo = /* @__PURE__ */ K({
|
|
1818
|
+
__name: "index",
|
|
1819
|
+
props: {
|
|
1820
|
+
editor: {}
|
|
1821
|
+
},
|
|
1822
|
+
setup(e) {
|
|
1823
|
+
const r = e, o = H(!1), t = H(""), s = H("");
|
|
1824
|
+
H(!1);
|
|
1825
|
+
const f = H(null);
|
|
1826
|
+
function _() {
|
|
1827
|
+
const a = r.editor;
|
|
1828
|
+
if (!o.value && a)
|
|
1829
|
+
try {
|
|
1830
|
+
const u = a.state.selection, c = u.from;
|
|
1831
|
+
u.to > c ? L() : (t.value = "链接", a.chain().focus().insertContent("链接").setTextSelection({ from: c, to: c + 2 }).run());
|
|
1832
|
+
} catch {
|
|
1833
|
+
}
|
|
1834
|
+
o.value = !o.value, o.value && d();
|
|
1835
|
+
}
|
|
1836
|
+
function d() {
|
|
1837
|
+
setTimeout(() => {
|
|
1838
|
+
var u;
|
|
1839
|
+
const a = (u = f.value) == null ? void 0 : u.querySelector('input[name="link-text"]');
|
|
1840
|
+
a == null || a.focus(), a == null || a.select();
|
|
1841
|
+
}, 0);
|
|
1842
|
+
}
|
|
1843
|
+
function L() {
|
|
1844
|
+
const a = r.editor;
|
|
1845
|
+
if (a)
|
|
1846
|
+
try {
|
|
1847
|
+
const u = a.state.selection, c = u.from, x = u.to, T = x > c ? a.state.doc.textBetween(c, x) : "";
|
|
1848
|
+
t.value = T || "";
|
|
1849
|
+
const M = a.getAttributes("link") || {};
|
|
1850
|
+
s.value = typeof M.href == "string" ? M.href : "";
|
|
1851
|
+
} catch {
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
function b() {
|
|
1855
|
+
const a = r.editor;
|
|
1856
|
+
if (!a) return;
|
|
1857
|
+
const u = t.value.trim(), c = s.value.trim();
|
|
1858
|
+
if (c)
|
|
1859
|
+
try {
|
|
1860
|
+
const x = a.state.selection, m = x.from, T = x.to;
|
|
1861
|
+
if (T > m) {
|
|
1862
|
+
const i = k(u || a.state.doc.textBetween(m, T)), n = k(c);
|
|
1863
|
+
a.chain().focus().insertContent(
|
|
1864
|
+
`<a href="${n}" target="_blank" rel="noopener noreferrer">${i}</a>`,
|
|
1865
|
+
{ from: m, to: T }
|
|
1866
|
+
).run();
|
|
1867
|
+
} else {
|
|
1868
|
+
const i = k(c), n = k(u || c);
|
|
1869
|
+
a.chain().focus().insertContent(
|
|
1870
|
+
`<a href="${i}" target="_blank" rel="noopener noreferrer">${n}</a>`
|
|
1871
|
+
).run();
|
|
1872
|
+
}
|
|
1873
|
+
} finally {
|
|
1874
|
+
o.value = !1, t.value = "", s.value = "";
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
function k(a) {
|
|
1878
|
+
return String(a).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1879
|
+
}
|
|
1880
|
+
function w(a) {
|
|
1881
|
+
a.key === "Enter" && b(), a.key === "Escape" && (o.value = !1);
|
|
1882
|
+
}
|
|
1883
|
+
let y = null;
|
|
1884
|
+
ue(() => {
|
|
1885
|
+
y = (a) => {
|
|
1886
|
+
if (!o.value) return;
|
|
1887
|
+
const u = f.value, c = a.target;
|
|
1888
|
+
u && c && !u.contains(c) && (o.value = !1);
|
|
1889
|
+
}, document.addEventListener("mousedown", y, !0);
|
|
1890
|
+
}), ve(() => {
|
|
1891
|
+
y && (document.removeEventListener("mousedown", y, !0), y = null);
|
|
1892
|
+
});
|
|
1893
|
+
const g = H({});
|
|
1894
|
+
return be(o, async (a) => {
|
|
1895
|
+
var c;
|
|
1896
|
+
if (!a) return;
|
|
1897
|
+
const u = r.editor;
|
|
1898
|
+
if (u) {
|
|
1899
|
+
await me();
|
|
1900
|
+
try {
|
|
1901
|
+
const x = u.state.selection, m = x.from, T = x.to;
|
|
1902
|
+
if (!(T > m)) {
|
|
1903
|
+
g.value = {};
|
|
1904
|
+
return;
|
|
1905
|
+
}
|
|
1906
|
+
const i = u.view.coordsAtPos(m), n = u.view.coordsAtPos(T), v = (i.left + n.right) / 2, A = Math.max(i.bottom, n.bottom) + 8, W = (c = f.value) == null ? void 0 : c.querySelector(".link-input-panel"), V = W ? W.getBoundingClientRect() : { width: 320, height: 120 }, X = window.innerWidth, G = window.innerHeight, Q = 12, fe = Math.max(
|
|
1907
|
+
Q + V.width / 2,
|
|
1908
|
+
Math.min(X - Q - V.width / 2, v)
|
|
1909
|
+
), ee = A, ae = Math.min(i.top, n.top) - V.height - 8;
|
|
1910
|
+
let le = ee;
|
|
1911
|
+
ee + V.height + Q > G && ae - Q >= 0 && (le = ae), le = Math.max(Q, Math.min(G - Q - V.height, le)), g.value = {
|
|
1912
|
+
position: "fixed",
|
|
1913
|
+
left: Math.round(fe) + "px",
|
|
1914
|
+
top: Math.round(le) + "px"
|
|
1915
|
+
};
|
|
1916
|
+
} catch {
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}), (a, u) => (S(), F("div", {
|
|
1920
|
+
class: "icon link-icon",
|
|
1921
|
+
onClick: _,
|
|
1922
|
+
ref_key: "rootRef",
|
|
1923
|
+
ref: f
|
|
1924
|
+
}, [
|
|
1925
|
+
l(he, {
|
|
1926
|
+
name: "link",
|
|
1927
|
+
size: 16
|
|
1928
|
+
}),
|
|
1929
|
+
l(Ce, {
|
|
1930
|
+
name: "link-panel",
|
|
1931
|
+
appear: ""
|
|
1932
|
+
}, {
|
|
1933
|
+
default: P(() => [
|
|
1934
|
+
o.value ? (S(), F("div", {
|
|
1935
|
+
key: 0,
|
|
1936
|
+
class: "link-input-panel",
|
|
1937
|
+
style: oe(g.value),
|
|
1938
|
+
onClick: u[2] || (u[2] = j(() => {
|
|
1939
|
+
}, ["stop"]))
|
|
1940
|
+
}, [
|
|
1941
|
+
h("div", Zo, [
|
|
1942
|
+
u[3] || (u[3] = h("div", { class: "label" }, "文本", -1)),
|
|
1943
|
+
ge(h("input", {
|
|
1944
|
+
name: "link-text",
|
|
1945
|
+
class: "input",
|
|
1946
|
+
type: "text",
|
|
1947
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => t.value = c),
|
|
1948
|
+
onKeydown: w
|
|
1949
|
+
}, null, 544), [
|
|
1950
|
+
[we, t.value]
|
|
1951
|
+
])
|
|
1952
|
+
]),
|
|
1953
|
+
h("div", Ko, [
|
|
1954
|
+
u[4] || (u[4] = h("div", { class: "label" }, "链接", -1)),
|
|
1955
|
+
ge(h("input", {
|
|
1956
|
+
name: "link-href",
|
|
1957
|
+
class: "input",
|
|
1958
|
+
type: "text",
|
|
1959
|
+
"onUpdate:modelValue": u[1] || (u[1] = (c) => s.value = c),
|
|
1960
|
+
placeholder: "链接地址",
|
|
1961
|
+
onKeydown: w
|
|
1962
|
+
}, null, 544), [
|
|
1963
|
+
[we, s.value]
|
|
1964
|
+
])
|
|
1965
|
+
]),
|
|
1966
|
+
h("div", Jo, [
|
|
1967
|
+
h("button", {
|
|
1968
|
+
class: "btn btn-primary",
|
|
1969
|
+
onClick: j(b, ["stop"])
|
|
1970
|
+
}, "确 定")
|
|
1971
|
+
])
|
|
1972
|
+
], 4)) : O("", !0)
|
|
1973
|
+
]),
|
|
1974
|
+
_: 1
|
|
1975
|
+
})
|
|
1976
|
+
], 512));
|
|
1977
|
+
}
|
|
1978
|
+
}), Qo = /* @__PURE__ */ J(Xo, [["__scopeId", "data-v-b5bf35e2"]]), en = { class: "grid" }, tn = ["onMouseenter"], on = { class: "size" }, nn = 10, sn = 10, ln = /* @__PURE__ */ K({
|
|
1979
|
+
__name: "index",
|
|
1980
|
+
props: {
|
|
1981
|
+
editor: {}
|
|
1982
|
+
},
|
|
1983
|
+
setup(e) {
|
|
1984
|
+
const r = e, o = H(!1), t = H(0), s = H(0), f = de(() => {
|
|
1985
|
+
const b = Math.max(t.value, 1), k = Math.max(s.value, 1);
|
|
1986
|
+
return `${b} x ${k}`;
|
|
1987
|
+
}), _ = () => {
|
|
1988
|
+
o.value = !o.value, o.value || (t.value = 0, s.value = 0);
|
|
1989
|
+
}, d = (b, k) => {
|
|
1990
|
+
t.value = b, s.value = k;
|
|
1991
|
+
}, L = () => {
|
|
1992
|
+
var w, y, g, a, u, c, x, m;
|
|
1993
|
+
const b = Math.max(t.value, 1), k = Math.max(s.value, 1);
|
|
1994
|
+
(m = (c = (a = (y = (w = r.editor) == null ? void 0 : w.chain) == null ? void 0 : (g = y.call(w)).focus) == null ? void 0 : (u = a.call(g)).insertTable) == null ? void 0 : (x = c.call(u, { rows: b, cols: k, withHeaderRow: !0 })).run) == null || m.call(x), o.value = !1, t.value = 0, s.value = 0;
|
|
1995
|
+
};
|
|
1996
|
+
return (b, k) => (S(), F("div", {
|
|
1997
|
+
class: "icon table-icon",
|
|
1998
|
+
onClick: _
|
|
1999
|
+
}, [
|
|
2000
|
+
l(he, {
|
|
2001
|
+
name: "table",
|
|
2002
|
+
size: 16
|
|
2003
|
+
}),
|
|
2004
|
+
o.value ? (S(), F("div", {
|
|
2005
|
+
key: 0,
|
|
2006
|
+
class: "table-panel",
|
|
2007
|
+
onClick: k[0] || (k[0] = j(() => {
|
|
2008
|
+
}, ["stop"]))
|
|
2009
|
+
}, [
|
|
2010
|
+
k[1] || (k[1] = h("div", { class: "panel-title" }, "表格", -1)),
|
|
2011
|
+
h("div", en, [
|
|
2012
|
+
(S(), F(ie, null, se(nn, (w) => h("div", {
|
|
2013
|
+
key: "r-" + w,
|
|
2014
|
+
class: "row"
|
|
2015
|
+
}, [
|
|
2016
|
+
(S(), F(ie, null, se(sn, (y) => h("span", {
|
|
2017
|
+
key: "c-" + w + "-" + y,
|
|
2018
|
+
class: N(["cell", { active: w <= t.value && y <= s.value }]),
|
|
2019
|
+
onMouseenter: (g) => d(w, y),
|
|
2020
|
+
onClick: j(L, ["stop"])
|
|
2021
|
+
}, null, 42, tn)), 64))
|
|
2022
|
+
])), 64))
|
|
2023
|
+
]),
|
|
2024
|
+
h("div", on, re(f.value), 1)
|
|
2025
|
+
])) : O("", !0)
|
|
2026
|
+
]));
|
|
2027
|
+
}
|
|
2028
|
+
}), rn = /* @__PURE__ */ J(ln, [["__scopeId", "data-v-ad6f66b7"]]), an = ["aria-disabled"], cn = { class: "tools-grid" }, dn = ["disabled"], un = ["disabled"], hn = ["disabled"], vn = ["disabled"], fn = ["disabled"], kn = ["disabled"], pn = ["disabled"], mn = ["disabled"], gn = ["disabled"], wn = ["disabled"], Cn = ["disabled"], bn = ["disabled"], yn = ["disabled"], xn = ["disabled"], Ln = ["disabled"], _n = ["disabled"], Mn = ["disabled"], $n = /* @__PURE__ */ K({
|
|
2029
|
+
__name: "index",
|
|
2030
|
+
props: {
|
|
2031
|
+
editor: {}
|
|
2032
|
+
},
|
|
2033
|
+
setup(e) {
|
|
2034
|
+
const r = e, o = H(!1), t = () => o.value = !o.value, s = (_, ...d) => {
|
|
2035
|
+
var b, k, w;
|
|
2036
|
+
const L = r.editor;
|
|
2037
|
+
return !!((w = (b = L == null ? void 0 : L.can) == null ? void 0 : (k = b.call(L))[_]) != null && w.call(k, ...d));
|
|
2038
|
+
}, f = (_, ...d) => {
|
|
2039
|
+
var b, k, w, y, g, a, u;
|
|
2040
|
+
const L = r.editor;
|
|
2041
|
+
(u = (a = (g = (y = (w = (b = L == null ? void 0 : L.chain) == null ? void 0 : (k = b.call(L)).focus) == null ? void 0 : w.call(k))[_]) == null ? void 0 : g.call(y, ...d)) == null ? void 0 : a.run) == null || u.call(a), o.value = !1;
|
|
2042
|
+
};
|
|
2043
|
+
return (_, d) => {
|
|
2044
|
+
var L, b;
|
|
2045
|
+
return S(), F("div", {
|
|
2046
|
+
class: "icon table-tools",
|
|
2047
|
+
onClick: t,
|
|
2048
|
+
"aria-disabled": !((b = (L = r.editor) == null ? void 0 : L.isActive) != null && b.call(L, "table"))
|
|
2049
|
+
}, [
|
|
2050
|
+
l(he, {
|
|
2051
|
+
name: "tableTools",
|
|
2052
|
+
size: 15
|
|
2053
|
+
}),
|
|
2054
|
+
o.value ? (S(), F("div", {
|
|
2055
|
+
key: 0,
|
|
2056
|
+
class: "tools-panel",
|
|
2057
|
+
onClick: d[17] || (d[17] = j(() => {
|
|
2058
|
+
}, ["stop"]))
|
|
2059
|
+
}, [
|
|
2060
|
+
h("div", cn, [
|
|
2061
|
+
h("button", {
|
|
2062
|
+
class: "btn",
|
|
2063
|
+
onClick: d[0] || (d[0] = j((k) => f("addColumnBefore"), ["stop"])),
|
|
2064
|
+
disabled: !s("addColumnBefore")
|
|
2065
|
+
}, " 前插列 ", 8, dn),
|
|
2066
|
+
h("button", {
|
|
2067
|
+
class: "btn",
|
|
2068
|
+
onClick: d[1] || (d[1] = j((k) => f("addColumnAfter"), ["stop"])),
|
|
2069
|
+
disabled: !s("addColumnAfter")
|
|
2070
|
+
}, " 后插列 ", 8, un),
|
|
2071
|
+
h("button", {
|
|
2072
|
+
class: "btn",
|
|
2073
|
+
onClick: d[2] || (d[2] = j((k) => f("deleteColumn"), ["stop"])),
|
|
2074
|
+
disabled: !s("deleteColumn")
|
|
2075
|
+
}, " 删除列 ", 8, hn),
|
|
2076
|
+
h("button", {
|
|
2077
|
+
class: "btn",
|
|
2078
|
+
onClick: d[3] || (d[3] = j((k) => f("addRowBefore"), ["stop"])),
|
|
2079
|
+
disabled: !s("addRowBefore")
|
|
2080
|
+
}, " 前插行 ", 8, vn),
|
|
2081
|
+
h("button", {
|
|
2082
|
+
class: "btn",
|
|
2083
|
+
onClick: d[4] || (d[4] = j((k) => f("addRowAfter"), ["stop"])),
|
|
2084
|
+
disabled: !s("addRowAfter")
|
|
2085
|
+
}, " 后插行 ", 8, fn),
|
|
2086
|
+
h("button", {
|
|
2087
|
+
class: "btn",
|
|
2088
|
+
onClick: d[5] || (d[5] = j((k) => f("deleteRow"), ["stop"])),
|
|
2089
|
+
disabled: !s("deleteRow")
|
|
2090
|
+
}, " 删除行 ", 8, kn),
|
|
2091
|
+
h("button", {
|
|
2092
|
+
class: "btn",
|
|
2093
|
+
onClick: d[6] || (d[6] = j((k) => f("deleteTable"), ["stop"])),
|
|
2094
|
+
disabled: !s("deleteTable")
|
|
2095
|
+
}, " 删除表 ", 8, pn),
|
|
2096
|
+
h("button", {
|
|
2097
|
+
class: "btn",
|
|
2098
|
+
onClick: d[7] || (d[7] = j((k) => f("mergeCells"), ["stop"])),
|
|
2099
|
+
disabled: !s("mergeCells")
|
|
2100
|
+
}, " 合并单元格 ", 8, mn),
|
|
2101
|
+
h("button", {
|
|
2102
|
+
class: "btn",
|
|
2103
|
+
onClick: d[8] || (d[8] = j((k) => f("splitCell"), ["stop"])),
|
|
2104
|
+
disabled: !s("splitCell")
|
|
2105
|
+
}, " 拆分单元格 ", 8, gn),
|
|
2106
|
+
h("button", {
|
|
2107
|
+
class: "btn",
|
|
2108
|
+
onClick: d[9] || (d[9] = j((k) => f("mergeOrSplit"), ["stop"])),
|
|
2109
|
+
disabled: !s("mergeOrSplit")
|
|
2110
|
+
}, " 合并/拆分 ", 8, wn),
|
|
2111
|
+
h("button", {
|
|
2112
|
+
class: "btn",
|
|
2113
|
+
onClick: d[10] || (d[10] = j((k) => f("toggleHeaderRow"), ["stop"])),
|
|
2114
|
+
disabled: !s("toggleHeaderRow")
|
|
2115
|
+
}, " 切换表头行 ", 8, Cn),
|
|
2116
|
+
h("button", {
|
|
2117
|
+
class: "btn",
|
|
2118
|
+
onClick: d[11] || (d[11] = j((k) => f("toggleHeaderColumn"), ["stop"])),
|
|
2119
|
+
disabled: !s("toggleHeaderColumn")
|
|
2120
|
+
}, " 切换表头列 ", 8, bn),
|
|
2121
|
+
h("button", {
|
|
2122
|
+
class: "btn",
|
|
2123
|
+
onClick: d[12] || (d[12] = j((k) => f("toggleHeaderCell"), ["stop"])),
|
|
2124
|
+
disabled: !s("toggleHeaderCell")
|
|
2125
|
+
}, " 切换表头单元 ", 8, yn),
|
|
2126
|
+
h("button", {
|
|
2127
|
+
class: "btn",
|
|
2128
|
+
onClick: d[13] || (d[13] = j((k) => f("fixTables"), ["stop"])),
|
|
2129
|
+
disabled: !s("fixTables")
|
|
2130
|
+
}, " 修复表格 ", 8, xn),
|
|
2131
|
+
h("button", {
|
|
2132
|
+
class: "btn",
|
|
2133
|
+
onClick: d[14] || (d[14] = j((k) => f("goToNextCell"), ["stop"])),
|
|
2134
|
+
disabled: !s("goToNextCell")
|
|
2135
|
+
}, " 下个单元格 ", 8, Ln),
|
|
2136
|
+
h("button", {
|
|
2137
|
+
class: "btn",
|
|
2138
|
+
onClick: d[15] || (d[15] = j((k) => f("goToPreviousCell"), ["stop"])),
|
|
2139
|
+
disabled: !s("goToPreviousCell")
|
|
2140
|
+
}, " 上个单元格 ", 8, _n),
|
|
2141
|
+
h("button", {
|
|
2142
|
+
class: "btn",
|
|
2143
|
+
onClick: d[16] || (d[16] = j((k) => f("setCellAttribute", "backgroundColor", "#FAF594"), ["stop"])),
|
|
2144
|
+
disabled: !s("setCellAttribute", "backgroundColor", "#FAF594")
|
|
2145
|
+
}, " 单元格着色 ", 8, Mn)
|
|
2146
|
+
])
|
|
2147
|
+
])) : O("", !0)
|
|
2148
|
+
], 8, an);
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
}), zn = /* @__PURE__ */ J($n, [["__scopeId", "data-v-89ddb4db"]]), Sn = /* @__PURE__ */ K({
|
|
2152
|
+
__name: "index",
|
|
2153
|
+
props: {
|
|
2154
|
+
editor: {}
|
|
2155
|
+
},
|
|
2156
|
+
setup(e) {
|
|
2157
|
+
const r = e;
|
|
2158
|
+
typeof navigator < "u" && navigator.platform.includes("Mac");
|
|
2159
|
+
function o() {
|
|
2160
|
+
const t = r.editor;
|
|
2161
|
+
if (t) {
|
|
2162
|
+
t.chain().focus().toggleTaskList().run();
|
|
2163
|
+
try {
|
|
2164
|
+
const { state: s } = t, f = s.selection;
|
|
2165
|
+
let _ = null;
|
|
2166
|
+
s.doc.nodesBetween(
|
|
2167
|
+
Math.max(0, f.from - 5),
|
|
2168
|
+
Math.min(s.doc.content.size, f.to + 5),
|
|
2169
|
+
(d, L) => {
|
|
2170
|
+
var b;
|
|
2171
|
+
return ((b = d == null ? void 0 : d.type) == null ? void 0 : b.name) === "taskItem" && _ == null ? (_ = L, !1) : !0;
|
|
2172
|
+
}
|
|
2173
|
+
), _ != null && t.commands.setTextSelection(_ + 1);
|
|
2174
|
+
} catch {
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
return (t, s) => (S(), F("div", {
|
|
2179
|
+
class: "icon",
|
|
2180
|
+
onClick: o
|
|
2181
|
+
}, [
|
|
2182
|
+
l(he, {
|
|
2183
|
+
name: "task",
|
|
2184
|
+
size: 17
|
|
2185
|
+
})
|
|
2186
|
+
]));
|
|
2187
|
+
}
|
|
2188
|
+
}), Tn = /* @__PURE__ */ J(Sn, [["__scopeId", "data-v-0b74c17c"]]), Fn = /* @__PURE__ */ K({
|
|
2189
|
+
__name: "index",
|
|
2190
|
+
props: {
|
|
2191
|
+
editor: {}
|
|
2192
|
+
},
|
|
2193
|
+
setup(e) {
|
|
2194
|
+
const r = e;
|
|
2195
|
+
function o() {
|
|
2196
|
+
const t = r.editor;
|
|
2197
|
+
t && t.chain().focus().toggleBlockquote().run();
|
|
2198
|
+
}
|
|
2199
|
+
return (t, s) => (S(), F("div", {
|
|
2200
|
+
class: "icon",
|
|
2201
|
+
onClick: o
|
|
2202
|
+
}, [
|
|
2203
|
+
l(he, {
|
|
2204
|
+
name: "quote",
|
|
2205
|
+
size: 18
|
|
2206
|
+
})
|
|
2207
|
+
]));
|
|
2208
|
+
}
|
|
2209
|
+
}), jn = /* @__PURE__ */ J(Fn, [["__scopeId", "data-v-bf6f40c3"]]), Hn = ["aria-expanded"], An = { class: "label" }, Bn = {
|
|
2210
|
+
key: 0,
|
|
2211
|
+
class: "dropdown",
|
|
2212
|
+
role: "listbox"
|
|
2213
|
+
}, En = ["aria-selected", "onClick"], Dn = { class: "shortcut" }, We = "md-toolbar-dropdown-open", Pe = "heading-select", Un = /* @__PURE__ */ K({
|
|
2214
|
+
__name: "index",
|
|
2215
|
+
props: {
|
|
2216
|
+
editor: {}
|
|
2217
|
+
},
|
|
2218
|
+
setup(e) {
|
|
2219
|
+
const r = e, o = typeof navigator < "u" && navigator.platform.includes("Mac"), t = {
|
|
2220
|
+
0: o ? "⌥ ⌘ 0" : "Ctrl Alt 0",
|
|
2221
|
+
1: o ? "⌥ ⌘ 1" : "Ctrl Alt 1",
|
|
2222
|
+
2: o ? "⌥ ⌘ 2" : "Ctrl Alt 2",
|
|
2223
|
+
3: o ? "⌥ ⌘ 3" : "Ctrl Alt 3",
|
|
2224
|
+
4: o ? "⌥ ⌘ 4" : "Ctrl Alt 4",
|
|
2225
|
+
5: o ? "⌥ ⌘ 5" : "Ctrl Alt 5",
|
|
2226
|
+
6: o ? "⌥ ⌘ 6" : "Ctrl Alt 6"
|
|
2227
|
+
}, s = [
|
|
2228
|
+
{ label: "正文", level: null, shortcut: t[0] },
|
|
2229
|
+
{ label: "标题1", level: 1, shortcut: t[1] },
|
|
2230
|
+
{ label: "标题2", level: 2, shortcut: t[2] },
|
|
2231
|
+
{ label: "标题3", level: 3, shortcut: t[3] },
|
|
2232
|
+
{ label: "标题4", level: 4, shortcut: t[4] },
|
|
2233
|
+
{ label: "标题5", level: 5, shortcut: t[5] },
|
|
2234
|
+
{ label: "标题6", level: 6, shortcut: t[6] }
|
|
2235
|
+
], f = de(() => {
|
|
2236
|
+
var u, c;
|
|
2237
|
+
const a = r.editor;
|
|
2238
|
+
if (!a) return null;
|
|
2239
|
+
for (let x = 1; x <= 6; x++)
|
|
2240
|
+
if ((u = a.isActive) != null && u.call(a, "heading", { level: x })) return x;
|
|
2241
|
+
return (c = a.isActive) != null && c.call(a, "paragraph"), null;
|
|
2242
|
+
}), _ = de(() => {
|
|
2243
|
+
const a = f.value;
|
|
2244
|
+
return a ? `标题${a}` : "正文";
|
|
2245
|
+
}), d = H(!1), L = H(null);
|
|
2246
|
+
function b() {
|
|
2247
|
+
d.value || window.dispatchEvent(new CustomEvent(We, { detail: { id: Pe } })), d.value = !d.value;
|
|
2248
|
+
}
|
|
2249
|
+
function k() {
|
|
2250
|
+
d.value = !1;
|
|
2251
|
+
}
|
|
2252
|
+
function w(a) {
|
|
2253
|
+
var c, x, m, T, M, i, n, v, A, W;
|
|
2254
|
+
const u = (T = (x = (c = r.editor) == null ? void 0 : c.chain) == null ? void 0 : (m = x.call(c)).focus) == null ? void 0 : T.call(m);
|
|
2255
|
+
u && (a.level === null ? (n = (M = u.setParagraph) == null ? void 0 : (i = M.call(u)).run) == null || n.call(i) : (W = (A = (v = u.toggleHeading) == null ? void 0 : v.call(u, { level: a.level })) == null ? void 0 : A.run) == null || W.call(A), k());
|
|
2256
|
+
}
|
|
2257
|
+
function y(a) {
|
|
2258
|
+
const u = a.target, c = L.value;
|
|
2259
|
+
c && !c.contains(u) && k();
|
|
2260
|
+
}
|
|
2261
|
+
function g(a) {
|
|
2262
|
+
var c;
|
|
2263
|
+
((c = a.detail) == null ? void 0 : c.id) !== Pe && (d.value = !1);
|
|
2264
|
+
}
|
|
2265
|
+
return ue(() => {
|
|
2266
|
+
document.addEventListener("click", y), window.addEventListener(We, g);
|
|
2267
|
+
}), ve(() => {
|
|
2268
|
+
document.removeEventListener("click", y), window.removeEventListener(We, g);
|
|
2269
|
+
}), (a, u) => (S(), F("div", {
|
|
2270
|
+
class: "heading-select",
|
|
2271
|
+
ref_key: "rootRef",
|
|
2272
|
+
ref: L
|
|
2273
|
+
}, [
|
|
2274
|
+
h("div", {
|
|
2275
|
+
class: "icon",
|
|
2276
|
+
onClick: j(b, ["stop"]),
|
|
2277
|
+
"aria-expanded": d.value
|
|
2278
|
+
}, [
|
|
2279
|
+
h("div", An, re(_.value), 1),
|
|
2280
|
+
l(z(Fe), {
|
|
2281
|
+
theme: "filled",
|
|
2282
|
+
strokeWidth: 3
|
|
2283
|
+
})
|
|
2284
|
+
], 8, Hn),
|
|
2285
|
+
l(Ce, { name: "dropdown-slide" }, {
|
|
2286
|
+
default: P(() => [
|
|
2287
|
+
d.value ? (S(), F("div", Bn, [
|
|
2288
|
+
(S(), F(ie, null, se(s, (c) => h("div", {
|
|
2289
|
+
key: c.label,
|
|
2290
|
+
class: "dropdown-item",
|
|
2291
|
+
"aria-selected": c.level === f.value,
|
|
2292
|
+
onClick: j((x) => w(c), ["stop"])
|
|
2293
|
+
}, [
|
|
2294
|
+
c.level === f.value ? (S(), ye(z(ze), {
|
|
2295
|
+
key: 0,
|
|
2296
|
+
theme: "filled",
|
|
2297
|
+
strokeWidth: 3
|
|
2298
|
+
})) : O("", !0),
|
|
2299
|
+
h("span", {
|
|
2300
|
+
class: N(["item-label", {
|
|
2301
|
+
paragraph: c.level === null,
|
|
2302
|
+
"level-1": c.level === 1,
|
|
2303
|
+
"level-2": c.level === 2,
|
|
2304
|
+
"level-3": c.level === 3,
|
|
2305
|
+
"level-4": c.level === 4,
|
|
2306
|
+
"level-5": c.level === 5,
|
|
2307
|
+
"level-6": c.level === 6
|
|
2308
|
+
}])
|
|
2309
|
+
}, re(c.label), 3),
|
|
2310
|
+
h("span", Dn, re(c.shortcut), 1)
|
|
2311
|
+
], 8, En)), 64))
|
|
2312
|
+
])) : O("", !0)
|
|
2313
|
+
]),
|
|
2314
|
+
_: 1
|
|
2315
|
+
})
|
|
2316
|
+
], 512));
|
|
2317
|
+
}
|
|
2318
|
+
}), Wn = /* @__PURE__ */ J(Un, [["__scopeId", "data-v-fceb28df"]]), Vn = { class: "header_box" }, In = ["aria-disabled"], On = ["aria-disabled"], Rn = /* @__PURE__ */ K({
|
|
2319
|
+
__name: "index",
|
|
2320
|
+
props: {
|
|
2321
|
+
editor: {},
|
|
2322
|
+
currentColor: {},
|
|
2323
|
+
videoUploader: { type: Function },
|
|
2324
|
+
imageUploader: { type: Function },
|
|
2325
|
+
uploadSizeLimit: {}
|
|
2326
|
+
},
|
|
2327
|
+
emits: ["openLinkModal"],
|
|
2328
|
+
setup(e, { emit: r }) {
|
|
2329
|
+
const o = e, t = (M, i) => {
|
|
2330
|
+
var n, v;
|
|
2331
|
+
return (v = (n = o.editor) == null ? void 0 : n.isActive) == null ? void 0 : v.call(n, M, i);
|
|
2332
|
+
}, s = (M, i) => {
|
|
2333
|
+
var A, W, V, X, G, Q;
|
|
2334
|
+
const n = o.editor;
|
|
2335
|
+
if (!n) return;
|
|
2336
|
+
const v = (V = (A = n.chain) == null ? void 0 : (W = A.call(n)).focus) == null ? void 0 : V.call(W);
|
|
2337
|
+
return (Q = (G = (X = v == null ? void 0 : v[M]) == null ? void 0 : X.call(v)) == null ? void 0 : G.run) == null ? void 0 : Q.call(G);
|
|
2338
|
+
}, f = (M) => {
|
|
2339
|
+
var i, n, v, A, W, V, X, G;
|
|
2340
|
+
return (G = (V = (A = (n = (i = o.editor) == null ? void 0 : i.chain) == null ? void 0 : (v = n.call(i)).focus) == null ? void 0 : (W = A.call(v)).setTextAlign) == null ? void 0 : (X = V.call(W, M)).run) == null ? void 0 : G.call(X);
|
|
2341
|
+
}, _ = (M) => {
|
|
2342
|
+
var i, n;
|
|
2343
|
+
return !!((n = (i = o.editor) == null ? void 0 : i.isActive) != null && n.call(i, { textAlign: M }));
|
|
2344
|
+
}, d = () => {
|
|
2345
|
+
var M, i, n, v;
|
|
2346
|
+
try {
|
|
2347
|
+
return !!((v = (i = (M = o.editor) == null ? void 0 : M.can) == null ? void 0 : (n = i.call(M)).undo) != null && v.call(n));
|
|
2348
|
+
} catch {
|
|
2349
|
+
return !1;
|
|
2350
|
+
}
|
|
2351
|
+
}, L = () => {
|
|
2352
|
+
var M, i, n, v;
|
|
2353
|
+
try {
|
|
2354
|
+
return !!((v = (i = (M = o.editor) == null ? void 0 : M.can) == null ? void 0 : (n = i.call(M)).redo) != null && v.call(n));
|
|
2355
|
+
} catch {
|
|
2356
|
+
return !1;
|
|
2357
|
+
}
|
|
2358
|
+
}, b = () => {
|
|
2359
|
+
var M, i, n;
|
|
2360
|
+
d() && ((n = (i = (M = o.editor) == null ? void 0 : M.commands) == null ? void 0 : i.undo) == null || n.call(i));
|
|
2361
|
+
}, k = () => {
|
|
2362
|
+
var M, i, n;
|
|
2363
|
+
return (n = (i = (M = o.editor) == null ? void 0 : M.commands) == null ? void 0 : i.redo) == null ? void 0 : n.call(i);
|
|
2364
|
+
}, w = typeof navigator < "u" && navigator.platform.includes("Mac") ? "⌘ Z" : "Ctrl Z", y = typeof navigator < "u" && navigator.platform.includes("Mac") ? "⇧ ⌘ Z" : "Ctrl Y", g = typeof navigator < "u" && navigator.platform.includes("Mac"), a = g ? "⌘ B" : "Ctrl B", u = g ? "⌘ I" : "Ctrl I", c = g ? "⌘ U" : "Ctrl U", x = g ? "⇧ ⌘ X" : "Ctrl Shift X", m = g ? "⇧ ⌘ 8" : "Ctrl Shift 8", T = g ? "⇧ ⌘ 7" : "Ctrl Shift 7";
|
|
2365
|
+
return (M, i) => (S(), F("div", Vn, [
|
|
2366
|
+
h("div", {
|
|
2367
|
+
class: "icon",
|
|
2368
|
+
"aria-disabled": !d(),
|
|
2369
|
+
onClick: b
|
|
2370
|
+
}, [
|
|
2371
|
+
l(z(ne), {
|
|
2372
|
+
text: "撤销",
|
|
2373
|
+
shortcut: z(w),
|
|
2374
|
+
placement: "bottom"
|
|
2375
|
+
}, {
|
|
2376
|
+
default: P(() => [
|
|
2377
|
+
l(z(At), {
|
|
2378
|
+
theme: "outline",
|
|
2379
|
+
strokeWidth: 3
|
|
2380
|
+
})
|
|
2381
|
+
]),
|
|
2382
|
+
_: 1
|
|
2383
|
+
}, 8, ["shortcut"])
|
|
2384
|
+
], 8, In),
|
|
2385
|
+
h("div", {
|
|
2386
|
+
class: "icon",
|
|
2387
|
+
"aria-disabled": !L(),
|
|
2388
|
+
onClick: k
|
|
2389
|
+
}, [
|
|
2390
|
+
l(z(ne), {
|
|
2391
|
+
text: "重做",
|
|
2392
|
+
shortcut: z(y),
|
|
2393
|
+
placement: "bottom"
|
|
2394
|
+
}, {
|
|
2395
|
+
default: P(() => [
|
|
2396
|
+
l(z(St), {
|
|
2397
|
+
theme: "outline",
|
|
2398
|
+
strokeWidth: 3
|
|
2399
|
+
})
|
|
2400
|
+
]),
|
|
2401
|
+
_: 1
|
|
2402
|
+
}, 8, ["shortcut"])
|
|
2403
|
+
], 8, On),
|
|
2404
|
+
l(z(Wn), {
|
|
2405
|
+
editor: o.editor
|
|
2406
|
+
}, null, 8, ["editor"]),
|
|
2407
|
+
l(z(qt), {
|
|
2408
|
+
editor: o.editor
|
|
2409
|
+
}, null, 8, ["editor"]),
|
|
2410
|
+
h("div", {
|
|
2411
|
+
class: N(["icon", { active: t("bold") }]),
|
|
2412
|
+
onClick: i[0] || (i[0] = (n) => s("toggleBold"))
|
|
2413
|
+
}, [
|
|
2414
|
+
l(z(ne), {
|
|
2415
|
+
text: "加粗",
|
|
2416
|
+
shortcut: z(a),
|
|
2417
|
+
placement: "bottom"
|
|
2418
|
+
}, {
|
|
2419
|
+
default: P(() => [
|
|
2420
|
+
l(z(Et), {
|
|
2421
|
+
theme: "outline",
|
|
2422
|
+
strokeWidth: 3
|
|
2423
|
+
})
|
|
2424
|
+
]),
|
|
2425
|
+
_: 1
|
|
2426
|
+
}, 8, ["shortcut"])
|
|
2427
|
+
], 2),
|
|
2428
|
+
h("div", {
|
|
2429
|
+
class: N(["icon", { active: t("italic") }]),
|
|
2430
|
+
onClick: i[1] || (i[1] = (n) => s("toggleItalic"))
|
|
2431
|
+
}, [
|
|
2432
|
+
l(z(ne), {
|
|
2433
|
+
text: "斜体",
|
|
2434
|
+
shortcut: z(u),
|
|
2435
|
+
placement: "bottom"
|
|
2436
|
+
}, {
|
|
2437
|
+
default: P(() => [
|
|
2438
|
+
l(z(Dt), {
|
|
2439
|
+
theme: "outline",
|
|
2440
|
+
strokeWidth: 3
|
|
2441
|
+
})
|
|
2442
|
+
]),
|
|
2443
|
+
_: 1
|
|
2444
|
+
}, 8, ["shortcut"])
|
|
2445
|
+
], 2),
|
|
2446
|
+
h("div", {
|
|
2447
|
+
class: N(["icon", { active: t("strike") }]),
|
|
2448
|
+
onClick: i[2] || (i[2] = (n) => s("toggleStrike"))
|
|
2449
|
+
}, [
|
|
2450
|
+
l(z(ne), {
|
|
2451
|
+
text: "删除线",
|
|
2452
|
+
shortcut: z(x),
|
|
2453
|
+
placement: "bottom"
|
|
2454
|
+
}, {
|
|
2455
|
+
default: P(() => [
|
|
2456
|
+
l(z(Bt), {
|
|
2457
|
+
theme: "outline",
|
|
2458
|
+
strokeWidth: 3
|
|
2459
|
+
})
|
|
2460
|
+
]),
|
|
2461
|
+
_: 1
|
|
2462
|
+
}, 8, ["shortcut"])
|
|
2463
|
+
], 2),
|
|
2464
|
+
h("div", {
|
|
2465
|
+
class: N(["icon", { active: t("underline") }]),
|
|
2466
|
+
onClick: i[3] || (i[3] = (n) => s("toggleUnderline"))
|
|
2467
|
+
}, [
|
|
2468
|
+
l(z(ne), {
|
|
2469
|
+
text: "下划线",
|
|
2470
|
+
shortcut: z(c),
|
|
2471
|
+
placement: "bottom"
|
|
2472
|
+
}, {
|
|
2473
|
+
default: P(() => [
|
|
2474
|
+
l(z(Ut), {
|
|
2475
|
+
theme: "outline",
|
|
2476
|
+
strokeWidth: 3
|
|
2477
|
+
})
|
|
2478
|
+
]),
|
|
2479
|
+
_: 1
|
|
2480
|
+
}, 8, ["shortcut"])
|
|
2481
|
+
], 2),
|
|
2482
|
+
l(z(co), {
|
|
2483
|
+
editor: o.editor,
|
|
2484
|
+
currentColor: o.currentColor
|
|
2485
|
+
}, null, 8, ["editor", "currentColor"]),
|
|
2486
|
+
l(z(Vo), {
|
|
2487
|
+
editor: o.editor,
|
|
2488
|
+
style: { "margin-left": "-6px" }
|
|
2489
|
+
}, null, 8, ["editor"]),
|
|
2490
|
+
h("div", {
|
|
2491
|
+
class: N(["icon", { active: _("left") }]),
|
|
2492
|
+
onClick: i[4] || (i[4] = (n) => f("left"))
|
|
2493
|
+
}, [
|
|
2494
|
+
l(z(ne), {
|
|
2495
|
+
text: "左对齐",
|
|
2496
|
+
placement: "bottom"
|
|
2497
|
+
}, {
|
|
2498
|
+
default: P(() => [
|
|
2499
|
+
l(z(Mt), {
|
|
2500
|
+
theme: "outline",
|
|
2501
|
+
strokeWidth: 3
|
|
2502
|
+
})
|
|
2503
|
+
]),
|
|
2504
|
+
_: 1
|
|
2505
|
+
})
|
|
2506
|
+
], 2),
|
|
2507
|
+
h("div", {
|
|
2508
|
+
class: N(["icon", { active: _("center") }]),
|
|
2509
|
+
onClick: i[5] || (i[5] = (n) => f("center"))
|
|
2510
|
+
}, [
|
|
2511
|
+
l(z(ne), {
|
|
2512
|
+
text: "居中对齐",
|
|
2513
|
+
placement: "bottom"
|
|
2514
|
+
}, {
|
|
2515
|
+
default: P(() => [
|
|
2516
|
+
l(z(_t), {
|
|
2517
|
+
theme: "outline",
|
|
2518
|
+
strokeWidth: 3
|
|
2519
|
+
})
|
|
2520
|
+
]),
|
|
2521
|
+
_: 1
|
|
2522
|
+
})
|
|
2523
|
+
], 2),
|
|
2524
|
+
h("div", {
|
|
2525
|
+
class: N(["icon", { active: _("right") }]),
|
|
2526
|
+
onClick: i[6] || (i[6] = (n) => f("right"))
|
|
2527
|
+
}, [
|
|
2528
|
+
l(z(ne), {
|
|
2529
|
+
text: "右对齐",
|
|
2530
|
+
placement: "bottom"
|
|
2531
|
+
}, {
|
|
2532
|
+
default: P(() => [
|
|
2533
|
+
l(z($t), {
|
|
2534
|
+
theme: "outline",
|
|
2535
|
+
strokeWidth: 3
|
|
2536
|
+
})
|
|
2537
|
+
]),
|
|
2538
|
+
_: 1
|
|
2539
|
+
})
|
|
2540
|
+
], 2),
|
|
2541
|
+
h("div", {
|
|
2542
|
+
class: N(["icon", { active: _("justify") }]),
|
|
2543
|
+
onClick: i[7] || (i[7] = (n) => f("justify"))
|
|
2544
|
+
}, [
|
|
2545
|
+
l(z(ne), {
|
|
2546
|
+
text: "两端对齐",
|
|
2547
|
+
placement: "bottom"
|
|
2548
|
+
}, {
|
|
2549
|
+
default: P(() => [
|
|
2550
|
+
l(z(Lt), {
|
|
2551
|
+
theme: "outline",
|
|
2552
|
+
strokeWidth: 3
|
|
2553
|
+
})
|
|
2554
|
+
]),
|
|
2555
|
+
_: 1
|
|
2556
|
+
})
|
|
2557
|
+
], 2),
|
|
2558
|
+
h("div", {
|
|
2559
|
+
class: N(["icon", { active: t("bulletList") }]),
|
|
2560
|
+
onClick: i[8] || (i[8] = (n) => s("toggleBulletList"))
|
|
2561
|
+
}, [
|
|
2562
|
+
l(z(ne), {
|
|
2563
|
+
text: "无序列表",
|
|
2564
|
+
shortcut: z(m),
|
|
2565
|
+
placement: "bottom"
|
|
2566
|
+
}, {
|
|
2567
|
+
default: P(() => [
|
|
2568
|
+
l(z(Tt), {
|
|
2569
|
+
theme: "outline",
|
|
2570
|
+
strokeWidth: 3
|
|
2571
|
+
})
|
|
2572
|
+
]),
|
|
2573
|
+
_: 1
|
|
2574
|
+
}, 8, ["shortcut"])
|
|
2575
|
+
], 2),
|
|
2576
|
+
h("div", {
|
|
2577
|
+
class: N(["icon", { active: t("orderedList") }]),
|
|
2578
|
+
onClick: i[9] || (i[9] = (n) => s("toggleOrderedList"))
|
|
2579
|
+
}, [
|
|
2580
|
+
l(z(ne), {
|
|
2581
|
+
text: "有序列表",
|
|
2582
|
+
shortcut: z(T),
|
|
2583
|
+
placement: "bottom"
|
|
2584
|
+
}, {
|
|
2585
|
+
default: P(() => [
|
|
2586
|
+
l(z(Ft), {
|
|
2587
|
+
theme: "outline",
|
|
2588
|
+
strokeWidth: 3
|
|
2589
|
+
})
|
|
2590
|
+
]),
|
|
2591
|
+
_: 1
|
|
2592
|
+
}, 8, ["shortcut"])
|
|
2593
|
+
], 2),
|
|
2594
|
+
l(z(Tn), {
|
|
2595
|
+
editor: o.editor
|
|
2596
|
+
}, null, 8, ["editor"]),
|
|
2597
|
+
h("div", {
|
|
2598
|
+
class: N(["icon", { active: t("code") }]),
|
|
2599
|
+
onClick: i[10] || (i[10] = (n) => s("toggleCode"))
|
|
2600
|
+
}, [
|
|
2601
|
+
l(he, {
|
|
2602
|
+
name: "code",
|
|
2603
|
+
size: 18
|
|
2604
|
+
})
|
|
2605
|
+
], 2),
|
|
2606
|
+
h("div", {
|
|
2607
|
+
class: N(["icon", { active: t("codeBlock") }]),
|
|
2608
|
+
onClick: i[11] || (i[11] = (n) => s("toggleCodeBlock"))
|
|
2609
|
+
}, [
|
|
2610
|
+
l(he, {
|
|
2611
|
+
name: "codeBlock",
|
|
2612
|
+
size: 16
|
|
2613
|
+
})
|
|
2614
|
+
], 2),
|
|
2615
|
+
l(z(jn), {
|
|
2616
|
+
editor: o.editor
|
|
2617
|
+
}, null, 8, ["editor"]),
|
|
2618
|
+
l(z(Qo), {
|
|
2619
|
+
editor: o.editor
|
|
2620
|
+
}, null, 8, ["editor"]),
|
|
2621
|
+
l(z(No), {
|
|
2622
|
+
editor: o.editor,
|
|
2623
|
+
imageUploader: o.imageUploader,
|
|
2624
|
+
uploadSizeLimit: o.uploadSizeLimit
|
|
2625
|
+
}, null, 8, ["editor", "imageUploader", "uploadSizeLimit"]),
|
|
2626
|
+
l(z(qo), {
|
|
2627
|
+
editor: o.editor,
|
|
2628
|
+
videoUploader: o.videoUploader,
|
|
2629
|
+
uploadSizeLimit: o.uploadSizeLimit
|
|
2630
|
+
}, null, 8, ["editor", "videoUploader", "uploadSizeLimit"]),
|
|
2631
|
+
l(z(rn), {
|
|
2632
|
+
editor: o.editor
|
|
2633
|
+
}, null, 8, ["editor"]),
|
|
2634
|
+
l(z(zn), {
|
|
2635
|
+
editor: o.editor
|
|
2636
|
+
}, null, 8, ["editor"])
|
|
2637
|
+
]));
|
|
2638
|
+
}
|
|
2639
|
+
}), Nn = /* @__PURE__ */ J(Rn, [["__scopeId", "data-v-6cce30ab"]]), Pn = { class: "outline__header" }, Gn = { style: { cursor: "pointer", "margin-top": "5px" } }, Yn = { class: "outline__listWrap" }, qn = { class: "outline__list" }, Zn = ["onClick"], Kn = ["onClick"], Jn = /* @__PURE__ */ K({
|
|
2640
|
+
__name: "index",
|
|
2641
|
+
props: {
|
|
2642
|
+
items: {},
|
|
2643
|
+
maxHeight: {},
|
|
2644
|
+
editor: {},
|
|
2645
|
+
container: {},
|
|
2646
|
+
duration: {},
|
|
2647
|
+
offset: {},
|
|
2648
|
+
open: { type: Boolean },
|
|
2649
|
+
pinned: { type: Boolean }
|
|
2650
|
+
},
|
|
2651
|
+
emits: ["select", "update:open"],
|
|
2652
|
+
setup(e, { emit: r }) {
|
|
2653
|
+
const o = e, t = r;
|
|
2654
|
+
function s(c) {
|
|
2655
|
+
g(c), t("select", c);
|
|
2656
|
+
}
|
|
2657
|
+
function f() {
|
|
2658
|
+
t("update:open", !1), t("update:pinned", !1);
|
|
2659
|
+
}
|
|
2660
|
+
function _() {
|
|
2661
|
+
o.pinned || f();
|
|
2662
|
+
}
|
|
2663
|
+
function d(c) {
|
|
2664
|
+
const x = [], m = [];
|
|
2665
|
+
for (const T of c) {
|
|
2666
|
+
const M = { ...T, children: [] };
|
|
2667
|
+
for (; m.length && m[m.length - 1].level >= M.level; ) m.pop();
|
|
2668
|
+
m.length ? m[m.length - 1].children.push(M) : x.push(M), m.push(M);
|
|
2669
|
+
}
|
|
2670
|
+
return x;
|
|
2671
|
+
}
|
|
2672
|
+
const L = H(/* @__PURE__ */ new Set());
|
|
2673
|
+
function b(c) {
|
|
2674
|
+
return L.value.has(c.pos);
|
|
2675
|
+
}
|
|
2676
|
+
function k(c) {
|
|
2677
|
+
const x = L.value;
|
|
2678
|
+
x.has(c.pos) ? x.delete(c.pos) : x.add(c.pos), L.value = new Set(x);
|
|
2679
|
+
}
|
|
2680
|
+
const w = de(() => d(o.items || [])), y = de(() => {
|
|
2681
|
+
const c = [], x = (m) => {
|
|
2682
|
+
for (const T of m)
|
|
2683
|
+
c.push({ node: T, level: T.level, hasChildren: T.children.length > 0 }), L.value.has(T.pos) || x(T.children);
|
|
2684
|
+
};
|
|
2685
|
+
return x(w.value), c;
|
|
2686
|
+
});
|
|
2687
|
+
function g(c) {
|
|
2688
|
+
const x = z(o.editor);
|
|
2689
|
+
if (!x) return;
|
|
2690
|
+
const { doc: m } = x.state, T = m.nodeAt(c.pos), M = Math.max(1, m.content.size - 1);
|
|
2691
|
+
let i = c.pos + 1;
|
|
2692
|
+
T && T.type.name === "heading" && (i = c.pos + T.nodeSize - 1), i = Math.min(Math.max(1, i), M), x.chain().focus().setTextSelection(i).run();
|
|
2693
|
+
const n = z(o.container) ?? null, v = x.view.coordsAtPos(i), A = o.offset ?? 8, W = o.duration ?? 700;
|
|
2694
|
+
if (n) {
|
|
2695
|
+
const V = n.getBoundingClientRect(), X = n.scrollTop + v.top - V.top - A;
|
|
2696
|
+
a(n, X, W);
|
|
2697
|
+
} else {
|
|
2698
|
+
const V = (window.scrollY || window.pageYOffset) + v.top - A;
|
|
2699
|
+
u(V, W);
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
function a(c, x, m = 600) {
|
|
2703
|
+
const T = c.scrollTop, M = x - T, i = performance.now(), n = (A) => A < 0.5 ? 4 * A * A * A : 1 - Math.pow(-2 * A + 2, 3) / 2;
|
|
2704
|
+
function v(A) {
|
|
2705
|
+
const W = A - i, V = Math.min(1, W / m);
|
|
2706
|
+
c.scrollTop = T + M * n(V), V < 1 && requestAnimationFrame(v);
|
|
2707
|
+
}
|
|
2708
|
+
requestAnimationFrame(v);
|
|
2709
|
+
}
|
|
2710
|
+
function u(c, x = 600) {
|
|
2711
|
+
const m = window.scrollY || window.pageYOffset, T = c - m, M = performance.now(), i = (v) => v < 0.5 ? 4 * v * v * v : 1 - Math.pow(-2 * v + 2, 3) / 2;
|
|
2712
|
+
function n(v) {
|
|
2713
|
+
const A = v - M, W = Math.min(1, A / x), V = m + T * i(W);
|
|
2714
|
+
window.scrollTo(0, V), W < 1 && requestAnimationFrame(n);
|
|
2715
|
+
}
|
|
2716
|
+
requestAnimationFrame(n);
|
|
2717
|
+
}
|
|
2718
|
+
return (c, x) => (S(), F("div", {
|
|
2719
|
+
class: "outline-wrapper",
|
|
2720
|
+
onClick: x[1] || (x[1] = j(() => {
|
|
2721
|
+
}, ["stop"]))
|
|
2722
|
+
}, [
|
|
2723
|
+
h("aside", {
|
|
2724
|
+
class: N(["outline", { isOpen: o.open }]),
|
|
2725
|
+
style: oe({
|
|
2726
|
+
maxHeight: typeof o.maxHeight == "number" ? o.maxHeight + "px" : o.maxHeight
|
|
2727
|
+
}),
|
|
2728
|
+
onMouseleave: _
|
|
2729
|
+
}, [
|
|
2730
|
+
h("div", Pn, [
|
|
2731
|
+
x[2] || (x[2] = h("div", { style: { "margin-right": "6px" } }, "大纲", -1)),
|
|
2732
|
+
h("div", Gn, [
|
|
2733
|
+
o.open && !o.pinned ? (S(), ye(z(Ht), {
|
|
2734
|
+
key: 0,
|
|
2735
|
+
onClick: x[0] || (x[0] = (m) => c.$emit("update:pinned", !0)),
|
|
2736
|
+
theme: "outline",
|
|
2737
|
+
size: 16,
|
|
2738
|
+
strokeWidth: 3
|
|
2739
|
+
})) : O("", !0),
|
|
2740
|
+
o.pinned ? (S(), ye(z(jt), {
|
|
2741
|
+
key: 1,
|
|
2742
|
+
onClick: f,
|
|
2743
|
+
theme: "outline",
|
|
2744
|
+
size: "16",
|
|
2745
|
+
strokeWidth: 3
|
|
2746
|
+
})) : O("", !0)
|
|
2747
|
+
])
|
|
2748
|
+
]),
|
|
2749
|
+
h("div", Yn, [
|
|
2750
|
+
h("ul", qn, [
|
|
2751
|
+
(S(!0), F(ie, null, se(y.value, (m, T) => (S(), F("li", {
|
|
2752
|
+
key: m.node.pos + "-" + T,
|
|
2753
|
+
class: N(["outline__item", "lv-" + m.level])
|
|
2754
|
+
}, [
|
|
2755
|
+
m.hasChildren ? (S(), F("span", {
|
|
2756
|
+
key: 0,
|
|
2757
|
+
class: N(["outline__caret", { collapsed: b(m.node), expanded: !b(m.node) }]),
|
|
2758
|
+
onClick: j((M) => k(m.node), ["stop"]),
|
|
2759
|
+
title: "展开/收起"
|
|
2760
|
+
}, [...x[3] || (x[3] = [
|
|
2761
|
+
h("svg", {
|
|
2762
|
+
width: "12",
|
|
2763
|
+
height: "12",
|
|
2764
|
+
viewBox: "0 0 24 24",
|
|
2765
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2766
|
+
}, [
|
|
2767
|
+
h("path", {
|
|
2768
|
+
d: "M8 5l8 7-8 7V5z",
|
|
2769
|
+
fill: "currentColor"
|
|
2770
|
+
})
|
|
2771
|
+
], -1)
|
|
2772
|
+
])], 10, Zn)) : O("", !0),
|
|
2773
|
+
h("span", {
|
|
2774
|
+
class: "outline__text",
|
|
2775
|
+
onClick: (M) => s(m.node)
|
|
2776
|
+
}, re(m.node.text || "(无标题)"), 9, Kn)
|
|
2777
|
+
], 2))), 128))
|
|
2778
|
+
])
|
|
2779
|
+
])
|
|
2780
|
+
], 38),
|
|
2781
|
+
l(Ce, { name: "outline-mask" }, {
|
|
2782
|
+
default: P(() => [
|
|
2783
|
+
o.open ? (S(), F("div", {
|
|
2784
|
+
key: 0,
|
|
2785
|
+
class: "outline-drawer-mask",
|
|
2786
|
+
onClick: f
|
|
2787
|
+
})) : O("", !0)
|
|
2788
|
+
]),
|
|
2789
|
+
_: 1
|
|
2790
|
+
})
|
|
2791
|
+
]));
|
|
2792
|
+
}
|
|
2793
|
+
}), Xn = /* @__PURE__ */ J(Jn, [["__scopeId", "data-v-b5f802fc"]]), Qn = ["onClick"], ei = /* @__PURE__ */ K({
|
|
2794
|
+
__name: "index",
|
|
2795
|
+
props: {
|
|
2796
|
+
modelValue: {},
|
|
2797
|
+
markdown: {},
|
|
2798
|
+
height: {},
|
|
2799
|
+
placeholder: {},
|
|
2800
|
+
imageUploader: { type: Function },
|
|
2801
|
+
videoUploader: { type: Function },
|
|
2802
|
+
caretColor: {},
|
|
2803
|
+
uploadSizeLimit: {}
|
|
2804
|
+
},
|
|
2805
|
+
emits: ["update:modelValue", "update:markdown"],
|
|
2806
|
+
setup(e, { expose: r, emit: o }) {
|
|
2807
|
+
const t = e, s = o, f = H(null);
|
|
2808
|
+
let _ = !1;
|
|
2809
|
+
const d = H(!1), L = H(""), b = H([]), k = H("#000000"), w = H(!0), y = H(!0), g = H(null), a = H(void 0), u = H([]), c = H(null), x = () => {
|
|
2810
|
+
const p = g.value;
|
|
2811
|
+
a.value = p ? p.clientHeight : void 0;
|
|
2812
|
+
};
|
|
2813
|
+
let m = null;
|
|
2814
|
+
ue(() => {
|
|
2815
|
+
x(), m = () => x(), window.addEventListener("resize", m), me(() => {
|
|
2816
|
+
const p = g.value;
|
|
2817
|
+
p && p.addEventListener("scroll", Se, { passive: !0 });
|
|
2818
|
+
});
|
|
2819
|
+
}), ve(() => {
|
|
2820
|
+
m && (window.removeEventListener("resize", m), m = null);
|
|
2821
|
+
const p = g.value;
|
|
2822
|
+
p && p.removeEventListener("scroll", Se);
|
|
2823
|
+
}), be([() => t.height, w], async () => {
|
|
2824
|
+
await me(), x(), Se();
|
|
2825
|
+
});
|
|
2826
|
+
const T = de(() => {
|
|
2827
|
+
const C = (($) => $ == null ? void 0 : typeof $ == "number" ? `${$}px` : $)(t.height);
|
|
2828
|
+
return {
|
|
2829
|
+
height: C,
|
|
2830
|
+
"--editor-height": C,
|
|
2831
|
+
"--editor-caret-color": t.caretColor || "#000"
|
|
2832
|
+
};
|
|
2833
|
+
}), M = Be.extend({
|
|
2834
|
+
addAttributes() {
|
|
2835
|
+
return {
|
|
2836
|
+
fontSize: {
|
|
2837
|
+
default: null,
|
|
2838
|
+
parseHTML: (p) => p.style.fontSize || null,
|
|
2839
|
+
renderHTML: (p) => p.fontSize ? { style: `font-size: ${p.fontSize}` } : {}
|
|
2840
|
+
}
|
|
2841
|
+
};
|
|
2842
|
+
},
|
|
2843
|
+
addCommands() {
|
|
2844
|
+
return {
|
|
2845
|
+
setFontSize: (p) => ({ chain: C }) => C().setMark("textStyle", { fontSize: p }).run(),
|
|
2846
|
+
unsetFontSize: () => ({ chain: p }) => p().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
|
|
2847
|
+
};
|
|
2848
|
+
}
|
|
2849
|
+
}), i = Be.extend({
|
|
2850
|
+
addAttributes() {
|
|
2851
|
+
return {
|
|
2852
|
+
backgroundColor: {
|
|
2853
|
+
default: null,
|
|
2854
|
+
parseHTML: (p) => p.style.backgroundColor || null,
|
|
2855
|
+
renderHTML: (p) => p.backgroundColor ? { style: `background-color: ${p.backgroundColor}` } : {}
|
|
2856
|
+
}
|
|
2857
|
+
};
|
|
2858
|
+
},
|
|
2859
|
+
addCommands() {
|
|
2860
|
+
return {
|
|
2861
|
+
setBackgroundColor: (p) => ({ chain: C }) => C().setMark("textStyle", { backgroundColor: p }).run(),
|
|
2862
|
+
unsetBackgroundColor: () => ({ chain: p }) => p().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run()
|
|
2863
|
+
};
|
|
2864
|
+
}
|
|
2865
|
+
});
|
|
2866
|
+
ue(() => {
|
|
2867
|
+
f.value = new et({
|
|
2868
|
+
extensions: [
|
|
2869
|
+
ot.configure({ dropcursor: !1 }),
|
|
2870
|
+
ht.configure({ color: "#22c55e", width: 2 }),
|
|
2871
|
+
ft,
|
|
2872
|
+
wt,
|
|
2873
|
+
kt.configure({
|
|
2874
|
+
inline: !0,
|
|
2875
|
+
allowBase64: !0
|
|
2876
|
+
}),
|
|
2877
|
+
// 通用/本地视频节点(支持 blob/base64/直链等)
|
|
2878
|
+
gt.configure({ HTMLAttributes: { class: "tiptap-video", controls: !0 } }),
|
|
2879
|
+
// Markdown 放在所有自定义节点之后,确保序列化规则被收集
|
|
2880
|
+
nt,
|
|
2881
|
+
// 表格支持(v3 TableKit)
|
|
2882
|
+
ut.configure({
|
|
2883
|
+
table: { resizable: !0 },
|
|
2884
|
+
tableCell: !1
|
|
2885
|
+
}),
|
|
2886
|
+
pt,
|
|
2887
|
+
Be,
|
|
2888
|
+
M,
|
|
2889
|
+
i,
|
|
2890
|
+
at,
|
|
2891
|
+
ct,
|
|
2892
|
+
lt.configure({
|
|
2893
|
+
autolink: !0,
|
|
2894
|
+
linkOnPaste: !0,
|
|
2895
|
+
openOnClick: !1,
|
|
2896
|
+
HTMLAttributes: {
|
|
2897
|
+
target: "_blank",
|
|
2898
|
+
rel: "noopener noreferrer"
|
|
2899
|
+
}
|
|
2900
|
+
}),
|
|
2901
|
+
rt.configure({
|
|
2902
|
+
types: ["heading", "paragraph"]
|
|
2903
|
+
}),
|
|
2904
|
+
st.configure({ placeholder: t.placeholder ?? "输入 / 以插入块" })
|
|
2905
|
+
],
|
|
2906
|
+
// 直接在构造时设置初始内容,避免立即调用 setContent 导致部分插件(如 resizable)在尚未完成挂载时触发 selection 更新报错
|
|
2907
|
+
content: t.markdown != null ? String(t.markdown || "") : String(t.modelValue || ""),
|
|
2908
|
+
contentType: t.markdown != null ? "markdown" : /<\s*(video|iframe)\b|data-youtube-video|<\w+/i.test(String(t.modelValue || "")) ? "html" : "markdown",
|
|
2909
|
+
editable: !0,
|
|
2910
|
+
autofocus: !0,
|
|
2911
|
+
editorProps: {
|
|
2912
|
+
// 任务列表等交互由扩展自身处理,无需额外事件
|
|
2913
|
+
handlePaste(p, C) {
|
|
2914
|
+
var Le, _e, Ve;
|
|
2915
|
+
const $ = C.clipboardData;
|
|
2916
|
+
if (!$) return !1;
|
|
2917
|
+
const E = $.files && $.files.length ? Array.from($.files) : [], B = E.find((q) => {
|
|
2918
|
+
var te;
|
|
2919
|
+
return (te = q.type) == null ? void 0 : te.startsWith("image/");
|
|
2920
|
+
});
|
|
2921
|
+
if (B) {
|
|
2922
|
+
if (C.preventDefault(), !t.imageUploader) {
|
|
2923
|
+
try {
|
|
2924
|
+
window.alert("未设置图片上传方法(image-uploader),无法上传图片文件");
|
|
2925
|
+
} catch {
|
|
2926
|
+
}
|
|
2927
|
+
return !0;
|
|
2928
|
+
}
|
|
2929
|
+
return W(B), !0;
|
|
2930
|
+
}
|
|
2931
|
+
const D = E.find((q) => {
|
|
2932
|
+
var te;
|
|
2933
|
+
return (te = q.type) == null ? void 0 : te.startsWith("video/");
|
|
2934
|
+
});
|
|
2935
|
+
if (D)
|
|
2936
|
+
return C.preventDefault(), ae(D), !0;
|
|
2937
|
+
const I = ($.items ? Array.from($.items) : []).find((q) => q.kind === "file"), Y = I ? I.getAsFile() : null;
|
|
2938
|
+
if (Y && Y.type.startsWith("image/")) {
|
|
2939
|
+
if (C.preventDefault(), !t.imageUploader) {
|
|
2940
|
+
try {
|
|
2941
|
+
window.alert("未设置图片上传方法(image-uploader),无法上传图片文件");
|
|
2942
|
+
} catch {
|
|
2943
|
+
}
|
|
2944
|
+
return !0;
|
|
2945
|
+
}
|
|
2946
|
+
return W(Y), !0;
|
|
2947
|
+
}
|
|
2948
|
+
if (Y && Y.type.startsWith("video/"))
|
|
2949
|
+
return C.preventDefault(), ae(Y), !0;
|
|
2950
|
+
const R = $.getData("text/html");
|
|
2951
|
+
if (R) {
|
|
2952
|
+
const q = R.match(/<img[^>]+src=["']([^"']+)["']/i), te = R.replace(/\s+/g, "").match(/^<img[^>]+src=["']([^"']+)["'][^>]*>$/i);
|
|
2953
|
+
if (q && te && te[1]) {
|
|
2954
|
+
C.preventDefault();
|
|
2955
|
+
const $e = te[1];
|
|
2956
|
+
if (t.imageUploader && /^data:image\//i.test($e)) {
|
|
2957
|
+
const Te = G($e, "clipboard.png");
|
|
2958
|
+
W(Te);
|
|
2959
|
+
} else {
|
|
2960
|
+
if (/^data:image\//i.test($e)) {
|
|
2961
|
+
const Te = G($e, "clipboard.png"), He = (Le = t.uploadSizeLimit) == null ? void 0 : Le.image;
|
|
2962
|
+
if (He) {
|
|
2963
|
+
const Ke = Math.max(1, He) * 1024 * 1024;
|
|
2964
|
+
if (Te.size > Ke) {
|
|
2965
|
+
try {
|
|
2966
|
+
window.alert(`图片文件大小超限(${(Te.size / 1024 / 1024).toFixed(2)}MB > ${He}MB)`);
|
|
2967
|
+
} catch {
|
|
2968
|
+
}
|
|
2969
|
+
return !0;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
n($e);
|
|
2974
|
+
}
|
|
2975
|
+
return !0;
|
|
2976
|
+
}
|
|
2977
|
+
const pe = R.match(/<video[^>]+src=["']([^"']+)["']/i), ce = R.match(/<source[^>]+src=["']([^"']+)["']/i), Me = R.replace(/\s+/g, "").match(/^<video[^>]*>.*<\/video>$/i), Ie = pe && pe[1] || ce && ce[1];
|
|
2978
|
+
if (Ie && Me)
|
|
2979
|
+
return C.preventDefault(), A(Ie), !0;
|
|
2980
|
+
}
|
|
2981
|
+
const ke = $.getData("text/plain");
|
|
2982
|
+
if (ke) {
|
|
2983
|
+
const q = ke.trim(), te = ee(q);
|
|
2984
|
+
if (Q(q) && q === ke.trim()) {
|
|
2985
|
+
if (C.preventDefault(), /^data:image\//i.test(q)) {
|
|
2986
|
+
const pe = G(q, "clipboard.png"), ce = (_e = t.uploadSizeLimit) == null ? void 0 : _e.image;
|
|
2987
|
+
if (ce) {
|
|
2988
|
+
const Me = Math.max(1, ce) * 1024 * 1024;
|
|
2989
|
+
if (pe.size > Me) {
|
|
2990
|
+
try {
|
|
2991
|
+
window.alert(`图片文件大小超限(${(pe.size / 1024 / 1024).toFixed(2)}MB > ${ce}MB)`);
|
|
2992
|
+
} catch {
|
|
2993
|
+
}
|
|
2994
|
+
return !0;
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
return n(q), !0;
|
|
2999
|
+
}
|
|
3000
|
+
if (te) {
|
|
3001
|
+
if (C.preventDefault(), /^data:image\//i.test(te)) {
|
|
3002
|
+
const pe = G(te, "clipboard.png"), ce = (Ve = t.uploadSizeLimit) == null ? void 0 : Ve.image;
|
|
3003
|
+
if (ce) {
|
|
3004
|
+
const Me = Math.max(1, ce) * 1024 * 1024;
|
|
3005
|
+
if (pe.size > Me) {
|
|
3006
|
+
try {
|
|
3007
|
+
window.alert(`图片文件大小超限(${(pe.size / 1024 / 1024).toFixed(2)}MB > ${ce}MB)`);
|
|
3008
|
+
} catch {
|
|
3009
|
+
}
|
|
3010
|
+
return !0;
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
return n(te), !0;
|
|
3015
|
+
}
|
|
3016
|
+
if (fe(q) && q === ke.trim())
|
|
3017
|
+
return C.preventDefault(), A(q), !0;
|
|
3018
|
+
}
|
|
3019
|
+
return !1;
|
|
3020
|
+
},
|
|
3021
|
+
handleDrop(p, C) {
|
|
3022
|
+
const $ = C.dataTransfer;
|
|
3023
|
+
if (!$) return !1;
|
|
3024
|
+
const B = ($.files ? Array.from($.files) : []).find((D) => {
|
|
3025
|
+
var U;
|
|
3026
|
+
return (U = D.type) == null ? void 0 : U.startsWith("image/");
|
|
3027
|
+
});
|
|
3028
|
+
if (B) {
|
|
3029
|
+
if (C.preventDefault(), !t.imageUploader) {
|
|
3030
|
+
try {
|
|
3031
|
+
window.alert("未设置图片上传方法(image-uploader),无法上传图片文件");
|
|
3032
|
+
} catch {
|
|
3033
|
+
}
|
|
3034
|
+
return !0;
|
|
3035
|
+
}
|
|
3036
|
+
return W(B), !0;
|
|
3037
|
+
}
|
|
3038
|
+
return !1;
|
|
3039
|
+
},
|
|
3040
|
+
handleClick(p, C, $) {
|
|
3041
|
+
const E = $, B = E.target, D = B ? B.closest("a[href]") : null;
|
|
3042
|
+
if (D && (E.ctrlKey || E.metaKey)) {
|
|
3043
|
+
const U = D.getAttribute("href") || "";
|
|
3044
|
+
if (U) {
|
|
3045
|
+
E.preventDefault();
|
|
3046
|
+
try {
|
|
3047
|
+
window.open(U, "_blank", "noopener,noreferrer");
|
|
3048
|
+
} catch (I) {
|
|
3049
|
+
console.warn("打开链接失败:", I);
|
|
3050
|
+
}
|
|
3051
|
+
return !0;
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
return !1;
|
|
3055
|
+
}
|
|
3056
|
+
},
|
|
3057
|
+
onSelectionUpdate: (p) => {
|
|
3058
|
+
var E;
|
|
3059
|
+
const $ = ((E = p.editor.getAttributes("textStyle")) == null ? void 0 : E.color) || "#000000";
|
|
3060
|
+
k.value = typeof $ == "string" ? $ : "#000000";
|
|
3061
|
+
},
|
|
3062
|
+
onUpdate: () => {
|
|
3063
|
+
const p = f.value;
|
|
3064
|
+
_ = !0, s("update:modelValue", p.getHTML()), s("update:markdown", p.getMarkdown()), je();
|
|
3065
|
+
},
|
|
3066
|
+
onTransaction: () => {
|
|
3067
|
+
je();
|
|
3068
|
+
}
|
|
3069
|
+
}), me(() => {
|
|
3070
|
+
var p;
|
|
3071
|
+
je();
|
|
3072
|
+
try {
|
|
3073
|
+
(p = f.value) == null || p.chain().focus().run();
|
|
3074
|
+
} catch {
|
|
3075
|
+
}
|
|
3076
|
+
});
|
|
3077
|
+
}), ve(() => {
|
|
3078
|
+
var p;
|
|
3079
|
+
(p = f.value) == null || p.destroy();
|
|
3080
|
+
}), be(
|
|
3081
|
+
() => t.modelValue,
|
|
3082
|
+
(p) => {
|
|
3083
|
+
if (_) {
|
|
3084
|
+
_ = !1;
|
|
3085
|
+
return;
|
|
3086
|
+
}
|
|
3087
|
+
p != null && f.value && me(() => {
|
|
3088
|
+
try {
|
|
3089
|
+
const C = /<\s*(video|iframe)\b|data-youtube-video/i.test(p), $ = p.match(/\[video\]\(([^)]+)\)/i);
|
|
3090
|
+
if (!C && $) {
|
|
3091
|
+
const E = $[1], B = p.replace(
|
|
3092
|
+
/\[video\]\(([^)]+)\)/gi,
|
|
3093
|
+
(D, U) => `<video data-tiptap-video src="${U}" controls></video>`
|
|
3094
|
+
);
|
|
3095
|
+
f.value.commands.setContent(B, { contentType: "html" });
|
|
3096
|
+
} else
|
|
3097
|
+
f.value.commands.setContent(p, {
|
|
3098
|
+
contentType: C ? "html" : "markdown"
|
|
3099
|
+
});
|
|
3100
|
+
} catch (C) {
|
|
3101
|
+
console.warn("setContent 失败,内容更新被忽略:", C);
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
}
|
|
3105
|
+
), be(
|
|
3106
|
+
() => t.markdown,
|
|
3107
|
+
(p) => {
|
|
3108
|
+
if (_) {
|
|
3109
|
+
_ = !1;
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
3112
|
+
p != null && f.value && me(() => {
|
|
3113
|
+
try {
|
|
3114
|
+
f.value.commands.setContent(p, { contentType: "markdown" });
|
|
3115
|
+
} catch (C) {
|
|
3116
|
+
console.warn("setContent 失败,内容更新被忽略:", C);
|
|
3117
|
+
}
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
);
|
|
3121
|
+
function n(p) {
|
|
3122
|
+
var C;
|
|
3123
|
+
(C = f.value) == null || C.chain().focus().setImage({ src: p }).run();
|
|
3124
|
+
}
|
|
3125
|
+
function v(p) {
|
|
3126
|
+
return String(p).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3127
|
+
}
|
|
3128
|
+
function A(p) {
|
|
3129
|
+
const C = f.value;
|
|
3130
|
+
if (!C) return;
|
|
3131
|
+
if (typeof C.commands.setVideo == "function") {
|
|
3132
|
+
C.chain().focus().setVideo({ src: p, HTMLAttributes: { controls: !0, autoplay: !1, width: 640 } }).run();
|
|
3133
|
+
return;
|
|
3134
|
+
}
|
|
3135
|
+
const E = v(p);
|
|
3136
|
+
try {
|
|
3137
|
+
C.chain().focus().insertContent(
|
|
3138
|
+
`<p><a href="${E}" target="_blank" rel="noopener noreferrer">${E}</a></p>`
|
|
3139
|
+
).run();
|
|
3140
|
+
} catch {
|
|
3141
|
+
C.chain().focus().insertContent(E).run();
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
async function W(p) {
|
|
3145
|
+
var $, E;
|
|
3146
|
+
const C = ($ = t.uploadSizeLimit) == null ? void 0 : $.image;
|
|
3147
|
+
if (C) {
|
|
3148
|
+
const B = Math.max(1, C) * 1024 * 1024;
|
|
3149
|
+
if (p.size > B) {
|
|
3150
|
+
try {
|
|
3151
|
+
window.alert(`图片文件大小超限(${(p.size / 1024 / 1024).toFixed(2)}MB > ${C}MB)`);
|
|
3152
|
+
} catch {
|
|
3153
|
+
}
|
|
3154
|
+
return;
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
if (t.imageUploader) {
|
|
3158
|
+
const B = URL.createObjectURL(p);
|
|
3159
|
+
(E = f.value) == null || E.chain().focus().setImage({ src: B, uploading: !0 }).run();
|
|
3160
|
+
try {
|
|
3161
|
+
const D = await t.imageUploader(p);
|
|
3162
|
+
if (typeof D == "string" && D) {
|
|
3163
|
+
V(B, D);
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3166
|
+
X(p, (U) => V(B, U));
|
|
3167
|
+
} catch (D) {
|
|
3168
|
+
console.warn("图片上传失败,回退为 base64", D), X(p, (U) => V(B, U));
|
|
3169
|
+
} finally {
|
|
3170
|
+
try {
|
|
3171
|
+
URL.revokeObjectURL(B);
|
|
3172
|
+
} catch {
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
return;
|
|
3176
|
+
}
|
|
3177
|
+
try {
|
|
3178
|
+
window.alert("未设置图片上传方法(image-uploader),无法上传图片文件");
|
|
3179
|
+
} catch {
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
function V(p, C) {
|
|
3183
|
+
const $ = f.value;
|
|
3184
|
+
if (!$) return;
|
|
3185
|
+
const { state: E } = $, { doc: B } = E;
|
|
3186
|
+
let D = null;
|
|
3187
|
+
if (B.descendants((U, I) => {
|
|
3188
|
+
var Y, R;
|
|
3189
|
+
return ((Y = U.type) == null ? void 0 : Y.name) === "image" && ((R = U.attrs) == null ? void 0 : R.src) === p ? (D = I, !1) : !0;
|
|
3190
|
+
}), D != null) {
|
|
3191
|
+
const U = B.nodeAt(D), I = E.schema.nodes.image;
|
|
3192
|
+
if (!U || !I) return;
|
|
3193
|
+
const Y = { ...U.attrs || {}, src: C, uploading: null }, R = E.tr.setNodeMarkup(D, I, Y, U.marks);
|
|
3194
|
+
$.view.dispatch(R);
|
|
3195
|
+
} else
|
|
3196
|
+
n(C);
|
|
3197
|
+
}
|
|
3198
|
+
function X(p, C) {
|
|
3199
|
+
const $ = new FileReader();
|
|
3200
|
+
$.onload = () => C(String($.result || "")), $.readAsDataURL(p);
|
|
3201
|
+
}
|
|
3202
|
+
function G(p, C = "image.png") {
|
|
3203
|
+
var I;
|
|
3204
|
+
const $ = p.split(","), E = ((I = $[0].match(/:(.*?);/)) == null ? void 0 : I[1]) || "image/png", B = atob($[1]);
|
|
3205
|
+
let D = B.length;
|
|
3206
|
+
const U = new Uint8Array(D);
|
|
3207
|
+
for (; D--; )
|
|
3208
|
+
U[D] = B.charCodeAt(D);
|
|
3209
|
+
return new File([U], C, { type: E });
|
|
3210
|
+
}
|
|
3211
|
+
function Q(p) {
|
|
3212
|
+
return /^data:image\//i.test(p) || /^https?:\/\//i.test(p) && /\.(png|jpe?g|gif|webp|svg)(\?.*)?$/i.test(p);
|
|
3213
|
+
}
|
|
3214
|
+
function fe(p) {
|
|
3215
|
+
return /^https?:\/\//i.test(p) && /\.(mp4|webm|m3u8|mov|ogv?)(\?.*)?$/i.test(p);
|
|
3216
|
+
}
|
|
3217
|
+
function ee(p) {
|
|
3218
|
+
const C = p.match(/^!\[[^\]]*\]\(([^)]+)\)\s*$/);
|
|
3219
|
+
if (!C) return null;
|
|
3220
|
+
const $ = C[1].trim().replace(/^<|>$/g, "");
|
|
3221
|
+
return Q($) ? $ : null;
|
|
3222
|
+
}
|
|
3223
|
+
async function ae(p) {
|
|
3224
|
+
var E;
|
|
3225
|
+
const C = (E = t.uploadSizeLimit) == null ? void 0 : E.video;
|
|
3226
|
+
if (C) {
|
|
3227
|
+
const B = Math.max(1, C) * 1024 * 1024;
|
|
3228
|
+
if (p.size > B) {
|
|
3229
|
+
try {
|
|
3230
|
+
window.alert(`视频文件大小超限(${(p.size / 1024 / 1024).toFixed(2)}MB > ${C}MB)`);
|
|
3231
|
+
} catch {
|
|
3232
|
+
}
|
|
3233
|
+
return;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
if (t.videoUploader) {
|
|
3237
|
+
const B = URL.createObjectURL(p), D = f.value, U = D == null ? void 0 : D.commands;
|
|
3238
|
+
try {
|
|
3239
|
+
typeof (U == null ? void 0 : U.setVideo) == "function" ? D == null || D.chain().focus().setVideo({
|
|
3240
|
+
src: B,
|
|
3241
|
+
HTMLAttributes: { controls: !0, autoplay: !1, width: 640, uploading: !0 }
|
|
3242
|
+
}).run() : A(B);
|
|
3243
|
+
} catch {
|
|
3244
|
+
A(B);
|
|
3245
|
+
}
|
|
3246
|
+
try {
|
|
3247
|
+
const I = await t.videoUploader(p);
|
|
3248
|
+
le(B, I);
|
|
3249
|
+
} catch (I) {
|
|
3250
|
+
console.warn("视频上传失败,保留本地对象 URL 作为预览", I);
|
|
3251
|
+
} finally {
|
|
3252
|
+
try {
|
|
3253
|
+
URL.revokeObjectURL(B);
|
|
3254
|
+
} catch {
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
const $ = URL.createObjectURL(p);
|
|
3260
|
+
A($);
|
|
3261
|
+
}
|
|
3262
|
+
function le(p, C) {
|
|
3263
|
+
const $ = f.value;
|
|
3264
|
+
if (!$) return;
|
|
3265
|
+
const { state: E } = $, { doc: B } = E;
|
|
3266
|
+
let D = null;
|
|
3267
|
+
if (B.descendants((U, I) => {
|
|
3268
|
+
var Y, R;
|
|
3269
|
+
return ((Y = U.type) == null ? void 0 : Y.name) === "video" && ((R = U.attrs) == null ? void 0 : R.src) === p ? (D = I, !1) : !0;
|
|
3270
|
+
}), D != null) {
|
|
3271
|
+
const U = B.nodeAt(D), I = E.schema.nodes.video;
|
|
3272
|
+
if (!U || !I) return;
|
|
3273
|
+
const Y = { ...U.attrs || {}, src: C, uploading: null }, R = E.tr.setNodeMarkup(D, I, Y, U.marks);
|
|
3274
|
+
$.view.dispatch(R);
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
function xe() {
|
|
3278
|
+
var p, C;
|
|
3279
|
+
L.value = ((C = (p = f.value) == null ? void 0 : p.getAttributes("link")) == null ? void 0 : C.href) || "", d.value = !0;
|
|
3280
|
+
}
|
|
3281
|
+
function je() {
|
|
3282
|
+
const p = f.value;
|
|
3283
|
+
if (!p) return;
|
|
3284
|
+
const C = [];
|
|
3285
|
+
p.state.doc.descendants(($, E) => {
|
|
3286
|
+
if ($.type.name === "heading") {
|
|
3287
|
+
const B = $.attrs.level || 1, D = $.textContent || "";
|
|
3288
|
+
C.push({ text: D, level: B, pos: E });
|
|
3289
|
+
}
|
|
3290
|
+
}), b.value = C, Se();
|
|
3291
|
+
}
|
|
3292
|
+
function Se() {
|
|
3293
|
+
const p = f.value, C = g.value, $ = b.value;
|
|
3294
|
+
if (!p || !C || !$.length) {
|
|
3295
|
+
u.value = [], c.value = null;
|
|
3296
|
+
return;
|
|
3297
|
+
}
|
|
3298
|
+
const E = C.getBoundingClientRect(), B = C.scrollHeight || C.clientHeight, D = C.clientHeight || 1, U = $.map((R) => {
|
|
3299
|
+
const Le = p.view.coordsAtPos(Math.min(R.pos + 1, p.state.doc.content.size)).top - E.top + C.scrollTop, _e = B ? Math.max(0, Math.min(1, Le / B)) : 0;
|
|
3300
|
+
return Math.round(_e * D);
|
|
3301
|
+
});
|
|
3302
|
+
u.value = U;
|
|
3303
|
+
const I = C.scrollTop + 8;
|
|
3304
|
+
let Y = null;
|
|
3305
|
+
for (let R = 0; R < $.length; R++) {
|
|
3306
|
+
const ke = $[R];
|
|
3307
|
+
if (p.view.coordsAtPos(Math.min(ke.pos + 1, p.state.doc.content.size)).top - E.top + C.scrollTop <= I) Y = ke.pos;
|
|
3308
|
+
else break;
|
|
3309
|
+
}
|
|
3310
|
+
c.value = Y;
|
|
3311
|
+
}
|
|
3312
|
+
function qe(p) {
|
|
3313
|
+
const C = p.target;
|
|
3314
|
+
C.closest(".outline") || C.closest(".outline-toggle") || f.value && f.value.chain().focus().run();
|
|
3315
|
+
}
|
|
3316
|
+
function Ze() {
|
|
3317
|
+
const p = f.value;
|
|
3318
|
+
return p ? p.getMarkdown() : "";
|
|
3319
|
+
}
|
|
3320
|
+
return r({ getMarkdown: Ze }), (p, C) => (S(), F("div", {
|
|
3321
|
+
class: "simple-editor",
|
|
3322
|
+
style: oe(T.value)
|
|
3323
|
+
}, [
|
|
3324
|
+
l(z(Nn), {
|
|
3325
|
+
editor: f.value,
|
|
3326
|
+
currentColor: k.value,
|
|
3327
|
+
imageUploader: e.imageUploader,
|
|
3328
|
+
videoUploader: e.videoUploader,
|
|
3329
|
+
"upload-size-limit": t.uploadSizeLimit,
|
|
3330
|
+
onOpenLinkModal: xe
|
|
3331
|
+
}, null, 8, ["editor", "currentColor", "imageUploader", "videoUploader", "upload-size-limit"]),
|
|
3332
|
+
h("div", {
|
|
3333
|
+
class: N(["editor_main", { hasOutline: w.value }])
|
|
3334
|
+
}, [
|
|
3335
|
+
h("div", {
|
|
3336
|
+
ref_key: "wrapperRef",
|
|
3337
|
+
ref: g,
|
|
3338
|
+
class: "editor_wrapper",
|
|
3339
|
+
onClick: qe
|
|
3340
|
+
}, [
|
|
3341
|
+
l(z(tt), {
|
|
3342
|
+
editor: f.value,
|
|
3343
|
+
class: "content"
|
|
3344
|
+
}, null, 8, ["editor"])
|
|
3345
|
+
], 512),
|
|
3346
|
+
l(z(Xn), {
|
|
3347
|
+
open: w.value,
|
|
3348
|
+
"onUpdate:open": C[0] || (C[0] = ($) => w.value = $),
|
|
3349
|
+
items: b.value,
|
|
3350
|
+
editor: f.value,
|
|
3351
|
+
container: g.value,
|
|
3352
|
+
maxHeight: a.value,
|
|
3353
|
+
pinned: y.value,
|
|
3354
|
+
"onUpdate:pinned": C[1] || (C[1] = ($) => y.value = $)
|
|
3355
|
+
}, null, 8, ["open", "items", "editor", "container", "maxHeight", "pinned"]),
|
|
3356
|
+
w.value ? O("", !0) : (S(), F("div", {
|
|
3357
|
+
key: 0,
|
|
3358
|
+
class: "outline-markers",
|
|
3359
|
+
onMouseenter: C[2] || (C[2] = ($) => (w.value = !0, y.value = !1))
|
|
3360
|
+
}, [
|
|
3361
|
+
(S(!0), F(ie, null, se(u.value, ($, E) => {
|
|
3362
|
+
var B;
|
|
3363
|
+
return S(), F("span", {
|
|
3364
|
+
key: E,
|
|
3365
|
+
class: N(["outline-marker", { active: ((B = b.value[E]) == null ? void 0 : B.pos) === c.value }]),
|
|
3366
|
+
style: oe({ top: ($ || 0) + "px" }),
|
|
3367
|
+
onClick: j((D) => {
|
|
3368
|
+
var U, I;
|
|
3369
|
+
return (I = f.value) == null ? void 0 : I.chain().focus().setTextSelection((((U = b.value[E]) == null ? void 0 : U.pos) || 1) + 1).run();
|
|
3370
|
+
}, ["stop"])
|
|
3371
|
+
}, null, 14, Qn);
|
|
3372
|
+
}), 128))
|
|
3373
|
+
], 32))
|
|
3374
|
+
], 2)
|
|
3375
|
+
], 4));
|
|
3376
|
+
}
|
|
3377
|
+
}), ti = /* @__PURE__ */ J(ei, [["__scopeId", "data-v-c9ed96a6"]]), mi = {
|
|
3378
|
+
install(e) {
|
|
3379
|
+
e.component("Editor", ti);
|
|
3380
|
+
}
|
|
3381
|
+
};
|
|
3382
|
+
export {
|
|
3383
|
+
ti as Editor,
|
|
3384
|
+
mi as default
|
|
3385
|
+
};
|