@pie-lib/editable-html-tip-tap 2.2.0-beta.8 → 3.0.0-next.20261002094057
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 +141 -0
- package/dist/components/EditableHtml.d.ts +11 -0
- package/dist/components/EditableHtml.js +331 -0
- package/dist/components/MenuBar.d.ts +11 -0
- package/dist/components/MenuBar.js +531 -0
- package/dist/components/TiptapContainer.d.ts +11 -0
- package/dist/components/TiptapContainer.js +167 -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 +96 -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 +34 -0
- package/dist/components/icons/TextAlign.d.ts +18 -0
- package/dist/components/icons/TextAlign.js +143 -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 +33 -0
- package/dist/components/image/InsertImageHandler.js +65 -0
- package/dist/components/image/findImageNode.d.ts +3 -0
- package/dist/components/image/findImageNode.js +11 -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/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 +157 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
- package/dist/components/respArea/ExplicitConstructedResponse.js +84 -0
- package/dist/components/respArea/InlineDropdown.d.ts +18 -0
- package/dist/components/respArea/InlineDropdown.js +126 -0
- package/dist/components/respArea/MathTemplated.d.ts +19 -0
- package/dist/components/respArea/MathTemplated.js +98 -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 +120 -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 +223 -0
- package/dist/extensions/image.d.ts +10 -0
- package/dist/extensions/image.js +77 -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 +214 -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 +255 -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/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/dist/utils/toolbar.d.ts +10 -0
- package/dist/utils/toolbar.js +7 -0
- package/package.json +59 -43
- package/CHANGELOG.json +0 -32
- package/CHANGELOG.md +0 -2532
- package/lib/components/CharacterPicker.js +0 -226
- package/lib/components/CharacterPicker.js.map +0 -1
- package/lib/components/EditableHtml.js +0 -388
- package/lib/components/EditableHtml.js.map +0 -1
- package/lib/components/MenuBar.js +0 -702
- package/lib/components/MenuBar.js.map +0 -1
- package/lib/components/TiptapContainer.js +0 -242
- 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 -149
- 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 -253
- package/lib/components/respArea/DragInTheBlank/choice.js.map +0 -1
- package/lib/components/respArea/ExplicitConstructedResponse.js +0 -137
- package/lib/components/respArea/ExplicitConstructedResponse.js.map +0 -1
- package/lib/components/respArea/InlineDropdown.js +0 -223
- 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 -227
- 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 -351
- 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 -469
- 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 -452
- 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/lib/utils/toolbar.js +0 -19
- package/lib/utils/toolbar.js.map +0 -1
- package/src/__tests__/EditableHtml.test.jsx +0 -588
- 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 -237
- package/src/components/EditableHtml.jsx +0 -458
- package/src/components/MenuBar.jsx +0 -561
- package/src/components/TiptapContainer.jsx +0 -235
- package/src/components/__tests__/AltDialog.test.jsx +0 -147
- package/src/components/__tests__/CharacterPicker.test.jsx +0 -270
- 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 -209
- package/src/components/__tests__/ImageToolbar.test.jsx +0 -128
- package/src/components/__tests__/InlineDropdown.test.jsx +0 -557
- 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 -127
- 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/__tests__/choice.test.jsx +0 -72
- package/src/components/respArea/DragInTheBlank/choice.jsx +0 -259
- package/src/components/respArea/ExplicitConstructedResponse.jsx +0 -136
- package/src/components/respArea/InlineDropdown.jsx +0 -240
- 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 -346
- package/src/extensions/__tests__/image.test.js +0 -237
- package/src/extensions/__tests__/math.test.js +0 -900
- 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 -655
- package/src/extensions/css.js +0 -233
- 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 -340
- package/src/extensions/image.js +0 -109
- package/src/extensions/index.js +0 -81
- package/src/extensions/math.js +0 -454
- package/src/extensions/media.js +0 -188
- package/src/extensions/responseArea.js +0 -407
- 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/__tests__/toolbar.test.js +0 -43
- package/src/utils/helper.js +0 -69
- package/src/utils/size.js +0 -32
- package/src/utils/toolbar.js +0 -15
|
@@ -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 React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const onValueChange: (editor: any, node: any, pos: any, choice: any) => void;
|
|
12
|
+
export declare const onRemoveResponse: (editor: any, node: any, choice: any) => void;
|
|
13
|
+
declare const DragDrop: {
|
|
14
|
+
(props: any): React.JSX.Element;
|
|
15
|
+
propTypes: {
|
|
16
|
+
attributes: PropTypes.Requireable<object>;
|
|
17
|
+
data: PropTypes.Requireable<object>;
|
|
18
|
+
n: PropTypes.Requireable<object>;
|
|
19
|
+
nodeProps: PropTypes.Requireable<object>;
|
|
20
|
+
opts: PropTypes.Requireable<object>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default DragDrop;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import e from "./choice.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { omit as t } from "@pie-element/shared-lodash";
|
|
4
|
+
import { NodeViewWrapper as n } from "@tiptap/react";
|
|
5
|
+
import r from "prop-types";
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
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, n, r) => {
|
|
15
|
+
let { tr: i } = e.state;
|
|
16
|
+
i.setNodeMarkup(r.pos, void 0, t(n.attrs, ["value", "id"])), i.isDone = !0, e.view.dispatch(i);
|
|
17
|
+
}, s = (t) => {
|
|
18
|
+
let { editor: r, node: s, getPos: c, options: l, selected: u } = t, { attrs: d } = s, { inTable: f } = d, p = c();
|
|
19
|
+
return /* @__PURE__ */ i(n, {
|
|
20
|
+
className: "drag-in-the-blank",
|
|
21
|
+
"data-selected": u,
|
|
22
|
+
style: {
|
|
23
|
+
display: "inline",
|
|
24
|
+
whiteSpace: "normal"
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ i("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__ */ i(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(r, s, p, e),
|
|
45
|
+
removeResponse: (e) => o(r, s, e)
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
s.propTypes = {
|
|
51
|
+
attributes: r.object,
|
|
52
|
+
data: r.object,
|
|
53
|
+
n: r.object,
|
|
54
|
+
nodeProps: r.object,
|
|
55
|
+
opts: r.object
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { s as default, o as onRemoveResponse, a as onValueChange };
|
|
@@ -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 React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare function BlankContent({ n, children, isDragging, isOver, dragItem, value, selected }: {
|
|
12
|
+
n: any;
|
|
13
|
+
children: any;
|
|
14
|
+
isDragging: any;
|
|
15
|
+
isOver: any;
|
|
16
|
+
dragItem: any;
|
|
17
|
+
value: any;
|
|
18
|
+
selected: any;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
export declare namespace BlankContent {
|
|
21
|
+
var propTypes: {
|
|
22
|
+
n: PropTypes.Requireable<object>;
|
|
23
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
24
|
+
isDragging: PropTypes.Requireable<boolean>;
|
|
25
|
+
isOver: PropTypes.Requireable<boolean>;
|
|
26
|
+
dragItem: PropTypes.Requireable<object>;
|
|
27
|
+
value: PropTypes.Requireable<object>;
|
|
28
|
+
selected: PropTypes.Requireable<boolean>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare function DragDropChoice({ value, disabled, instanceId, children, n, onChange, removeResponse, duplicates, pos, selected, }: {
|
|
32
|
+
value: any;
|
|
33
|
+
disabled: any;
|
|
34
|
+
instanceId: any;
|
|
35
|
+
children: any;
|
|
36
|
+
n: any;
|
|
37
|
+
onChange: any;
|
|
38
|
+
removeResponse: any;
|
|
39
|
+
duplicates: any;
|
|
40
|
+
pos: any;
|
|
41
|
+
selected: any;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
declare namespace DragDropChoice {
|
|
44
|
+
var propTypes: {
|
|
45
|
+
value: PropTypes.Requireable<object>;
|
|
46
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
47
|
+
instanceId: PropTypes.Requireable<string>;
|
|
48
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
49
|
+
n: PropTypes.Validator<object>;
|
|
50
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
51
|
+
removeResponse: PropTypes.Validator<(...args: any[]) => any>;
|
|
52
|
+
duplicates: PropTypes.Requireable<boolean>;
|
|
53
|
+
selected: PropTypes.Requireable<boolean>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export default DragDropChoice;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { clsx as 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-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn": { fontSize: "120% !important" },
|
|
14
|
+
"& mjx-frac": { fontSize: "120% !important" }
|
|
15
|
+
}));
|
|
16
|
+
function m({ n: e, children: a, isDragging: o, isOver: l, dragItem: u, value: p, selected: m }) {
|
|
17
|
+
let [h, g] = i(null), _ = r(null), v = (e) => {
|
|
18
|
+
_.current && (_.current.contains(e.target) ? _.current.classList.add("selected") : _.current.classList.remove("selected"));
|
|
19
|
+
};
|
|
20
|
+
n(() => (document.addEventListener("click", v), () => {
|
|
21
|
+
document.removeEventListener("click", v);
|
|
22
|
+
}), []), n(() => {
|
|
23
|
+
_.current && typeof f == "function" && f(_.current);
|
|
24
|
+
}, [
|
|
25
|
+
p?.value,
|
|
26
|
+
l,
|
|
27
|
+
u?.value?.value
|
|
28
|
+
]), n(() => {
|
|
29
|
+
if (l && _.current && !h) {
|
|
30
|
+
let e = _.current;
|
|
31
|
+
g({
|
|
32
|
+
width: e.offsetWidth,
|
|
33
|
+
height: e.offsetHeight
|
|
34
|
+
});
|
|
35
|
+
} else !l && h && g(null);
|
|
36
|
+
}, [l, h]);
|
|
37
|
+
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}`;
|
|
38
|
+
return /* @__PURE__ */ c("div", {
|
|
39
|
+
ref: _,
|
|
40
|
+
className: m ? "selected" : void 0,
|
|
41
|
+
style: {
|
|
42
|
+
display: "inline-flex",
|
|
43
|
+
minWidth: "178px",
|
|
44
|
+
minHeight: "36px",
|
|
45
|
+
background: S ? `${d.defaults.BORDER_LIGHT}` : `${d.defaults.WHITE}`,
|
|
46
|
+
border: C,
|
|
47
|
+
boxSizing: "border-box",
|
|
48
|
+
borderRadius: "3px",
|
|
49
|
+
overflow: "hidden",
|
|
50
|
+
position: "relative",
|
|
51
|
+
padding: "8px 8px 8px 35px",
|
|
52
|
+
width: h ? h.width : void 0,
|
|
53
|
+
height: h ? h.height : void 0,
|
|
54
|
+
touchAction: "none"
|
|
55
|
+
},
|
|
56
|
+
"data-key": e.index,
|
|
57
|
+
contentEditable: !1,
|
|
58
|
+
children: [
|
|
59
|
+
x && /* @__PURE__ */ s(t, {
|
|
60
|
+
style: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
top: "6px",
|
|
63
|
+
left: "15px",
|
|
64
|
+
color: "#9B9B9B"
|
|
65
|
+
},
|
|
66
|
+
contentEditable: !1
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: b } }),
|
|
69
|
+
a
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
m.propTypes = {
|
|
74
|
+
n: o.object,
|
|
75
|
+
children: o.node,
|
|
76
|
+
isDragging: o.bool,
|
|
77
|
+
isOver: o.bool,
|
|
78
|
+
dragItem: o.object,
|
|
79
|
+
value: o.object,
|
|
80
|
+
selected: o.bool
|
|
81
|
+
};
|
|
82
|
+
function h({ value: t, disabled: n, instanceId: r, children: i, n: a, onChange: o, removeResponse: c, duplicates: d, pos: f, selected: h }) {
|
|
83
|
+
let { attributes: g, listeners: _, setNodeRef: v, isDragging: y } = l({
|
|
84
|
+
id: `drag-${a.index}`,
|
|
85
|
+
disabled: n || !t?.value,
|
|
86
|
+
data: {
|
|
87
|
+
id: `drag-${a.index}`,
|
|
88
|
+
value: t,
|
|
89
|
+
instanceId: r,
|
|
90
|
+
n: a,
|
|
91
|
+
pos: f,
|
|
92
|
+
opts: { duplicates: d },
|
|
93
|
+
type: "drag-in-the-blank-placed-choice",
|
|
94
|
+
fromChoice: !t,
|
|
95
|
+
onRemove: (e) => c(e),
|
|
96
|
+
onDrop: (e, t) => {
|
|
97
|
+
t?.type === "drag-in-the-blank-drop-choice" && (o(e), !d && e.fromChoice && c(e));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}), { setNodeRef: b, isOver: x, active: S } = u({
|
|
101
|
+
id: `drop-${a.index}`,
|
|
102
|
+
data: {
|
|
103
|
+
type: "drag-in-the-blank-drop-choice",
|
|
104
|
+
accepts: ["drag-in-the-blank-choice", "drag-in-the-blank-placed-choice"],
|
|
105
|
+
instanceId: r,
|
|
106
|
+
value: t,
|
|
107
|
+
id: `drop-${a.index}`,
|
|
108
|
+
pos: f,
|
|
109
|
+
n: a,
|
|
110
|
+
opts: { duplicates: d },
|
|
111
|
+
onDrop: (e, t) => {
|
|
112
|
+
if (t?.type === "drag-in-the-blank-drop-choice" && e.value.id !== t.value.id) {
|
|
113
|
+
if (e.type === "drag-in-the-blank-choice") {
|
|
114
|
+
o(e), !d && e.fromChoice && c(e);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
e.type === "drag-in-the-blank-placed-choice" && (c(t), o(e), setTimeout(() => c(e), 10));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}), C = (e) => {
|
|
122
|
+
v(e), b(e);
|
|
123
|
+
}, w = /* @__PURE__ */ s(m, {
|
|
124
|
+
n: a,
|
|
125
|
+
isDragging: y,
|
|
126
|
+
isOver: x,
|
|
127
|
+
dragItem: S?.data?.current,
|
|
128
|
+
value: t,
|
|
129
|
+
selected: h,
|
|
130
|
+
children: i
|
|
131
|
+
}), T = t ? /* @__PURE__ */ s("span", {
|
|
132
|
+
ref: C,
|
|
133
|
+
...g,
|
|
134
|
+
..._,
|
|
135
|
+
children: w
|
|
136
|
+
}) : /* @__PURE__ */ s("span", {
|
|
137
|
+
ref: b,
|
|
138
|
+
children: w
|
|
139
|
+
});
|
|
140
|
+
return /* @__PURE__ */ s(p, {
|
|
141
|
+
className: e(x && "over"),
|
|
142
|
+
children: T
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
h.propTypes = {
|
|
146
|
+
value: o.object,
|
|
147
|
+
disabled: o.bool,
|
|
148
|
+
instanceId: o.string,
|
|
149
|
+
children: o.node,
|
|
150
|
+
n: o.object.isRequired,
|
|
151
|
+
onChange: o.func.isRequired,
|
|
152
|
+
removeResponse: o.func.isRequired,
|
|
153
|
+
duplicates: o.bool,
|
|
154
|
+
selected: o.bool
|
|
155
|
+
};
|
|
156
|
+
//#endregion
|
|
157
|
+
export { m as BlankContent, 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,84 @@
|
|
|
1
|
+
import e from "../../extensions/custom-toolbar-wrapper.js";
|
|
2
|
+
import { setToolbarOpened as t } from "../../utils/toolbar.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 s from "react-dom";
|
|
6
|
+
import c from "prop-types";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/respArea/ExplicitConstructedResponse.tsx
|
|
9
|
+
var d = (c) => {
|
|
10
|
+
let { editor: d, node: f, getPos: p, options: m, selected: h } = c, { attrs: g } = f, { value: _ } = g, { respAreaToolbar: v, error: y } = m, b = p(), [x, S] = a(!1), C = v([f, b], d, () => {}), w = i(null), T;
|
|
11
|
+
if (y) {
|
|
12
|
+
let e = y(), t = parseInt(g.index, 10);
|
|
13
|
+
T = !!e?.[t]?.[0];
|
|
14
|
+
}
|
|
15
|
+
return r(() => {
|
|
16
|
+
let { selection: e } = d.state, t = e.from + f.nodeSize === e.to;
|
|
17
|
+
h ? t && S(h) : S(h);
|
|
18
|
+
}, [
|
|
19
|
+
d,
|
|
20
|
+
f,
|
|
21
|
+
h
|
|
22
|
+
]), r(() => {
|
|
23
|
+
let e = (e) => {
|
|
24
|
+
!(e.target.closest(".insert-character-dialog") || e.target.closest("[data-toolbar-for]")) && w.current && !w.current.contains(e.target) && !e.target.closest("[data-inline-node]") && S(!1);
|
|
25
|
+
};
|
|
26
|
+
return x ? document.addEventListener("mousedown", e) : document.removeEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
27
|
+
}, [x]), /* @__PURE__ */ u(o, {
|
|
28
|
+
className: "drag-in-the-blank",
|
|
29
|
+
"data-selected": h,
|
|
30
|
+
style: {
|
|
31
|
+
display: "inline-flex",
|
|
32
|
+
minHeight: "55px",
|
|
33
|
+
position: "relative",
|
|
34
|
+
cursor: "pointer"
|
|
35
|
+
},
|
|
36
|
+
children: [/* @__PURE__ */ l("div", {
|
|
37
|
+
...g,
|
|
38
|
+
style: {
|
|
39
|
+
display: "inline-flex",
|
|
40
|
+
width: "100%",
|
|
41
|
+
minHeight: "46px",
|
|
42
|
+
height: "46px",
|
|
43
|
+
backgroundColor: "#FFF",
|
|
44
|
+
border: `1px solid ${T ? "red" : "#C0C3CF"}`,
|
|
45
|
+
boxSizing: "border-box",
|
|
46
|
+
borderRadius: "4px",
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
padding: "12px 21px",
|
|
49
|
+
margin: "0 4px",
|
|
50
|
+
minWidth: "178px",
|
|
51
|
+
visibility: x ? "hidden" : "visible"
|
|
52
|
+
},
|
|
53
|
+
onClick: () => S(!0),
|
|
54
|
+
dangerouslySetInnerHTML: { __html: _ || "<div> </div>" }
|
|
55
|
+
}), x && /* @__PURE__ */ u(n.Fragment, { children: [/* @__PURE__ */ l("div", {
|
|
56
|
+
ref: w,
|
|
57
|
+
className: "absolute z-50 bg-white shadow-lg rounded p-2",
|
|
58
|
+
style: { zIndex: 1 },
|
|
59
|
+
children: /* @__PURE__ */ l(C, {})
|
|
60
|
+
}), d._tiptapContainerEl && s.createPortal(/* @__PURE__ */ l(e, {
|
|
61
|
+
deletable: !0,
|
|
62
|
+
toolbarOpts: { minWidth: "auto" },
|
|
63
|
+
autoWidth: !0,
|
|
64
|
+
style: {
|
|
65
|
+
top: -40,
|
|
66
|
+
left: 0,
|
|
67
|
+
right: 0
|
|
68
|
+
},
|
|
69
|
+
onDelete: () => {
|
|
70
|
+
let { tr: e } = d.state;
|
|
71
|
+
e.delete(b, b + f.nodeSize), t(d, !1), d.view.dispatch(e), S(!1), d.commands.focus();
|
|
72
|
+
},
|
|
73
|
+
showDone: !1
|
|
74
|
+
}), d._tiptapContainerEl)] })]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
d.propTypes = {
|
|
78
|
+
attributes: c.object,
|
|
79
|
+
error: c.any,
|
|
80
|
+
value: c.string,
|
|
81
|
+
isFocused: c.bool
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
export { d 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,126 @@
|
|
|
1
|
+
import e from "../../extensions/custom-toolbar-wrapper.js";
|
|
2
|
+
import { setToolbarOpened as t } from "../../utils/toolbar.js";
|
|
3
|
+
import { Chevron as n } from "../icons/RespArea.js";
|
|
4
|
+
import r, { useEffect as i, useRef as a, useState as o } from "react";
|
|
5
|
+
import { NodeViewWrapper as s } from "@tiptap/react";
|
|
6
|
+
import { NodeSelection as c } from "prosemirror-state";
|
|
7
|
+
import l from "react-dom";
|
|
8
|
+
import u from "prop-types";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { renderMath as p } from "@pie-element/shared-math-rendering-mathjax";
|
|
11
|
+
//#region src/components/respArea/InlineDropdown.tsx
|
|
12
|
+
var m = (u) => {
|
|
13
|
+
let { editor: m, node: h, getPos: g, options: _, selected: v } = u, { attrs: y } = h, { value: b, error: x } = y, S = b || "<div> </div>", C = g(), w = a(null), T = a(null), E = a(!1), D = a(null), O = () => m._holdInlineDropdownToolbarIndex != null && String(m._holdInlineDropdownToolbarIndex) === String(h.attrs.index), [k, A] = o(!1), [j, M] = o({
|
|
14
|
+
top: 0,
|
|
15
|
+
left: 0
|
|
16
|
+
}), N = () => {
|
|
17
|
+
O() || (A(!1), _.onInlineDropdownToolbarClose?.(m));
|
|
18
|
+
}, P = _.respAreaToolbar([h, C], m, N), F = () => {
|
|
19
|
+
let { tr: e } = m.state, t = e.doc.nodeAt(C);
|
|
20
|
+
if (!t) return;
|
|
21
|
+
let { selection: n } = e;
|
|
22
|
+
n.from === C && n.to === C + t.nodeSize || (e.setSelection(c.create(e.doc, C)), m.view.dispatch(e));
|
|
23
|
+
}, I = () => {
|
|
24
|
+
E.current || (_.onToolbarCloseRequest ? (E.current = !0, _.onToolbarCloseRequest([h, C], m, () => {
|
|
25
|
+
E.current = !1, delete m._holdInlineDropdownToolbarIndex, N();
|
|
26
|
+
}, () => {
|
|
27
|
+
E.current = !1, delete m._holdInlineDropdownToolbarIndex, A(!0), setTimeout(F, 0);
|
|
28
|
+
})) : N());
|
|
29
|
+
};
|
|
30
|
+
i(() => {
|
|
31
|
+
let { selection: e } = m.state, t = e.from + h.nodeSize === e.to;
|
|
32
|
+
v ? t && A(!0) : k && I();
|
|
33
|
+
}, [
|
|
34
|
+
m,
|
|
35
|
+
h,
|
|
36
|
+
v
|
|
37
|
+
]);
|
|
38
|
+
let L = (e) => e.clientX > document.documentElement.clientWidth || e.clientY > document.documentElement.clientHeight || e.target === document.documentElement;
|
|
39
|
+
return i(() => {
|
|
40
|
+
D.current && typeof p == "function" && p(D.current);
|
|
41
|
+
}, [b]), i(() => {
|
|
42
|
+
let e = document.body.getBoundingClientRect(), { from: t } = m.state.selection, n = m.view.coordsAtPos(t);
|
|
43
|
+
M({
|
|
44
|
+
top: n.top + Math.abs(e.top) + 40,
|
|
45
|
+
left: n.left
|
|
46
|
+
});
|
|
47
|
+
let r = (e) => {
|
|
48
|
+
if (L(e)) return;
|
|
49
|
+
let t = e.target.closest("[data-toolbar-for]");
|
|
50
|
+
!e.target.closest("[data-inline-dropdown-toolbar]") && (!t || t.dataset.toolbarFor !== T.current?.instanceId) && !m._toolbarOpened && w.current && !w.current.contains(e.target) && !e.target.closest("[data-inline-node]") && I();
|
|
51
|
+
};
|
|
52
|
+
return k ? document.addEventListener("mousedown", r) : document.removeEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
53
|
+
}, [k, h]), /* @__PURE__ */ f(s, {
|
|
54
|
+
className: "inline-dropdown",
|
|
55
|
+
"data-selected": v,
|
|
56
|
+
style: {
|
|
57
|
+
display: "inline-flex",
|
|
58
|
+
height: "50px",
|
|
59
|
+
cursor: "pointer"
|
|
60
|
+
},
|
|
61
|
+
children: [/* @__PURE__ */ f("div", {
|
|
62
|
+
ref: D,
|
|
63
|
+
style: {
|
|
64
|
+
display: "inline-flex",
|
|
65
|
+
minWidth: "178px",
|
|
66
|
+
height: "36px",
|
|
67
|
+
background: "#FFF",
|
|
68
|
+
border: "1px solid #C0C3CF",
|
|
69
|
+
boxSizing: "border-box",
|
|
70
|
+
borderRadius: "3px",
|
|
71
|
+
margin: "0 2px",
|
|
72
|
+
position: "relative",
|
|
73
|
+
alignItems: "center"
|
|
74
|
+
},
|
|
75
|
+
onClick: () => A(!0),
|
|
76
|
+
children: [/* @__PURE__ */ d("div", {
|
|
77
|
+
style: {
|
|
78
|
+
flex: 1,
|
|
79
|
+
overflow: "hidden",
|
|
80
|
+
padding: "0 25px 0 8px",
|
|
81
|
+
whiteSpace: "nowrap",
|
|
82
|
+
textOverflow: "ellipsis"
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ d("span", {
|
|
85
|
+
style: {
|
|
86
|
+
display: "inline-block",
|
|
87
|
+
verticalAlign: "middle"
|
|
88
|
+
},
|
|
89
|
+
dangerouslySetInnerHTML: { __html: S }
|
|
90
|
+
})
|
|
91
|
+
}), /* @__PURE__ */ d(n, {
|
|
92
|
+
direction: "down",
|
|
93
|
+
style: {
|
|
94
|
+
position: "absolute",
|
|
95
|
+
top: "5px",
|
|
96
|
+
right: "5px"
|
|
97
|
+
}
|
|
98
|
+
})]
|
|
99
|
+
}), k && /* @__PURE__ */ f(r.Fragment, { children: [l.createPortal(/* @__PURE__ */ d("div", {
|
|
100
|
+
ref: w,
|
|
101
|
+
children: /* @__PURE__ */ d(P, { editorCallback: (e) => {
|
|
102
|
+
T.current = e;
|
|
103
|
+
} })
|
|
104
|
+
}), m?._tiptapContainerEl || document.body), m._tiptapContainerEl && l.createPortal(/* @__PURE__ */ d(e, {
|
|
105
|
+
deletable: !0,
|
|
106
|
+
toolbarOpts: { minWidth: "auto" },
|
|
107
|
+
autoWidth: !0,
|
|
108
|
+
style: {
|
|
109
|
+
top: -40,
|
|
110
|
+
left: 0,
|
|
111
|
+
right: 0
|
|
112
|
+
},
|
|
113
|
+
onDelete: () => {
|
|
114
|
+
let { tr: e } = m.state;
|
|
115
|
+
e.delete(C, C + h.nodeSize), t(m, !1), delete m._holdInlineDropdownToolbarIndex, m.view.dispatch(e), A(!1), m.commands.focus();
|
|
116
|
+
},
|
|
117
|
+
showDone: !1
|
|
118
|
+
}), m._tiptapContainerEl)] })]
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
m.propTypes = {
|
|
122
|
+
attributes: u.object,
|
|
123
|
+
selectedItem: u.oneOfType([u.string, u.object])
|
|
124
|
+
};
|
|
125
|
+
//#endregion
|
|
126
|
+
export { m 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,98 @@
|
|
|
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 { color as a } from "@pie-lib/render-ui";
|
|
7
|
+
import { mq as o } from "@pie-lib/math-input";
|
|
8
|
+
//#region src/components/respArea/MathTemplated.tsx
|
|
9
|
+
var s = t("span")(() => ({
|
|
10
|
+
display: "inline-flex",
|
|
11
|
+
border: `1px solid ${a.border()}`,
|
|
12
|
+
margin: "1px 5px",
|
|
13
|
+
cursor: "pointer",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
minWidth: "50px",
|
|
17
|
+
minHeight: "36px",
|
|
18
|
+
height: "fit-content"
|
|
19
|
+
})), c = t("div")(() => ({
|
|
20
|
+
background: a.backgroundDark(),
|
|
21
|
+
color: a.text(),
|
|
22
|
+
display: "inline-flex",
|
|
23
|
+
borderRight: `2px solid ${a.border()}`,
|
|
24
|
+
boxSizing: "border-box",
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
fontSize: "12px",
|
|
27
|
+
minHeight: "36px",
|
|
28
|
+
height: "100%",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
fontFamily: "Symbola, Times New Roman, serif",
|
|
31
|
+
padding: "0 2px"
|
|
32
|
+
})), l = t("div")(() => ({
|
|
33
|
+
flex: 8,
|
|
34
|
+
color: "var(--pie-text, black)",
|
|
35
|
+
padding: "4px !important",
|
|
36
|
+
display: "flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
justifyContent: "center",
|
|
39
|
+
backgroundColor: "var(--pie-background, rgba(255, 255, 255, 0))",
|
|
40
|
+
"& > .mq-math-mode sup.mq-nthroot": {
|
|
41
|
+
fontSize: "70% !important",
|
|
42
|
+
verticalAlign: "1em !important"
|
|
43
|
+
},
|
|
44
|
+
"& > .mq-math-mode .mq-sqrt-stem": {
|
|
45
|
+
borderTop: "0.07em solid",
|
|
46
|
+
marginLeft: "-1.5px",
|
|
47
|
+
marginTop: "-2px !important",
|
|
48
|
+
paddingTop: "5px !important"
|
|
49
|
+
},
|
|
50
|
+
"& .mq-overarrow-inner": {
|
|
51
|
+
paddingTop: "0 !important",
|
|
52
|
+
border: "none !important"
|
|
53
|
+
},
|
|
54
|
+
"& .mq-overarrow.mq-arrow-both": {
|
|
55
|
+
marginTop: "0px",
|
|
56
|
+
minWidth: "1.23em",
|
|
57
|
+
"& *": { lineHeight: "1 !important" },
|
|
58
|
+
"&:before": {
|
|
59
|
+
top: "-0.4em",
|
|
60
|
+
left: "-1px"
|
|
61
|
+
},
|
|
62
|
+
"&:after": {
|
|
63
|
+
top: "0px !important",
|
|
64
|
+
position: "absolute !important",
|
|
65
|
+
right: "-2px"
|
|
66
|
+
},
|
|
67
|
+
"&.mq-empty:after": { top: "-0.45em" }
|
|
68
|
+
},
|
|
69
|
+
"& .mq-overarrow.mq-arrow-right": { "&:before": {
|
|
70
|
+
top: "-0.4em",
|
|
71
|
+
right: "-1px"
|
|
72
|
+
} },
|
|
73
|
+
"& .mq-overarrow-inner-right": { display: "none !important" },
|
|
74
|
+
"& .mq-overarrow-inner-left": { display: "none !important" }
|
|
75
|
+
})), u = (t) => {
|
|
76
|
+
let { node: n, options: a, selected: u } = t, { attrs: d } = n, { value: f, index: p } = d, m = `R ${parseInt(p) + 1}`;
|
|
77
|
+
return /* @__PURE__ */ r(e, {
|
|
78
|
+
className: "math-templated",
|
|
79
|
+
"data-selected": u,
|
|
80
|
+
style: {
|
|
81
|
+
display: "inline-flex",
|
|
82
|
+
minHeight: "36px",
|
|
83
|
+
minWidth: "50px",
|
|
84
|
+
cursor: "pointer"
|
|
85
|
+
},
|
|
86
|
+
children: /* @__PURE__ */ i(s, {
|
|
87
|
+
...d,
|
|
88
|
+
children: [/* @__PURE__ */ r(c, { children: m }), /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(o.Static, { latex: f }) })]
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
u.propTypes = {
|
|
93
|
+
attributes: n.object,
|
|
94
|
+
value: n.string,
|
|
95
|
+
keyToDisplay: n.string
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { u 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;
|