edu360-web-ui 1.0.94 → 1.0.95

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.
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  var _a2;
5
- import { ref, defineComponent, provide, markRaw, reactive, h as h$2, render as render$1, getCurrentInstance, watchEffect, nextTick, unref, onBeforeUnmount, customRef, shallowRef, onMounted, watch, onUnmounted, createBlock, openBlock, normalizeClass, withCtx, createElementVNode, createCommentVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment as Fragment$1, renderList, resolveComponent, resolveDirective, normalizeStyle, withDirectives, vShow, withModifiers, Teleport, isRef, createApp, renderSlot, computed } from "vue";
5
+ import { ref, defineComponent, provide, markRaw, reactive, h as h$2, render as render$1, getCurrentInstance, watchEffect, nextTick, unref, onBeforeUnmount, customRef, shallowRef, onMounted, watch, onUnmounted, createBlock, openBlock, normalizeClass, withCtx, createElementVNode, createCommentVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment as Fragment$1, renderList, resolveComponent, resolveDirective, normalizeStyle, withDirectives, vShow, withModifiers, Teleport, computed, isRef, createApp, renderSlot } from "vue";
6
6
  import { ElDropdown, ElDropdownMenu, ElDropdownItem, ElMessage, ElInput, ElButton, ElCard, ElForm, ElFormItem, ElTooltip, ElUpload, ElPopover, ElDrawer, ElTable, ElTableColumn, ElColorPicker, ElButtonGroup, ElLoading, ElDialog } from "element-plus";
