@pie-lib/editable-html-tip-tap 2.1.2-next.29 → 2.1.2-next.30
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.js +131 -0
- package/dist/components/EditableHtml.d.ts +11 -0
- package/dist/components/EditableHtml.js +291 -0
- package/dist/components/MenuBar.d.ts +11 -0
- package/dist/components/MenuBar.js +462 -0
- package/dist/components/TiptapContainer.d.ts +11 -0
- package/dist/components/TiptapContainer.js +154 -0
- package/dist/components/characters/characterUtils.d.ts +35 -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.js +32 -0
- package/dist/components/common/done-button.d.ts +30 -0
- package/dist/components/common/done-button.js +26 -0
- package/dist/components/common/toolbar-buttons.d.ts +38 -0
- package/dist/components/common/toolbar-buttons.js +91 -0
- package/dist/components/icons/CssIcon.d.ts +11 -0
- package/dist/components/icons/CssIcon.js +14 -0
- package/dist/components/icons/RespArea.d.ts +26 -0
- package/dist/components/icons/RespArea.js +42 -0
- package/dist/components/icons/TableIcons.d.ts +14 -0
- package/dist/components/icons/TableIcons.js +32 -0
- package/dist/components/icons/TextAlign.d.ts +18 -0
- package/dist/components/icons/TextAlign.js +134 -0
- package/dist/components/image/AltDialog.d.ts +22 -0
- package/dist/components/image/AltDialog.js +61 -0
- package/dist/components/image/ImageToolbar.d.ts +24 -0
- package/dist/components/image/ImageToolbar.js +80 -0
- package/dist/components/image/InsertImageHandler.d.ts +32 -0
- package/dist/components/image/InsertImageHandler.js +53 -0
- package/dist/components/media/MediaDialog.d.ts +43 -0
- package/dist/components/media/MediaDialog.js +389 -0
- package/dist/components/media/MediaToolbar.d.ts +19 -0
- package/dist/components/media/MediaToolbar.js +41 -0
- package/dist/components/media/MediaWrapper.d.ts +19 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +23 -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.js +156 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
- package/dist/components/respArea/ExplicitConstructedResponse.js +83 -0
- package/dist/components/respArea/InlineDropdown.d.ts +18 -0
- package/dist/components/respArea/InlineDropdown.js +119 -0
- package/dist/components/respArea/MathTemplated.d.ts +19 -0
- package/dist/components/respArea/MathTemplated.js +97 -0
- package/dist/components/respArea/ToolbarIcon.d.ts +14 -0
- package/dist/components/respArea/ToolbarIcon.js +17 -0
- package/dist/components/respArea/inlineDropdownUtils.d.ts +15 -0
- package/dist/components/respArea/inlineDropdownUtils.js +15 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +4 -0
- package/dist/extensions/css.d.ts +11 -0
- package/dist/extensions/css.js +115 -0
- package/dist/extensions/custom-toolbar-wrapper.d.ts +11 -0
- package/dist/extensions/custom-toolbar-wrapper.js +61 -0
- package/dist/extensions/div-node.d.ts +10 -0
- package/dist/extensions/div-node.js +42 -0
- package/dist/extensions/ensure-empty-root-div.d.ts +14 -0
- package/dist/extensions/ensure-empty-root-div.js +24 -0
- package/dist/extensions/ensure-list-item-content-is-div.d.ts +15 -0
- package/dist/extensions/ensure-list-item-content-is-div.js +31 -0
- package/dist/extensions/extended-list-item.d.ts +13 -0
- package/dist/extensions/extended-list-item.js +5 -0
- package/dist/extensions/extended-table-cell.d.ts +10 -0
- package/dist/extensions/extended-table-cell.js +6 -0
- package/dist/extensions/extended-table.d.ts +17 -0
- package/dist/extensions/extended-table.js +34 -0
- package/dist/extensions/heading-paragraph.d.ts +17 -0
- package/dist/extensions/heading-paragraph.js +30 -0
- package/dist/extensions/image-component.d.ts +22 -0
- package/dist/extensions/image-component.js +220 -0
- package/dist/extensions/image.d.ts +10 -0
- package/dist/extensions/image.js +68 -0
- package/dist/extensions/index.d.ts +16 -0
- package/dist/extensions/index.js +64 -0
- package/dist/extensions/math.d.ts +15 -0
- package/dist/extensions/math.js +158 -0
- package/dist/extensions/media.d.ts +19 -0
- package/dist/extensions/media.js +149 -0
- package/dist/extensions/responseArea.d.ts +27 -0
- package/dist/extensions/responseArea.js +259 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +7 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/styles/editorContainerStyles.d.ts +134 -0
- package/dist/theme.d.ts +9 -0
- package/dist/utils/helper.d.ts +9 -0
- package/dist/utils/helper.js +27 -0
- package/dist/utils/size.d.ts +9 -0
- package/dist/utils/size.js +14 -0
- package/package.json +40 -24
- package/CHANGELOG.json +0 -32
- package/CHANGELOG.md +0 -2532
- package/LICENSE.md +0 -5
- package/lib/components/CharacterPicker.js +0 -201
- package/lib/components/CharacterPicker.js.map +0 -1
- package/lib/components/EditableHtml.js +0 -376
- package/lib/components/EditableHtml.js.map +0 -1
- package/lib/components/MenuBar.js +0 -696
- package/lib/components/MenuBar.js.map +0 -1
- package/lib/components/TiptapContainer.js +0 -234
- package/lib/components/TiptapContainer.js.map +0 -1
- package/lib/components/characters/characterUtils.js +0 -378
- package/lib/components/characters/characterUtils.js.map +0 -1
- package/lib/components/characters/custom-popper.js +0 -44
- package/lib/components/characters/custom-popper.js.map +0 -1
- package/lib/components/common/done-button.js +0 -34
- package/lib/components/common/done-button.js.map +0 -1
- package/lib/components/common/toolbar-buttons.js +0 -144
- package/lib/components/common/toolbar-buttons.js.map +0 -1
- package/lib/components/icons/CssIcon.js +0 -25
- package/lib/components/icons/CssIcon.js.map +0 -1
- package/lib/components/icons/RespArea.js +0 -72
- package/lib/components/icons/RespArea.js.map +0 -1
- package/lib/components/icons/TableIcons.js +0 -53
- package/lib/components/icons/TableIcons.js.map +0 -1
- package/lib/components/icons/TextAlign.js +0 -157
- package/lib/components/icons/TextAlign.js.map +0 -1
- package/lib/components/image/AltDialog.js +0 -98
- package/lib/components/image/AltDialog.js.map +0 -1
- package/lib/components/image/ImageToolbar.js +0 -137
- package/lib/components/image/ImageToolbar.js.map +0 -1
- package/lib/components/image/InsertImageHandler.js +0 -135
- package/lib/components/image/InsertImageHandler.js.map +0 -1
- package/lib/components/media/MediaDialog.js +0 -594
- package/lib/components/media/MediaDialog.js.map +0 -1
- package/lib/components/media/MediaToolbar.js +0 -74
- package/lib/components/media/MediaToolbar.js.map +0 -1
- package/lib/components/media/MediaWrapper.js +0 -67
- package/lib/components/media/MediaWrapper.js.map +0 -1
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js +0 -84
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js.map +0 -1
- package/lib/components/respArea/DragInTheBlank/choice.js +0 -250
- package/lib/components/respArea/DragInTheBlank/choice.js.map +0 -1
- package/lib/components/respArea/ExplicitConstructedResponse.js +0 -136
- package/lib/components/respArea/ExplicitConstructedResponse.js.map +0 -1
- package/lib/components/respArea/InlineDropdown.js +0 -209
- package/lib/components/respArea/InlineDropdown.js.map +0 -1
- package/lib/components/respArea/MathTemplated.js +0 -130
- package/lib/components/respArea/MathTemplated.js.map +0 -1
- package/lib/components/respArea/ToolbarIcon.js +0 -81
- package/lib/components/respArea/ToolbarIcon.js.map +0 -1
- package/lib/components/respArea/inlineDropdownUtils.js +0 -67
- package/lib/components/respArea/inlineDropdownUtils.js.map +0 -1
- package/lib/constants.js +0 -11
- package/lib/constants.js.map +0 -1
- package/lib/extensions/css.js +0 -217
- package/lib/extensions/css.js.map +0 -1
- package/lib/extensions/custom-toolbar-wrapper.js +0 -92
- package/lib/extensions/custom-toolbar-wrapper.js.map +0 -1
- package/lib/extensions/div-node.js +0 -83
- package/lib/extensions/div-node.js.map +0 -1
- package/lib/extensions/ensure-empty-root-div.js +0 -48
- package/lib/extensions/ensure-empty-root-div.js.map +0 -1
- package/lib/extensions/ensure-list-item-content-is-div.js +0 -64
- package/lib/extensions/ensure-list-item-content-is-div.js.map +0 -1
- package/lib/extensions/extended-list-item.js +0 -15
- package/lib/extensions/extended-list-item.js.map +0 -1
- package/lib/extensions/extended-table-cell.js +0 -22
- package/lib/extensions/extended-table-cell.js.map +0 -1
- package/lib/extensions/extended-table.js +0 -75
- package/lib/extensions/extended-table.js.map +0 -1
- package/lib/extensions/heading-paragraph.js +0 -61
- package/lib/extensions/heading-paragraph.js.map +0 -1
- package/lib/extensions/image-component.js +0 -348
- package/lib/extensions/image-component.js.map +0 -1
- package/lib/extensions/image.js +0 -134
- package/lib/extensions/image.js.map +0 -1
- package/lib/extensions/index.js +0 -46
- package/lib/extensions/index.js.map +0 -1
- package/lib/extensions/math.js +0 -342
- package/lib/extensions/math.js.map +0 -1
- package/lib/extensions/media.js +0 -243
- package/lib/extensions/media.js.map +0 -1
- package/lib/extensions/responseArea.js +0 -446
- package/lib/extensions/responseArea.js.map +0 -1
- package/lib/index.js +0 -37
- package/lib/index.js.map +0 -1
- package/lib/styles/editorContainerStyles.js +0 -137
- package/lib/styles/editorContainerStyles.js.map +0 -1
- package/lib/theme.js +0 -8
- package/lib/theme.js.map +0 -1
- package/lib/utils/helper.js +0 -73
- package/lib/utils/helper.js.map +0 -1
- package/lib/utils/size.js +0 -26
- package/lib/utils/size.js.map +0 -1
- package/src/__tests__/EditableHtml.test.jsx +0 -554
- package/src/__tests__/constants.test.js +0 -19
- package/src/__tests__/div-to-paragraph-conversion.test.jsx +0 -125
- package/src/__tests__/extensions.test.js +0 -208
- package/src/__tests__/index.test.jsx +0 -154
- package/src/__tests__/size-utils.test.js +0 -64
- package/src/__tests__/theme.test.js +0 -17
- package/src/components/CharacterPicker.jsx +0 -207
- package/src/components/EditableHtml.jsx +0 -440
- package/src/components/MenuBar.jsx +0 -554
- package/src/components/TiptapContainer.jsx +0 -219
- package/src/components/__tests__/AltDialog.test.jsx +0 -147
- package/src/components/__tests__/CharacterPicker.test.jsx +0 -261
- package/src/components/__tests__/CssIcon.test.jsx +0 -46
- package/src/components/__tests__/DragInTheBlank.test.jsx +0 -255
- package/src/components/__tests__/ExplicitConstructedResponse.test.jsx +0 -204
- package/src/components/__tests__/ImageToolbar.test.jsx +0 -128
- package/src/components/__tests__/InlineDropdown.test.jsx +0 -388
- package/src/components/__tests__/InsertImageHandler.test.js +0 -161
- package/src/components/__tests__/MediaDialog.test.jsx +0 -293
- package/src/components/__tests__/MediaToolbar.test.jsx +0 -74
- package/src/components/__tests__/MediaWrapper.test.jsx +0 -81
- package/src/components/__tests__/MenuBar.test.jsx +0 -250
- package/src/components/__tests__/RespArea.test.jsx +0 -122
- package/src/components/__tests__/TableIcons.test.jsx +0 -149
- package/src/components/__tests__/TextAlign.test.jsx +0 -167
- package/src/components/__tests__/TiptapContainer.test.jsx +0 -138
- package/src/components/__tests__/characterUtils.test.js +0 -166
- package/src/components/__tests__/choice.test.jsx +0 -171
- package/src/components/__tests__/custom-popper.test.jsx +0 -82
- package/src/components/__tests__/done-button.test.jsx +0 -54
- package/src/components/__tests__/toolbar-buttons.test.jsx +0 -234
- package/src/components/characters/characterUtils.js +0 -447
- package/src/components/characters/custom-popper.js +0 -38
- package/src/components/common/done-button.jsx +0 -27
- package/src/components/common/toolbar-buttons.jsx +0 -122
- package/src/components/icons/CssIcon.jsx +0 -15
- package/src/components/icons/RespArea.jsx +0 -71
- package/src/components/icons/TableIcons.jsx +0 -52
- package/src/components/icons/TextAlign.jsx +0 -114
- package/src/components/image/AltDialog.jsx +0 -82
- package/src/components/image/ImageToolbar.jsx +0 -99
- package/src/components/image/InsertImageHandler.js +0 -107
- package/src/components/media/MediaDialog.jsx +0 -596
- package/src/components/media/MediaToolbar.jsx +0 -49
- package/src/components/media/MediaWrapper.jsx +0 -39
- package/src/components/respArea/DragInTheBlank/DragInTheBlank.jsx +0 -76
- package/src/components/respArea/DragInTheBlank/choice.jsx +0 -256
- package/src/components/respArea/ExplicitConstructedResponse.jsx +0 -135
- package/src/components/respArea/InlineDropdown.jsx +0 -220
- package/src/components/respArea/MathTemplated.jsx +0 -124
- package/src/components/respArea/ToolbarIcon.jsx +0 -66
- package/src/components/respArea/__tests__/MathTemplated.test.jsx +0 -210
- package/src/components/respArea/inlineDropdownUtils.js +0 -79
- package/src/constants.js +0 -5
- package/src/extensions/__tests__/css.test.js +0 -196
- package/src/extensions/__tests__/custom-toolbar-wrapper.test.jsx +0 -180
- package/src/extensions/__tests__/divNode.test.js +0 -87
- package/src/extensions/__tests__/ensure-empty-root-div.test.js +0 -57
- package/src/extensions/__tests__/ensure-list-item-content-is-div.test.js +0 -44
- package/src/extensions/__tests__/extended-list-item.test.js +0 -13
- package/src/extensions/__tests__/extended-table-cell.test.js +0 -22
- package/src/extensions/__tests__/extended-table.test.js +0 -183
- package/src/extensions/__tests__/image-component.test.jsx +0 -345
- package/src/extensions/__tests__/image.test.js +0 -237
- package/src/extensions/__tests__/math.test.js +0 -603
- package/src/extensions/__tests__/media-node-view.test.jsx +0 -298
- package/src/extensions/__tests__/media.test.js +0 -271
- package/src/extensions/__tests__/responseArea.test.js +0 -601
- package/src/extensions/css.js +0 -220
- package/src/extensions/custom-toolbar-wrapper.jsx +0 -78
- package/src/extensions/div-node.js +0 -86
- package/src/extensions/ensure-empty-root-div.js +0 -47
- package/src/extensions/ensure-list-item-content-is-div.js +0 -62
- package/src/extensions/extended-list-item.js +0 -10
- package/src/extensions/extended-table-cell.js +0 -19
- package/src/extensions/extended-table.js +0 -60
- package/src/extensions/heading-paragraph.js +0 -53
- package/src/extensions/image-component.jsx +0 -338
- package/src/extensions/image.js +0 -109
- package/src/extensions/index.js +0 -81
- package/src/extensions/math.js +0 -326
- package/src/extensions/media.js +0 -188
- package/src/extensions/responseArea.js +0 -401
- package/src/index.jsx +0 -5
- package/src/styles/editorContainerStyles.js +0 -145
- package/src/theme.js +0 -1
- package/src/utils/__tests__/helper.test.js +0 -126
- package/src/utils/helper.js +0 -69
- package/src/utils/size.js +0 -32
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import e from "../../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
2
|
+
import { GripIcon as t } from "../../icons/RespArea.js";
|
|
3
|
+
import { useEffect as n, useRef as r, useState as i } from "react";
|
|
4
|
+
import { styled as a } from "@mui/material/styles";
|
|
5
|
+
import o from "prop-types";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { useDraggable as l, useDroppable as u } from "@dnd-kit/core";
|
|
8
|
+
import { color as d } from "@pie-lib/render-ui";
|
|
9
|
+
import { renderMath as f } from "@pie-element/shared-math-rendering-mathjax";
|
|
10
|
+
//#region src/components/respArea/DragInTheBlank/choice.tsx
|
|
11
|
+
var p = a("span")(({ theme: e }) => ({
|
|
12
|
+
border: `solid 0px ${e.palette.primary.main}`,
|
|
13
|
+
"& mjx-frac": { fontSize: "120% !important" }
|
|
14
|
+
}));
|
|
15
|
+
function m({ n: e, children: a, isDragging: o, isOver: l, dragItem: u, value: p, selected: m }) {
|
|
16
|
+
let [h, g] = i(null), _ = r(null), v = (e) => {
|
|
17
|
+
_.current && (_.current.contains(e.target) ? _.current.classList.add("selected") : _.current.classList.remove("selected"));
|
|
18
|
+
};
|
|
19
|
+
n(() => (document.addEventListener("click", v), () => {
|
|
20
|
+
document.removeEventListener("click", v);
|
|
21
|
+
}), []), n(() => {
|
|
22
|
+
_.current && typeof f == "function" && f(_.current);
|
|
23
|
+
}, [
|
|
24
|
+
p?.value,
|
|
25
|
+
l,
|
|
26
|
+
u?.value?.value
|
|
27
|
+
]), n(() => {
|
|
28
|
+
if (l && _.current && !h) {
|
|
29
|
+
let e = _.current;
|
|
30
|
+
g({
|
|
31
|
+
width: e.offsetWidth,
|
|
32
|
+
height: e.offsetHeight
|
|
33
|
+
});
|
|
34
|
+
} else !l && h && g(null);
|
|
35
|
+
}, [l, h]);
|
|
36
|
+
let y = u && l ? u.value.value : p.value || "\xA0", b = o ? "\xA0" : y, x = b !== "\xA0", S = u && l, C = m ? `2px solid ${d.primaryDark()}` : S ? `1px solid ${d.defaults.BORDER_DARK}` : `1px solid ${d.defaults.BORDER_LIGHT}`;
|
|
37
|
+
return /* @__PURE__ */ c("div", {
|
|
38
|
+
ref: _,
|
|
39
|
+
className: m ? "selected" : void 0,
|
|
40
|
+
style: {
|
|
41
|
+
display: "inline-flex",
|
|
42
|
+
minWidth: "178px",
|
|
43
|
+
minHeight: "36px",
|
|
44
|
+
background: S ? `${d.defaults.BORDER_LIGHT}` : `${d.defaults.WHITE}`,
|
|
45
|
+
border: C,
|
|
46
|
+
boxSizing: "border-box",
|
|
47
|
+
borderRadius: "3px",
|
|
48
|
+
overflow: "hidden",
|
|
49
|
+
position: "relative",
|
|
50
|
+
padding: "8px 8px 8px 35px",
|
|
51
|
+
width: h ? h.width : void 0,
|
|
52
|
+
height: h ? h.height : void 0,
|
|
53
|
+
touchAction: "none"
|
|
54
|
+
},
|
|
55
|
+
"data-key": e.index,
|
|
56
|
+
contentEditable: !1,
|
|
57
|
+
children: [
|
|
58
|
+
x && /* @__PURE__ */ s(t, {
|
|
59
|
+
style: {
|
|
60
|
+
position: "absolute",
|
|
61
|
+
top: "6px",
|
|
62
|
+
left: "15px",
|
|
63
|
+
color: "#9B9B9B"
|
|
64
|
+
},
|
|
65
|
+
contentEditable: !1
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: b } }),
|
|
68
|
+
a
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
m.propTypes = {
|
|
73
|
+
n: o.object,
|
|
74
|
+
children: o.node,
|
|
75
|
+
isDragging: o.bool,
|
|
76
|
+
isOver: o.bool,
|
|
77
|
+
dragItem: o.object,
|
|
78
|
+
value: o.object,
|
|
79
|
+
selected: o.bool
|
|
80
|
+
};
|
|
81
|
+
function h({ value: t, disabled: n, instanceId: r, children: i, n: a, onChange: o, removeResponse: c, duplicates: d, pos: f, selected: h }) {
|
|
82
|
+
let { attributes: g, listeners: _, setNodeRef: v, isDragging: y } = l({
|
|
83
|
+
id: `drag-${a.index}`,
|
|
84
|
+
disabled: n || !t?.value,
|
|
85
|
+
data: {
|
|
86
|
+
id: `drag-${a.index}`,
|
|
87
|
+
value: t,
|
|
88
|
+
instanceId: r,
|
|
89
|
+
n: a,
|
|
90
|
+
pos: f,
|
|
91
|
+
opts: { duplicates: d },
|
|
92
|
+
type: "drag-in-the-blank-placed-choice",
|
|
93
|
+
fromChoice: !t,
|
|
94
|
+
onRemove: (e) => c(e),
|
|
95
|
+
onDrop: (e, t) => {
|
|
96
|
+
t?.type === "drag-in-the-blank-drop-choice" && (o(e), !d && e.fromChoice && c(e));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}), { setNodeRef: b, isOver: x, active: S } = u({
|
|
100
|
+
id: `drop-${a.index}`,
|
|
101
|
+
data: {
|
|
102
|
+
type: "drag-in-the-blank-drop-choice",
|
|
103
|
+
accepts: ["drag-in-the-blank-choice", "drag-in-the-blank-placed-choice"],
|
|
104
|
+
instanceId: r,
|
|
105
|
+
value: t,
|
|
106
|
+
id: `drop-${a.index}`,
|
|
107
|
+
pos: f,
|
|
108
|
+
n: a,
|
|
109
|
+
opts: { duplicates: d },
|
|
110
|
+
onDrop: (e, t) => {
|
|
111
|
+
if (t?.type === "drag-in-the-blank-drop-choice" && e.value.id !== t.value.id) {
|
|
112
|
+
if (e.type === "drag-in-the-blank-choice") {
|
|
113
|
+
o(e), !d && e.fromChoice && c(e);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
e.type === "drag-in-the-blank-placed-choice" && (c(t), o(e), setTimeout(() => c(e), 10));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}), C = (e) => {
|
|
121
|
+
v(e), b(e);
|
|
122
|
+
}, w = /* @__PURE__ */ s(m, {
|
|
123
|
+
n: a,
|
|
124
|
+
isDragging: y,
|
|
125
|
+
isOver: x,
|
|
126
|
+
dragItem: S?.data?.current,
|
|
127
|
+
value: t,
|
|
128
|
+
selected: h,
|
|
129
|
+
children: i
|
|
130
|
+
}), T = t ? /* @__PURE__ */ s("span", {
|
|
131
|
+
ref: C,
|
|
132
|
+
...g,
|
|
133
|
+
..._,
|
|
134
|
+
children: w
|
|
135
|
+
}) : /* @__PURE__ */ s("span", {
|
|
136
|
+
ref: b,
|
|
137
|
+
children: w
|
|
138
|
+
});
|
|
139
|
+
return /* @__PURE__ */ s(p, {
|
|
140
|
+
className: e(x && "over"),
|
|
141
|
+
children: T
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
h.propTypes = {
|
|
145
|
+
value: o.object,
|
|
146
|
+
disabled: o.bool,
|
|
147
|
+
instanceId: o.string,
|
|
148
|
+
children: o.node,
|
|
149
|
+
n: o.object.isRequired,
|
|
150
|
+
onChange: o.func.isRequired,
|
|
151
|
+
removeResponse: o.func.isRequired,
|
|
152
|
+
duplicates: o.bool,
|
|
153
|
+
selected: o.bool
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
export { h as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/ExplicitConstructedResponse.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 const ExplicitConstructedResponse: {
|
|
12
|
+
(props: any): React.JSX.Element;
|
|
13
|
+
propTypes: {
|
|
14
|
+
attributes: PropTypes.Requireable<object>;
|
|
15
|
+
error: PropTypes.Requireable<any>;
|
|
16
|
+
value: PropTypes.Requireable<string>;
|
|
17
|
+
isFocused: PropTypes.Requireable<boolean>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default ExplicitConstructedResponse;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import e from "../../extensions/custom-toolbar-wrapper.js";
|
|
2
|
+
import t, { useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { NodeViewWrapper as a } from "@tiptap/react";
|
|
4
|
+
import o from "react-dom";
|
|
5
|
+
import s from "prop-types";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/respArea/ExplicitConstructedResponse.tsx
|
|
8
|
+
var u = (s) => {
|
|
9
|
+
let { editor: u, node: d, getPos: f, options: p, selected: m } = s, { attrs: h } = d, { value: g } = h, { respAreaToolbar: _, error: v } = p, y = f(), [b, x] = i(!1), S = _([d, y], u, () => {}), C = r(null), w;
|
|
10
|
+
if (v) {
|
|
11
|
+
let e = v(), t = parseInt(h.index, 10);
|
|
12
|
+
w = !!e?.[t]?.[0];
|
|
13
|
+
}
|
|
14
|
+
return n(() => {
|
|
15
|
+
let { selection: e } = u.state, t = e.from + d.nodeSize === e.to;
|
|
16
|
+
m ? t && x(m) : x(m);
|
|
17
|
+
}, [
|
|
18
|
+
u,
|
|
19
|
+
d,
|
|
20
|
+
m
|
|
21
|
+
]), n(() => {
|
|
22
|
+
let e = (e) => {
|
|
23
|
+
!(e.target.closest(".insert-character-dialog") || e.target.closest("[data-toolbar-for]")) && C.current && !C.current.contains(e.target) && !e.target.closest("[data-inline-node]") && x(!1);
|
|
24
|
+
};
|
|
25
|
+
return b ? document.addEventListener("mousedown", e) : document.removeEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
26
|
+
}, [b]), /* @__PURE__ */ l(a, {
|
|
27
|
+
className: "drag-in-the-blank",
|
|
28
|
+
"data-selected": m,
|
|
29
|
+
style: {
|
|
30
|
+
display: "inline-flex",
|
|
31
|
+
minHeight: "55px",
|
|
32
|
+
position: "relative",
|
|
33
|
+
cursor: "pointer"
|
|
34
|
+
},
|
|
35
|
+
children: [/* @__PURE__ */ c("div", {
|
|
36
|
+
...h,
|
|
37
|
+
style: {
|
|
38
|
+
display: "inline-flex",
|
|
39
|
+
width: "100%",
|
|
40
|
+
minHeight: "46px",
|
|
41
|
+
height: "46px",
|
|
42
|
+
backgroundColor: "#FFF",
|
|
43
|
+
border: `1px solid ${w ? "red" : "#C0C3CF"}`,
|
|
44
|
+
boxSizing: "border-box",
|
|
45
|
+
borderRadius: "4px",
|
|
46
|
+
overflow: "hidden",
|
|
47
|
+
padding: "12px 21px",
|
|
48
|
+
margin: "0 4px",
|
|
49
|
+
minWidth: "178px",
|
|
50
|
+
visibility: b ? "hidden" : "visible"
|
|
51
|
+
},
|
|
52
|
+
onClick: () => x(!0),
|
|
53
|
+
dangerouslySetInnerHTML: { __html: g || "<div> </div>" }
|
|
54
|
+
}), b && /* @__PURE__ */ l(t.Fragment, { children: [/* @__PURE__ */ c("div", {
|
|
55
|
+
ref: C,
|
|
56
|
+
className: "absolute z-50 bg-white shadow-lg rounded p-2",
|
|
57
|
+
style: { zIndex: 1 },
|
|
58
|
+
children: /* @__PURE__ */ c(S, {})
|
|
59
|
+
}), u._tiptapContainerEl && o.createPortal(/* @__PURE__ */ c(e, {
|
|
60
|
+
deletable: !0,
|
|
61
|
+
toolbarOpts: { minWidth: "auto" },
|
|
62
|
+
autoWidth: !0,
|
|
63
|
+
style: {
|
|
64
|
+
top: -40,
|
|
65
|
+
left: 0,
|
|
66
|
+
right: 0
|
|
67
|
+
},
|
|
68
|
+
onDelete: () => {
|
|
69
|
+
let { tr: e } = u.state;
|
|
70
|
+
e.delete(y, y + d.nodeSize), u._toolbarOpened = !1, u.view.dispatch(e), x(!1), u.commands.focus();
|
|
71
|
+
},
|
|
72
|
+
showDone: !1
|
|
73
|
+
}), u._tiptapContainerEl)] })]
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
u.propTypes = {
|
|
77
|
+
attributes: s.object,
|
|
78
|
+
error: s.any,
|
|
79
|
+
value: s.string,
|
|
80
|
+
isFocused: s.bool
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { u as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/InlineDropdown.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 const InlineDropdown: {
|
|
12
|
+
(props: any): React.JSX.Element;
|
|
13
|
+
propTypes: {
|
|
14
|
+
attributes: PropTypes.Requireable<object>;
|
|
15
|
+
selectedItem: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default InlineDropdown;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import e from "../../extensions/custom-toolbar-wrapper.js";
|
|
2
|
+
import { Chevron as t } from "../icons/RespArea.js";
|
|
3
|
+
import n, { useEffect as r, useRef as i, useState as a } from "react";
|
|
4
|
+
import { NodeViewWrapper as o } from "@tiptap/react";
|
|
5
|
+
import { NodeSelection as s } from "prosemirror-state";
|
|
6
|
+
import c from "react-dom";
|
|
7
|
+
import l from "prop-types";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/respArea/InlineDropdown.tsx
|
|
10
|
+
var f = (l) => {
|
|
11
|
+
let { editor: f, node: p, getPos: m, options: h, selected: g } = l, { attrs: _ } = p, { value: v, error: y } = _, b = v || "<div> </div>", x = m(), S = i(null), C = i(null), w = i(!1), T = () => f._holdInlineDropdownToolbarIndex != null && String(f._holdInlineDropdownToolbarIndex) === String(p.attrs.index), [E, D] = a(!1), [O, k] = a({
|
|
12
|
+
top: 0,
|
|
13
|
+
left: 0
|
|
14
|
+
}), A = () => {
|
|
15
|
+
T() || D(!1);
|
|
16
|
+
}, j = h.respAreaToolbar([p, x], f, A), M = () => {
|
|
17
|
+
let { tr: e } = f.state, t = e.doc.nodeAt(x);
|
|
18
|
+
if (!t) return;
|
|
19
|
+
let { selection: n } = e;
|
|
20
|
+
n.from === x && n.to === x + t.nodeSize || (e.setSelection(s.create(e.doc, x)), f.view.dispatch(e));
|
|
21
|
+
}, N = () => {
|
|
22
|
+
w.current || (h.onToolbarCloseRequest ? (w.current = !0, h.onToolbarCloseRequest([p, x], f, () => {
|
|
23
|
+
w.current = !1, delete f._holdInlineDropdownToolbarIndex, A();
|
|
24
|
+
}, () => {
|
|
25
|
+
w.current = !1, delete f._holdInlineDropdownToolbarIndex, D(!0), setTimeout(M, 0);
|
|
26
|
+
})) : A());
|
|
27
|
+
};
|
|
28
|
+
return r(() => {
|
|
29
|
+
let { selection: e } = f.state, t = e.from + p.nodeSize === e.to;
|
|
30
|
+
g ? t && D(!0) : E && N();
|
|
31
|
+
}, [
|
|
32
|
+
f,
|
|
33
|
+
p,
|
|
34
|
+
g
|
|
35
|
+
]), r(() => {
|
|
36
|
+
let e = document.body.getBoundingClientRect(), { from: t } = f.state.selection, n = f.view.coordsAtPos(t);
|
|
37
|
+
k({
|
|
38
|
+
top: n.top + Math.abs(e.top) + 40,
|
|
39
|
+
left: n.left
|
|
40
|
+
});
|
|
41
|
+
let r = (e) => {
|
|
42
|
+
let t = e.target.closest("[data-toolbar-for]");
|
|
43
|
+
!e.target.closest("[data-inline-dropdown-toolbar]") && (!t || t.dataset.toolbarFor !== C.current?.instanceId) && !f._toolbarOpened && S.current && !S.current.contains(e.target) && !e.target.closest("[data-inline-node]") && N();
|
|
44
|
+
};
|
|
45
|
+
return E ? document.addEventListener("mousedown", r) : document.removeEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
46
|
+
}, [E]), /* @__PURE__ */ d(o, {
|
|
47
|
+
className: "inline-dropdown",
|
|
48
|
+
"data-selected": g,
|
|
49
|
+
style: {
|
|
50
|
+
display: "inline-flex",
|
|
51
|
+
height: "50px",
|
|
52
|
+
cursor: "pointer"
|
|
53
|
+
},
|
|
54
|
+
children: [/* @__PURE__ */ d("div", {
|
|
55
|
+
style: {
|
|
56
|
+
display: "inline-flex",
|
|
57
|
+
minWidth: "178px",
|
|
58
|
+
height: "36px",
|
|
59
|
+
background: "#FFF",
|
|
60
|
+
border: "1px solid #C0C3CF",
|
|
61
|
+
boxSizing: "border-box",
|
|
62
|
+
borderRadius: "3px",
|
|
63
|
+
margin: "0 2px",
|
|
64
|
+
position: "relative",
|
|
65
|
+
alignItems: "center"
|
|
66
|
+
},
|
|
67
|
+
onClick: () => D(!0),
|
|
68
|
+
children: [/* @__PURE__ */ u("div", {
|
|
69
|
+
style: {
|
|
70
|
+
flex: 1,
|
|
71
|
+
overflow: "hidden",
|
|
72
|
+
padding: "0 25px 0 8px",
|
|
73
|
+
whiteSpace: "nowrap",
|
|
74
|
+
textOverflow: "ellipsis"
|
|
75
|
+
},
|
|
76
|
+
children: /* @__PURE__ */ u("span", {
|
|
77
|
+
style: {
|
|
78
|
+
display: "inline-block",
|
|
79
|
+
verticalAlign: "middle"
|
|
80
|
+
},
|
|
81
|
+
dangerouslySetInnerHTML: { __html: b }
|
|
82
|
+
})
|
|
83
|
+
}), /* @__PURE__ */ u(t, {
|
|
84
|
+
direction: "down",
|
|
85
|
+
style: {
|
|
86
|
+
position: "absolute",
|
|
87
|
+
top: "5px",
|
|
88
|
+
right: "5px"
|
|
89
|
+
}
|
|
90
|
+
})]
|
|
91
|
+
}), E && /* @__PURE__ */ d(n.Fragment, { children: [c.createPortal(/* @__PURE__ */ u("div", {
|
|
92
|
+
ref: S,
|
|
93
|
+
style: { zIndex: 1 },
|
|
94
|
+
children: /* @__PURE__ */ u(j, { editorCallback: (e) => {
|
|
95
|
+
C.current = e;
|
|
96
|
+
} })
|
|
97
|
+
}), document.body), f._tiptapContainerEl && c.createPortal(/* @__PURE__ */ u(e, {
|
|
98
|
+
deletable: !0,
|
|
99
|
+
toolbarOpts: { minWidth: "auto" },
|
|
100
|
+
autoWidth: !0,
|
|
101
|
+
style: {
|
|
102
|
+
top: -40,
|
|
103
|
+
left: 0,
|
|
104
|
+
right: 0
|
|
105
|
+
},
|
|
106
|
+
onDelete: () => {
|
|
107
|
+
let { tr: e } = f.state;
|
|
108
|
+
e.delete(x, x + p.nodeSize), f._toolbarOpened = !1, delete f._holdInlineDropdownToolbarIndex, f.view.dispatch(e), D(!1), f.commands.focus();
|
|
109
|
+
},
|
|
110
|
+
showDone: !1
|
|
111
|
+
}), f._tiptapContainerEl)] })]
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
f.propTypes = {
|
|
115
|
+
attributes: l.object,
|
|
116
|
+
selectedItem: l.oneOfType([l.string, l.object])
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
export { f as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/MathTemplated.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 const MathTemplated: {
|
|
12
|
+
(props: any): React.JSX.Element;
|
|
13
|
+
propTypes: {
|
|
14
|
+
attributes: PropTypes.Requireable<object>;
|
|
15
|
+
value: PropTypes.Requireable<string>;
|
|
16
|
+
keyToDisplay: PropTypes.Requireable<string>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default MathTemplated;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { NodeViewWrapper as e } from "@tiptap/react";
|
|
3
|
+
import { styled as t } from "@mui/material/styles";
|
|
4
|
+
import n from "prop-types";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
import { mq as a } from "@pie-lib/math-input";
|
|
7
|
+
//#region src/components/respArea/MathTemplated.tsx
|
|
8
|
+
var o = t("span")(() => ({
|
|
9
|
+
display: "inline-flex",
|
|
10
|
+
border: "1px solid #C0C3CF",
|
|
11
|
+
margin: "1px 5px",
|
|
12
|
+
cursor: "pointer",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
minWidth: "50px",
|
|
16
|
+
minHeight: "36px",
|
|
17
|
+
height: "fit-content"
|
|
18
|
+
})), s = t("div")(({ theme: e }) => ({
|
|
19
|
+
background: e.palette.grey.A100,
|
|
20
|
+
color: e.palette.grey.A700,
|
|
21
|
+
display: "inline-flex",
|
|
22
|
+
borderRight: "2px solid #C0C3CF",
|
|
23
|
+
boxSizing: "border-box",
|
|
24
|
+
overflow: "hidden",
|
|
25
|
+
fontSize: "12px",
|
|
26
|
+
minHeight: "36px",
|
|
27
|
+
height: "100%",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
fontFamily: "Symbola, Times New Roman, serif",
|
|
30
|
+
padding: "0 2px"
|
|
31
|
+
})), c = t("div")(() => ({
|
|
32
|
+
flex: 8,
|
|
33
|
+
color: "var(--pie-text, black)",
|
|
34
|
+
padding: "4px !important",
|
|
35
|
+
display: "flex",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
justifyContent: "center",
|
|
38
|
+
backgroundColor: "var(--pie-background, rgba(255, 255, 255, 0))",
|
|
39
|
+
"& > .mq-math-mode sup.mq-nthroot": {
|
|
40
|
+
fontSize: "70% !important",
|
|
41
|
+
verticalAlign: "1em !important"
|
|
42
|
+
},
|
|
43
|
+
"& > .mq-math-mode .mq-sqrt-stem": {
|
|
44
|
+
borderTop: "0.07em solid",
|
|
45
|
+
marginLeft: "-1.5px",
|
|
46
|
+
marginTop: "-2px !important",
|
|
47
|
+
paddingTop: "5px !important"
|
|
48
|
+
},
|
|
49
|
+
"& .mq-overarrow-inner": {
|
|
50
|
+
paddingTop: "0 !important",
|
|
51
|
+
border: "none !important"
|
|
52
|
+
},
|
|
53
|
+
"& .mq-overarrow.mq-arrow-both": {
|
|
54
|
+
marginTop: "0px",
|
|
55
|
+
minWidth: "1.23em",
|
|
56
|
+
"& *": { lineHeight: "1 !important" },
|
|
57
|
+
"&:before": {
|
|
58
|
+
top: "-0.4em",
|
|
59
|
+
left: "-1px"
|
|
60
|
+
},
|
|
61
|
+
"&:after": {
|
|
62
|
+
top: "0px !important",
|
|
63
|
+
position: "absolute !important",
|
|
64
|
+
right: "-2px"
|
|
65
|
+
},
|
|
66
|
+
"&.mq-empty:after": { top: "-0.45em" }
|
|
67
|
+
},
|
|
68
|
+
"& .mq-overarrow.mq-arrow-right": { "&:before": {
|
|
69
|
+
top: "-0.4em",
|
|
70
|
+
right: "-1px"
|
|
71
|
+
} },
|
|
72
|
+
"& .mq-overarrow-inner-right": { display: "none !important" },
|
|
73
|
+
"& .mq-overarrow-inner-left": { display: "none !important" }
|
|
74
|
+
})), l = (t) => {
|
|
75
|
+
let { node: n, options: l, selected: u } = t, { attrs: d } = n, { value: f, index: p } = d, m = `R ${parseInt(p) + 1}`;
|
|
76
|
+
return /* @__PURE__ */ r(e, {
|
|
77
|
+
className: "math-templated",
|
|
78
|
+
"data-selected": u,
|
|
79
|
+
style: {
|
|
80
|
+
display: "inline-flex",
|
|
81
|
+
minHeight: "36px",
|
|
82
|
+
minWidth: "50px",
|
|
83
|
+
cursor: "pointer"
|
|
84
|
+
},
|
|
85
|
+
children: /* @__PURE__ */ i(o, {
|
|
86
|
+
...d,
|
|
87
|
+
children: [/* @__PURE__ */ r(s, { children: m }), /* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(a.Static, { latex: f }) })]
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
l.propTypes = {
|
|
92
|
+
attributes: n.object,
|
|
93
|
+
value: n.string,
|
|
94
|
+
keyToDisplay: n.string
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
export { l as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/ToolbarIcon.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
|
+
export declare const Chevron: (props: any) => React.JSX.Element;
|
|
11
|
+
export declare const GripIcon: ({ style }: {
|
|
12
|
+
style: any;
|
|
13
|
+
}) => React.JSX.Element;
|
|
14
|
+
export declare const ToolbarIcon: () => React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { styled as e } from "@mui/material/styles";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/respArea/ToolbarIcon.tsx
|
|
5
|
+
var n = e("div")(({ theme: e }) => ({
|
|
6
|
+
fontFamily: "Cerebri Sans !important",
|
|
7
|
+
fontSize: e.typography.fontSize,
|
|
8
|
+
fontWeight: "bold",
|
|
9
|
+
lineHeight: "14px",
|
|
10
|
+
position: "relative",
|
|
11
|
+
top: "7px",
|
|
12
|
+
width: "110px",
|
|
13
|
+
height: "28px",
|
|
14
|
+
whiteSpace: "nowrap"
|
|
15
|
+
})), r = () => /* @__PURE__ */ t(n, { children: "+ Response Area" });
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as ToolbarIcon };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/inlineDropdownUtils.js
|
|
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
|
+
export declare const HOLD_INLINE_DROPDOWN_TOOLBAR_INDEX = "_holdInlineDropdownToolbarIndex";
|
|
10
|
+
export declare const findInlineDropdownPos: (editor: any, index: any) => null;
|
|
11
|
+
export declare const holdInlineDropdownToolbar: (editor: any, index: any) => void;
|
|
12
|
+
export declare const releaseInlineDropdownToolbarHold: (editor: any) => void;
|
|
13
|
+
export declare const isInlineDropdownToolbarHeld: (editor: any, index: any) => boolean;
|
|
14
|
+
export declare const selectInlineDropdownNode: (editor: any, index: any, fallbackPos: any) => any;
|
|
15
|
+
export declare const deleteInlineDropdownByIndex: (editor: any, index: any, fallbackPos: any) => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "prosemirror-state";
|
|
2
|
+
//#region src/components/respArea/inlineDropdownUtils.ts
|
|
3
|
+
var e = "_holdInlineDropdownToolbarIndex", t = (e, t) => {
|
|
4
|
+
let n = null;
|
|
5
|
+
return e.state.doc.descendants((e, r) => e.type?.name === "inline_dropdown" && String(e.attrs?.index) === String(t) ? (n = r, !1) : !0), n;
|
|
6
|
+
}, n = (t) => {
|
|
7
|
+
delete t[e];
|
|
8
|
+
}, r = (e, r, i) => {
|
|
9
|
+
let a = t(e, r) ?? i;
|
|
10
|
+
if (a == null) return n(e), !1;
|
|
11
|
+
let { tr: o } = e.state, s = o.doc.nodeAt(a);
|
|
12
|
+
return s ? (o.delete(a, a + s.nodeSize), e.view.dispatch(o), n(e), !0) : (n(e), !1);
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as deleteInlineDropdownByIndex };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/constants.js
|
|
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
|
+
export declare const PIE_TOOLBAR__CLASS = "pie-toolbar";
|
|
10
|
+
declare const _default: {
|
|
11
|
+
PIE_TOOLBAR__CLASS: string;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/extensions/css.js
|
|
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 { Mark } from '@tiptap/core';
|
|
10
|
+
export declare const removeDialogs: () => void;
|
|
11
|
+
export declare const CSSMark: Mark<any, any>;
|