@ylzcc/editor 0.1.31 → 0.1.50

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
@@ -64396,6 +64396,17 @@ const Heading = Node$1.create({
64396
64396
  // 标题是否可以编辑
64397
64397
  };
64398
64398
  },
64399
+ // addKeyboardShortcuts() {
64400
+ // return {
64401
+ // 'Mod-x': (props) => {
64402
+ // console.log(props)
64403
+ // return true
64404
+ // },
64405
+ // 'Mod-v': (props) => {
64406
+ // return true
64407
+ // }
64408
+ // }
64409
+ // },
64399
64410
  addProseMirrorPlugins() {
64400
64411
  const { limitChar: Ff, onChange: kh, editable: x_ } = this.options, { editor: B_ } = this;
64401
64412
  return [
@@ -64404,7 +64415,7 @@ const Heading = Node$1.create({
64404
64415
  view: ($_) => ({
64405
64416
  update($P, zP) {
64406
64417
  const { state: eme } = $P, { doc: tme } = eme, nme = tme.firstChild, rme = zP.doc.firstChild;
64407
- (nme == null ? void 0 : nme.textContent) !== (rme == null ? void 0 : rme.textContent) && kh(nme == null ? void 0 : nme.textContent);
64418
+ x_ && (nme == null ? void 0 : nme.textContent) !== (rme == null ? void 0 : rme.textContent) && kh(nme == null ? void 0 : nme.textContent);
64408
64419
  }
64409
64420
  }),
64410
64421
  props: {
@@ -64424,6 +64435,12 @@ const Heading = Node$1.create({
64424
64435
  const { state: zP } = $_, { selection: eme, doc: tme } = zP, { anchor: nme, $from: rme } = eme, ime = tme.firstChild;
64425
64436
  return $P.key === "Enter" && ime && nme <= (ime == null ? void 0 : ime.nodeSize) ? (B_.commands.focus((ime == null ? void 0 : ime.nodeSize) + 1), !0) : !1;
64426
64437
  }
64438
+ },
64439
+ filterTransaction($_, $P) {
64440
+ if (x_)
64441
+ return !0;
64442
+ const zP = $_.doc.firstChild, eme = $P.doc.firstChild;
64443
+ return (zP == null ? void 0 : zP.textContent) === (eme == null ? void 0 : eme.textContent);
64427
64444
  }
64428
64445
  })
64429
64446
  ];
@@ -88197,7 +88214,7 @@ const upload = async (Ff) => {
88197
88214
  x_.type = "text", x_.text = Ff == null ? void 0 : Ff.value;
88198
88215
  break;
88199
88216
  case "code":
88200
- (Ff == null ? void 0 : Ff.props) === "active" ? (x_.type = "active", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, id: Ff == null ? void 0 : Ff.value }) : (Ff == null ? void 0 : Ff.props) === "exec" ? (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, exec: !0 }, x_.content = [{ type: "text", text: Ff == null ? void 0 : Ff.value }]) : (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang }, x_.content = [{ type: "text", text: Ff == null ? void 0 : Ff.value }]);
88217
+ (Ff == null ? void 0 : Ff.props) === "active" ? (x_.type = "active", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, id: Ff == null ? void 0 : Ff.value }) : (Ff == null ? void 0 : Ff.props) === "exec" ? (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, exec: !0 }, x_.content = Ff != null && Ff.value ? [{ type: "text", text: Ff == null ? void 0 : Ff.value }] : []) : (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang }, x_.content = Ff != null && Ff.value ? [{ type: "text", text: Ff == null ? void 0 : Ff.value }] : []);
88201
88218
  break;
88202
88219
  case "inlineCode":
88203
88220
  x_.type = "text", x_.text = Ff == null ? void 0 : Ff.value, x_.marks = [{ type: "code" }];
