@ylzcc/editor 0.2.3 → 0.2.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.
package/dist/editor.es.js CHANGED
@@ -62471,7 +62471,7 @@ const Heading = Node$1.create({
62471
62471
  HTMLAttributes: {
62472
62472
  class: "tiptap-title"
62473
62473
  },
62474
- limitChar: 50,
62474
+ limitChar: 10,
62475
62475
  // 输入的字符个数限制
62476
62476
  onChange: () => {
62477
62477
  },
@@ -62480,17 +62480,17 @@ const Heading = Node$1.create({
62480
62480
  // 标题是否可以编辑
62481
62481
  };
62482
62482
  },
62483
- // addKeyboardShortcuts() {
62484
- // return {
62485
- // 'Mod-x': (props) => {
62486
- // console.log(props)
62487
- // return true
62488
- // },
62489
- // 'Mod-v': (props) => {
62490
- // return true
62491
- // }
62492
- // }
62493
- // },
62483
+ addKeyboardShortcuts() {
62484
+ return {
62485
+ // 'Mod-x': (props) => {
62486
+ // console.log(props)
62487
+ // return true
62488
+ // },
62489
+ // 'Mod-c': (props) => {
62490
+ // return true
62491
+ // }
62492
+ };
62493
+ },
62494
62494
  addProseMirrorPlugins() {
62495
62495
  const { limitChar: Ff, onChange: kh, titleEditable: x_ } = this.options, { editor: B_ } = this;
62496
62496
  return [
@@ -62506,8 +62506,12 @@ const Heading = Node$1.create({
62506
62506
  handleTextInput($_, $P, zP, eme) {
62507
62507
  var ume;
62508
62508
  const { state: tme } = $_, { selection: nme, doc: rme } = tme, { anchor: ime, $from: ome } = nme, ame = rme.firstChild;
62509
- if (ame && ime <= (ame == null ? void 0 : ame.nodeSize)) {
62510
- if (!x_ || ame != null && ame.textContent && ((ume = ame == null ? void 0 : ame.textContent) == null ? void 0 : ume.length) >= Ff)
62509
+ if (ame && ime < (ame == null ? void 0 : ame.nodeSize)) {
62510
+ if (!x_)
62511
+ return !0;
62512
+ if ($_.composing)
62513
+ return !1;
62514
+ if (ame != null && ame.textContent && ((ume = ame == null ? void 0 : ame.textContent) == null ? void 0 : ume.length) >= Ff)
62511
62515
  return !0;
62512
62516
  const cme = new RegExp("^[a-zA-Z0-9 \\u4e00-\\u9fa5\\_\\-]+$");
62513
62517
  if (ame != null && ame.textContent && !cme.test((ame == null ? void 0 : ame.textContent) + eme))
@@ -62523,8 +62527,12 @@ const Heading = Node$1.create({
62523
62527
  filterTransaction($_, $P) {
62524
62528
  if (x_)
62525
62529
  return !0;
62526
- const zP = $_.doc.firstChild, eme = $P.doc.firstChild;
62527
- return !(B_.isFocused && (zP == null ? void 0 : zP.textContent) !== (eme == null ? void 0 : eme.textContent));
62530
+ {
62531
+ const zP = $_.doc.firstChild, eme = $P.doc.firstChild;
62532
+ if (B_.isFocused && (zP == null ? void 0 : zP.textContent) !== (eme == null ? void 0 : eme.textContent))
62533
+ return !1;
62534
+ }
62535
+ return !0;
62528
62536
  }
62529
62537
  })
62530
62538
  ];
@@ -84755,6 +84763,10 @@ const CodeBlockView = ({ editor: Ff, node: kh, updateAttributes: x_, extension:
84755
84763
  nme.isEditable && (kh = setTimeout(() => {
84756
84764
  rme == null || rme.move(eme, tme);
84757
84765
  }, 0));
84766
+ },
84767
+ wheel: () => {
84768
+ var eme;
84769
+ (eme = Ff.tip) == null || eme.hide();
84758
84770
  }
84759
84771
  },
84760
84772
  decorations(eme) {
@@ -86635,6 +86647,7 @@ const upload = async (Ff) => {
86635
86647
  placement: "bottom-start",
86636
86648
  content: $P,
86637
86649
  interactive: !0,
86650
+ trigger: "mouseenter focus click focusin",
86638
86651
  // duration: [300, 300],
86639
86652
  // interactiveBorder: 40,
86640
86653
  // interactiveDebounce: 75,
@@ -86664,8 +86677,10 @@ const upload = async (Ff) => {
86664
86677
  // interactiveBorder: 40,
86665
86678
  // interactiveDebounce: 75,
86666
86679
  onTrigger(sme, lme) {
86680
+ kh == null || kh.commands.changeTip(!0);
86667
86681
  },
86668
86682
  onHide(sme) {
86683
+ kh == null || kh.commands.changeTip(!1);
86669
86684
  }
86670
86685
  });
86671
86686
  return () => {
@@ -86729,11 +86744,11 @@ class Handle {
86729
86744
  }
86730
86745
  // 是否覆盖创建,默认不覆盖,如果存在不进行创建
86731
86746
  createTippy(kh = !1) {
86732
- var B_, $_, $P, zP, eme;
86747
+ var B_, $_, $P;
86733
86748
  if (!kh && this.tippy)
86734
86749
  return;
86735
86750
  const x_ = this.build();
86736
- this.tippy = tippy(($_ = (B_ = this.editor) == null ? void 0 : B_.view) == null ? void 0 : $_.dom, {
86751
+ this.tippy = tippy(document.body, {
86737
86752
  duration: 0,
86738
86753
  getReferenceClientRect: null,
86739
86754
  content: x_,
@@ -86744,7 +86759,7 @@ class Handle {
86744
86759
  placement: "left-start",
86745
86760
  hideOnClick: "toggle",
86746
86761
  ...this.tippyOptions
86747
- }), (eme = (zP = ($P = this.editor) == null ? void 0 : $P.view) == null ? void 0 : zP.dom.parentElement) == null || eme.addEventListener("mouseleave", this.mouseLeave.bind(this));
86762
+ }), ($P = ($_ = (B_ = this.editor) == null ? void 0 : B_.view) == null ? void 0 : $_.dom.parentElement) == null || $P.addEventListener("mouseleave", this.mouseLeave.bind(this));
86748
86763
  }
86749
86764
  mouseLeave() {
86750
86765
  setTimeout(() => {
@@ -86810,7 +86825,9 @@ const FloatingMenu = Extension.create({
86810
86825
  },
86811
86826
  onBeforeCreate() {
86812
86827
  this.options.tip = new Handle(this.editor, Tip, {}, [
86813
- "title"
86828
+ "title",
86829
+ "pdf",
86830
+ "active"
86814
86831
  ]);
86815
86832
  },
86816
86833
  addCommands() {
@@ -87080,7 +87097,7 @@ const normalClass = "tiptap-menu-item-menus-item", lighClass = "tiptap-menu-item
87080
87097
  }, ume = () => {
87081
87098
  x_ == null || x_.chain().focus(eme).deleteRange($_.range).showBubbleMenu({ from: eme, to: eme }).hideMenu().run();
87082
87099
  }, cme = (mme) => {
87083
- window.postMessage({
87100
+ x_ == null || x_.chain().focus(eme).deleteRange($_.range).hideMenu().run(), window.postMessage({
87084
87101
  type: mme,
87085
87102
  value: {
87086
87103
  pos: eme
@@ -87227,8 +87244,8 @@ const normalClass = "tiptap-menu-item-menus-item", lighClass = "tiptap-menu-item
87227
87244
  if (this.options.tip)
87228
87245
  return;
87229
87246
  const kh = build(SlashMenu, this.editor, this.options.emitter);
87230
- this.options.tip = tippy(this.editor.view.dom, {
87231
- appendTo: document.body,
87247
+ this.options.tip = tippy(document.body, {
87248
+ // appendTo: document.body,
87232
87249
  getReferenceClientRect: null,
87233
87250
  content: kh,
87234
87251
  interactive: !0,
@@ -91911,19 +91928,20 @@ function code$1() {
91911
91928
  }
91912
91929
  function codeText() {
91913
91930
  return {
91914
- tokenize: Ff
91931
+ tokenize: Ff,
91932
+ concrete: !0
91915
91933
  };
91916
91934
  function Ff(kh, x_, B_) {
91917
91935
  let $_ = 0, $P = 0, zP = 0, eme = 0, tme = 0, nme = 0;
91918
91936
  return kh.enter("codeBlock"), kh.enter("codeMeta"), rme;
91919
91937
  function rme(lme) {
91920
- return lme === 96 ? ($_++, kh.consume(lme), rme) : $_ !== 3 || lme === null ? B_(lme) : ime(lme);
91938
+ return lme === 96 ? ($_++, kh.consume(lme), rme) : $_ !== 3 || lme == null ? B_(lme) : ime(lme);
91921
91939
  }
91922
91940
  function ime(lme) {
91923
- return lme === null ? B_(lme) : 0 > lme ? (kh.exit("codeMeta"), ome(lme)) : (kh.enter("codeMetadata"), kh.consume(lme), kh.exit("codeMetadata"), ime);
91941
+ return 0 > lme ? (kh.exit("codeMeta"), ome(lme)) : (kh.enter("codeMetadata"), kh.consume(lme), kh.exit("codeMetadata"), ime);
91924
91942
  }
91925
91943
  function ome(lme) {
91926
- return lme === null ? B_(lme) : lme === 96 && zP ? ($P && kh.exit("codeData"), ame(lme)) : (0 > lme ? zP = 1 : zP = 0, $P || kh.enter("codeData"), !$P && 0 > lme ? ($P++, kh.enter("codeContentIgnore"), kh.consume(lme), kh.exit("codeContentIgnore"), ome) : ($P++, kh.enter("codeContent"), kh.consume(lme), kh.exit("codeContent"), ome));
91944
+ return lme === 96 && zP ? ($P && kh.exit("codeData"), ame(lme)) : (0 > lme ? zP = 1 : zP = 0, $P || kh.enter("codeData"), !$P && 0 > lme ? ($P++, kh.enter("codeContentIgnore"), kh.consume(lme), kh.exit("codeContentIgnore"), ome) : ($P++, kh.enter("codeContent"), kh.consume(lme), kh.exit("codeContent"), ome));
91927
91945
  }
91928
91946
  function ame(lme) {
91929
91947
  return lme === 96 ? (eme++, kh.enter("codeClose"), kh.consume(lme), kh.exit("codeClose"), ame) : eme !== 3 ? B_(lme) : lme == 123 ? ume(lme) : lme === null || 0 > lme ? (kh.exit("codeBlock"), x_(lme)) : B_(lme);
@@ -91932,10 +91950,10 @@ function codeText() {
91932
91950
  return lme === 123 ? (tme++, kh.enter("codeLeft"), kh.consume(lme), kh.exit("codeLeft"), ume) : tme !== 2 ? B_(lme) : cme(lme);
91933
91951
  }
91934
91952
  function cme(lme) {
91935
- return lme === null ? B_(lme) : lme === 125 ? sme(lme) : (kh.enter("codeProperties"), kh.consume(lme), kh.exit("codeProperties"), cme);
91953
+ return lme === 125 ? sme(lme) : (kh.enter("codeProperties"), kh.consume(lme), kh.exit("codeProperties"), cme);
91936
91954
  }
91937
91955
  function sme(lme) {
91938
- return lme === 125 ? (nme++, kh.enter("codeRight"), kh.consume(lme), kh.exit("codeRight"), sme) : nme != 2 ? B_(lme) : (console.log("right =>", lme), lme === null || 0 > lme ? (kh.exit("codeBlock"), x_(lme)) : B_(lme));
91956
+ return lme === 125 ? (nme++, kh.enter("codeRight"), kh.consume(lme), kh.exit("codeRight"), sme) : nme != 2 ? B_(lme) : lme === null || 0 > lme ? (kh.exit("codeBlock"), x_(lme)) : B_(lme);
91939
91957
  }
91940
91958
  }
91941
91959
  }
@@ -94253,8 +94271,8 @@ const LinkComponent = (Ff) => {
94253
94271
  var dme;
94254
94272
  kh == null || kh.commands.unsetLink(), (dme = kh == null ? void 0 : kh.commands) == null || dme.hideLinkTip();
94255
94273
  }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
94256
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12.7787 13.7347L2.26416 3.22022L3.21875 2.26562L13.7333 12.7802L12.7787 13.7347Z", fill: "#666666" }),
94257
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.2993 9.41374L12.2422 10.3565L13.185 9.41374C15.0074 7.59134 15.0074 4.63655 13.185 2.8141C11.3625 0.991654 8.40781 0.991654 6.58533 2.8141L5.64253 3.75691L6.58533 4.69972L7.52815 3.75691C8.82988 2.45516 10.9404 2.45516 12.2422 3.75691C13.5439 5.05865 13.5439 7.16921 12.2422 8.47094L11.2993 9.41374ZM9.86676 12.732L8.92396 11.7892L8.47095 12.2422C7.16921 13.5439 5.05865 13.5439 3.75691 12.2422C2.45516 10.9405 2.45516 8.82987 3.75691 7.52814L4.2099 7.07515L3.2671 6.13234L2.8141 6.58533C0.991654 8.40781 0.991654 11.3625 2.8141 13.185C4.63655 15.0075 7.59135 15.0075 9.41375 13.185L9.86676 12.732ZM7.05011 8.00616L9.88515 5.17112L10.8279 6.11393L7.99293 8.94898L7.05011 8.00616ZM6.09551 8.96075L7.03834 9.90358L6.11393 10.828L5.17112 9.88514L6.09551 8.96075Z", fill: "#666666" })
94274
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.7787 13.7347L2.26416 3.22022L3.21875 2.26562L13.7333 12.7802L12.7787 13.7347Z", fill: "#666666" }),
94275
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.2993 9.41374L12.2422 10.3565L13.185 9.41374C15.0074 7.59134 15.0074 4.63655 13.185 2.8141C11.3625 0.991654 8.40781 0.991654 6.58533 2.8141L5.64253 3.75691L6.58533 4.69972L7.52815 3.75691C8.82988 2.45516 10.9404 2.45516 12.2422 3.75691C13.5439 5.05865 13.5439 7.16921 12.2422 8.47094L11.2993 9.41374ZM9.86676 12.732L8.92396 11.7892L8.47095 12.2422C7.16921 13.5439 5.05865 13.5439 3.75691 12.2422C2.45516 10.9405 2.45516 8.82987 3.75691 7.52814L4.2099 7.07515L3.2671 6.13234L2.8141 6.58533C0.991654 8.40781 0.991654 11.3625 2.8141 13.185C4.63655 15.0075 7.59135 15.0075 9.41375 13.185L9.86676 12.732ZM7.05011 8.00616L9.88515 5.17112L10.8279 6.11393L7.99293 8.94898L7.05011 8.00616ZM6.09551 8.96075L7.03834 9.90358L6.11393 10.828L5.17112 9.88514L6.09551 8.96075Z", fill: "#666666" })
94258
94276
  ] }) }),
94259
94277
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hoveValue", ref: nme, children: Ff == null ? void 0 : Ff.value }),
94260
94278
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hoveValue", ref: ime, children: ume }),
@@ -123388,7 +123406,7 @@ const EditorComponent = (Ff) => {
123388
123406
  config: $P
123389
123407
  });
123390
123408
  $_(zP);
123391
- }, [B_]), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: x_, style: { border: "none" } });
123409
+ }, [B_]), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { contentEditable: !1, ref: x_, style: { border: "none" } });
123392
123410
  }, AllActive = (Ff) => {
123393
123411
  var Dme, Bme, $me, Ume, Vme, Gme, zme, qme, u_e, Zme, T_e, l_e, g_e, E_e, p_e, t_e, i_e, b_e, O_e, Kme, o_e, y_e, A_e, N_e, F_e, V_e, v_e, h_e, r_e, Jme;
123394
123412
  const [kh, x_] = useState(), [B_, $_] = useState([]), [$P, zP] = useState(!1), [eme, tme] = useState(void 0), [nme, rme] = useState(!1), [ime, ome] = useState([]), [ame, ume] = useState(!0), [cme, sme] = useState([]), [lme, dme] = useState(!1), [fme, pme] = useState(!1), [hme, mme] = useState(0), [_me, gme] = useState(!1), [vme, Sme] = useState(), [Eme, bme] = useState(), [Rme, wme] = useState(), [Pme, Lme] = useState(), [Mme, yme] = useState(), kme = (d_e, R_e) => {
@@ -139904,13 +139922,13 @@ const deleteTableWhenAllCellsSelected = ({ editor: Ff }) => {
139904
139922
  return [
139905
139923
  {
139906
139924
  tag: "div",
139907
- attrs: {
139908
- class: "tableWrapper"
139925
+ getAttrs(Ff) {
139926
+ return Ff instanceof HTMLElement && (Ff != null && Ff.classList.contains("tableWrapper")) ? {} : !1;
139909
139927
  }
139928
+ },
139929
+ {
139930
+ tag: "table"
139910
139931
  }
139911
- // {
139912
- // tag: 'table'
139913
- // }
139914
139932
  ];
139915
139933
  }
139916
139934
  }), { BubbleMenu, BubbleMenuView } = bubbleModules, shareData = createContext({});