@pie-lib/editable-html-tip-tap 2.2.0-beta.9 → 3.0.0-next.20261002100925
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/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/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/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/inlineDropdownUtils.js +0 -79
- package/src/constants.js +0 -5
- 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/helper.js +0 -69
- package/src/utils/size.js +0 -32
- package/src/utils/toolbar.js +0 -15
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { PIE_TOOLBAR__CLASS as e } from "../constants.js";
|
|
2
|
+
import { DoneButton as t } from "./common/done-button.js";
|
|
3
|
+
import { clsx as n } from "../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
4
|
+
import { ToolbarIcon as r } from "./respArea/ToolbarIcon.js";
|
|
5
|
+
import { spanishConfig as i, specialConfig as a } from "./characters/characterUtils.js";
|
|
6
|
+
import o from "./icons/TextAlign.js";
|
|
7
|
+
import s from "./icons/CssIcon.js";
|
|
8
|
+
import { AddColumn as c, AddRow as l, RemoveColumn as u, RemoveRow as d, RemoveTable as f } from "./icons/TableIcons.js";
|
|
9
|
+
import { CharacterIcon as p, CharacterPicker as m } from "./CharacterPicker.js";
|
|
10
|
+
import { useMemo as h, useState as g } from "react";
|
|
11
|
+
import { useEditorState as _ } from "@tiptap/react";
|
|
12
|
+
import { styled as v, useTheme as y } from "@mui/material/styles";
|
|
13
|
+
import { NodeSelection as b } from "prosemirror-state";
|
|
14
|
+
import x from "@mui/icons-material/Delete";
|
|
15
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
16
|
+
import { color as w } from "@pie-lib/render-ui";
|
|
17
|
+
import T from "@mui/icons-material/FormatBold";
|
|
18
|
+
import E from "@mui/icons-material/FormatItalic";
|
|
19
|
+
import D from "@mui/icons-material/FormatStrikethrough";
|
|
20
|
+
import O from "@mui/icons-material/Code";
|
|
21
|
+
import k from "@mui/icons-material/GridOn";
|
|
22
|
+
import A from "@mui/icons-material/FormatListBulleted";
|
|
23
|
+
import j from "@mui/icons-material/FormatListNumbered";
|
|
24
|
+
import M from "@mui/icons-material/FormatUnderlined";
|
|
25
|
+
import N from "@mui/icons-material/Functions";
|
|
26
|
+
import P from "@mui/icons-material/Image";
|
|
27
|
+
import F from "@mui/icons-material/Redo";
|
|
28
|
+
import ee from "@mui/icons-material/Undo";
|
|
29
|
+
import I from "@mui/icons-material/FormatQuote";
|
|
30
|
+
import L from "@mui/icons-material/Theaters";
|
|
31
|
+
import R from "@mui/icons-material/VolumeUp";
|
|
32
|
+
import z from "@mui/icons-material/BorderAll";
|
|
33
|
+
//#region src/components/MenuBar.tsx
|
|
34
|
+
var B = () => /* @__PURE__ */ S("svg", {
|
|
35
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
36
|
+
height: "24px",
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
width: "24px",
|
|
39
|
+
fill: "none",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
focusable: "false",
|
|
42
|
+
children: /* @__PURE__ */ S("path", {
|
|
43
|
+
d: "M22,7h-2v1h3v1h-4V7c0-0.55,0.45-1,1-1h2V5h-3V4h3c0.55,0,1,0.45,1,1v1C23,6.55,22.55,7,22,7z M5.88,20h2.66l3.4-5.42h0.12 l3.4,5.42h2.66l-4.65-7.27L17.81,6h-2.68l-3.07,4.99h-0.12L8.85,6H6.19l4.32,6.73L5.88,20z",
|
|
44
|
+
fill: "currentColor"
|
|
45
|
+
})
|
|
46
|
+
}), V = () => /* @__PURE__ */ S("svg", {
|
|
47
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
48
|
+
height: "24px",
|
|
49
|
+
viewBox: "0 0 24 24",
|
|
50
|
+
width: "24px",
|
|
51
|
+
fill: "none",
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
focusable: "false",
|
|
54
|
+
children: /* @__PURE__ */ S("path", {
|
|
55
|
+
d: "M22,18h-2v1h3v1h-4v-2c0-0.55,0.45-1,1-1h2v-1h-3v-1h3c0.55,0,1,0.45,1,1v1C23,17.55,22.55,18,22,18z M5.88,18h2.66 l3.4-5.42h0.12l3.4,5.42h2.66l-4.65-7.27L17.81,4h-2.68l-3.07,4.99h-0.12L8.85,4H6.19l4.32,6.73L5.88,18z",
|
|
56
|
+
fill: "currentColor"
|
|
57
|
+
})
|
|
58
|
+
}), H = () => /* @__PURE__ */ S("svg", {
|
|
59
|
+
width: "30",
|
|
60
|
+
height: "28",
|
|
61
|
+
viewBox: "0 0 30 28",
|
|
62
|
+
fill: "none",
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
+
style: {
|
|
65
|
+
width: "20px",
|
|
66
|
+
height: "18px"
|
|
67
|
+
},
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
focusable: "false",
|
|
70
|
+
children: /* @__PURE__ */ S("path", {
|
|
71
|
+
d: "M27 4V24H29C29.5 24 30 24.5 30 25V27C30 27.5625 29.5 28 29 28H19C18.4375 28 18 27.5625 18 27V25C18 24.5 18.4375 24 19 24H21V16H9V24H11C11.5 24 12 24.5 12 25V27C12 27.5625 11.5 28 11 28H1C0.4375 28 0 27.5625 0 27V25C0 24.5 0.4375 24 1 24H3V4H1C0.4375 4 0 3.5625 0 3V1C0 0.5 0.4375 0 1 0H11C11.5 0 12 0.5 12 1V3C12 3.5625 11.5 4 11 4H9V12H21V4H19C18.4375 4 18 3.5625 18 3V1C18 0.5 18.4375 0 19 0H29C29.5 0 30 0.5 30 1V3C30 3.5625 29.5 4 29 4H27Z",
|
|
72
|
+
fill: "currentColor"
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
function U({ editor: v, classes: y, activePlugins: w, toolbarOpts: U, responseAreaProps: W, onChange: G, autoWidthToolbar: K }) {
|
|
76
|
+
let [q, J] = g(!1), Y = U ?? {}, X = _({
|
|
77
|
+
editor: v,
|
|
78
|
+
selector: (e) => {
|
|
79
|
+
let { selection: t } = e.editor?.state || {}, n;
|
|
80
|
+
if (!e.editor?.commandManager) return {};
|
|
81
|
+
t instanceof b && (n = t.node);
|
|
82
|
+
let r = e.editor?.isActive("math") || e.editor?.isActive("explicit_constructed_response") || e.editor?.isActive("imageUploadNode") || e.editor?.isActive("drag_in_the_blank"), i = t && t.empty === !1 && e.editor.isActive("table");
|
|
83
|
+
return {
|
|
84
|
+
currentNode: n,
|
|
85
|
+
hideDefaultToolbar: r,
|
|
86
|
+
hasTextSelectionInTable: i,
|
|
87
|
+
isFocused: e.editor?.isFocused,
|
|
88
|
+
toolbarOpened: e.editor?._toolbarOpened ?? !1,
|
|
89
|
+
isBold: e.editor.isActive("bold") ?? !1,
|
|
90
|
+
canBold: e.editor.can().chain().toggleBold().run() ?? !1,
|
|
91
|
+
isTable: e.editor.isActive("table") ?? !1,
|
|
92
|
+
tableHasBorder: e.editor.getAttributes("table")?.border === "1",
|
|
93
|
+
canTable: e.editor.can().chain().insertTable().run() ?? !1,
|
|
94
|
+
isItalic: e.editor.isActive("italic") ?? !1,
|
|
95
|
+
canItalic: e.editor.can().chain().toggleItalic().run() ?? !1,
|
|
96
|
+
isStrike: e.editor.isActive("strike") ?? !1,
|
|
97
|
+
canStrike: e.editor.can().chain().toggleStrike().run() ?? !1,
|
|
98
|
+
isCode: e.editor.isActive("code") ?? !1,
|
|
99
|
+
canCode: e.editor.can().chain().toggleCode().run() ?? !1,
|
|
100
|
+
canClearMarks: e.editor.can().chain().unsetAllMarks().run() ?? !1,
|
|
101
|
+
isUnderline: e.editor.isActive("underline") ?? !1,
|
|
102
|
+
isSubScript: e.editor.isActive("subscript") ?? !1,
|
|
103
|
+
isSuperScript: e.editor.isActive("superscript") ?? !1,
|
|
104
|
+
isParagraph: e.editor.isActive("paragraph") ?? !1,
|
|
105
|
+
isHeading1: e.editor.isActive("heading", { level: 1 }) ?? !1,
|
|
106
|
+
isHeading2: e.editor.isActive("heading", { level: 2 }) ?? !1,
|
|
107
|
+
isHeading3: e.editor.isActive("heading", { level: 3 }) ?? !1,
|
|
108
|
+
isHeadingParagraph: e.editor.isActive("headingParagraph") ?? !1,
|
|
109
|
+
isHeading4: e.editor.isActive("heading", { level: 4 }) ?? !1,
|
|
110
|
+
isHeading5: e.editor.isActive("heading", { level: 5 }) ?? !1,
|
|
111
|
+
isHeading6: e.editor.isActive("heading", { level: 6 }) ?? !1,
|
|
112
|
+
isBulletList: e.editor.isActive("bulletList") ?? !1,
|
|
113
|
+
isOrderedList: e.editor.isActive("orderedList") ?? !1,
|
|
114
|
+
isCodeBlock: e.editor.isActive("codeBlock") ?? !1,
|
|
115
|
+
isBlockquote: e.editor.isActive("blockquote") ?? !1,
|
|
116
|
+
canUndo: e.editor.can().chain().undo().run() ?? !1,
|
|
117
|
+
canRedo: e.editor.can().chain().redo().run() ?? !1
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}), Z = !!K, Q = n(y.toolbar, e, {
|
|
121
|
+
[y.toolbarWithNoDone]: !0,
|
|
122
|
+
[y.toolbarTop]: Y.position === "top",
|
|
123
|
+
[y.toolbarRight]: Y.alignment === "right",
|
|
124
|
+
[y.focused]: Y.alwaysVisible || X.isFocused && !X.toolbarOpened && !X.hideDefaultToolbar,
|
|
125
|
+
[y.autoWidth]: Z,
|
|
126
|
+
[y.fullWidth]: !Z,
|
|
127
|
+
[y.hidden]: Y.isHidden === !0
|
|
128
|
+
}), $ = Y.minWidth === void 0 ? {} : { minWidth: Y.minWidth }, te = (e) => {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
}, ne = h(() => [
|
|
131
|
+
{
|
|
132
|
+
icon: /* @__PURE__ */ S(k, {}),
|
|
133
|
+
label: "Insert table",
|
|
134
|
+
onClick: (e) => e.chain().focus().insertTable({
|
|
135
|
+
rows: 2,
|
|
136
|
+
cols: 2,
|
|
137
|
+
withHeaderRow: !1
|
|
138
|
+
}).run(),
|
|
139
|
+
hidden: (e) => !w?.includes("table") || e.isTable,
|
|
140
|
+
isActive: (e) => e.isTable,
|
|
141
|
+
isDisabled: (e) => !e.canTable
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
icon: /* @__PURE__ */ S(l, {}),
|
|
145
|
+
label: "Add table row",
|
|
146
|
+
onClick: (e) => e.chain().focus().addRowAfter().run(),
|
|
147
|
+
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
148
|
+
isActive: (e) => e.isTable,
|
|
149
|
+
isDisabled: (e) => !e.canTable
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
icon: /* @__PURE__ */ S(d, {}),
|
|
153
|
+
label: "Remove table row",
|
|
154
|
+
onClick: (e) => e.chain().focus().deleteRow().run(),
|
|
155
|
+
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
156
|
+
isActive: (e) => e.isTable,
|
|
157
|
+
isDisabled: (e) => !e.canTable
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
icon: /* @__PURE__ */ S(c, {}),
|
|
161
|
+
label: "Add table column",
|
|
162
|
+
onClick: (e) => e.chain().focus().addColumnAfter().run(),
|
|
163
|
+
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
164
|
+
isActive: (e) => e.isTable,
|
|
165
|
+
isDisabled: (e) => !e.canTable
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
icon: /* @__PURE__ */ S(u, {}),
|
|
169
|
+
label: "Remove table column",
|
|
170
|
+
onClick: (e) => e.chain().focus().deleteColumn().run(),
|
|
171
|
+
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
172
|
+
isActive: (e) => e.isTable,
|
|
173
|
+
isDisabled: (e) => !e.canTable
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
icon: /* @__PURE__ */ S(f, {}),
|
|
177
|
+
label: "Remove table",
|
|
178
|
+
onClick: (e) => e.chain().focus().deleteTable().run(),
|
|
179
|
+
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
180
|
+
isActive: (e) => e.isTable,
|
|
181
|
+
isDisabled: (e) => !e.canTable
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
icon: /* @__PURE__ */ S(z, {}),
|
|
185
|
+
label: "Table borders",
|
|
186
|
+
toggle: !0,
|
|
187
|
+
onClick: (e) => {
|
|
188
|
+
let t = e.getAttributes("table"), n = {
|
|
189
|
+
...t,
|
|
190
|
+
border: t.border === "0" ? "1" : "0"
|
|
191
|
+
};
|
|
192
|
+
e.commands.updateAttributes("table", n);
|
|
193
|
+
},
|
|
194
|
+
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
195
|
+
isActive: (e) => e.tableHasBorder,
|
|
196
|
+
isDisabled: (e) => !e.canTable
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
icon: /* @__PURE__ */ S(T, {}),
|
|
200
|
+
label: "Bold",
|
|
201
|
+
toggle: !0,
|
|
202
|
+
onClick: (e) => e.chain().focus().toggleBold().run(),
|
|
203
|
+
hidden: () => !w?.includes("bold"),
|
|
204
|
+
isActive: (e) => e.isBold,
|
|
205
|
+
isDisabled: (e) => !e.canBold
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
icon: /* @__PURE__ */ S(E, {}),
|
|
209
|
+
label: "Italic",
|
|
210
|
+
toggle: !0,
|
|
211
|
+
onClick: (e) => e.chain().focus().toggleItalic().run(),
|
|
212
|
+
hidden: () => !w?.includes("italic"),
|
|
213
|
+
isActive: (e) => e.isItalic,
|
|
214
|
+
isDisabled: (e) => !e.canItalic
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
icon: /* @__PURE__ */ S(D, {}),
|
|
218
|
+
label: "Strikethrough",
|
|
219
|
+
toggle: !0,
|
|
220
|
+
onClick: (e) => e.chain().focus().toggleStrike().run(),
|
|
221
|
+
hidden: () => !w?.includes("strikethrough"),
|
|
222
|
+
isActive: (e) => e.isStrike,
|
|
223
|
+
isDisabled: (e) => !e.canStrike
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
icon: /* @__PURE__ */ S(O, {}),
|
|
227
|
+
label: "Code",
|
|
228
|
+
toggle: !0,
|
|
229
|
+
onClick: (e) => e.chain().focus().toggleCode().run(),
|
|
230
|
+
hidden: () => !w?.includes("code"),
|
|
231
|
+
isActive: (e) => e.isCode,
|
|
232
|
+
isDisabled: (e) => !e.canCode
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
icon: /* @__PURE__ */ S(M, {}),
|
|
236
|
+
label: "Underline",
|
|
237
|
+
toggle: !0,
|
|
238
|
+
onClick: (e) => e.chain().focus().toggleUnderline().run(),
|
|
239
|
+
hidden: () => !w?.includes("underline"),
|
|
240
|
+
isActive: (e) => e.isUnderline
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
icon: /* @__PURE__ */ S(V, {}),
|
|
244
|
+
label: "Subscript",
|
|
245
|
+
toggle: !0,
|
|
246
|
+
onClick: (e) => e.chain().focus().toggleSubscript().run(),
|
|
247
|
+
hidden: () => !w?.includes("subscript"),
|
|
248
|
+
isActive: (e) => e.isSubScript
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
icon: /* @__PURE__ */ S(B, {}),
|
|
252
|
+
label: "Superscript",
|
|
253
|
+
toggle: !0,
|
|
254
|
+
onClick: (e) => e.chain().focus().toggleSuperscript().run(),
|
|
255
|
+
hidden: () => !w?.includes("superscript"),
|
|
256
|
+
isActive: (e) => e.isSuperScript
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
icon: /* @__PURE__ */ S(P, {}),
|
|
260
|
+
label: "Insert image",
|
|
261
|
+
hidden: () => !w?.includes("image"),
|
|
262
|
+
onClick: (e) => e.chain().focus().setImageUploadNode().run()
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
icon: /* @__PURE__ */ S(L, {}),
|
|
266
|
+
label: "Insert video",
|
|
267
|
+
hidden: () => !w?.includes("video"),
|
|
268
|
+
onClick: (e) => e.chain().focus().insertMedia({ type: "video" }).run()
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
icon: /* @__PURE__ */ S(R, {}),
|
|
272
|
+
label: "Insert audio",
|
|
273
|
+
hidden: () => !w?.includes("audio"),
|
|
274
|
+
onClick: (e) => e.chain().focus().insertMedia({
|
|
275
|
+
type: "audio",
|
|
276
|
+
tag: "audio"
|
|
277
|
+
}).run()
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
icon: /* @__PURE__ */ S(s, {}),
|
|
281
|
+
label: "CSS classes",
|
|
282
|
+
hidden: () => !w?.includes("css"),
|
|
283
|
+
onClick: (e) => e.commands.openCSSClassDialog()
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
icon: /* @__PURE__ */ S(I, {}),
|
|
287
|
+
label: "Blockquote",
|
|
288
|
+
toggle: !0,
|
|
289
|
+
hidden: () => !w?.includes("blockquote"),
|
|
290
|
+
onClick: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
291
|
+
isActive: (e) => e.isBlockquote
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
icon: /* @__PURE__ */ S(H, {}),
|
|
295
|
+
label: "Heading",
|
|
296
|
+
toggle: !0,
|
|
297
|
+
hidden: () => !w?.includes("h3"),
|
|
298
|
+
onClick: (e) => e.chain().focus().toggleHeadingParagraph().run(),
|
|
299
|
+
isActive: (e) => e.isHeadingParagraph
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
icon: /* @__PURE__ */ S(N, {}),
|
|
303
|
+
label: "Insert math",
|
|
304
|
+
hidden: () => !w?.includes("math"),
|
|
305
|
+
onClick: (e) => e.chain().focus().insertMath("").run()
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
icon: /* @__PURE__ */ S(p, { letter: "ñ" }),
|
|
309
|
+
label: "Spanish characters (ñ)",
|
|
310
|
+
hidden: () => !w?.includes("languageCharacters"),
|
|
311
|
+
onClick: () => J(i)
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
icon: /* @__PURE__ */ S(p, { letter: "€" }),
|
|
315
|
+
label: "Special characters (€)",
|
|
316
|
+
hidden: () => w?.filter((e) => e === "languageCharacters").length !== 2,
|
|
317
|
+
onClick: () => J(a)
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
icon: /* @__PURE__ */ S(o, { editor: v }),
|
|
321
|
+
label: "Text alignment",
|
|
322
|
+
hidden: () => !w?.includes("text-align"),
|
|
323
|
+
onClick: () => {}
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
icon: /* @__PURE__ */ S(A, {}),
|
|
327
|
+
label: "Bulleted list",
|
|
328
|
+
toggle: !0,
|
|
329
|
+
hidden: () => !w?.includes("bulleted-list"),
|
|
330
|
+
onClick: (e) => e.chain().focus().toggleBulletList().run(),
|
|
331
|
+
isActive: (e) => e.isBulletList
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
icon: /* @__PURE__ */ S(j, {}),
|
|
335
|
+
label: "Numbered list",
|
|
336
|
+
toggle: !0,
|
|
337
|
+
hidden: () => !w?.includes("numbered-list"),
|
|
338
|
+
onClick: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
339
|
+
isActive: (e) => e.isOrderedList
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
icon: /* @__PURE__ */ S(ee, {}),
|
|
343
|
+
label: "Undo",
|
|
344
|
+
hidden: () => !w?.includes("undo"),
|
|
345
|
+
onClick: (e) => e.chain().focus().undo().run(),
|
|
346
|
+
isDisabled: (e) => !e.canUndo
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
icon: /* @__PURE__ */ S(F, {}),
|
|
350
|
+
label: "Redo",
|
|
351
|
+
hidden: () => !w?.includes("redo"),
|
|
352
|
+
onClick: (e) => e.chain().focus().redo().run(),
|
|
353
|
+
isDisabled: (e) => !e.canRedo
|
|
354
|
+
}
|
|
355
|
+
], [w, v]), re = X.hideDefaultToolbar && X.currentNode?.type?.name === "drag_in_the_blank";
|
|
356
|
+
return /* @__PURE__ */ C("div", {
|
|
357
|
+
className: Q,
|
|
358
|
+
style: { ...$ },
|
|
359
|
+
onMouseDown: te,
|
|
360
|
+
children: [
|
|
361
|
+
re && /* @__PURE__ */ S("div", {
|
|
362
|
+
className: y.defaultToolbar,
|
|
363
|
+
tabIndex: "1",
|
|
364
|
+
children: /* @__PURE__ */ S("div", {
|
|
365
|
+
className: y.buttonsContainer,
|
|
366
|
+
children: /* @__PURE__ */ S("button", {
|
|
367
|
+
type: "button",
|
|
368
|
+
className: y.button,
|
|
369
|
+
onClick: (e) => {
|
|
370
|
+
e.preventDefault(), v.chain().focus().deleteSelection().run(), G?.(v.getHTML());
|
|
371
|
+
},
|
|
372
|
+
"aria-label": "Delete response area",
|
|
373
|
+
title: "Delete response area",
|
|
374
|
+
children: /* @__PURE__ */ S(x, {})
|
|
375
|
+
})
|
|
376
|
+
})
|
|
377
|
+
}),
|
|
378
|
+
!X.hideDefaultToolbar && /* @__PURE__ */ C("div", {
|
|
379
|
+
className: y.defaultToolbar,
|
|
380
|
+
tabIndex: "1",
|
|
381
|
+
children: [
|
|
382
|
+
/* @__PURE__ */ S("div", {
|
|
383
|
+
className: y.buttonsContainer,
|
|
384
|
+
children: ne.filter((e) => !e.hidden?.(X)).map((e, t) => {
|
|
385
|
+
let r = e.isDisabled?.(X), i = e.isActive?.(X);
|
|
386
|
+
return /* @__PURE__ */ S("button", {
|
|
387
|
+
type: "button",
|
|
388
|
+
disabled: r,
|
|
389
|
+
"aria-label": e.label,
|
|
390
|
+
title: e.label,
|
|
391
|
+
"aria-pressed": e.toggle ? !!i : void 0,
|
|
392
|
+
onClick: (t) => {
|
|
393
|
+
t.preventDefault(), e.onClick(v);
|
|
394
|
+
},
|
|
395
|
+
className: n(y.button, { [y.active]: i }),
|
|
396
|
+
children: e.icon
|
|
397
|
+
}, t);
|
|
398
|
+
})
|
|
399
|
+
}),
|
|
400
|
+
w?.includes("responseArea") && /* @__PURE__ */ S("button", {
|
|
401
|
+
type: "button",
|
|
402
|
+
"aria-label": "Insert response area",
|
|
403
|
+
title: "Insert response area",
|
|
404
|
+
onClick: () => {
|
|
405
|
+
v.chain().focus().insertResponseArea(W.type).run();
|
|
406
|
+
},
|
|
407
|
+
className: y.button,
|
|
408
|
+
children: /* @__PURE__ */ S(r, {})
|
|
409
|
+
}),
|
|
410
|
+
Y.showDone && /* @__PURE__ */ S(t, { onClick: () => {
|
|
411
|
+
G?.(v.getHTML()), v.commands.blur();
|
|
412
|
+
} })
|
|
413
|
+
]
|
|
414
|
+
}),
|
|
415
|
+
q && /* @__PURE__ */ S(m, {
|
|
416
|
+
editor: v,
|
|
417
|
+
opts: {
|
|
418
|
+
...q,
|
|
419
|
+
renderPopOver: (e, t) => console.log("Show popover", t),
|
|
420
|
+
closePopOver: () => console.log("Close popover")
|
|
421
|
+
},
|
|
422
|
+
onClose: () => J(!1)
|
|
423
|
+
})
|
|
424
|
+
]
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
var W = (e) => {
|
|
428
|
+
y();
|
|
429
|
+
let t = {
|
|
430
|
+
defaultToolbar: "defaultToolbar",
|
|
431
|
+
buttonsContainer: "buttonsContainer",
|
|
432
|
+
button: "toolbarButton",
|
|
433
|
+
active: "active",
|
|
434
|
+
disabled: "disabled",
|
|
435
|
+
isActive: "isActive",
|
|
436
|
+
toolbar: "toolbar",
|
|
437
|
+
toolbarWithNoDone: "toolbarWithNoDone",
|
|
438
|
+
toolbarTop: "toolbarTop",
|
|
439
|
+
toolbarRight: "toolbarRight",
|
|
440
|
+
fullWidth: "fullWidth",
|
|
441
|
+
hidden: "hidden",
|
|
442
|
+
autoWidth: "autoWidth",
|
|
443
|
+
focused: "focused",
|
|
444
|
+
iconRoot: "iconRoot",
|
|
445
|
+
label: "label",
|
|
446
|
+
shared: "shared"
|
|
447
|
+
};
|
|
448
|
+
return /* @__PURE__ */ S(G, { children: /* @__PURE__ */ S(U, {
|
|
449
|
+
...e,
|
|
450
|
+
classes: t
|
|
451
|
+
}) });
|
|
452
|
+
}, G = v("div")(() => ({
|
|
453
|
+
height: 0,
|
|
454
|
+
overflow: "visible",
|
|
455
|
+
"& .defaultToolbar": {
|
|
456
|
+
display: "flex",
|
|
457
|
+
width: "100%",
|
|
458
|
+
justifyContent: "space-between"
|
|
459
|
+
},
|
|
460
|
+
"& .buttonsContainer": {
|
|
461
|
+
alignItems: "center",
|
|
462
|
+
display: "flex",
|
|
463
|
+
width: "100%"
|
|
464
|
+
},
|
|
465
|
+
"& .toolbarButton": {
|
|
466
|
+
color: "grey",
|
|
467
|
+
display: "inline-flex",
|
|
468
|
+
padding: "2px",
|
|
469
|
+
background: "none",
|
|
470
|
+
border: "none",
|
|
471
|
+
cursor: "pointer",
|
|
472
|
+
"& svg": {
|
|
473
|
+
width: "24px",
|
|
474
|
+
height: "24px"
|
|
475
|
+
},
|
|
476
|
+
"&:hover": { color: w.text() },
|
|
477
|
+
"&:focus": { outline: `2px solid ${w.buttonFocusOutline()}` }
|
|
478
|
+
},
|
|
479
|
+
"& .active": { color: w.text() },
|
|
480
|
+
"& .disabled": {
|
|
481
|
+
opacity: .7,
|
|
482
|
+
cursor: "not-allowed",
|
|
483
|
+
"& :hover": { color: w.disabled() }
|
|
484
|
+
},
|
|
485
|
+
"& .isActive": {
|
|
486
|
+
background: "var(--purple)",
|
|
487
|
+
color: "var(--white)"
|
|
488
|
+
},
|
|
489
|
+
"& .toolbar": {
|
|
490
|
+
position: "relative",
|
|
491
|
+
top: "5px",
|
|
492
|
+
zIndex: 20,
|
|
493
|
+
cursor: "pointer",
|
|
494
|
+
justifyContent: "space-between",
|
|
495
|
+
background: "var(--editable-html-toolbar-bg, #efefef)",
|
|
496
|
+
minWidth: "280px",
|
|
497
|
+
margin: 0,
|
|
498
|
+
padding: "2px",
|
|
499
|
+
boxShadow: "0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)",
|
|
500
|
+
boxSizing: "border-box",
|
|
501
|
+
display: "flex",
|
|
502
|
+
opacity: 0,
|
|
503
|
+
pointerEvents: "none"
|
|
504
|
+
},
|
|
505
|
+
"& .toolbarWithNoDone": { minWidth: "265px" },
|
|
506
|
+
"& .toolbarTop": {
|
|
507
|
+
position: "absolute",
|
|
508
|
+
top: "-45px"
|
|
509
|
+
},
|
|
510
|
+
"& .toolbarRight": { right: 0 },
|
|
511
|
+
"& .fullWidth": {
|
|
512
|
+
width: "fit-content",
|
|
513
|
+
minWidth: "100%"
|
|
514
|
+
},
|
|
515
|
+
"& .hidden": { visibility: "hidden" },
|
|
516
|
+
"& .autoWidth": { width: "fit-content" },
|
|
517
|
+
"& .focused": {
|
|
518
|
+
opacity: 1,
|
|
519
|
+
pointerEvents: "auto"
|
|
520
|
+
},
|
|
521
|
+
"& .iconRoot": {
|
|
522
|
+
width: "28px",
|
|
523
|
+
height: "28px",
|
|
524
|
+
padding: "4px",
|
|
525
|
+
verticalAlign: "top"
|
|
526
|
+
},
|
|
527
|
+
"& .label": { color: "var(--editable-html-toolbar-check, #00bb00)" },
|
|
528
|
+
"& .shared": { display: "flex" }
|
|
529
|
+
}));
|
|
530
|
+
//#endregion
|
|
531
|
+
export { W as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/TiptapContainer.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
|
+
declare function TiptapContainer(props: any): React.JSX.Element;
|
|
11
|
+
export default TiptapContainer;
|