smart-editor-v3 1.16.2 → 1.16.4

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.
@@ -4675,8 +4675,8 @@ const LT = {
4675
4675
  // }
4676
4676
  }, Iw = Object.keys(Up), Ag = {
4677
4677
  common: {
4678
- primaryColor: "#497fed",
4679
- primaryColorHover: "#497fed",
4678
+ primaryColor: "#3A76EF",
4679
+ primaryColorHover: "#3A76EF",
4680
4680
  heightTiny: "24px"
4681
4681
  },
4682
4682
  Tooltip: {
@@ -53974,6 +53974,7 @@ const GU = { class: "smart-button-content" }, jU = { class: "smart-button-text"
53974
53974
  }, 8, ["class", "data-smart-id"]));
53975
53975
  }
53976
53976
  }, hV = /* @__PURE__ */ rt(fV, [["__scopeId", "data-v-c9d475ce"]]), { options: pV } = ve(), mV = Uk(Mk), gV = rz.extend({
53977
+ isInitialized: !1,
53977
53978
  isolating: !0,
53978
53979
  addAttributes() {
53979
53980
  var t;
@@ -54008,36 +54009,25 @@ const GU = { class: "smart-button-content" }, jU = { class: "smart-button-text"
54008
54009
  var t;
54009
54010
  return kn((t = pV.value.render.codeBlock) != null && t.view ? hV : dV);
54010
54011
  },
54012
+ addKeyboardShortcuts() {
54013
+ var t;
54014
+ return {
54015
+ ...(t = this.parent) == null ? void 0 : t.call(this),
54016
+ Backspace: () => {
54017
+ const { empty: e, $anchor: n } = this.editor.state.selection, r = n.pos === 1;
54018
+ return !e || n.parent.type.name !== this.name ? !1 : !!(r || !n.parent.textContent.length);
54019
+ }
54020
+ };
54021
+ },
54011
54022
  addProseMirrorPlugins() {
54012
54023
  var t;
54013
54024
  return [
54014
54025
  ...(t = this.parent) == null ? void 0 : t.call(this),
54015
54026
  new mt({
54016
54027
  key: new _t("codeBlockInit"),
54017
- // view(editorView) {
54018
- // const { state, dispatch } = editorView
54019
- // state.doc.descendants((node, pos) => {
54020
- // console.log('初始化 codeBlock', node, pos);
54021
- // if (node.type.name === 'codeBlock' && node.attrs.code && node.content.size === 0) {
54022
- // console.log('进入 codeBlock', node, pos);
54023
- // const textNode = node.type.schema.text(node.attrs.code)
54024
- // const fragment = Fragment.from(textNode)
54025
- // const tr = state.tr.replaceRangeWith(
54026
- // pos + 1,
54027
- // pos + node.nodeSize - 1,
54028
- // fragment,
54029
- // )
54030
- // // 清空 attrs.code 避免重复
54031
- // tr.setNodeMarkup(pos, undefined, {
54032
- // ...node.attrs,
54033
- // code: '',
54034
- // })
54035
- // dispatch(tr)
54036
- // }
54037
- // })
54038
- // return {}
54039
- // },
54040
54028
  appendTransaction: (e, n, r) => {
54029
+ if (this.isInitialized)
54030
+ return null;
54041
54031
  const i = [];
54042
54032
  if (r.doc.descendants((s, a) => {
54043
54033
  if (s.type.name === "codeBlock" && s.attrs.code && s.content.size === 0) {
@@ -54050,6 +54040,7 @@ const GU = { class: "smart-button-content" }, jU = { class: "smart-button-text"
54050
54040
  }
54051
54041
  }), i.length === 0)
54052
54042
  return null;
54043
+ this.isInitialized = !0;
54053
54044
  const o = r.tr;
54054
54045
  return i.sort((s, a) => a.pos - s.pos), i.forEach((s) => {
54055
54046
  o.insert(s.pos, s.content);
@@ -54064,7 +54055,10 @@ const GU = { class: "smart-button-content" }, jU = { class: "smart-button-text"
54064
54055
  return r.doc.descendants((s, a) => {
54065
54056
  if (s.type.name !== "codeBlock")
54066
54057
  return;
54067
- const l = s.textContent, c = {
54058
+ const l = s.textContent;
54059
+ if (s.attrs.code === l)
54060
+ return;
54061
+ const c = {
54068
54062
  ...s.attrs,
54069
54063
  code: l
54070
54064
  };
@@ -60679,7 +60673,7 @@ const rK = {
60679
60673
  class: "stop",
60680
60674
  onClick: T
60681
60675
  }, [
60682
- E[3] || (E[3] = G("i", { class: "i-sed:assistant-stop text-[#497fed]" }, null, -1)),
60676
+ E[3] || (E[3] = G("i", { class: "i-sed:assistant-stop text-[#3A76EF]" }, null, -1)),
60683
60677
  G("span", aK, Oe(v(A)("assistant.stop")), 1),
60684
60678
  E[4] || (E[4] = G("span", { class: "stop_en" }, "ESC", -1))
60685
60679
  ])
@@ -60740,7 +60734,7 @@ const rK = {
60740
60734
  ])) : Ke("", !0)
60741
60735
  ], 4));
60742
60736
  }
60743
- }, bK = /* @__PURE__ */ rt(gK, [["__scopeId", "data-v-7aa67823"]]), vK = {
60737
+ }, bK = /* @__PURE__ */ rt(gK, [["__scopeId", "data-v-fa5c2d6c"]]), vK = {
60744
60738
  __name: "common",
60745
60739
  props: {
60746
60740
  node: {
@@ -72655,7 +72649,7 @@ const xZ = /* @__PURE__ */ rt(yZ, [["render", wZ], ["__scopeId", "data-v-3d91acb
72655
72649
  _: 1
72656
72650
  }, 8, ["class", "data-smart-id"]));
72657
72651
  }
72658
- }, IZ = /* @__PURE__ */ rt(RZ, [["__scopeId", "data-v-6d9e9fff"]]), DZ = {
72652
+ }, IZ = /* @__PURE__ */ rt(RZ, [["__scopeId", "data-v-cfc7b247"]]), DZ = {
72659
72653
  __name: "code-wrapper",
72660
72654
  props: fn,
72661
72655
  setup(t) {