@fileverse-dev/ddoc 3.0.97-fragment-1 → 3.0.97-fragment-2

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.
Files changed (2) hide show
  1. package/dist/index.es.js +42 -9
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -46151,13 +46151,46 @@ const Hge = (e, t, n) => wt.create({
46151
46151
  new Et({
46152
46152
  props: {
46153
46153
  handlePaste: (r, o) => {
46154
- o.preventDefault();
46155
46154
  const i = o.clipboardData;
46156
46155
  if (!i) return !1;
46157
- const s = i.getData("text/plain"), { state: a } = r, { selection: l } = a, { $from: u } = l;
46158
- if (u.parent.type.name === "codeBlock") {
46159
- const d = a.tr.insertText(s);
46160
- return r.dispatch(d), !0;
46156
+ const s = i.getData("text/plain"), { empty: a } = r.state.selection;
46157
+ if (a && s)
46158
+ try {
46159
+ const p = new URL(s.trim());
46160
+ if (p.origin === window.location.origin && p.hash) {
46161
+ const h = decodeURIComponent(p.hash.slice(1)), g = new URLSearchParams(h).get("heading");
46162
+ if (g) {
46163
+ const m = g.split("-").pop();
46164
+ if (m) {
46165
+ const b = Array.from(
46166
+ document.querySelectorAll("[data-toc-id]")
46167
+ ).find(
46168
+ (y) => {
46169
+ var x;
46170
+ return (x = y.dataset.tocId) == null ? void 0 : x.includes(m);
46171
+ }
46172
+ );
46173
+ if (b != null && b.textContent)
46174
+ return o.preventDefault(), this.editor.chain().focus().insertContent({
46175
+ type: "text",
46176
+ text: b.textContent,
46177
+ marks: [
46178
+ {
46179
+ type: "link",
46180
+ attrs: { href: s.trim() }
46181
+ }
46182
+ ]
46183
+ }).run(), !0;
46184
+ }
46185
+ }
46186
+ }
46187
+ } catch {
46188
+ }
46189
+ o.preventDefault();
46190
+ const { state: l } = r, { selection: u } = l, { $from: c } = u;
46191
+ if (c.parent.type.name === "codeBlock") {
46192
+ const p = l.tr.insertText(s);
46193
+ return r.dispatch(p), !0;
46161
46194
  }
46162
46195
  return Wge(s) ? (bp(r, s, e), !0) : !1;
46163
46196
  }
@@ -180611,9 +180644,9 @@ const u$e = ({
180611
180644
  // onItemRemove,
180612
180645
  }) => {
180613
180646
  const [, o] = kae(), [i, s] = Be(null);
180614
- function a(d) {
180615
- o(d).then((p) => {
180616
- s(!!p);
180647
+ function a(d, p) {
180648
+ d.stopPropagation(), o(p).then((h) => {
180649
+ s(!!h);
180617
180650
  }).finally(
180618
180651
  () => setTimeout(() => {
180619
180652
  s(null);
@@ -180664,7 +180697,7 @@ const u$e = ({
180664
180697
  "!bg-transparent group-hover/toc-item:opacity-100 opacity-0 transition-all color-text-secondary active:scale-75",
180665
180698
  e.isActive ? "max-[1280px]:visible" : "max-[1280px]:invisible"
180666
180699
  ),
180667
- onClick: () => a(u)
180700
+ onClick: (d) => a(d, u)
180668
180701
  }
180669
180702
  )
180670
180703
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "3.0.97-fragment-1",
5
+ "version": "3.0.97-fragment-2",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {