@pie-lib/editable-html-tip-tap 3.1.3-next.20261102140134 → 3.1.3-next.20261102164954

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.
@@ -36,7 +36,9 @@ function S({ editor: u, opts: h, onClose: _, triggerEl: v, focusOnOpen: b }) {
36
36
  left: 0
37
37
  }), [E, D] = s(null);
38
38
  C.current = _;
39
- let O = a(() => {
39
+ let O = () => {
40
+ u.view.focus(), u.commands.focus(), C.current();
41
+ }, k = a(() => {
40
42
  if (!h) return t;
41
43
  switch (!0) {
42
44
  case h.language === "spanish": return t;
@@ -44,12 +46,12 @@ function S({ editor: u, opts: h, onClose: _, triggerEl: v, focusOnOpen: b }) {
44
46
  case h.language === "arabic": return e;
45
47
  default: return h;
46
48
  }
47
- }, [h]), k = a(() => O.characters.reduce((e, t) => (t.length >= e.columns && (e.columns = t.length), e), {
48
- rows: O.characters.length,
49
+ }, [h]), A = a(() => k.characters.reduce((e, t) => (t.length >= e.columns && (e.columns = t.length), e), {
50
+ rows: k.characters.length,
49
51
  columns: 0
50
- }), [O]), A = () => D(null);
52
+ }), [k]), j = () => D(null);
51
53
  i(() => () => {
52
- A();
54
+ j();
53
55
  }, []), i(() => {
54
56
  if (!u) return;
55
57
  let e = u.options.element, t = u.view.dom, n = () => {
@@ -76,55 +78,57 @@ function S({ editor: u, opts: h, onClose: _, triggerEl: v, focusOnOpen: b }) {
76
78
  clearTimeout(o), r !== null && cancelAnimationFrame(r), window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i), document.removeEventListener("click", a);
77
79
  };
78
80
  }, [u]);
79
- let j = w.top !== 0 || w.left !== 0, M = () => Array.from(S.current?.querySelectorAll("button:not([disabled])") ?? []), N = o(!1);
81
+ let M = w.top !== 0 || w.left !== 0, N = () => Array.from(S.current?.querySelectorAll("button:not([disabled])") ?? []), P = o(!1);
80
82
  i(() => {
81
- if (!b || !j || N.current) return;
82
- let e = M()[0];
83
- e && (e.focus(), N.current = !0);
84
- }, [b, j]), i(() => {
83
+ if (!b || !M || P.current) return;
84
+ let e = N()[0];
85
+ e && (e.focus(), P.current = !0);
86
+ }, [b, M]), i(() => {
85
87
  if (!v) return;
86
- let e = () => {
87
- C.current(), v.focus();
88
- }, t = (e, t, n) => {
89
- x(n, Math.max(0, n.indexOf(t.closest("button"))), e, k.columns || 1)?.focus();
90
- }, n = () => {
88
+ let e = (e, t, n) => {
89
+ x(n, Math.max(0, n.indexOf(t.closest("button"))), e, A.columns || 1)?.focus();
90
+ }, t = () => {
91
91
  let e = y(document.body).filter((e) => !S.current.contains(e)), t = e.indexOf(v);
92
92
  ((t === -1 ? null : e[t + 1]) || v).focus();
93
- }, r = (r) => {
93
+ }, n = (n) => {
94
94
  if (!S.current) return;
95
- let i = M();
96
- if (!i.length) return;
97
- let a = r.target, o = S.current.contains(a), s = i[0], c = i[i.length - 1];
98
- if (o && r.key === "Escape") {
99
- r.preventDefault(), r.stopPropagation(), e();
95
+ let r = N();
96
+ if (!r.length) return;
97
+ let i = n.target, a = S.current.contains(i), o = r[0], s = r[r.length - 1];
98
+ if (a && n.key === "Escape") {
99
+ n.preventDefault(), n.stopPropagation(), O();
100
100
  return;
101
101
  }
102
- if (o && g.includes(r.key)) {
103
- r.preventDefault(), r.stopPropagation(), t(r.key, a, i);
102
+ if (a && g.includes(n.key)) {
103
+ n.preventDefault(), n.stopPropagation(), e(n.key, i, r);
104
104
  return;
105
105
  }
106
- if (r.key !== "Tab") return;
107
- let l = a === v && !r.shiftKey, u = a === s && r.shiftKey, d = a === c && !r.shiftKey;
108
- l ? (r.preventDefault(), s.focus()) : u ? (r.preventDefault(), v.focus()) : d && (r.preventDefault(), n());
106
+ if (n.key !== "Tab") return;
107
+ let c = i === v && !n.shiftKey, l = i === o && n.shiftKey, u = i === s && !n.shiftKey;
108
+ c ? (n.preventDefault(), o.focus()) : l ? (n.preventDefault(), v.focus()) : u && (n.preventDefault(), t());
109
109
  };
110
- return document.addEventListener("keydown", r, !0), () => document.removeEventListener("keydown", r, !0);
111
- }, [v, k.columns]);
112
- let P = (e, t) => D({
110
+ return document.addEventListener("keydown", n, !0), () => document.removeEventListener("keydown", n, !0);
111
+ }, [
112
+ u,
113
+ v,
114
+ A.columns
115
+ ]);
116
+ let F = (e, t) => D({
113
117
  anchorEl: e.currentTarget,
114
118
  el: t
115
- }), F = o("keyboard");
119
+ }), I = o("keyboard");
116
120
  return /* @__PURE__ */ p(d, { children: [l.createPortal(/* @__PURE__ */ f("div", {
117
121
  ref: S,
118
122
  className: "insert-character-dialog",
119
123
  "data-toolbar-for": u.instanceId,
120
124
  onPointerDown: () => {
121
- F.current = "pointer";
125
+ I.current = "pointer";
122
126
  },
123
127
  onKeyDown: () => {
124
- F.current = "keyboard";
128
+ I.current = "keyboard";
125
129
  },
126
130
  style: {
127
- visibility: j ? "initial" : "hidden",
131
+ visibility: M ? "initial" : "hidden",
128
132
  position: "fixed",
129
133
  top: `${w.top}px`,
130
134
  left: `${w.left}px`,
@@ -138,8 +142,8 @@ function S({ editor: u, opts: h, onClose: _, triggerEl: v, focusOnOpen: b }) {
138
142
  hideInput: !0,
139
143
  noLatexHandling: !0,
140
144
  hideDoneButtonBackground: !0,
141
- layoutForKeyPad: k,
142
- additionalKeys: O.characters.reduce((e, t) => (e = [...e, ...t.map((e) => ({
145
+ layoutForKeyPad: A,
146
+ additionalKeys: k.characters.reduce((e, t) => (e = [...e, ...t.map((e) => ({
143
147
  name: c(e, "name") || c(e, "label") || e,
144
148
  write: c(e, "write") || e,
145
149
  label: c(e, "label") || e,
@@ -149,24 +153,22 @@ function S({ editor: u, opts: h, onClose: _, triggerEl: v, focusOnOpen: b }) {
149
153
  ...e.extraProps || {},
150
154
  style: {
151
155
  ...(e.extraProps || {}).style,
152
- border: "1px solid #000"
156
+ border: "1px solid currentColor"
153
157
  }
154
158
  },
155
- ...O.hasPreview ? { actions: {
156
- onMouseEnter: (t) => P(t, e),
157
- onMouseLeave: A
159
+ ...k.hasPreview ? { actions: {
160
+ onMouseEnter: (t) => F(t, e),
161
+ onMouseLeave: j
158
162
  } } : {}
159
163
  }))], e), []),
160
164
  keypadMode: "language",
161
165
  onChange: (e) => {
162
- typeof e == "string" && (F.current === "pointer" ? u.chain().focus().insertContent(e).run() : u.chain().insertContent(e).run());
166
+ typeof e == "string" && (I.current === "pointer" ? u.chain().focus().insertContent(e).run() : u.chain().insertContent(e).run());
163
167
  },
164
- onDone: () => {
165
- _(), v?.focus();
166
- }
168
+ onDone: O
167
169
  }) })
168
170
  }), document.body), E && l.createPortal(/* @__PURE__ */ p(r, {
169
- onClose: A,
171
+ onClose: j,
170
172
  anchorEl: E.anchorEl,
171
173
  children: [
172
174
  /* @__PURE__ */ f("div", { children: E.el.label }),
@@ -583,6 +583,11 @@ var R = (e) => {
583
583
  height: "24px"
584
584
  },
585
585
  "&:hover": { color: m.text() },
586
+ "&:disabled, &:disabled:hover": {
587
+ opacity: .4,
588
+ color: m.disabled(),
589
+ cursor: "not-allowed"
590
+ },
586
591
  "&:focus": { outline: `2px solid ${m.buttonFocusOutline()}` }
587
592
  },
588
593
  "& .active": { color: m.text() },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/editable-html-tip-tap",
3
- "version": "3.1.3-next.20261102140134",
3
+ "version": "3.1.3-next.20261102164954",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,10 +14,10 @@
14
14
  "@mui/icons-material": "^7.3.4",
15
15
  "@mui/material": "^7.3.4",
16
16
  "@pie-framework/mathml-to-latex": "1.4.4",
17
- "@pie-lib/drag": "5.0.8-next.20261027193325",
18
- "@pie-lib/math-input": "9.0.8-next.20261027193325",
19
- "@pie-lib/math-toolbar": "4.0.8-next.20261027193325",
20
- "@pie-lib/render-ui": "8.0.8-next.20261027193325",
17
+ "@pie-lib/drag": "5.0.8-next.20261102164954",
18
+ "@pie-lib/math-input": "9.0.8-next.20261102164954",
19
+ "@pie-lib/math-toolbar": "4.0.8-next.20261102164954",
20
+ "@pie-lib/render-ui": "8.0.8-next.20261102164954",
21
21
  "@pie-lib/translator": "5.0.3-next.20261027184745",
22
22
  "@tiptap/core": "3.32.0",
23
23
  "@tiptap/extension-character-count": "3.32.0",
@@ -48,7 +48,7 @@
48
48
  "@pie-element/shared-utils": "0.1.7-next.20261027193325",
49
49
  "clsx": "^2.1.1",
50
50
  "prosemirror-state": "^1.4.4",
51
- "@pie-element/shared-math-rendering-mathjax": "0.1.9-next.20261026200905",
51
+ "@pie-element/shared-math-rendering-mathjax": "0.1.9-next.20261102164954",
52
52
  "@tiptap/extensions": "3.32.0",
53
53
  "@tiptap/extension-list": "3.32.0",
54
54
  "@tiptap/extension-bubble-menu": "3.32.0",