@pie-lib/editable-html-tip-tap 3.1.2-next.20261019183544 → 3.1.2-next.20261020062838
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/components/image/AltDialog.d.ts +1 -2
- package/dist/components/image/AltDialog.js +4 -13
- package/dist/components/image/ImageToolbar.js +26 -23
- package/dist/extensions/css.d.ts +0 -1
- package/dist/extensions/css.js +43 -39
- package/dist/extensions/media.js +24 -22
- package/package.json +5 -6
|
@@ -3,12 +3,11 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
export declare class AltDialog extends React.Component {
|
|
4
4
|
static propTypes: {
|
|
5
5
|
onDone: PropTypes.Validator<(...args: any[]) => any>;
|
|
6
|
+
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
6
7
|
alt: PropTypes.Requireable<string>;
|
|
7
8
|
};
|
|
8
9
|
constructor(props: any);
|
|
9
|
-
closeDialog: any;
|
|
10
10
|
onDone: any;
|
|
11
|
-
handleOverflow: any;
|
|
12
11
|
render(): React.JSX.Element;
|
|
13
12
|
}
|
|
14
13
|
export default AltDialog;
|
|
@@ -11,6 +11,7 @@ import l from "@mui/material/Dialog";
|
|
|
11
11
|
var u = class extends e.Component {
|
|
12
12
|
static propTypes = {
|
|
13
13
|
onDone: t.func.isRequired,
|
|
14
|
+
onClose: t.func.isRequired,
|
|
14
15
|
alt: t.string
|
|
15
16
|
};
|
|
16
17
|
constructor(e) {
|
|
@@ -18,28 +19,18 @@ var u = class extends e.Component {
|
|
|
18
19
|
let { alt: t } = e;
|
|
19
20
|
this.state = { value: t };
|
|
20
21
|
}
|
|
21
|
-
closeDialog = () => {
|
|
22
|
-
document.querySelectorAll("#text-dialog").forEach(function(e) {
|
|
23
|
-
return e.remove();
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
22
|
onDone = () => {
|
|
27
|
-
let { onDone: e } = this.props, { value:
|
|
28
|
-
e(
|
|
29
|
-
};
|
|
30
|
-
handleOverflow = () => {
|
|
31
|
-
document.body.style.removeProperty("overflow");
|
|
23
|
+
let { onDone: e, onClose: t } = this.props, { value: n } = this.state;
|
|
24
|
+
e(n), t();
|
|
32
25
|
};
|
|
33
26
|
render() {
|
|
34
27
|
let { value: e } = this.state;
|
|
35
28
|
return /* @__PURE__ */ r(l, {
|
|
36
29
|
open: !0,
|
|
37
|
-
|
|
38
|
-
onClose: this.closeDialog,
|
|
30
|
+
onClose: this.props.onClose,
|
|
39
31
|
id: "text-dialog",
|
|
40
32
|
hideBackdrop: !0,
|
|
41
33
|
disableScrollLock: !0,
|
|
42
|
-
onEntered: this.handleOverflow,
|
|
43
34
|
children: [/* @__PURE__ */ n(i, { children: /* @__PURE__ */ r("div", {
|
|
44
35
|
style: { display: "flex" },
|
|
45
36
|
children: [/* @__PURE__ */ n(a, { style: { paddingTop: "6px" } }), /* @__PURE__ */ n(o, {
|
|
@@ -2,12 +2,12 @@ import { AltDialog as e } from "./AltDialog.js";
|
|
|
2
2
|
import { MarkButton as t } from "../common/toolbar-buttons.js";
|
|
3
3
|
import n from "react";
|
|
4
4
|
import { styled as r } from "@mui/material/styles";
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "
|
|
7
|
-
import
|
|
8
|
-
import l from "
|
|
5
|
+
import i from "prop-types";
|
|
6
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import c from "debug";
|
|
8
|
+
import { createRoot as l } from "react-dom/client";
|
|
9
9
|
//#region src/components/image/ImageToolbar.tsx
|
|
10
|
-
var u =
|
|
10
|
+
var u = c("@pie-lib:editable-html:plugins:image:image-toolbar"), d = r("div")(({ theme: e }) => ({
|
|
11
11
|
paddingLeft: e.spacing.unit,
|
|
12
12
|
display: "flex",
|
|
13
13
|
alignItems: "center"
|
|
@@ -18,24 +18,24 @@ var u = l("@pie-lib:editable-html:plugins:image:image-toolbar"), d = r("div")(({
|
|
|
18
18
|
paddingLeft: 8,
|
|
19
19
|
marginLeft: 4
|
|
20
20
|
}
|
|
21
|
-
})), p = ({ alignment: e, active: n, onClick: r }) => /* @__PURE__ */
|
|
21
|
+
})), p = ({ alignment: e, active: n, onClick: r }) => /* @__PURE__ */ o(t, {
|
|
22
22
|
active: n,
|
|
23
23
|
onToggle: () => r(e),
|
|
24
24
|
label: e,
|
|
25
25
|
children: e
|
|
26
26
|
});
|
|
27
27
|
p.propTypes = {
|
|
28
|
-
alignment:
|
|
29
|
-
active:
|
|
30
|
-
onClick:
|
|
28
|
+
alignment: i.string.isRequired,
|
|
29
|
+
active: i.bool.isRequired,
|
|
30
|
+
onClick: i.func.isRequired
|
|
31
31
|
};
|
|
32
32
|
var m = class extends n.Component {
|
|
33
33
|
static propTypes = {
|
|
34
|
-
onChange:
|
|
35
|
-
alignment:
|
|
36
|
-
alt:
|
|
37
|
-
imageLoaded:
|
|
38
|
-
disableImageAlignmentButtons:
|
|
34
|
+
onChange: i.func.isRequired,
|
|
35
|
+
alignment: i.string,
|
|
36
|
+
alt: i.string,
|
|
37
|
+
imageLoaded: i.bool,
|
|
38
|
+
disableImageAlignmentButtons: i.bool
|
|
39
39
|
};
|
|
40
40
|
onAltTextDone = (e) => {
|
|
41
41
|
u("[onAltTextDone]: alt:", e), this.props.onChange({ alt: e }, !0);
|
|
@@ -44,31 +44,34 @@ var m = class extends n.Component {
|
|
|
44
44
|
u("[onAlignmentClick]: alignment:", e), this.props.onChange({ alignment: e });
|
|
45
45
|
};
|
|
46
46
|
renderDialog = () => {
|
|
47
|
-
let { alt: t } = this.props, n = document.createElement("div"), r =
|
|
47
|
+
let { alt: t } = this.props, n = document.createElement("div"), r = l(n);
|
|
48
|
+
r.render(/* @__PURE__ */ o(e, {
|
|
48
49
|
alt: t,
|
|
49
|
-
onDone: this.onAltTextDone
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
onDone: this.onAltTextDone,
|
|
51
|
+
onClose: () => {
|
|
52
|
+
r.unmount(), n.remove();
|
|
53
|
+
}
|
|
54
|
+
})), document.body.appendChild(n);
|
|
52
55
|
};
|
|
53
56
|
render() {
|
|
54
57
|
let { alignment: e, imageLoaded: t, disableImageAlignmentButtons: n } = this.props;
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ s(d, { children: [!n && /* @__PURE__ */ s(a, { children: [
|
|
59
|
+
/* @__PURE__ */ o(p, {
|
|
57
60
|
alignment: "left",
|
|
58
61
|
active: e === "left",
|
|
59
62
|
onClick: this.onAlignmentClick
|
|
60
63
|
}),
|
|
61
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ o(p, {
|
|
62
65
|
alignment: "center",
|
|
63
66
|
active: e === "center",
|
|
64
67
|
onClick: this.onAlignmentClick
|
|
65
68
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ o(p, {
|
|
67
70
|
alignment: "right",
|
|
68
71
|
active: e === "right",
|
|
69
72
|
onClick: this.onAlignmentClick
|
|
70
73
|
})
|
|
71
|
-
] }), /* @__PURE__ */
|
|
74
|
+
] }), /* @__PURE__ */ o(f, {
|
|
72
75
|
disabled: !t,
|
|
73
76
|
hasAlignmentButtons: !n,
|
|
74
77
|
onMouseDown: (e) => t && this.renderDialog(e),
|
package/dist/extensions/css.d.ts
CHANGED
package/dist/extensions/css.js
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import { Mark as e, mergeAttributes as t } from "@tiptap/core";
|
|
3
|
-
import n from "react-dom";
|
|
3
|
+
import { flushSync as n } from "react-dom";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
import a from "
|
|
6
|
-
import o from "@mui/material/
|
|
5
|
+
import { createRoot as a } from "react-dom/client";
|
|
6
|
+
import o from "@mui/material/List";
|
|
7
|
+
import s from "@mui/material/ListItem";
|
|
7
8
|
//#region src/extensions/css.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
var c = null, l = ({ editor: e, callback: t, opts: l, selectedText: u, parentNode: d }) => {
|
|
10
|
+
c?.();
|
|
11
|
+
let f = e.options.element, p = document.createElement("div"), { selection: m } = e.state;
|
|
12
|
+
p.className = "insert-css-dialog";
|
|
13
|
+
let h = a(p), g, _ = !1, v = (e) => {
|
|
14
|
+
if (_) {
|
|
15
|
+
let t = p.contains(e.target) || g, n = f.contains(e.target);
|
|
16
|
+
t || n || b();
|
|
17
|
+
} else _ = !0;
|
|
18
|
+
}, y = () => {
|
|
19
|
+
h.unmount(), p.remove(), document.body.removeEventListener("click", v), c === y && (c = null);
|
|
20
|
+
};
|
|
21
|
+
c = y;
|
|
22
|
+
let b = () => {
|
|
23
|
+
t(void 0, !0), y();
|
|
24
|
+
}, x = (e) => {
|
|
25
|
+
t(e, !0), y();
|
|
26
|
+
}, S = d?.attrs.class, C = (e) => {
|
|
27
|
+
let t = `<span class="${e}">${u}</span>`;
|
|
28
|
+
if (d) {
|
|
25
29
|
let e = "span";
|
|
26
|
-
|
|
30
|
+
d?.object === "inline" && (e = "span"), d?.object === "block" && (e = "div"), t = `<${e} class="${S}">${d.text.slice(0, m.$anchor.textOffset)}${t}${d.text.slice(m.$head.textOffset)}</${e}>`;
|
|
27
31
|
}
|
|
28
32
|
return t;
|
|
29
|
-
},
|
|
33
|
+
}, w = /* @__PURE__ */ i("div", {
|
|
30
34
|
style: {
|
|
31
35
|
background: "white",
|
|
32
36
|
height: 500,
|
|
@@ -37,35 +41,35 @@ var s = () => {
|
|
|
37
41
|
},
|
|
38
42
|
children: [
|
|
39
43
|
/* @__PURE__ */ r("h2", { children: "Please choose a css class" }),
|
|
40
|
-
|
|
41
|
-
/* @__PURE__ */ r(
|
|
44
|
+
S && /* @__PURE__ */ i("div", { children: ["The current parent has this class ", S] }),
|
|
45
|
+
/* @__PURE__ */ r(o, {
|
|
42
46
|
component: "nav",
|
|
43
47
|
style: { overflow: "scroll" },
|
|
44
|
-
children:
|
|
48
|
+
children: l.names.map((e, t) => /* @__PURE__ */ i(s, {
|
|
45
49
|
button: !0,
|
|
46
|
-
onClick: () =>
|
|
50
|
+
onClick: () => x(e),
|
|
47
51
|
children: [/* @__PURE__ */ r("div", {
|
|
48
52
|
style: { marginRight: 20 },
|
|
49
53
|
children: e
|
|
50
|
-
}), /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html:
|
|
54
|
+
}), /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html: C(e) } })]
|
|
51
55
|
}, `rule-${t}`))
|
|
52
56
|
})
|
|
53
57
|
]
|
|
54
58
|
});
|
|
55
|
-
n.render(
|
|
59
|
+
n(() => h.render(w)), (() => {
|
|
56
60
|
let t = e.view.nodeDOM(e.state.selection.from)?.parentNode;
|
|
57
61
|
if (t) {
|
|
58
|
-
let e =
|
|
59
|
-
|
|
62
|
+
let e = f.parentElement.parentElement.parentElement.getBoundingClientRect(), n = t.getBoundingClientRect();
|
|
63
|
+
f.parentElement.parentElement.parentElement.appendChild(p), p.style.maxWidth = "500px", p.style.position = "absolute", p.style.top = 0, p.style.zIndex = 99999;
|
|
60
64
|
let r = `${n.left + Math.abs(e.left) + t.offsetWidth + 10}px`, i = `${n.x}px`;
|
|
61
|
-
|
|
62
|
-
let a =
|
|
63
|
-
|
|
64
|
-
let o =
|
|
65
|
-
|
|
65
|
+
p.style.left = r;
|
|
66
|
+
let a = p.offsetWidth;
|
|
67
|
+
p.style.left = "unset", p.style.right = i;
|
|
68
|
+
let o = p.offsetWidth;
|
|
69
|
+
p.style.left = "unset", p.style.right = "unset", a >= o ? p.style.left = r : p.style.right = i, document.body.addEventListener("click", v);
|
|
66
70
|
}
|
|
67
|
-
});
|
|
68
|
-
},
|
|
71
|
+
})();
|
|
72
|
+
}, u = e.create({
|
|
69
73
|
name: "cssmark",
|
|
70
74
|
addOptions() {
|
|
71
75
|
return { classes: [] };
|
|
@@ -103,7 +107,7 @@ var s = () => {
|
|
|
103
107
|
setCSSClass: (e) => ({ commands: t }) => t.setMark(this.name, { class: e }),
|
|
104
108
|
unsetCSSClass: () => ({ commands: e }) => e.unsetMark(this.name),
|
|
105
109
|
openCSSClassDialog: () => ({ editor: e }) => {
|
|
106
|
-
|
|
110
|
+
l({
|
|
107
111
|
editor: e,
|
|
108
112
|
selectedText: e.state.doc.textBetween(e.state.selection.from, e.state.selection.to),
|
|
109
113
|
parentNode: e.state.selection.$from.nodeAfter,
|
|
@@ -117,4 +121,4 @@ var s = () => {
|
|
|
117
121
|
}
|
|
118
122
|
});
|
|
119
123
|
//#endregion
|
|
120
|
-
export {
|
|
124
|
+
export { u as CSSMark };
|
package/dist/extensions/media.js
CHANGED
|
@@ -3,8 +3,8 @@ import t from "../components/media/MediaToolbar.js";
|
|
|
3
3
|
import { useEffect as n } from "react";
|
|
4
4
|
import { NodeViewWrapper as r, ReactNodeViewRenderer as i } from "@tiptap/react";
|
|
5
5
|
import { Node as a, mergeAttributes as o } from "@tiptap/core";
|
|
6
|
-
import s from "react-
|
|
7
|
-
import {
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { createRoot as l } from "react-dom/client";
|
|
8
8
|
//#region src/extensions/media.tsx
|
|
9
9
|
var u = a.create({
|
|
10
10
|
name: "media",
|
|
@@ -78,63 +78,65 @@ var u = a.create({
|
|
|
78
78
|
};
|
|
79
79
|
},
|
|
80
80
|
addNodeView() {
|
|
81
|
-
return i((e) => /* @__PURE__ */
|
|
81
|
+
return i((e) => /* @__PURE__ */ s(p, {
|
|
82
82
|
...e,
|
|
83
83
|
options: this.options
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
|
-
}), d = () => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
}), d = null, f = (t) => {
|
|
87
|
+
d?.();
|
|
88
|
+
let n = document.createElement("div"), { type: r, callback: i, options: a, ...o } = t, c = document.body.style.overflow;
|
|
89
|
+
n.className = "insert-media-dialog", document.body.style.overflow = "hidden";
|
|
90
|
+
let u = l(n), f = () => {
|
|
91
|
+
u.unmount(), n.remove(), document.body.style.overflow = c, d === f && (d = null);
|
|
92
|
+
};
|
|
93
|
+
d = f;
|
|
94
|
+
let p = (e, t) => {
|
|
95
|
+
i(e, t), f();
|
|
96
|
+
}, m = /* @__PURE__ */ s(e, {
|
|
94
97
|
...o,
|
|
95
98
|
uploadSoundSupport: a.uploadSoundSupport,
|
|
96
99
|
type: r,
|
|
97
|
-
disablePortal: !0,
|
|
98
100
|
open: !0,
|
|
99
|
-
handleClose:
|
|
101
|
+
handleClose: p
|
|
100
102
|
});
|
|
101
|
-
|
|
103
|
+
u.render(m), document.body.appendChild(n);
|
|
102
104
|
};
|
|
103
|
-
function p({ editor: e, node: i, updateAttributes: a, deleteNode: o, options:
|
|
105
|
+
function p({ editor: e, node: i, updateAttributes: a, deleteNode: o, options: l }) {
|
|
104
106
|
let { type: u, src: d, width: p, height: m, tag: h } = i.attrs;
|
|
105
107
|
return n(() => {
|
|
106
108
|
d || f({
|
|
107
109
|
...i.attrs,
|
|
108
|
-
options:
|
|
110
|
+
options: l,
|
|
109
111
|
edit: !0,
|
|
110
112
|
callback: (t, n) => {
|
|
111
113
|
t ? a(n) : o(), e.chain().focus().run();
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
|
-
}, []), /* @__PURE__ */
|
|
116
|
+
}, []), /* @__PURE__ */ c(r, {
|
|
115
117
|
"data-type": u,
|
|
116
118
|
style: {
|
|
117
119
|
width: p,
|
|
118
120
|
height: m
|
|
119
121
|
},
|
|
120
|
-
children: [h === "audio" ? /* @__PURE__ */
|
|
122
|
+
children: [h === "audio" ? /* @__PURE__ */ s("audio", {
|
|
121
123
|
controls: !0,
|
|
122
124
|
controlsList: "nodownload",
|
|
123
|
-
children: /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ s("source", {
|
|
124
126
|
type: "audio/mp3",
|
|
125
127
|
src: d
|
|
126
128
|
})
|
|
127
|
-
}) : /* @__PURE__ */
|
|
129
|
+
}) : /* @__PURE__ */ s("iframe", {
|
|
128
130
|
src: d,
|
|
129
131
|
allowFullScreen: !0,
|
|
130
132
|
frameBorder: "0",
|
|
131
133
|
width: p,
|
|
132
134
|
height: m
|
|
133
|
-
}), /* @__PURE__ */
|
|
135
|
+
}), /* @__PURE__ */ s(t, {
|
|
134
136
|
onEdit: () => {
|
|
135
137
|
f({
|
|
136
138
|
...i.attrs,
|
|
137
|
-
options:
|
|
139
|
+
options: l,
|
|
138
140
|
edit: !0,
|
|
139
141
|
callback: (t, n) => {
|
|
140
142
|
t && a(n), e.chain().focus().run();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/editable-html-tip-tap",
|
|
3
|
-
"version": "3.1.2-next.
|
|
3
|
+
"version": "3.1.2-next.20261020062838",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@dnd-kit/utilities": "3.2.2",
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
|
-
"@pie-lib/drag": "5.0.7-next.
|
|
17
|
-
"@pie-lib/math-input": "9.0.7-next.
|
|
18
|
-
"@pie-lib/math-toolbar": "4.0.7-next.
|
|
19
|
-
"@pie-lib/render-ui": "8.0.7-next.
|
|
16
|
+
"@pie-lib/drag": "5.0.7-next.20261019223635",
|
|
17
|
+
"@pie-lib/math-input": "9.0.7-next.20261019223635",
|
|
18
|
+
"@pie-lib/math-toolbar": "4.0.7-next.20261019223635",
|
|
19
|
+
"@pie-lib/render-ui": "8.0.7-next.20261019223635",
|
|
20
20
|
"@pie-lib/translator": "5.0.2-next.20261019155156",
|
|
21
21
|
"@tiptap/core": "3.32.0",
|
|
22
22
|
"@tiptap/extension-character-count": "3.32.0",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"keycode": "^2.2.0",
|
|
41
41
|
"prop-types": "^15.6.2",
|
|
42
42
|
"react-attr-converter": "^0.3.1",
|
|
43
|
-
"react-jss": "^8.6.1",
|
|
44
43
|
"react-portal": "^4.2.0",
|
|
45
44
|
"tippy.js": "latest",
|
|
46
45
|
"to-style": "^1.3.3",
|