7
7
  function OrderedMap(content) {
8
8
  this.content = content;
@@ -78316,7 +78316,7 @@ const _export_sfc = (sfc, props) => {
78316
78316
  return target;
78317
78317
  };
78318
78318
  const _hoisted_1$9 = { class: "code-block-view-cont" };
78319
- const _hoisted_2$7 = { class: "code-toolbar" };
78319
+ const _hoisted_2$8 = { class: "code-toolbar" };
78320
78320
  const _hoisted_3$6 = { class: "code-toolbar-right" };
78321
78321
  const _hoisted_4$4 = { class: "el-dropdown-link" };
78322
78322
  const _hoisted_5$4 = { style: { "height": "300px" } };
@@ -78381,7 +78381,7 @@ const _sfc_main$b = {
78381
78381
  }, {
78382
78382
  default: withCtx(() => [
78383
78383
  createElementVNode("div", _hoisted_1$9, [
78384
- createElementVNode("div", _hoisted_2$7, [
78384
+ createElementVNode("div", _hoisted_2$8, [
78385
78385
  _cache[0] || (_cache[0] = createElementVNode("div", null, null, -1)),
78386
78386
  createElementVNode("div", _hoisted_3$6, [
78387
78387
  unref(showType) != "ai" ? (openBlock(), createBlock(unref(ElDropdown), {
@@ -88462,13 +88462,23 @@ const commonExtensions = () => [
88462
88462
  // 启用1-6级标题
88463
88463
  bulletList: false,
88464
88464
  orderedList: false,
88465
- listItem: false
88465
+ listItem: false,
88466
+ strike: true,
88467
+ // 确保启用中划线
88468
+ bold: true,
88469
+ // 确保启用粗体
88470
+ italic: true
88471
+ // 确保启用斜体
88466
88472
  }),
88467
88473
  TextStyle,
88468
88474
  // 文本样式扩展
88469
88475
  Color,
88470
88476
  // 颜色选择扩展
88471
- index_default$9,
88477
+ index_default$9.configure({
88478
+ HTMLAttributes: {
88479
+ class: "underline"
88480
+ }
88481
+ }),
88472
88482
  // 下划线功能
88473
88483
  FontSize,
88474
88484
  // 自定义字体大小
@@ -88521,7 +88531,9 @@ const commonExtensions = () => [
88521
88531
  }),
88522
88532
  AutoOrderedOnEnter,
88523
88533
  index_default$2.configure({
88524
- types: ["heading", "paragraph"]
88534
+ types: ["heading", "paragraph"],
88535
+ alignments: ["left", "center", "right", "justify"],
88536
+ defaultAlignment: "left"
88525
88537
  }),
88526
88538
  index_default$b.configure({
88527
88539
  openOnClick: false,
@@ -98115,7 +98127,7 @@ function htmlToMarkdown(html2) {
98115
98127
  return turndownService.turndown(html2);
98116
98128
  }
98117
98129
  const _hoisted_1$8 = { class: "ai-input" };
98118
- const _hoisted_2$6 = {
98130
+ const _hoisted_2$7 = {
98119
98131
  key: 0,
98120
98132
  class: "ai-btns"
98121
98133
  };
@@ -98133,10 +98145,10 @@ const _hoisted_6$3 = {
98133
98145
  class: "result-image"
98134
98146
  };
98135
98147
  const _hoisted_7$3 = ["onClick"];
98136
- const _hoisted_8$2 = ["src"];
98137
- const _hoisted_9$2 = { class: "result-image-checkbox" };
98148
+ const _hoisted_8$3 = ["src"];
98149
+ const _hoisted_9$3 = { class: "result-image-checkbox" };
98138
98150
  const _hoisted_10$2 = { class: "result-text" };
98139
- const _hoisted_11$1 = { class: "result-actions" };
98151
+ const _hoisted_11 = { class: "result-actions" };
98140
98152
  const _sfc_main$a = {
98141
98153
  __name: "AiComponent",
98142
98154
  props: {
@@ -98391,7 +98403,7 @@ const _sfc_main$a = {
98391
98403
  ], 512), [
98392
98404
  [vShow, !unref(showResult)]
98393
98405
  ]),
98394
- !unref(showResult) ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
98406
+ !unref(showResult) ? (openBlock(), createElementBlock("div", _hoisted_2$7, [
98395
98407
  createElementVNode("div", {
98396
98408
  class: normalizeClass(["ai-btns-send", { "is-disabled": !question.value }]),
98397
98409
  onClick: send2
@@ -98538,8 +98550,8 @@ const _sfc_main$a = {
98538
98550
  src: item.img,
98539
98551
  alt: "",
98540
98552
  width: "100%"
98541
- }, null, 8, _hoisted_8$2),
98542
- createElementVNode("div", _hoisted_9$2, [
98553
+ }, null, 8, _hoisted_8$3),
98554
+ createElementVNode("div", _hoisted_9$3, [
98543
98555
  createVNode(_component_el_checkbox, {
98544
98556
  modelValue: item.checked,
98545
98557
  "onUpdate:modelValue": ($event) => item.checked = $event,
@@ -98555,7 +98567,7 @@ const _sfc_main$a = {
98555
98567
  editor: unref(previewEditor)
98556
98568
  }, null, 8, ["editor"])) : createCommentVNode("", true)
98557
98569
  ]),
98558
- createElementVNode("div", _hoisted_11$1, [
98570
+ createElementVNode("div", _hoisted_11, [
98559
98571
  createVNode(unref(ElButton), {
98560
98572
  disabled: unref(typewriterLoading),
98561
98573
  size: "small",
@@ -101009,7 +101021,8 @@ defineComponent({
101009
101021
  };
101010
101022
  }
101011
101023
  });
101012
- const _hoisted_1$7 = { class: "text-right mt-2" };
101024
+ const _hoisted_1$7 = { class: "flex justify-between items-center mt-2" };
101025
+ const _hoisted_2$6 = { key: 1 };
101013
101026
  const _sfc_main$8 = {
101014
101027
  __name: "LinkToolbar",
101015
101028
  props: {
@@ -101027,6 +101040,9 @@ const _sfc_main$8 = {
101027
101040
  href: ""
101028
101041
  });
101029
101042
  let currentPos = 0;
101043
+ const hasExistingLink = computed(() => {
101044
+ return !!form.href && form.text;
101045
+ });
101030
101046
  const open = () => {
101031
101047
  console.log("22222");
101032
101048
  const { editor } = props;
@@ -101084,6 +101100,11 @@ const _sfc_main$8 = {
101084
101100
  const close2 = () => {
101085
101101
  show.value = false;
101086
101102
  };
101103
+ const removeLink = () => {
101104
+ const { editor } = props;
101105
+ editor.chain().focus().unsetLink().run();
101106
+ close2();
101107
+ };
101087
101108
  onMounted(() => {
101088
101109
  document.addEventListener("mousedown", handleClickOutside);
101089
101110
  });
@@ -101129,25 +101150,58 @@ const _sfc_main$8 = {
101129
101150
  _: 1
101130
101151
  }, 8, ["model"]),
101131
101152
  createElementVNode("div", _hoisted_1$7, [
101132
- createVNode(unref(ElButton), {
101153
+ hasExistingLink.value ? (openBlock(), createBlock(unref(ElButton), {
101154
+ key: 0,
101133
101155
  size: "small",
101134
- onClick: close2
101156
+ onClick: removeLink,
101157
+ class: "unlink-btn"
101135
101158
  }, {
101136
101159
  default: withCtx(() => [..._cache[2] || (_cache[2] = [
101137
- createTextVNode("取消", -1)
101138
- ])]),
101139
- _: 1
101140
- }),
101141
- createVNode(unref(ElButton), {
101142
- size: "small",
101143
- type: "primary",
101144
- onClick: applyLink
101145
- }, {
101146
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
101147
- createTextVNode("确定", -1)
101160
+ createElementVNode("svg", {
101161
+ xmlns: "http://www.w3.org/2000/svg",
101162
+ width: "16",
101163
+ height: "16",
101164
+ viewBox: "0 0 24 24",
101165
+ fill: "none",
101166
+ stroke: "currentColor",
101167
+ "stroke-width": "2",
101168
+ "stroke-linecap": "round",
101169
+ "stroke-linejoin": "round"
101170
+ }, [
101171
+ createElementVNode("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
101172
+ createElementVNode("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }),
101173
+ createElementVNode("line", {
101174
+ x1: "4",
101175
+ y1: "20",
101176
+ x2: "20",
101177
+ y2: "4"
101178
+ })
101179
+ ], -1),
101180
+ createElementVNode("span", { class: "ml-1" }, "取消链接", -1)
101148
101181
  ])]),
101149
101182
  _: 1
101150
- })
101183
+ })) : (openBlock(), createElementBlock("div", _hoisted_2$6)),
101184
+ createElementVNode("div", null, [
101185
+ createVNode(unref(ElButton), {
101186
+ size: "small",
101187
+ onClick: close2
101188
+ }, {
101189
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
101190
+ createTextVNode("取消", -1)
101191
+ ])]),
101192
+ _: 1
101193
+ }),
101194
+ createVNode(unref(ElButton), {
101195
+ size: "small",
101196
+ type: "primary",
101197
+ onClick: applyLink
101198
+ }, {
101199
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
101200
+ createTextVNode("确定", -1)
101201
+ ])]),
101202
+ _: 1
101203
+ })
101204
+ ])
101151
101205
  ])
101152
101206
  ]),
101153
101207
  _: 1
@@ -101156,7 +101210,7 @@ const _sfc_main$8 = {
101156
101210
  };
101157
101211
  }
101158
101212
  };
101159
- const LinkToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-1a77d30e"]]);
101213
+ const LinkToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-652c40fc"]]);
101160
101214
  const _hoisted_1$6 = { class: "sudoku-div" };
101161
101215
  const _hoisted_2$5 = ["row", "col", "onMouseover", "onClick"];
101162
101216
  const _sfc_main$7 = {
@@ -107773,8 +107827,8 @@ const _hoisted_4$2 = { class: "floating-menu-common-list" };
107773
107827
  const _hoisted_5$2 = { class: "block-menu-item-icon" };
107774
107828
  const _hoisted_6$2 = { class: "block-menu-item" };
107775
107829
  const _hoisted_7$2 = { class: "block-menu-item-icon" };
107776
- const _hoisted_8$1 = { class: "block-menu-item-icon" };
107777
- const _hoisted_9$1 = { class: "block-menu-item-icon" };
107830
+ const _hoisted_8$2 = { class: "block-menu-item-icon" };
107831
+ const _hoisted_9$2 = { class: "block-menu-item-icon" };
107778
107832
  const _hoisted_10$1 = { class: "block-menu-item-icon" };
107779
107833
  const _sfc_main$6 = {
107780
107834
  __name: "BlockMenu",
@@ -107917,13 +107971,31 @@ const _sfc_main$6 = {
107917
107971
  emit("closemenu", "codeblock");
107918
107972
  };
107919
107973
  let tablePopoverVisible = ref(false);
107974
+ let selectedTableData = ref(null);
107920
107975
  const selectTable = (data) => {
107976
+ selectedTableData.value = data;
107921
107977
  tablePopoverVisible.value = false;
107922
107978
  nextTick(() => {
107923
- emit("closemenu");
107924
- setTimeout(() => {
107925
- props.editor.chain().focus().insertTable({ rows: data.row, cols: data.col, withHeaderRow: true }).run();
107926
- }, 0);
107979
+ emit("closemenu", () => {
107980
+ setTimeout(() => {
107981
+ const { state } = props.editor;
107982
+ const { $from } = state.selection;
107983
+ const currentNode = $from.node();
107984
+ if (currentNode && currentNode.type.name === "paragraph" && currentNode.content.size > 0) {
107985
+ props.editor.chain().focus().insertContent("<p></p>").insertTable({
107986
+ rows: selectedTableData.value.row,
107987
+ cols: selectedTableData.value.col,
107988
+ withHeaderRow: true
107989
+ }).run();
107990
+ } else {
107991
+ props.editor.chain().focus().insertTable({
107992
+ rows: selectedTableData.value.row,
107993
+ cols: selectedTableData.value.col,
107994
+ withHeaderRow: true
107995
+ }).run();
107996
+ }
107997
+ }, 50);
107998
+ });
107927
107999
  });
107928
108000
  };
107929
108001
  return (_ctx, _cache) => {
@@ -108246,7 +108318,7 @@ const _sfc_main$6 = {
108246
108318
  class: normalizeClass(["block-menu-item", { "icon-gray": isActive2("codeBlock") || isActive2("table") || isActive2("bulletList") || isActive2("orderedList") || isActive2("taskList") }]),
108247
108319
  ref: "tableRef"
108248
108320
  }, [
108249
- createElementVNode("div", _hoisted_8$1, [
108321
+ createElementVNode("div", _hoisted_8$2, [
108250
108322
  createVNode(unref(Icon), {
108251
108323
  icon: "material-symbols:table-outline-sharp",
108252
108324
  width: "20"
@@ -108284,7 +108356,7 @@ const _sfc_main$6 = {
108284
108356
  createElementVNode("div", {
108285
108357
  class: normalizeClass(["block-menu-item", { "icon-gray": isActive2("codeBlock") || isActive2("table") || isActive2("bulletList") || isActive2("orderedList") || isActive2("taskList") }])
108286
108358
  }, [
108287
- createElementVNode("div", _hoisted_9$1, [
108359
+ createElementVNode("div", _hoisted_9$2, [
108288
108360
  createVNode(unref(Icon), { icon: "tabler:file-word" })
108289
108361
  ]),
108290
108362
  _cache[27] || (_cache[27] = createElementVNode("div", null, "上传word文件", -1))
@@ -108335,7 +108407,7 @@ const _sfc_main$6 = {
108335
108407
  };
108336
108408
  }
108337
108409
  };
108338
- const BlockMenu = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-c9b1c163"]]);
108410
+ const BlockMenu = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-7f8a1002"]]);
108339
108411
  function BlockMenuPlugin(editor, options) {
108340
108412
  const PLUGIN_KEY = new PluginKey("blockMenu");
108341
108413
  let wrapperEl = options.wrapperEl || null;
@@ -108481,6 +108553,34 @@ Extension.create({
108481
108553
  }
108482
108554
  });
108483
108555
  const CustomImage = index_default$6.extend({
108556
+ addAttributes() {
108557
+ var _a3;
108558
+ return {
108559
+ ...(_a3 = this.parent) == null ? void 0 : _a3.call(this),
108560
+ width: {
108561
+ default: null,
108562
+ renderHTML: (attrs) => {
108563
+ if (!attrs.width) return {};
108564
+ return { width: attrs.width + "px" };
108565
+ },
108566
+ parseHTML: (element) => {
108567
+ const w2 = element.getAttribute("width") || element.style.width;
108568
+ return w2 ? parseInt(w2) : null;
108569
+ }
108570
+ },
108571
+ height: {
108572
+ default: null,
108573
+ renderHTML: (attrs) => {
108574
+ if (!attrs.height) return {};
108575
+ return { height: attrs.height + "px" };
108576
+ },
108577
+ parseHTML: (element) => {
108578
+ const h2 = element.getAttribute("height") || element.style.height;
108579
+ return h2 ? parseInt(h2) : null;
108580
+ }
108581
+ }
108582
+ };
108583
+ },
108484
108584
  addProseMirrorPlugins() {
108485
108585
  const PLUGIN_KEY = new PluginKey("customImageClick");
108486
108586
  return [
@@ -108488,18 +108588,272 @@ const CustomImage = index_default$6.extend({
108488
108588
  key: PLUGIN_KEY,
108489
108589
  props: {
108490
108590
  handleDOMEvents: {
108491
- click: (view, event) => {
108492
- const target = event.target;
108493
- if (target.tagName === "IMG") {
108494
- window.dispatchEvent(new CustomEvent("tiptap-image-click", { detail: target.src }));
108495
- return true;
108496
- }
108497
- return false;
108498
- }
108591
+ // 去掉“点击图片放大”行为,仅通过工具条按钮查看原图
108592
+ click: () => false
108499
108593
  }
108500
108594
  }
108501
108595
  })
108502
108596
  ];
108597
+ },
108598
+ addNodeView() {
108599
+ return ({ node, editor, getPos }) => {
108600
+ const wrapper = document.createElement("div");
108601
+ wrapper.style.position = "relative";
108602
+ wrapper.style.display = "inline-block";
108603
+ wrapper.style.lineHeight = "0";
108604
+ const img = document.createElement("img");
108605
+ img.src = node.attrs.src;
108606
+ img.alt = node.attrs.alt || "";
108607
+ img.title = node.attrs.title || "";
108608
+ img.style.display = "block";
108609
+ img.style.borderRadius = "4px";
108610
+ if (node.attrs.width) img.style.width = node.attrs.width + "px";
108611
+ if (node.attrs.height) img.style.height = node.attrs.height + "px";
108612
+ const toolbar = document.createElement("div");
108613
+ toolbar.style.position = "absolute";
108614
+ toolbar.style.top = "8px";
108615
+ toolbar.style.right = "8px";
108616
+ toolbar.style.display = "flex";
108617
+ toolbar.style.gap = "6px";
108618
+ toolbar.style.opacity = "0";
108619
+ toolbar.style.visibility = "hidden";
108620
+ toolbar.style.transition = "all .2s";
108621
+ toolbar.style.zIndex = "2";
108622
+ const getIconSvg = (type) => {
108623
+ if (type === "view") {
108624
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>`;
108625
+ }
108626
+ if (type === "reset") {
108627
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>`;
108628
+ }
108629
+ if (type === "fit") {
108630
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="18" height="12" rx="2" ry="2"></rect><polyline points="8 12 11 9 11 15 8 12"></polyline><polyline points="16 12 13 9 13 15 16 12"></polyline></svg>`;
108631
+ }
108632
+ return "";
108633
+ };
108634
+ const makeBtn = (type, title) => {
108635
+ const btn = document.createElement("button");
108636
+ btn.type = "button";
108637
+ btn.title = title;
108638
+ btn.style.width = "30px";
108639
+ btn.style.height = "30px";
108640
+ btn.style.padding = "0";
108641
+ btn.style.border = "none";
108642
+ btn.style.borderRadius = "6px";
108643
+ btn.style.background = "rgba(0,0,0,.7)";
108644
+ btn.style.color = "#fff";
108645
+ btn.style.cursor = "pointer";
108646
+ btn.style.display = "flex";
108647
+ btn.style.alignItems = "center";
108648
+ btn.style.justifyContent = "center";
108649
+ btn.style.transition = "all .2s";
108650
+ btn.style.boxShadow = "0 2px 8px rgba(0,0,0,.2)";
108651
+ btn.innerHTML = getIconSvg(type);
108652
+ btn.addEventListener("mouseenter", () => {
108653
+ btn.style.background = "rgba(0,0,0,.9)";
108654
+ });
108655
+ btn.addEventListener("mouseleave", () => {
108656
+ btn.style.background = "rgba(0,0,0,.7)";
108657
+ });
108658
+ return btn;
108659
+ };
108660
+ const viewBtn = makeBtn("view", "查看原图");
108661
+ const fitBtn = makeBtn("fit", "适配编辑区宽度");
108662
+ const resetBtn = makeBtn("reset", "重置大小");
108663
+ toolbar.appendChild(viewBtn);
108664
+ toolbar.appendChild(fitBtn);
108665
+ toolbar.appendChild(resetBtn);
108666
+ viewBtn.addEventListener("click", (e) => {
108667
+ e.preventDefault();
108668
+ e.stopPropagation();
108669
+ window.dispatchEvent(new CustomEvent("tiptap-image-click", { detail: img.src }));
108670
+ });
108671
+ resetBtn.addEventListener("click", (e) => {
108672
+ e.preventDefault();
108673
+ e.stopPropagation();
108674
+ if (typeof getPos === "function") {
108675
+ const pos = getPos();
108676
+ const tr2 = editor.view.state.tr.setNodeMarkup(pos, null, {
108677
+ ...node.attrs,
108678
+ width: null,
108679
+ height: null
108680
+ });
108681
+ editor.view.dispatch(tr2);
108682
+ }
108683
+ });
108684
+ fitBtn.addEventListener("click", (e) => {
108685
+ e.preventDefault();
108686
+ e.stopPropagation();
108687
+ const editorDom = editor.view.dom;
108688
+ if (!editorDom) return;
108689
+ const containerWidth = Math.max(50, editorDom.clientWidth - 60);
108690
+ const naturalW = img.naturalWidth || img.offsetWidth || 1;
108691
+ const naturalH = img.naturalHeight || img.offsetHeight || 1;
108692
+ const aspect = naturalW / naturalH;
108693
+ const targetW = Math.round(containerWidth);
108694
+ const targetH = Math.round(targetW / aspect);
108695
+ img.style.width = targetW + "px";
108696
+ img.style.height = targetH + "px";
108697
+ if (typeof getPos === "function") {
108698
+ const pos = getPos();
108699
+ const tr2 = editor.view.state.tr.setNodeMarkup(pos, null, {
108700
+ ...node.attrs,
108701
+ width: targetW,
108702
+ height: targetH
108703
+ });
108704
+ editor.view.dispatch(tr2);
108705
+ }
108706
+ });
108707
+ const handlePositions = ["nw", "ne", "sw", "se"];
108708
+ const handles = {};
108709
+ const createHandle = (pos) => {
108710
+ const h2 = document.createElement("div");
108711
+ h2.dataset.position = pos;
108712
+ h2.style.position = "absolute";
108713
+ h2.style.width = "8px";
108714
+ h2.style.height = "8px";
108715
+ h2.style.background = "#fff";
108716
+ h2.style.border = "2px solid rgb(37,108,251)";
108717
+ h2.style.borderRadius = "50%";
108718
+ h2.style.opacity = "0";
108719
+ h2.style.visibility = "hidden";
108720
+ h2.style.transition = "all .2s";
108721
+ h2.style.zIndex = "1";
108722
+ h2.style.boxShadow = "0 2px 6px rgba(0,0,0,.15)";
108723
+ if (pos === "nw") {
108724
+ h2.style.top = "-4px";
108725
+ h2.style.left = "10px";
108726
+ h2.style.cursor = "nwse-resize";
108727
+ }
108728
+ if (pos === "ne") {
108729
+ h2.style.top = "-4px";
108730
+ h2.style.right = "14px";
108731
+ h2.style.cursor = "nesw-resize";
108732
+ }
108733
+ if (pos === "sw") {
108734
+ h2.style.bottom = "-4px";
108735
+ h2.style.left = "10px";
108736
+ h2.style.cursor = "nesw-resize";
108737
+ }
108738
+ if (pos === "se") {
108739
+ h2.style.bottom = "-4px";
108740
+ h2.style.right = "14px";
108741
+ h2.style.cursor = "nwse-resize";
108742
+ }
108743
+ h2.addEventListener("mouseenter", () => {
108744
+ h2.style.background = "rgb(37,108,251)";
108745
+ h2.style.transform = "scale(1.3)";
108746
+ });
108747
+ h2.addEventListener("mouseleave", () => {
108748
+ h2.style.background = "#fff";
108749
+ h2.style.transform = "scale(1)";
108750
+ });
108751
+ return h2;
108752
+ };
108753
+ handlePositions.forEach((p) => {
108754
+ handles[p] = createHandle(p);
108755
+ });
108756
+ const showUI = () => {
108757
+ toolbar.style.opacity = "1";
108758
+ toolbar.style.visibility = "visible";
108759
+ Object.values(handles).forEach((h2) => {
108760
+ h2.style.opacity = "1";
108761
+ h2.style.visibility = "visible";
108762
+ });
108763
+ };
108764
+ const hideUI = () => {
108765
+ toolbar.style.opacity = "0";
108766
+ toolbar.style.visibility = "hidden";
108767
+ Object.values(handles).forEach((h2) => {
108768
+ h2.style.opacity = "0";
108769
+ h2.style.visibility = "hidden";
108770
+ });
108771
+ };
108772
+ wrapper.addEventListener("mouseenter", showUI);
108773
+ wrapper.addEventListener("mouseleave", hideUI);
108774
+ const startResize = (downEvent, position) => {
108775
+ downEvent.preventDefault();
108776
+ downEvent.stopPropagation();
108777
+ const startX = downEvent.clientX;
108778
+ const startY = downEvent.clientY;
108779
+ const startWidth = img.offsetWidth;
108780
+ const startHeight = img.offsetHeight;
108781
+ const aspect = startWidth / startHeight || 1;
108782
+ const isLeft = position.includes("w");
108783
+ const isTop = position.includes("n");
108784
+ const onMove = (moveEvent) => {
108785
+ let dx = moveEvent.clientX - startX;
108786
+ let dy = moveEvent.clientY - startY;
108787
+ if (isLeft) dx = -dx;
108788
+ if (isTop) dy = -dy;
108789
+ const keepRatio = !moveEvent.shiftKey;
108790
+ let newW, newH;
108791
+ if (keepRatio) {
108792
+ const d2 = Math.max(dx, dy);
108793
+ newW = Math.max(50, startWidth + d2);
108794
+ newH = Math.max(50, newW / aspect);
108795
+ } else {
108796
+ newW = Math.max(50, startWidth + dx);
108797
+ newH = Math.max(50, startHeight + dy);
108798
+ }
108799
+ img.style.width = newW + "px";
108800
+ img.style.height = newH + "px";
108801
+ };
108802
+ const onUp = (upEvent) => {
108803
+ document.removeEventListener("mousemove", onMove);
108804
+ document.removeEventListener("mouseup", onUp);
108805
+ let dx = upEvent.clientX - startX;
108806
+ let dy = upEvent.clientY - startY;
108807
+ if (isLeft) dx = -dx;
108808
+ if (isTop) dy = -dy;
108809
+ const keepRatio = !upEvent.shiftKey;
108810
+ let finalW, finalH;
108811
+ if (keepRatio) {
108812
+ const d2 = Math.max(dx, dy);
108813
+ finalW = Math.max(50, startWidth + d2);
108814
+ finalH = Math.max(50, finalW / aspect);
108815
+ } else {
108816
+ finalW = Math.max(50, startWidth + dx);
108817
+ finalH = Math.max(50, startHeight + dy);
108818
+ }
108819
+ if (typeof getPos === "function") {
108820
+ const pos = getPos();
108821
+ const tr2 = editor.view.state.tr.setNodeMarkup(pos, null, {
108822
+ ...node.attrs,
108823
+ width: Math.round(finalW),
108824
+ height: Math.round(finalH)
108825
+ });
108826
+ editor.view.dispatch(tr2);
108827
+ }
108828
+ };
108829
+ document.addEventListener("mousemove", onMove);
108830
+ document.addEventListener("mouseup", onUp);
108831
+ };
108832
+ handlePositions.forEach((p) => {
108833
+ handles[p].addEventListener("mousedown", (e) => startResize(e, p));
108834
+ });
108835
+ wrapper.appendChild(img);
108836
+ wrapper.appendChild(toolbar);
108837
+ handlePositions.forEach((p) => wrapper.appendChild(handles[p]));
108838
+ return {
108839
+ dom: wrapper,
108840
+ contentDOM: null,
108841
+ update: (updatedNode) => {
108842
+ if (updatedNode.type.name !== "image") return false;
108843
+ img.src = updatedNode.attrs.src;
108844
+ img.alt = updatedNode.attrs.alt || "";
108845
+ img.title = updatedNode.attrs.title || "";
108846
+ if (updatedNode.attrs.width) img.style.width = updatedNode.attrs.width + "px";
108847
+ else img.style.width = "";
108848
+ if (updatedNode.attrs.height) img.style.height = updatedNode.attrs.height + "px";
108849
+ else img.style.height = "";
108850
+ return true;
108851
+ },
108852
+ destroy: () => {
108853
+ wrapper.remove();
108854
+ }
108855
+ };
108856
+ };
108503
108857
  }
108504
108858
  });
108505
108859
  createLowlight();
@@ -108526,7 +108880,13 @@ const createEditor = ({ content = "", info = {}, limit = 50, isInline: isInline2
108526
108880
  // 启用1-6级标题
108527
108881
  bulletList: false,
108528
108882
  orderedList: false,
108529
- listItem: false
108883
+ listItem: false,
108884
+ strike: true,
108885
+ // 确保启用中划线
108886
+ bold: true,
108887
+ // 确保启用粗体
108888
+ italic: true
108889
+ // 确保启用斜体
108530
108890
  }),
108531
108891
  index_default.configure({
108532
108892
  placeholder: ({ node, editor: editor2 }) => {
@@ -108548,7 +108908,11 @@ const createEditor = ({ content = "", info = {}, limit = 50, isInline: isInline2
108548
108908
  // 文本样式扩展
108549
108909
  Color,
108550
108910
  // 颜色选择扩展
108551
- index_default$9,
108911
+ index_default$9.configure({
108912
+ HTMLAttributes: {
108913
+ class: "underline"
108914
+ }
108915
+ }),
108552
108916
  // 下划线功能
108553
108917
  FontSize,
108554
108918
  // 自定义字体大小
@@ -108603,7 +108967,9 @@ const createEditor = ({ content = "", info = {}, limit = 50, isInline: isInline2
108603
108967
  }),
108604
108968
  AutoOrderedOnEnter,
108605
108969
  index_default$2.configure({
108606
- types: ["heading", "paragraph"]
108970
+ types: ["heading", "paragraph"],
108971
+ alignments: ["left", "center", "right", "justify"],
108972
+ defaultAlignment: "left"
108607
108973
  }),
108608
108974
  index_default$b.configure({
108609
108975
  openOnClick: false,
@@ -108643,12 +109009,6 @@ const createEditor = ({ content = "", info = {}, limit = 50, isInline: isInline2
108643
109009
  // --- 修改这里 ---
108644
109010
  handlePaste: (view, event, slice2) => {
108645
109011
  var _a3;
108646
- slice2.content.copy().content.filter((node) => {
108647
- if (node.type.name === "table" || node.type.name === "codeBlock") {
108648
- return false;
108649
- }
108650
- return true;
108651
- });
108652
109012
  const currentSize = getTextLength(view.state.doc);
108653
109013
  const pastedSize = slice2.content.size;
108654
109014
  if (currentSize + pastedSize > limit) {
@@ -108672,7 +109032,6 @@ const createEditor = ({ content = "", info = {}, limit = 50, isInline: isInline2
108672
109032
  apiHost: info.apiHost,
108673
109033
  token: info.token,
108674
109034
  getFileContent: info.uploadUrl
108675
- // 请确认这个 key 是否正确
108676
109035
  }
108677
109036
  };
108678
109037
  uploadImageApi(params, formData).then((res) => {
@@ -108680,9 +109039,11 @@ const createEditor = ({ content = "", info = {}, limit = 50, isInline: isInline2
108680
109039
  editor.chain().focus().setImage({ src: res.data.show_url }).run();
108681
109040
  } else {
108682
109041
  console.error("Image upload failed or response format is incorrect.", res);
109042
+ ElMessage.error("图片上传失败");
108683
109043
  }
108684
109044
  }).catch((error2) => {
108685
109045
  console.error("Error during image upload:", error2);
109046
+ ElMessage.error("图片上传失败");
108686
109047
  });
108687
109048
  return true;
108688
109049
  },
@@ -109023,24 +109384,21 @@ const textLevel = {
109023
109384
  h6: "标题6"
109024
109385
  };
109025
109386
  const _hoisted_1$3 = { class: "toolbar" };
109026
- const _hoisted_2$2 = { class: "el-dropdown-link" };
109027
- const _hoisted_3$2 = { class: "el-dropdown-link" };
109028
- const _hoisted_4$1 = {
109387
+ const _hoisted_2$2 = {
109029
109388
  key: 2,
109030
109389
  class: "flex-center"
109031
109390
  };
109032
- const _hoisted_5$1 = { class: "flex-center" };
109033
- const _hoisted_6$1 = {
109391
+ const _hoisted_3$2 = { class: "flex-center" };
109392
+ const _hoisted_4$1 = {
109034
109393
  key: 3,
109035
109394
  class: "flex-center"
109036
109395
  };
109396
+ const _hoisted_5$1 = { class: "flex-center" };
109397
+ const _hoisted_6$1 = { class: "flex-center" };
109037
109398
  const _hoisted_7$1 = { class: "flex-center" };
109038
- const _hoisted_8 = { class: "el-dropdown-link" };
109039
- const _hoisted_9 = { class: "flex-center" };
109040
- const _hoisted_10 = { class: "flex-center" };
109041
- const _hoisted_11 = { class: "flex-center" };
109042
- const _hoisted_12 = { class: "table-content" };
109043
- const _hoisted_13 = { key: 5 };
109399
+ const _hoisted_8$1 = { class: "flex-center" };
109400
+ const _hoisted_9$1 = { class: "table-content" };
109401
+ const _hoisted_10 = { key: 6 };
109044
109402
  const _sfc_main$4 = {
109045
109403
  __name: "EditorToolbar",
109046
109404
  props: {
@@ -109061,7 +109419,7 @@ const _sfc_main$4 = {
109061
109419
  default: () => []
109062
109420
  }
109063
109421
  },
109064
- emits: ["showAi", "showLink", "toggleLoading"],
109422
+ emits: ["showAi", "showLink", "toggleLoading", "showSource"],
109065
109423
  setup(__props, { emit: __emit }) {
109066
109424
  const { appContext } = getCurrentInstance();
109067
109425
  const props = __props;
@@ -109070,6 +109428,10 @@ const _sfc_main$4 = {
109070
109428
  let curFontColor = ref("#000");
109071
109429
  let curBgColor = ref("");
109072
109430
  const isActive2 = (name, params) => props.editor.isActive(name, params);
109431
+ const isInCodeBlock = computed(() => {
109432
+ if (!props.editor) return false;
109433
+ return props.editor.isActive("codeBlock") || props.editor.isActive("codeBlockCustom");
109434
+ });
109073
109435
  let curText = ref("正文");
109074
109436
  const setHeading = (level) => {
109075
109437
  if (level === "paragraph") {
@@ -109132,6 +109494,9 @@ const _sfc_main$4 = {
109132
109494
  props.editor.setEditable(false);
109133
109495
  }
109134
109496
  };
109497
+ const viewSource = () => {
109498
+ emit("showSource");
109499
+ };
109135
109500
  const commonExpressionVisible = ref(false);
109136
109501
  const showExpression = () => {
109137
109502
  commonExpressionVisible.value = true;
@@ -109292,7 +109657,8 @@ const _sfc_main$4 = {
109292
109657
  createVNode(unref(ElDropdown), {
109293
109658
  onCommand: setHeading,
109294
109659
  trigger: "click",
109295
- "popper-class": "tiptap-drop-down"
109660
+ "popper-class": "tiptap-drop-down",
109661
+ disabled: isInCodeBlock.value
109296
109662
  }, {
109297
109663
  dropdown: withCtx(() => [
109298
109664
  createVNode(unref(ElDropdownMenu), null, {
@@ -109356,16 +109722,18 @@ const _sfc_main$4 = {
109356
109722
  })
109357
109723
  ]),
109358
109724
  default: withCtx(() => [
109359
- createElementVNode("div", _hoisted_2$2, [
109725
+ createElementVNode("div", {
109726
+ class: normalizeClass(["el-dropdown-link", { "disabled": isInCodeBlock.value }])
109727
+ }, [
109360
109728
  createElementVNode("p", null, toDisplayString(unref(curText)), 1),
109361
109729
  createVNode(unref(Icon), {
109362
109730
  icon: "ic:baseline-expand-more",
109363
109731
  width: "16"
109364
109732
  })
109365
- ])
109733
+ ], 2)
109366
109734
  ]),
109367
109735
  _: 1
109368
- })
109736
+ }, 8, ["disabled"])
109369
109737
  ]),
109370
109738
  _: 1
109371
109739
  })) : createCommentVNode("", true),
@@ -109379,7 +109747,8 @@ const _sfc_main$4 = {
109379
109747
  createVNode(unref(ElDropdown), {
109380
109748
  onCommand: setFontSize,
109381
109749
  trigger: "click",
109382
- "popper-class": "tiptap-drop-down"
109750
+ "popper-class": "tiptap-drop-down",
109751
+ disabled: isInCodeBlock.value
109383
109752
  }, {
109384
109753
  dropdown: withCtx(() => [
109385
109754
  createVNode(unref(ElDropdownMenu), null, {
@@ -109402,20 +109771,22 @@ const _sfc_main$4 = {
109402
109771
  })
109403
109772
  ]),
109404
109773
  default: withCtx(() => [
109405
- createElementVNode("div", _hoisted_3$2, [
109774
+ createElementVNode("div", {
109775
+ class: normalizeClass(["el-dropdown-link", { "disabled": isInCodeBlock.value }])
109776
+ }, [
109406
109777
  createElementVNode("p", null, toDisplayString(unref(curFontSize)), 1),
109407
109778
  createVNode(unref(Icon), {
109408
109779
  icon: "ic:baseline-expand-more",
109409
109780
  width: "16"
109410
109781
  })
109411
- ])
109782
+ ], 2)
109412
109783
  ]),
109413
109784
  _: 1
109414
- })
109785
+ }, 8, ["disabled"])
109415
109786
  ]),
109416
109787
  _: 1
109417
109788
  }),
109418
- unref(isShowMenu)("color", __props.showMenu) ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
109789
+ unref(isShowMenu)("color", __props.showMenu) ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
109419
109790
  createVNode(unref(ElTooltip), {
109420
109791
  class: "box-item",
109421
109792
  effect: "dark",
@@ -109423,20 +109794,21 @@ const _sfc_main$4 = {
109423
109794
  placement: "bottom"
109424
109795
  }, {
109425
109796
  default: withCtx(() => [
109426
- createElementVNode("div", _hoisted_5$1, [
109797
+ createElementVNode("div", _hoisted_3$2, [
109427
109798
  createVNode(unref(ElColorPicker), {
109428
109799
  modelValue: unref(curFontColor),
109429
109800
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(curFontColor) ? curFontColor.value = $event : curFontColor = $event),
109430
109801
  onChange: setFontColor,
109431
109802
  size: "small",
109432
- "show-alpha": ""
109433
- }, null, 8, ["modelValue"])
109803
+ "show-alpha": "",
109804
+ disabled: isInCodeBlock.value
109805
+ }, null, 8, ["modelValue", "disabled"])
109434
109806
  ])
109435
109807
  ]),
109436
109808
  _: 1
109437
109809
  })
109438
109810
  ])) : createCommentVNode("", true),
109439
- unref(isShowMenu)("bgColor", __props.showMenu) ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
109811
+ unref(isShowMenu)("bgColor", __props.showMenu) ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
109440
109812
  createVNode(unref(ElTooltip), {
109441
109813
  class: "box-item",
109442
109814
  effect: "dark",
@@ -109444,14 +109816,15 @@ const _sfc_main$4 = {
109444
109816
  placement: "bottom"
109445
109817
  }, {
109446
109818
  default: withCtx(() => [
109447
- createElementVNode("div", _hoisted_7$1, [
109819
+ createElementVNode("div", _hoisted_5$1, [
109448
109820
  createVNode(unref(ElColorPicker), {
109449
109821
  modelValue: unref(curBgColor),
109450
109822
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(curBgColor) ? curBgColor.value = $event : curBgColor = $event),
109451
109823
  onChange: setBgColor,
109452
109824
  size: "small",
109453
- "show-alpha": ""
109454
- }, null, 8, ["modelValue"])
109825
+ "show-alpha": "",
109826
+ disabled: isInCodeBlock.value
109827
+ }, null, 8, ["modelValue", "disabled"])
109455
109828
  ])
109456
109829
  ]),
109457
109830
  _: 1
@@ -109471,16 +109844,18 @@ const _sfc_main$4 = {
109471
109844
  size: "small",
109472
109845
  type: isActive2("bold") ? "primary" : "",
109473
109846
  onClick: _cache[2] || (_cache[2] = ($event) => __props.editor.chain().focus().toggleBold().run()),
109474
- link: ""
109847
+ link: "",
109848
+ disabled: isInCodeBlock.value
109475
109849
  }, {
109476
109850
  default: withCtx(() => [
109477
109851
  createVNode(unref(Icon), {
109478
109852
  icon: "mdi:format-bold",
109479
- width: "20"
109480
- })
109853
+ width: "20",
109854
+ class: normalizeClass({ "icon-gray": isInCodeBlock.value })
109855
+ }, null, 8, ["class"])
109481
109856
  ]),
109482
109857
  _: 1
109483
- }, 8, ["type"])
109858
+ }, 8, ["type", "disabled"])
109484
109859
  ]),
109485
109860
  _: 1
109486
109861
  })) : createCommentVNode("", true),
@@ -109496,16 +109871,18 @@ const _sfc_main$4 = {
109496
109871
  size: "small",
109497
109872
  type: isActive2("italic") ? "primary" : "",
109498
109873
  onClick: _cache[3] || (_cache[3] = ($event) => __props.editor.chain().focus().toggleItalic().run()),
109499
- link: ""
109874
+ link: "",
109875
+ disabled: isInCodeBlock.value
109500
109876
  }, {
109501
109877
  default: withCtx(() => [
109502
109878
  createVNode(unref(Icon), {
109503
109879
  icon: "mdi:format-italic",
109504
- width: "20"
109505
- })
109880
+ width: "20",
109881
+ class: normalizeClass({ "icon-gray": isInCodeBlock.value })
109882
+ }, null, 8, ["class"])
109506
109883
  ]),
109507
109884
  _: 1
109508
- }, 8, ["type"])
109885
+ }, 8, ["type", "disabled"])
109509
109886
  ]),
109510
109887
  _: 1
109511
109888
  })) : createCommentVNode("", true),
@@ -109521,16 +109898,18 @@ const _sfc_main$4 = {
109521
109898
  size: "small",
109522
109899
  type: isActive2("underline") ? "primary" : "",
109523
109900
  onClick: _cache[4] || (_cache[4] = ($event) => __props.editor.chain().focus().toggleUnderline().run()),
109524
- link: ""
109901
+ link: "",
109902
+ disabled: isInCodeBlock.value
109525
109903
  }, {
109526
109904
  default: withCtx(() => [
109527
109905
  createVNode(unref(Icon), {
109528
109906
  icon: "mdi:format-underline",
109529
- width: "20"
109530
- })
109907
+ width: "20",
109908
+ class: normalizeClass({ "icon-gray": isInCodeBlock.value })
109909
+ }, null, 8, ["class"])
109531
109910
  ]),
109532
109911
  _: 1
109533
- }, 8, ["type"])
109912
+ }, 8, ["type", "disabled"])
109534
109913
  ]),
109535
109914
  _: 1
109536
109915
  })) : createCommentVNode("", true),
@@ -109546,16 +109925,18 @@ const _sfc_main$4 = {
109546
109925
  size: "small",
109547
109926
  type: isActive2("strike") ? "primary" : "",
109548
109927
  onClick: _cache[5] || (_cache[5] = ($event) => __props.editor.chain().focus().toggleStrike().run()),
109549
- link: ""
109928
+ link: "",
109929
+ disabled: isInCodeBlock.value
109550
109930
  }, {
109551
109931
  default: withCtx(() => [
109552
109932
  createVNode(unref(Icon), {
109553
109933
  icon: "mdi:format-strikethrough",
109554
- width: "20"
109555
- })
109934
+ width: "20",
109935
+ class: normalizeClass({ "icon-gray": isInCodeBlock.value })
109936
+ }, null, 8, ["class"])
109556
109937
  ]),
109557
109938
  _: 1
109558
- }, 8, ["type"])
109939
+ }, 8, ["type", "disabled"])
109559
109940
  ]),
109560
109941
  _: 1
109561
109942
  })) : createCommentVNode("", true),
@@ -109642,16 +110023,18 @@ const _sfc_main$4 = {
109642
110023
  createVNode(unref(ElButton), {
109643
110024
  onClick: setLink,
109644
110025
  type: isActive2("link") ? "primary" : "",
109645
- link: ""
110026
+ link: "",
110027
+ disabled: isInCodeBlock.value
109646
110028
  }, {
109647
110029
  default: withCtx(() => [
109648
110030
  createVNode(unref(Icon), {
109649
110031
  icon: "mdi:link-variant",
109650
- width: "20"
109651
- })
110032
+ width: "20",
110033
+ class: normalizeClass({ "icon-gray": isInCodeBlock.value })
110034
+ }, null, 8, ["class"])
109652
110035
  ]),
109653
110036
  _: 1
109654
- }, 8, ["type"])
110037
+ }, 8, ["type", "disabled"])
109655
110038
  ]),
109656
110039
  _: 1
109657
110040
  })) : createCommentVNode("", true)
@@ -109668,7 +110051,8 @@ const _sfc_main$4 = {
109668
110051
  createVNode(unref(ElDropdown), {
109669
110052
  onCommand: setAlign,
109670
110053
  trigger: "click",
109671
- teleported: false
110054
+ teleported: false,
110055
+ disabled: isInCodeBlock.value
109672
110056
  }, {
109673
110057
  dropdown: withCtx(() => [
109674
110058
  createVNode(unref(ElDropdownMenu), null, {
@@ -109769,23 +110153,27 @@ const _sfc_main$4 = {
109769
110153
  })
109770
110154
  ]),
109771
110155
  default: withCtx(() => [
109772
- createElementVNode("div", _hoisted_8, [
110156
+ createElementVNode("div", {
110157
+ class: normalizeClass(["el-dropdown-link", { "disabled": isInCodeBlock.value }])
110158
+ }, [
109773
110159
  createVNode(unref(Icon), {
109774
110160
  icon: `mdi:format-align-${unref(alignType)}`,
109775
- width: "20"
109776
- }, null, 8, ["icon"]),
110161
+ width: "20",
110162
+ class: normalizeClass({ "icon-gray": isInCodeBlock.value })
110163
+ }, null, 8, ["icon", "class"]),
109777
110164
  createVNode(unref(Icon), {
109778
110165
  icon: "ic:baseline-expand-more",
109779
- width: "16"
109780
- })
109781
- ])
110166
+ width: "16",
110167
+ class: normalizeClass({ "icon-gray": isInCodeBlock.value })
110168
+ }, null, 8, ["class"])
110169
+ ], 2)
109782
110170
  ]),
109783
110171
  _: 1
109784
- })
110172
+ }, 8, ["disabled"])
109785
110173
  ]),
109786
110174
  _: 1
109787
110175
  }),
109788
- createElementVNode("div", _hoisted_9, [
110176
+ createElementVNode("div", _hoisted_6$1, [
109789
110177
  !__props.isBubble && unref(isShowMenu)("image", __props.showMenu) ? (openBlock(), createBlock(unref(ElTooltip), {
109790
110178
  key: 0,
109791
110179
  class: "box-item",
@@ -109804,6 +110192,7 @@ const _sfc_main$4 = {
109804
110192
  headers: {
109805
110193
  "access-token": __props.info.token
109806
110194
  },
110195
+ accept: ".jpg,.png,.jpeg,.gif",
109807
110196
  "before-upload": handleImageUpload,
109808
110197
  "on-success": uploadFileSuccess
109809
110198
  }, {
@@ -109819,7 +110208,7 @@ const _sfc_main$4 = {
109819
110208
  _: 1
109820
110209
  })) : createCommentVNode("", true)
109821
110210
  ]),
109822
- createElementVNode("div", _hoisted_10, [
110211
+ createElementVNode("div", _hoisted_7$1, [
109823
110212
  !__props.isBubble && unref(isShowMenu)("doc", __props.showMenu) ? (openBlock(), createBlock(unref(ElTooltip), {
109824
110213
  key: 0,
109825
110214
  class: "box-item",
@@ -109846,8 +110235,9 @@ const _sfc_main$4 = {
109846
110235
  default: withCtx(() => [
109847
110236
  createVNode(unref(Icon), {
109848
110237
  icon: "mdi:file-word",
109849
- width: "20"
109850
- })
110238
+ width: "20",
110239
+ class: normalizeClass(isActive2("codeBlock") || isActive2("table") || isActive2("bulletList") || isActive2("orderedList") || isActive2("taskList") ? "icon-gray" : "")
110240
+ }, null, 8, ["class"])
109851
110241
  ]),
109852
110242
  _: 1
109853
110243
  }, 8, ["action", "headers", "disabled"])
@@ -109855,7 +110245,7 @@ const _sfc_main$4 = {
109855
110245
  _: 1
109856
110246
  })) : createCommentVNode("", true)
109857
110247
  ]),
109858
- createElementVNode("div", _hoisted_11, [
110248
+ createElementVNode("div", _hoisted_8$1, [
109859
110249
  !__props.isBubble && unref(isShowMenu)("jupyter", __props.showMenu) ? (openBlock(), createBlock(unref(ElTooltip), {
109860
110250
  key: 0,
109861
110251
  class: "box-item",
@@ -109880,7 +110270,10 @@ const _sfc_main$4 = {
109880
110270
  disabled: isActive2("codeBlock") || isActive2("table") || isActive2("bulletList") || isActive2("orderedList") || isActive2("taskList")
109881
110271
  }, {
109882
110272
  default: withCtx(() => [
109883
- createVNode(unref(Icon), { icon: "logos:jupyter" })
110273
+ createVNode(unref(Icon), {
110274
+ icon: "logos:jupyter",
110275
+ class: normalizeClass(isActive2("codeBlock") || isActive2("table") || isActive2("bulletList") || isActive2("orderedList") || isActive2("taskList") ? "icon-gray" : "")
110276
+ }, null, 8, ["class"])
109884
110277
  ]),
109885
110278
  _: 1
109886
110279
  }, 8, ["action", "headers", "disabled"])
@@ -109923,7 +110316,7 @@ const _sfc_main$4 = {
109923
110316
  placement: "bottom"
109924
110317
  }, {
109925
110318
  default: withCtx(() => [
109926
- createElementVNode("div", _hoisted_12, [
110319
+ createElementVNode("div", _hoisted_9$1, [
109927
110320
  createVNode(unref(ElPopover), {
109928
110321
  placement: "bottom",
109929
110322
  title: "",
@@ -110007,7 +110400,31 @@ const _sfc_main$4 = {
110007
110400
  ]),
110008
110401
  _: 1
110009
110402
  }),
110010
- !__props.isBubble && unref(isShowMenu)("expression", __props.showMenu) ? (openBlock(), createElementBlock("div", _hoisted_13, [
110403
+ !__props.isBubble && unref(isShowMenu)("viewSource", __props.showMenu) ? (openBlock(), createBlock(unref(ElTooltip), {
110404
+ key: 5,
110405
+ class: "box-item",
110406
+ effect: "dark",
110407
+ content: "查看源代码",
110408
+ placement: "bottom"
110409
+ }, {
110410
+ default: withCtx(() => [
110411
+ createVNode(unref(ElButton), {
110412
+ size: "small",
110413
+ onClick: viewSource,
110414
+ link: ""
110415
+ }, {
110416
+ default: withCtx(() => [
110417
+ createVNode(unref(Icon), {
110418
+ icon: "mdi:code-tags",
110419
+ width: "20"
110420
+ })
110421
+ ]),
110422
+ _: 1
110423
+ })
110424
+ ]),
110425
+ _: 1
110426
+ })) : createCommentVNode("", true),
110427
+ !__props.isBubble && unref(isShowMenu)("expression", __props.showMenu) ? (openBlock(), createElementBlock("div", _hoisted_10, [
110011
110428
  createVNode(unref(ElButton), {
110012
110429
  link: "",
110013
110430
  onClick: showExpression
@@ -110030,7 +110447,7 @@ const _sfc_main$4 = {
110030
110447
  };
110031
110448
  }
110032
110449
  };
110033
- const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ad34f900"]]);
110450
+ const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-8982114a"]]);
110034
110451
  const _hoisted_1$2 = { class: "bubble-menu" };
110035
110452
  const _sfc_main$3 = {
110036
110453
  __name: "BubbleMenu",
@@ -111515,11 +111932,13 @@ const _hoisted_2 = { key: 1 };
111515
111932
  const _hoisted_3 = { class: "editor-content-container" };
111516
111933
  const _hoisted_4 = { ref: "blockMenuRef" };
111517
111934
  const _hoisted_5 = ["src"];
111518
- const _hoisted_6 = {
111935
+ const _hoisted_6 = { class: "source-dialog-content" };
111936
+ const _hoisted_7 = { class: "dialog-footer" };
111937
+ const _hoisted_8 = {
111519
111938
  key: 2,
111520
111939
  class: "editor-bottom"
111521
111940
  };
111522
- const _hoisted_7 = { class: "editor-bottom-r" };
111941
+ const _hoisted_9 = { class: "editor-bottom-r" };
111523
111942
  const _sfc_main = {
111524
111943
  __name: "index",
111525
111944
  props: {
@@ -111630,8 +112049,11 @@ const _sfc_main = {
111630
112049
  editor.chain().focus().insertContent({
111631
112050
  type: "codeBlock",
111632
112051
  attrs: { language: "javascript" }
111633
- // content: [{ type: "text", text: "// 在这里写代码…" }],
111634
112052
  }).run();
112053
+ } else if (typeof type === "function") {
112054
+ nextTick(() => {
112055
+ type();
112056
+ });
111635
112057
  } else if (type && type != "undele") {
111636
112058
  type();
111637
112059
  }
@@ -111717,6 +112139,34 @@ const _sfc_main = {
111717
112139
  imageSrc.value = e.detail;
111718
112140
  imageDialogVisible.value = true;
111719
112141
  }
112142
+ const sourceDialogVisible = ref(false);
112143
+ const sourceCode = ref("");
112144
+ function openSourceDialog() {
112145
+ sourceCode.value = editor.getHTML();
112146
+ sourceDialogVisible.value = true;
112147
+ }
112148
+ function applySourceCode() {
112149
+ try {
112150
+ isLoading.value = true;
112151
+ loadContentInChunks({
112152
+ editor,
112153
+ content: sourceCode.value,
112154
+ type: "html",
112155
+ extensions: commonExtensions(),
112156
+ chunkSize: 5,
112157
+ onProgress: (p) => {
112158
+ if (p > 0) {
112159
+ isLoading.value = false;
112160
+ }
112161
+ }
112162
+ });
112163
+ sourceDialogVisible.value = false;
112164
+ ElMessage.success("源代码已应用");
112165
+ } catch (error2) {
112166
+ console.error("应用源代码失败:", error2);
112167
+ ElMessage.error("应用源代码失败,请检查代码格式");
112168
+ }
112169
+ }
111720
112170
  const toggleLoading = (data) => {
111721
112171
  isLoading.value = data;
111722
112172
  };
@@ -111745,7 +112195,8 @@ const _sfc_main = {
111745
112195
  showMenu: __props.showMenu,
111746
112196
  onShowLink: _cache[0] || (_cache[0] = ($event) => showLink("top")),
111747
112197
  onToggleLoading: toggleLoading,
111748
- onShowAi: showAi
112198
+ onShowAi: showAi,
112199
+ onShowSource: openSourceDialog
111749
112200
  }, null, 8, ["editor", "info", "limitLength", "showMenu"])
111750
112201
  ])) : createCommentVNode("", true),
111751
112202
  !__props.isInline && !unref(floatAiStatus) ? (openBlock(), createElementBlock("div", _hoisted_2, [
@@ -111819,23 +112270,64 @@ const _sfc_main = {
111819
112270
  }, null, 8, _hoisted_5)
111820
112271
  ]),
111821
112272
  _: 1
112273
+ }, 8, ["modelValue"]),
112274
+ createVNode(unref(ElDialog), {
112275
+ modelValue: sourceDialogVisible.value,
112276
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => sourceDialogVisible.value = $event),
112277
+ title: "查看源代码",
112278
+ width: "70%",
112279
+ "close-on-click-modal": false
112280
+ }, {
112281
+ footer: withCtx(() => [
112282
+ createElementVNode("span", _hoisted_7, [
112283
+ createVNode(unref(ElButton), {
112284
+ onClick: _cache[7] || (_cache[7] = ($event) => sourceDialogVisible.value = false)
112285
+ }, {
112286
+ default: withCtx(() => [..._cache[9] || (_cache[9] = [
112287
+ createTextVNode("取消", -1)
112288
+ ])]),
112289
+ _: 1
112290
+ }),
112291
+ createVNode(unref(ElButton), {
112292
+ type: "primary",
112293
+ onClick: applySourceCode
112294
+ }, {
112295
+ default: withCtx(() => [..._cache[10] || (_cache[10] = [
112296
+ createTextVNode("确认", -1)
112297
+ ])]),
112298
+ _: 1
112299
+ })
112300
+ ])
112301
+ ]),
112302
+ default: withCtx(() => [
112303
+ createElementVNode("div", _hoisted_6, [
112304
+ createVNode(unref(ElInput), {
112305
+ modelValue: sourceCode.value,
112306
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => sourceCode.value = $event),
112307
+ type: "textarea",
112308
+ rows: 20,
112309
+ placeholder: "HTML源代码"
112310
+ }, null, 8, ["modelValue"])
112311
+ ])
112312
+ ]),
112313
+ _: 1
111822
112314
  }, 8, ["modelValue"])
111823
112315
  ], 2)
111824
112316
  ])), [
111825
112317
  [_directive_loading, unref(isLoading)]
111826
112318
  ]),
111827
- __props.limitLength != Infinity ? (openBlock(), createElementBlock("div", _hoisted_6, [
112319
+ __props.limitLength != Infinity ? (openBlock(), createElementBlock("div", _hoisted_8, [
111828
112320
  createElementVNode("div", null, [
111829
112321
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
111830
112322
  ]),
111831
- createElementVNode("div", _hoisted_7, toDisplayString(unref(getTextLength)(unref(editor).state.doc)) + "/" + toDisplayString(__props.limitLength), 1)
112323
+ createElementVNode("div", _hoisted_9, toDisplayString(unref(getTextLength)(unref(editor).state.doc)) + "/" + toDisplayString(__props.limitLength), 1)
111832
112324
  ])) : createCommentVNode("", true)
111833
112325
  ], 4)
111834
112326
  ], 4);
111835
112327
  };
111836
112328
  }
111837
112329
  };
111838
- const TiptapVue = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3d89208a"]]);
112330
+ const TiptapVue = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8ba51e61"]]);
111839
112331
  const components = [
111840
112332
  {
111841
112333
  name: "TiptapVue",