@pie-lib/editable-html-tip-tap 0.1.0
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/CharacterPicker.d.ts +31 -0
- package/dist/components/CharacterPicker.d.ts.map +1 -0
- package/dist/components/CharacterPicker.js +129 -0
- package/dist/components/EditableHtml.d.ts +11 -0
- package/dist/components/EditableHtml.d.ts.map +1 -0
- package/dist/components/EditableHtml.js +270 -0
- package/dist/components/MenuBar.d.ts +11 -0
- package/dist/components/MenuBar.d.ts.map +1 -0
- package/dist/components/MenuBar.js +460 -0
- package/dist/components/TiptapContainer.d.ts +11 -0
- package/dist/components/TiptapContainer.d.ts.map +1 -0
- package/dist/components/TiptapContainer.js +157 -0
- package/dist/components/characters/characterUtils.d.ts +36 -0
- package/dist/components/characters/characterUtils.d.ts.map +1 -0
- package/dist/components/characters/characterUtils.js +465 -0
- package/dist/components/characters/custom-popper.d.ts +14 -0
- package/dist/components/characters/custom-popper.d.ts.map +1 -0
- package/dist/components/characters/custom-popper.js +32 -0
- package/dist/components/common/done-button.d.ts +30 -0
- package/dist/components/common/done-button.d.ts.map +1 -0
- package/dist/components/common/done-button.js +26 -0
- package/dist/components/common/toolbar-buttons.d.ts +39 -0
- package/dist/components/common/toolbar-buttons.d.ts.map +1 -0
- package/dist/components/common/toolbar-buttons.js +91 -0
- package/dist/components/icons/CssIcon.d.ts +11 -0
- package/dist/components/icons/CssIcon.d.ts.map +1 -0
- package/dist/components/icons/CssIcon.js +14 -0
- package/dist/components/icons/RespArea.d.ts +26 -0
- package/dist/components/icons/RespArea.d.ts.map +1 -0
- package/dist/components/icons/RespArea.js +42 -0
- package/dist/components/icons/TableIcons.d.ts +14 -0
- package/dist/components/icons/TableIcons.d.ts.map +1 -0
- package/dist/components/icons/TableIcons.js +32 -0
- package/dist/components/icons/TextAlign.d.ts +18 -0
- package/dist/components/icons/TextAlign.d.ts.map +1 -0
- package/dist/components/icons/TextAlign.js +134 -0
- package/dist/components/image/AltDialog.d.ts +23 -0
- package/dist/components/image/AltDialog.d.ts.map +1 -0
- package/dist/components/image/AltDialog.js +61 -0
- package/dist/components/image/ImageToolbar.d.ts +25 -0
- package/dist/components/image/ImageToolbar.d.ts.map +1 -0
- package/dist/components/image/ImageToolbar.js +80 -0
- package/dist/components/image/InsertImageHandler.d.ts +33 -0
- package/dist/components/image/InsertImageHandler.d.ts.map +1 -0
- package/dist/components/image/InsertImageHandler.js +55 -0
- package/dist/components/media/MediaDialog.d.ts +44 -0
- package/dist/components/media/MediaDialog.d.ts.map +1 -0
- package/dist/components/media/MediaDialog.js +389 -0
- package/dist/components/media/MediaToolbar.d.ts +20 -0
- package/dist/components/media/MediaToolbar.d.ts.map +1 -0
- package/dist/components/media/MediaToolbar.js +41 -0
- package/dist/components/media/MediaWrapper.d.ts +20 -0
- package/dist/components/media/MediaWrapper.d.ts.map +1 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +23 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts.map +1 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +58 -0
- package/dist/components/respArea/DragInTheBlank/choice.d.ts +56 -0
- package/dist/components/respArea/DragInTheBlank/choice.d.ts.map +1 -0
- package/dist/components/respArea/DragInTheBlank/choice.js +156 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts.map +1 -0
- package/dist/components/respArea/ExplicitConstructedResponse.js +67 -0
- package/dist/components/respArea/InlineDropdown.d.ts +18 -0
- package/dist/components/respArea/InlineDropdown.d.ts.map +1 -0
- package/dist/components/respArea/InlineDropdown.js +91 -0
- package/dist/components/respArea/MathTemplated.d.ts +19 -0
- package/dist/components/respArea/MathTemplated.d.ts.map +1 -0
- package/dist/components/respArea/MathTemplated.js +97 -0
- package/dist/components/respArea/ToolbarIcon.d.ts +14 -0
- package/dist/components/respArea/ToolbarIcon.d.ts.map +1 -0
- package/dist/components/respArea/ToolbarIcon.js +17 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/extensions/css.d.ts +12 -0
- package/dist/extensions/css.d.ts.map +1 -0
- package/dist/extensions/css.js +115 -0
- package/dist/extensions/custom-toolbar-wrapper.d.ts +11 -0
- package/dist/extensions/custom-toolbar-wrapper.d.ts.map +1 -0
- package/dist/extensions/custom-toolbar-wrapper.js +58 -0
- package/dist/extensions/div-node.d.ts +11 -0
- package/dist/extensions/div-node.d.ts.map +1 -0
- package/dist/extensions/div-node.js +25 -0
- package/dist/extensions/extended-table.d.ts +11 -0
- package/dist/extensions/extended-table.d.ts.map +1 -0
- package/dist/extensions/extended-table.js +15 -0
- package/dist/extensions/image-component.d.ts +22 -0
- package/dist/extensions/image-component.d.ts.map +1 -0
- package/dist/extensions/image-component.js +200 -0
- package/dist/extensions/image.d.ts +11 -0
- package/dist/extensions/image.d.ts.map +1 -0
- package/dist/extensions/image.js +42 -0
- package/dist/extensions/index.d.ts +17 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +65 -0
- package/dist/extensions/math.d.ts +15 -0
- package/dist/extensions/math.d.ts.map +1 -0
- package/dist/extensions/math.js +150 -0
- package/dist/extensions/media.d.ts +19 -0
- package/dist/extensions/media.d.ts.map +1 -0
- package/dist/extensions/media.js +147 -0
- package/dist/extensions/responseArea.d.ts +28 -0
- package/dist/extensions/responseArea.d.ts.map +1 -0
- package/dist/extensions/responseArea.js +259 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/styles/editorContainerStyles.d.ts +135 -0
- package/dist/styles/editorContainerStyles.d.ts.map +1 -0
- package/dist/theme.d.ts +10 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/utils/helper.d.ts +10 -0
- package/dist/utils/helper.d.ts.map +1 -0
- package/dist/utils/helper.js +7 -0
- package/dist/utils/size.d.ts +10 -0
- package/dist/utils/size.d.ts.map +1 -0
- package/dist/utils/size.js +14 -0
- package/package.json +71 -0
- package/src/components/CharacterPicker.tsx +210 -0
- package/src/components/EditableHtml.tsx +416 -0
- package/src/components/MenuBar.tsx +558 -0
- package/src/components/TiptapContainer.tsx +228 -0
- package/src/components/characters/characterUtils.ts +457 -0
- package/src/components/characters/custom-popper.tsx +48 -0
- package/src/components/common/done-button.tsx +37 -0
- package/src/components/common/toolbar-buttons.tsx +132 -0
- package/src/components/icons/CssIcon.tsx +25 -0
- package/src/components/icons/RespArea.tsx +81 -0
- package/src/components/icons/TableIcons.tsx +62 -0
- package/src/components/icons/TextAlign.tsx +124 -0
- package/src/components/image/AltDialog.tsx +92 -0
- package/src/components/image/ImageToolbar.tsx +109 -0
- package/src/components/image/InsertImageHandler.ts +121 -0
- package/src/components/media/MediaDialog.tsx +606 -0
- package/src/components/media/MediaToolbar.tsx +59 -0
- package/src/components/media/MediaWrapper.tsx +49 -0
- package/src/components/respArea/DragInTheBlank/DragInTheBlank.tsx +86 -0
- package/src/components/respArea/DragInTheBlank/choice.tsx +266 -0
- package/src/components/respArea/ExplicitConstructedResponse.tsx +122 -0
- package/src/components/respArea/InlineDropdown.tsx +152 -0
- package/src/components/respArea/MathTemplated.tsx +134 -0
- package/src/components/respArea/ToolbarIcon.tsx +76 -0
- package/src/constants.ts +15 -0
- package/src/extensions/css.tsx +230 -0
- package/src/extensions/custom-toolbar-wrapper.tsx +88 -0
- package/src/extensions/div-node.tsx +46 -0
- package/src/extensions/extended-table.ts +34 -0
- package/src/extensions/image-component.tsx +303 -0
- package/src/extensions/image.tsx +64 -0
- package/src/extensions/index.tsx +91 -0
- package/src/extensions/math.tsx +285 -0
- package/src/extensions/media.tsx +198 -0
- package/src/extensions/responseArea.tsx +404 -0
- package/src/index.tsx +15 -0
- package/src/styles/editorContainerStyles.ts +155 -0
- package/src/theme.ts +11 -0
- package/src/utils/helper.tsx +27 -0
- package/src/utils/size.ts +42 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { styled as t } from "@mui/material/styles";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import o from "debug";
|
|
6
|
+
import s from "@mui/material/DialogContent";
|
|
7
|
+
import c from "@mui/material/TextField";
|
|
8
|
+
import l from "@mui/material/DialogActions";
|
|
9
|
+
import u from "@mui/material/Button";
|
|
10
|
+
import d from "@mui/material/Dialog";
|
|
11
|
+
import f from "@mui/material/IconButton";
|
|
12
|
+
import p from "@mui/icons-material/Delete";
|
|
13
|
+
import m from "@mui/material/Tabs";
|
|
14
|
+
import h from "@mui/material/Tab";
|
|
15
|
+
import g from "@mui/material/DialogTitle";
|
|
16
|
+
import _ from "@mui/material/DialogContentText";
|
|
17
|
+
import v from "@mui/material/Typography";
|
|
18
|
+
//#region src/components/media/MediaDialog.tsx
|
|
19
|
+
var y = o("@pie-lib:editable-html:plugins:media:dialog"), b = (e) => {
|
|
20
|
+
if (!e) return !1;
|
|
21
|
+
let t = /^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
|
|
22
|
+
return e.match(t) ? e.match(t)[1] : !1;
|
|
23
|
+
}, x = (e) => e && /(http|https)?:\/\/(www\.)?(player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(video\/)?(\d+)(?:|\/\?)/.test(e), S = (e) => e && /^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)/.test(e), C = (e) => {
|
|
24
|
+
if (!e) return !1;
|
|
25
|
+
let t = /^https?:\/\/(soundcloud\.com|snd\.sc)\/(.*)$/;
|
|
26
|
+
return e.match(t) && e.match(t)[2];
|
|
27
|
+
}, w = (e) => new Promise((t) => {
|
|
28
|
+
try {
|
|
29
|
+
fetch(`https://soundcloud.com/oembed?format=json&url=${e}`).then((e) => e.json()).then((e) => {
|
|
30
|
+
let n = document.createElement("div");
|
|
31
|
+
n.innerHTML = e.html, t(n.querySelector("iframe").src);
|
|
32
|
+
}).catch((e) => {
|
|
33
|
+
t(""), y(e);
|
|
34
|
+
});
|
|
35
|
+
} catch {
|
|
36
|
+
t("");
|
|
37
|
+
}
|
|
38
|
+
}), T = {
|
|
39
|
+
video: "Video",
|
|
40
|
+
audio: "Audio"
|
|
41
|
+
}, E = {
|
|
42
|
+
uploadFile: "upload-file",
|
|
43
|
+
insertUrl: "insert-url"
|
|
44
|
+
}, D = t(d)(({ theme: e }) => ({ "& .MuiDialog-paper": { minWidth: "500px" } })), O = t(s)(({ theme: e }) => ({ padding: 0 })), k = t("div")(({ theme: e }) => ({
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexDirection: "space-between"
|
|
47
|
+
})), A = t("div")(({ theme: e }) => ({ marginTop: e.spacing(1.5) })), j = t("input")(({ theme: e }) => ({})), M = t(v)(({ theme: e }) => ({
|
|
48
|
+
marginTop: e.spacing(1.5),
|
|
49
|
+
color: e.palette.error.main
|
|
50
|
+
})), N = t(f)(({ theme: e }) => ({ marginLeft: e.spacing(1.5) })), P = class extends e.Component {
|
|
51
|
+
static propTypes = {
|
|
52
|
+
open: n.bool,
|
|
53
|
+
edit: n.bool,
|
|
54
|
+
disablePortal: n.bool,
|
|
55
|
+
handleClose: n.func,
|
|
56
|
+
uploadSoundSupport: n.shape({
|
|
57
|
+
add: n.func,
|
|
58
|
+
delete: n.func
|
|
59
|
+
}),
|
|
60
|
+
type: n.string,
|
|
61
|
+
src: n.string,
|
|
62
|
+
url: n.string,
|
|
63
|
+
urlToUse: n.string,
|
|
64
|
+
starts: n.number,
|
|
65
|
+
ends: n.number,
|
|
66
|
+
height: n.number,
|
|
67
|
+
width: n.number
|
|
68
|
+
};
|
|
69
|
+
constructor(e) {
|
|
70
|
+
super(e);
|
|
71
|
+
let { ends: t, height: n, src: r, starts: i, type: a, uploadSoundSupport: o, url: s, urlToUse: c, width: l } = e, u = o?.add && o?.delete && a !== "video" && !r;
|
|
72
|
+
this.state = {
|
|
73
|
+
ends: t || 0,
|
|
74
|
+
url: s,
|
|
75
|
+
urlToUse: c,
|
|
76
|
+
formattedUrl: r,
|
|
77
|
+
height: n || 315,
|
|
78
|
+
invalid: !1,
|
|
79
|
+
starts: i || 0,
|
|
80
|
+
width: l || 560,
|
|
81
|
+
tabValue: u ? E.uploadFile : E.insertUrl,
|
|
82
|
+
fileUpload: {
|
|
83
|
+
error: null,
|
|
84
|
+
loading: !1,
|
|
85
|
+
scheduled: !1,
|
|
86
|
+
url: "",
|
|
87
|
+
mimeType: ""
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
componentDidMount() {
|
|
92
|
+
this.props.url && this.urlChange({ target: { value: this.props.url } });
|
|
93
|
+
}
|
|
94
|
+
formatUrl = () => {
|
|
95
|
+
let { url: e, urlToUse: t, starts: n, ends: r } = this.state, i = b(e), a = x(e), o = t;
|
|
96
|
+
if ((i || a) && t) {
|
|
97
|
+
let e = [], s, c;
|
|
98
|
+
switch (!0) {
|
|
99
|
+
case a:
|
|
100
|
+
s = "t", c = "#";
|
|
101
|
+
break;
|
|
102
|
+
case i:
|
|
103
|
+
s = "start", c = "?";
|
|
104
|
+
break;
|
|
105
|
+
default: s = "start", c = "?";
|
|
106
|
+
}
|
|
107
|
+
n && e.push(`${s}=${n}`), r && e.push(`end=${r}`), o = `${t}${e.length ? c : ""}${e.join("&")}`;
|
|
108
|
+
}
|
|
109
|
+
this.setState({
|
|
110
|
+
formattedUrl: null,
|
|
111
|
+
updating: !0
|
|
112
|
+
}, () => this.setState({
|
|
113
|
+
formattedUrl: o,
|
|
114
|
+
updating: !1
|
|
115
|
+
}));
|
|
116
|
+
};
|
|
117
|
+
handleStateChange = (e) => this.setState(e, this.formatUrl);
|
|
118
|
+
checkAudio = (e) => {
|
|
119
|
+
C(e) && w(e).then((t) => {
|
|
120
|
+
this.handleStateChange({
|
|
121
|
+
urlToUse: t,
|
|
122
|
+
invalid: !t,
|
|
123
|
+
url: e
|
|
124
|
+
});
|
|
125
|
+
}).catch(y);
|
|
126
|
+
};
|
|
127
|
+
checkVideo = (e) => {
|
|
128
|
+
if (b(e)) {
|
|
129
|
+
let t = `https://youtube.com/embed/${e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)[2]}`;
|
|
130
|
+
y("is youtube"), this.handleStateChange({
|
|
131
|
+
urlToUse: t,
|
|
132
|
+
url: e,
|
|
133
|
+
invalid: !1
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (x(e)) {
|
|
137
|
+
let t = `https://player.vimeo.com/video/${e.replace(/.*vimeo.com\/(.*)/g, "$1")}`;
|
|
138
|
+
y("is vimeo"), this.handleStateChange({
|
|
139
|
+
urlToUse: t,
|
|
140
|
+
url: e,
|
|
141
|
+
ends: null,
|
|
142
|
+
invalid: !1
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (S(e)) {
|
|
146
|
+
let t = `https://drive.google.com/file/d/${e.replace(/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)\/.*/, "$1")}/preview`;
|
|
147
|
+
y("is google drive"), this.handleStateChange({
|
|
148
|
+
urlToUse: t,
|
|
149
|
+
url: e,
|
|
150
|
+
ends: null,
|
|
151
|
+
invalid: !1
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
urlChange = (e) => {
|
|
156
|
+
let { value: t } = e.target || {}, { type: n } = this.props;
|
|
157
|
+
if (n && n === "audio") {
|
|
158
|
+
this.checkAudio(t);
|
|
159
|
+
return;
|
|
160
|
+
} else if (n && n === "video") {
|
|
161
|
+
this.checkVideo(t);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.handleStateChange({
|
|
165
|
+
urlToUse: null,
|
|
166
|
+
url: null,
|
|
167
|
+
invalid: !0
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
changeHandler = (e) => (t) => this.handleStateChange({ [e]: t.target.value });
|
|
171
|
+
handleDone = (e) => {
|
|
172
|
+
let { handleClose: t } = this.props, { tabValue: n, fileUpload: r } = this.state, i = n === E.insertUrl;
|
|
173
|
+
if (!e) {
|
|
174
|
+
r.url && this.handleRemoveFile(), t(e);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (i) {
|
|
178
|
+
let { ends: n, height: r, url: i, urlToUse: a, formattedUrl: o, starts: s, width: c } = this.state;
|
|
179
|
+
t(e, {
|
|
180
|
+
tag: "iframe",
|
|
181
|
+
ends: n,
|
|
182
|
+
height: r,
|
|
183
|
+
starts: s,
|
|
184
|
+
width: c,
|
|
185
|
+
url: i,
|
|
186
|
+
urlToUse: a,
|
|
187
|
+
src: o
|
|
188
|
+
});
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (!r.loading) {
|
|
192
|
+
t(e, {
|
|
193
|
+
tag: "audio",
|
|
194
|
+
src: r.url
|
|
195
|
+
});
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this.setState({ fileUpload: {
|
|
199
|
+
...r,
|
|
200
|
+
scheduled: !0
|
|
201
|
+
} });
|
|
202
|
+
};
|
|
203
|
+
handleUploadFile = async (e) => {
|
|
204
|
+
e.preventDefault(), this.setState({ fileUpload: {
|
|
205
|
+
...this.state.fileUpload,
|
|
206
|
+
error: null,
|
|
207
|
+
loading: !0
|
|
208
|
+
} });
|
|
209
|
+
let t = e.target.files[0], n = new FileReader();
|
|
210
|
+
n.onload = () => {
|
|
211
|
+
let e = n.result;
|
|
212
|
+
this.setState({ fileUpload: {
|
|
213
|
+
...this.state.fileUpload,
|
|
214
|
+
url: e,
|
|
215
|
+
mimeType: t.type
|
|
216
|
+
} });
|
|
217
|
+
}, n.readAsDataURL(t), this.props.uploadSoundSupport.add({
|
|
218
|
+
fileChosen: t,
|
|
219
|
+
done: (e, t) => {
|
|
220
|
+
if (y("done: err:", e), e) {
|
|
221
|
+
console.log(e), this.setState({ fileUpload: {
|
|
222
|
+
...this.state.fileUpload,
|
|
223
|
+
scheduled: !1,
|
|
224
|
+
loading: !1,
|
|
225
|
+
error: e
|
|
226
|
+
} });
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
let { fileUpload: n } = this.state, r = n && n.scheduled ? this.handleDone.bind(this, !0) : void 0;
|
|
230
|
+
this.setState({ fileUpload: {
|
|
231
|
+
...n,
|
|
232
|
+
scheduled: !1,
|
|
233
|
+
loading: !1,
|
|
234
|
+
url: t
|
|
235
|
+
} }, r);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
handleRemoveFile = async () => {
|
|
240
|
+
this.props.uploadSoundSupport.delete(this.state.fileUpload.url, (e) => {
|
|
241
|
+
e && (console.log(e), this.setState({ fileUpload: {
|
|
242
|
+
...this.state.fileUpload,
|
|
243
|
+
error: e
|
|
244
|
+
} }));
|
|
245
|
+
}), this.setState({ fileUpload: {
|
|
246
|
+
...this.state.fileUpload,
|
|
247
|
+
loading: !1,
|
|
248
|
+
url: "",
|
|
249
|
+
mimeType: ""
|
|
250
|
+
} });
|
|
251
|
+
};
|
|
252
|
+
render() {
|
|
253
|
+
let { open: t, disablePortal: n, type: o, edit: d, uploadSoundSupport: f } = this.props, { ends: y, height: x, invalid: S, starts: C, width: w, url: P, mimeType: F, formattedUrl: I, updating: L, tabValue: R, fileUpload: z } = this.state, B = b(P), V = R === E.insertUrl, H = R === E.uploadFile, U = V ? S || P == null : !z.url || z.scheduled, W = f?.add && f?.delete && o !== "video";
|
|
254
|
+
return /* @__PURE__ */ a(D, {
|
|
255
|
+
disablePortal: n,
|
|
256
|
+
open: t,
|
|
257
|
+
onClose: () => this.handleDone(!1),
|
|
258
|
+
"aria-labelledby": "form-dialog-title",
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ a(g, {
|
|
261
|
+
id: "form-dialog-title",
|
|
262
|
+
children: ["Insert ", T[o]]
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ i(s, { children: /* @__PURE__ */ a("div", { children: [
|
|
265
|
+
/* @__PURE__ */ i(k, { children: /* @__PURE__ */ a(m, {
|
|
266
|
+
indicatorColor: "primary",
|
|
267
|
+
value: R,
|
|
268
|
+
onChange: (e, t) => {
|
|
269
|
+
this.setState({ tabValue: t });
|
|
270
|
+
},
|
|
271
|
+
children: [W ? /* @__PURE__ */ i(h, {
|
|
272
|
+
value: E.uploadFile,
|
|
273
|
+
label: "Upload file"
|
|
274
|
+
}) : null, /* @__PURE__ */ i(h, {
|
|
275
|
+
value: E.insertUrl,
|
|
276
|
+
label: o === "video" ? "Insert YouTube, Vimeo, or Google Drive URL" : "Insert SoundCloud URL"
|
|
277
|
+
})]
|
|
278
|
+
}) }),
|
|
279
|
+
V && /* @__PURE__ */ a("div", { children: [
|
|
280
|
+
/* @__PURE__ */ i(c, {
|
|
281
|
+
autoFocus: !0,
|
|
282
|
+
error: S,
|
|
283
|
+
helperText: S ? "Invalid URL" : "",
|
|
284
|
+
margin: "dense",
|
|
285
|
+
id: "name",
|
|
286
|
+
label: "URL",
|
|
287
|
+
placeholder: `Paste URL of ${o}...`,
|
|
288
|
+
type: "text",
|
|
289
|
+
onChange: this.urlChange,
|
|
290
|
+
value: P,
|
|
291
|
+
fullWidth: !0
|
|
292
|
+
}),
|
|
293
|
+
o === "video" && /* @__PURE__ */ a(O, { children: [
|
|
294
|
+
/* @__PURE__ */ i(_, { children: "Video Properties" }),
|
|
295
|
+
/* @__PURE__ */ i(c, {
|
|
296
|
+
autoFocus: !0,
|
|
297
|
+
margin: "dense",
|
|
298
|
+
id: "width",
|
|
299
|
+
label: "Width",
|
|
300
|
+
type: "number",
|
|
301
|
+
placeholder: "Width",
|
|
302
|
+
value: w,
|
|
303
|
+
onChange: this.changeHandler("width")
|
|
304
|
+
}),
|
|
305
|
+
/* @__PURE__ */ i(c, {
|
|
306
|
+
autoFocus: !0,
|
|
307
|
+
margin: "dense",
|
|
308
|
+
id: "height",
|
|
309
|
+
label: "Height",
|
|
310
|
+
type: "number",
|
|
311
|
+
placeholder: "Height",
|
|
312
|
+
value: x,
|
|
313
|
+
onChange: this.changeHandler("height")
|
|
314
|
+
})
|
|
315
|
+
] }),
|
|
316
|
+
I && /* @__PURE__ */ i("iframe", {
|
|
317
|
+
width: w,
|
|
318
|
+
height: x,
|
|
319
|
+
src: I,
|
|
320
|
+
frameBorder: "0",
|
|
321
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
322
|
+
allowFullScreen: !0
|
|
323
|
+
}),
|
|
324
|
+
o === "video" && (I || L) && !S && /* @__PURE__ */ i(e.Fragment, { children: /* @__PURE__ */ a(O, { children: [/* @__PURE__ */ i(c, {
|
|
325
|
+
autoFocus: !0,
|
|
326
|
+
margin: "dense",
|
|
327
|
+
id: "starts",
|
|
328
|
+
label: "Starts",
|
|
329
|
+
type: "number",
|
|
330
|
+
placeholder: "Starts",
|
|
331
|
+
value: C,
|
|
332
|
+
onChange: this.changeHandler("starts")
|
|
333
|
+
}), B && /* @__PURE__ */ i(c, {
|
|
334
|
+
autoFocus: !0,
|
|
335
|
+
margin: "dense",
|
|
336
|
+
id: "ends",
|
|
337
|
+
label: "Ends",
|
|
338
|
+
type: "number",
|
|
339
|
+
placeholder: "Ends",
|
|
340
|
+
value: y,
|
|
341
|
+
onChange: this.changeHandler("ends")
|
|
342
|
+
})] }) })
|
|
343
|
+
] }),
|
|
344
|
+
H && /* @__PURE__ */ i(A, { children: /* @__PURE__ */ a("div", { children: [z.url ? /* @__PURE__ */ a(r, { children: [
|
|
345
|
+
/* @__PURE__ */ a(k, { children: [/* @__PURE__ */ i("audio", {
|
|
346
|
+
controls: "controls",
|
|
347
|
+
controlsList: "nodownload",
|
|
348
|
+
children: /* @__PURE__ */ i("source", {
|
|
349
|
+
type: F,
|
|
350
|
+
src: z.url
|
|
351
|
+
})
|
|
352
|
+
}), /* @__PURE__ */ i(N, {
|
|
353
|
+
"aria-label": "delete",
|
|
354
|
+
onClick: this.handleRemoveFile,
|
|
355
|
+
children: /* @__PURE__ */ i(p, {})
|
|
356
|
+
})] }),
|
|
357
|
+
!z.scheduled && z.loading ? /* @__PURE__ */ i(v, {
|
|
358
|
+
variant: "subheading",
|
|
359
|
+
children: "Loading..."
|
|
360
|
+
}) : null,
|
|
361
|
+
z.scheduled ? /* @__PURE__ */ i(v, {
|
|
362
|
+
variant: "subheading",
|
|
363
|
+
children: "Waiting for Upload to finish, then inserting item..."
|
|
364
|
+
}) : null
|
|
365
|
+
] }) : z.loading ? null : /* @__PURE__ */ i(j, {
|
|
366
|
+
accept: "audio/*",
|
|
367
|
+
onChange: this.handleUploadFile,
|
|
368
|
+
type: "file"
|
|
369
|
+
}), !!z.error && /* @__PURE__ */ i(M, {
|
|
370
|
+
variant: "caption",
|
|
371
|
+
children: z.error
|
|
372
|
+
})] }) })
|
|
373
|
+
] }) }),
|
|
374
|
+
/* @__PURE__ */ a(l, { children: [/* @__PURE__ */ i(u, {
|
|
375
|
+
onClick: () => this.handleDone(!1),
|
|
376
|
+
color: "primary",
|
|
377
|
+
children: "Cancel"
|
|
378
|
+
}), /* @__PURE__ */ i(u, {
|
|
379
|
+
disabled: U,
|
|
380
|
+
onClick: () => this.handleDone(!0),
|
|
381
|
+
color: "primary",
|
|
382
|
+
children: d ? "Update" : "Insert"
|
|
383
|
+
})] })
|
|
384
|
+
]
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
//#endregion
|
|
389
|
+
export { P as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/media/MediaToolbar.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
declare class MediaToolbar extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
onEdit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
+
hideEdit: PropTypes.Requireable<boolean>;
|
|
15
|
+
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
render(): JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export default MediaToolbar;
|
|
20
|
+
//# sourceMappingURL=MediaToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/media/MediaToolbar.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA4BnC,cAAM,YAAa,SAAQ,KAAK,CAAC,SAAS;IACxC,MAAM,CAAC,SAAS;;;;MAId;IAEF,MAAM;CAUP;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { styled as t } from "@mui/material/styles";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/media/MediaToolbar.tsx
|
|
6
|
+
var a = t("span")(({ theme: e }) => ({
|
|
7
|
+
position: "relative",
|
|
8
|
+
bottom: "5px",
|
|
9
|
+
left: 0,
|
|
10
|
+
width: "100%",
|
|
11
|
+
background: e.palette.common.white,
|
|
12
|
+
display: "inline-flex",
|
|
13
|
+
padding: "5px",
|
|
14
|
+
boxShadow: "0px 4px 4px rgba(0, 0, 0, 0.25)"
|
|
15
|
+
})), o = t("span")(({ theme: e }) => ({
|
|
16
|
+
cursor: "pointer",
|
|
17
|
+
flex: 3,
|
|
18
|
+
border: `solid ${e.palette.common.black}`,
|
|
19
|
+
textAlign: "right",
|
|
20
|
+
borderWidth: "0 2px 0 0",
|
|
21
|
+
marginRight: "5px",
|
|
22
|
+
paddingRight: "5px"
|
|
23
|
+
})), s = t("span")({ cursor: "pointer" }), c = class extends e.Component {
|
|
24
|
+
static propTypes = {
|
|
25
|
+
onEdit: n.func,
|
|
26
|
+
hideEdit: n.bool,
|
|
27
|
+
onRemove: n.func
|
|
28
|
+
};
|
|
29
|
+
render() {
|
|
30
|
+
let { hideEdit: e, onEdit: t, onRemove: n } = this.props;
|
|
31
|
+
return /* @__PURE__ */ i(a, { children: [e ? null : /* @__PURE__ */ r(o, {
|
|
32
|
+
onClick: t,
|
|
33
|
+
children: "Edit Settings"
|
|
34
|
+
}), /* @__PURE__ */ r(s, {
|
|
35
|
+
onClick: n,
|
|
36
|
+
children: "Remove"
|
|
37
|
+
})] });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { c as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/media/MediaWrapper.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
declare class MediaWrapper extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
children: PropTypes.Requireable<any[]>;
|
|
14
|
+
editor: PropTypes.Requireable<boolean>;
|
|
15
|
+
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
16
|
+
};
|
|
17
|
+
render(): JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export default MediaWrapper;
|
|
20
|
+
//# sourceMappingURL=MediaWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/media/MediaWrapper.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAanC,cAAM,YAAa,SAAQ,KAAK,CAAC,SAAS;IACxC,MAAM,CAAC,SAAS;;;;MAId;IAEF,MAAM;CAeP;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/DragInTheBlank/DragInTheBlank.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
export declare const onValueChange: (editor: any, node: any, pos: any, choice: any) => void;
|
|
11
|
+
export declare const onRemoveResponse: (editor: any, node: any, choice: any) => void;
|
|
12
|
+
declare const DragDrop: {
|
|
13
|
+
(props: any): JSX.Element;
|
|
14
|
+
propTypes: {
|
|
15
|
+
attributes: PropTypes.Requireable<object>;
|
|
16
|
+
data: PropTypes.Requireable<object>;
|
|
17
|
+
n: PropTypes.Requireable<object>;
|
|
18
|
+
nodeProps: PropTypes.Requireable<object>;
|
|
19
|
+
opts: PropTypes.Requireable<object>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default DragDrop;
|
|
23
|
+
//# sourceMappingURL=DragInTheBlank.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragInTheBlank.d.ts","sourceRoot":"","sources":["../../../../src/components/respArea/DragInTheBlank/DragInTheBlank.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,eAAO,MAAM,aAAa,GAAI,WAAM,EAAE,SAAI,EAAE,QAAG,EAAE,WAAM,SAUtD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,WAAM,EAAE,SAAI,EAAE,WAAM,SAOpD,CAAC;AAEF,QAAA,MAAM,QAAQ;;;;;;;;;CAsCb,CAAC;AAUF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import e from "./choice.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { NodeViewWrapper as t } from "@tiptap/react";
|
|
4
|
+
import n from "prop-types";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import i from "lodash-es/omit.js";
|
|
7
|
+
//#region src/components/respArea/DragInTheBlank/DragInTheBlank.tsx
|
|
8
|
+
var a = (e, t, n, r) => {
|
|
9
|
+
let { tr: i } = e.state;
|
|
10
|
+
i.setNodeMarkup(n, void 0, {
|
|
11
|
+
...t.attrs,
|
|
12
|
+
...r.value
|
|
13
|
+
}), i.isDone = !0, e.view.dispatch(i);
|
|
14
|
+
}, o = (e, t, n) => {
|
|
15
|
+
let { tr: r } = e.state;
|
|
16
|
+
r.setNodeMarkup(n.pos, void 0, i(t.attrs, ["value", "id"])), r.isDone = !0, e.view.dispatch(r);
|
|
17
|
+
}, s = (n) => {
|
|
18
|
+
let { editor: i, node: s, getPos: c, options: l, selected: u } = n, { attrs: d } = s, { inTable: f } = d, p = c();
|
|
19
|
+
return /* @__PURE__ */ r(t, {
|
|
20
|
+
className: "drag-in-the-blank",
|
|
21
|
+
"data-selected": u,
|
|
22
|
+
style: {
|
|
23
|
+
display: "inline",
|
|
24
|
+
whiteSpace: "normal"
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ r("span", {
|
|
27
|
+
...d,
|
|
28
|
+
style: {
|
|
29
|
+
display: "inline-flex",
|
|
30
|
+
minHeight: "50px",
|
|
31
|
+
minWidth: "178px",
|
|
32
|
+
position: "relative",
|
|
33
|
+
margin: f ? "10px" : "0 10px",
|
|
34
|
+
cursor: "pointer"
|
|
35
|
+
},
|
|
36
|
+
children: /* @__PURE__ */ r(e, {
|
|
37
|
+
n: d,
|
|
38
|
+
dragKey: d.id,
|
|
39
|
+
targetId: "0",
|
|
40
|
+
pos: p,
|
|
41
|
+
value: d,
|
|
42
|
+
duplicates: l.duplicates,
|
|
43
|
+
selected: u,
|
|
44
|
+
onChange: (e) => a(i, s, p, e),
|
|
45
|
+
removeResponse: (e) => o(i, s, e)
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
s.propTypes = {
|
|
51
|
+
attributes: n.object,
|
|
52
|
+
data: n.object,
|
|
53
|
+
n: n.object,
|
|
54
|
+
nodeProps: n.object,
|
|
55
|
+
opts: n.object
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { s as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/DragInTheBlank/choice.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
export declare function BlankContent({ n, children, isDragging, isOver, dragItem, value, selected }: {
|
|
11
|
+
n: any;
|
|
12
|
+
children: any;
|
|
13
|
+
isDragging: any;
|
|
14
|
+
isOver: any;
|
|
15
|
+
dragItem: any;
|
|
16
|
+
value: any;
|
|
17
|
+
selected: any;
|
|
18
|
+
}): JSX.Element;
|
|
19
|
+
export declare namespace BlankContent {
|
|
20
|
+
var propTypes: {
|
|
21
|
+
n: PropTypes.Requireable<object>;
|
|
22
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
23
|
+
isDragging: PropTypes.Requireable<boolean>;
|
|
24
|
+
isOver: PropTypes.Requireable<boolean>;
|
|
25
|
+
dragItem: PropTypes.Requireable<object>;
|
|
26
|
+
value: PropTypes.Requireable<object>;
|
|
27
|
+
selected: PropTypes.Requireable<boolean>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare function DragDropChoice({ value, disabled, instanceId, children, n, onChange, removeResponse, duplicates, pos, selected, }: {
|
|
31
|
+
value: any;
|
|
32
|
+
disabled: any;
|
|
33
|
+
instanceId: any;
|
|
34
|
+
children: any;
|
|
35
|
+
n: any;
|
|
36
|
+
onChange: any;
|
|
37
|
+
removeResponse: any;
|
|
38
|
+
duplicates: any;
|
|
39
|
+
pos: any;
|
|
40
|
+
selected: any;
|
|
41
|
+
}): JSX.Element;
|
|
42
|
+
declare namespace DragDropChoice {
|
|
43
|
+
var propTypes: {
|
|
44
|
+
value: PropTypes.Requireable<object>;
|
|
45
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
46
|
+
instanceId: PropTypes.Requireable<string>;
|
|
47
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
48
|
+
n: PropTypes.Validator<object>;
|
|
49
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
50
|
+
removeResponse: PropTypes.Validator<(...args: any[]) => any>;
|
|
51
|
+
duplicates: PropTypes.Requireable<boolean>;
|
|
52
|
+
selected: PropTypes.Requireable<boolean>;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export default DragDropChoice;
|
|
56
|
+
//# sourceMappingURL=choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choice.d.ts","sourceRoot":"","sources":["../../../../src/components/respArea/DragInTheBlank/choice.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAgBnC,wBAAgB,YAAY,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;;;;;;;;CAAA,eAwF1F;yBAxFe,YAAY;;;;;;;;;;;AAoG5B,iBAAS,cAAc,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,CAAC,EACD,QAAQ,EACR,cAAc,EACd,UAAU,EACV,GAAG,EACH,QAAQ,GACT;;;;;;;;;;;CAAA,eAiHA;kBA5HQ,cAAc;;;;;;;;;;;;;AA0IvB,eAAe,cAAc,CAAC"}
|