@ylzcc/editor 0.2.4 → 0.2.5

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
@@ -62558,7 +62558,7 @@ const Heading = Node$1.create({
62558
62558
  return {
62559
62559
  emptyEditorClass: "tiptap-editor-is-empty",
62560
62560
  emptyNodeClass: "tiptap-is-empty",
62561
- placeholder: "输入“/”快速添加",
62561
+ placeholder: "点击“+”或输入“/”快速添加",
62562
62562
  showOnlyWhenEditable: !0,
62563
62563
  considerAnyAsEmpty: !1,
62564
62564
  showOnlyCurrent: !0,
@@ -86719,6 +86719,20 @@ class EventEmitter {
86719
86719
  this.callbacks = {};
86720
86720
  }
86721
86721
  }
86722
+ const allowTypes = [
86723
+ "paragraph",
86724
+ // 段落
86725
+ "heading",
86726
+ // 标题
86727
+ "horizontalRule",
86728
+ // 分割线
86729
+ "blockquote",
86730
+ // 引用
86731
+ "codeBlock",
86732
+ // 代码快
86733
+ "image"
86734
+ // 图片
86735
+ ];
86722
86736
  class Handle {
86723
86737
  // 是否阻止显示或隐藏的开关
86724
86738
  constructor(kh, x_, B_, $_ = []) {
@@ -86798,14 +86812,14 @@ class Handle {
86798
86812
  if (eme !== this.lastPos) {
86799
86813
  this.lastPos = eme, this.emitter.emit("hover", { node: ime, pos: ome, range: { from: ome, to: ome + ime.nodeSize } });
86800
86814
  const cme = posToDOMRect(kh, ome, ome + ime.nodeSize);
86801
- ime.type.name === "horizontalRule" ? this.setProps({
86815
+ ime.type.name === "horizontalRule" ? (cme.top - 10 < 5 && (nme = !0), this.setProps({
86802
86816
  getReferenceClientRect: () => ({ ...cme, top: cme.top - 10 })
86803
- }) : this.setProps({
86804
- getReferenceClientRect: () => ({ ...cme, top: cme.top + 2 })
86805
- });
86817
+ })) : (cme.top + 6 < 5 && (nme = !0), this.setProps({
86818
+ getReferenceClientRect: () => ({ ...cme, top: cme.top + 6 })
86819
+ }));
86806
86820
  } else
86807
86821
  rme = !1;
86808
- ime.type.name !== "paragraph" ? this.emitter.emit("type", { type: "content" }) : this.emitter.emit("type", { type: "add" }), this.ignoreType.includes(ime.type.name) && (nme = !0);
86822
+ ime.type.name !== "paragraph" ? this.emitter.emit("type", { type: "content" }) : this.emitter.emit("type", { type: "add" }), allowTypes.includes(ime.type.name) || (nme = !0), this.ignoreType.includes(ime.type.name) && (nme = !0);
86809
86823
  }
86810
86824
  return !1;
86811
86825
  }), rme && (nme ? this.hide() : this.show());
@@ -87234,7 +87248,7 @@ const normalClass = "tiptap-menu-item-menus-item", lighClass = "tiptap-menu-item
87234
87248
  allow: (Ff) => {
87235
87249
  const kh = Ff.editor.state.doc;
87236
87250
  let x_ = !0;
87237
- return kh.nodesBetween(Ff.range.from, Ff.range.to, (B_, $_, $P) => (ignoreChar.includes(B_.type.name) && (x_ = !1), !1)), x_;
87251
+ return Ff.editor.isFocused && kh.nodesBetween(Ff.range.from, Ff.range.to, (B_, $_, $P) => (ignoreChar.includes(B_.type.name) && (x_ = !1), !1)), x_;
87238
87252
  }
87239
87253
  };
87240
87254
  },