@@ -88660,7 +88677,9 @@ class Handle {
88660
88677
  if (eme !== this.lastPos) {
88661
88678
  this.lastPos = eme, this.emitter.emit("hover", { node: ime, pos: ome, range: { from: ome, to: ome + ime.nodeSize } });
88662
88679
  const cme = posToDOMRect(kh, ome, ome + ime.nodeSize);
88663
- this.setProps({
88680
+ ime.type.name === "horizontalRule" ? this.setProps({
88681
+ getReferenceClientRect: () => ({ ...cme, top: cme.top - 10 })
88682
+ }) : this.setProps({
88664
88683
  getReferenceClientRect: () => ({ ...cme, top: cme.top + 2 })
88665
88684
  });
88666
88685
  } else
@@ -125329,8 +125348,8 @@ const EditorComponent = (Ff) => {
125329
125348
  }, [$P]), useEffect(() => {
125330
125349
  window.localStorage.getItem("mark") && (kh != null && kh.id) ? (Pme((kh == null ? void 0 : kh.id) ?? "", !1), window.localStorage.getItem("mark") === "true" ? gme(!0) : gme(!1)) : gme(!1);
125331
125350
  }, [window.localStorage.getItem("mark"), kh == null ? void 0 : kh.id]), useEffect(() => {
125332
- Sme("https://openapi-test.oscollege.net/fs/read?repo=171da62a8040e001/HfsvXx&path=%E7%AC%AC%E4%B8%80%E7%AB%A0%2F%E7%AC%AC1%E8%8A%82&sign=''");
125333
- }, []), useEffect(() => {
125351
+ window.localStorage.getItem("activeUrl") && Sme(window.localStorage.getItem("activeUrl") ?? "");
125352
+ }, [window.localStorage.getItem("activeUrl")]), useEffect(() => {
125334
125353
  if ((Ff == null ? void 0 : Ff.lang) === "question" || !Ff.url || !kme)
125335
125354
  return;
125336
125355
  const c_e = new xtermExports.Terminal(), R_e = new WebSocket(Ff.url ?? "");
@@ -139978,19 +139997,22 @@ let Editor = (Ff, kh) => {
139978
139997
  const { data: $me } = Bme;
139979
139998
  try {
139980
139999
  const Ume = JSON.parse($me), Vme = Ume == null ? void 0 : Ume.type, Gme = Ume == null ? void 0 : Ume.data;
139981
- if (Vme === "read" && Gme) {
139982
- const zme = base64ToText$1(Gme);
139983
- sme(zme);
139984
- const qme = Fme(zme);
139985
- dme(qme);
139986
- const d_e = toEditorJSON(qme);
139987
- kme(d_e);
139988
- }
140000
+ if (Vme === "read")
140001
+ if (Gme) {
140002
+ const zme = base64ToText$1(Gme);
140003
+ sme(zme);
140004
+ const qme = Fme(zme);
140005
+ dme(qme);
140006
+ const d_e = toEditorJSON(qme);
140007
+ kme(d_e);
140008
+ } else
140009
+ kme("");
139989
140010
  } catch (Ume) {
139990
140011
  console.log(Ume);
139991
140012
  }
139992
140013
  }, Dme.onclose = function(Bme) {
139993
- Bme.code < 3e3 && Ame(!0);
140014
+ const $me = Bme.code;
140015
+ $me < 3e3 && $me !== 1005 && Ame(!0);
139994
140016
  };
139995
140017
  } catch (Dme) {
139996
140018
  console.log(Dme);
@@ -140030,7 +140052,7 @@ let Editor = (Ff, kh) => {
140030
140052
  };
140031
140053
  useEffect(() => (fme && (fme == null || fme.on("update", Ome)), () => {
140032
140054
  fme && (fme == null || fme.off("update", Ome));
140033
- }), [fme, bme]), useEffect(() => {
140055
+ }), [fme, bme, Sme]), useEffect(() => {
140034
140056
  if (fme && xme !== void 0 && Lme) {
140035
140057
  if (x_) {
140036
140058
  const Dme = {
@@ -140039,9 +140061,12 @@ let Editor = (Ff, kh) => {
140039
140061
  type: "text",
140040
140062
  text: nme
140041
140063
  }] : []
140042
- }, Bme = {
140064
+ }, Bme = xme ? {
140043
140065
  ...xme,
140044
140066
  content: xme != null && xme.content ? [Dme, ...xme.content] : [Dme]
140067
+ } : {
140068
+ type: "document",
140069
+ content: [Dme]
140045
140070
  };
140046
140071
  fme.commands.setContent(Bme);
140047
140072
  } else
@@ -140076,7 +140101,7 @@ let Editor = (Ff, kh) => {
140076
140101
  }, [eme]);
140077
140102
  const Tme = (Dme) => {
140078
140103
  const Bme = Dme == null ? void 0 : Dme.target;
140079
- console.log(Bme), Bme.classList.contains("exec-btn") && (console.log(Bme), ome && (ome == null || ome(Bme.getAttribute("data-value") ?? "")));
140104
+ Bme.classList.contains("exec-btn") && (console.log(Bme), ome && (ome == null || ome(Bme.getAttribute("data-value") ?? "")));
140080
140105
  };
140081
140106
  return useEffect(() => {
140082
140107
  if (tme) {