@pie-lib/editable-html-tip-tap 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/components/CharacterPicker.d.ts +31 -0
  2. package/dist/components/CharacterPicker.d.ts.map +1 -0
  3. package/dist/components/CharacterPicker.js +129 -0
  4. package/dist/components/EditableHtml.d.ts +11 -0
  5. package/dist/components/EditableHtml.d.ts.map +1 -0
  6. package/dist/components/EditableHtml.js +270 -0
  7. package/dist/components/MenuBar.d.ts +11 -0
  8. package/dist/components/MenuBar.d.ts.map +1 -0
  9. package/dist/components/MenuBar.js +460 -0
  10. package/dist/components/TiptapContainer.d.ts +11 -0
  11. package/dist/components/TiptapContainer.d.ts.map +1 -0
  12. package/dist/components/TiptapContainer.js +157 -0
  13. package/dist/components/characters/characterUtils.d.ts +36 -0
  14. package/dist/components/characters/characterUtils.d.ts.map +1 -0
  15. package/dist/components/characters/characterUtils.js +465 -0
  16. package/dist/components/characters/custom-popper.d.ts +14 -0
  17. package/dist/components/characters/custom-popper.d.ts.map +1 -0
  18. package/dist/components/characters/custom-popper.js +32 -0
  19. package/dist/components/common/done-button.d.ts +30 -0
  20. package/dist/components/common/done-button.d.ts.map +1 -0
  21. package/dist/components/common/done-button.js +26 -0
  22. package/dist/components/common/toolbar-buttons.d.ts +39 -0
  23. package/dist/components/common/toolbar-buttons.d.ts.map +1 -0
  24. package/dist/components/common/toolbar-buttons.js +91 -0
  25. package/dist/components/icons/CssIcon.d.ts +11 -0
  26. package/dist/components/icons/CssIcon.d.ts.map +1 -0
  27. package/dist/components/icons/CssIcon.js +14 -0
  28. package/dist/components/icons/RespArea.d.ts +26 -0
  29. package/dist/components/icons/RespArea.d.ts.map +1 -0
  30. package/dist/components/icons/RespArea.js +42 -0
  31. package/dist/components/icons/TableIcons.d.ts +14 -0
  32. package/dist/components/icons/TableIcons.d.ts.map +1 -0
  33. package/dist/components/icons/TableIcons.js +32 -0
  34. package/dist/components/icons/TextAlign.d.ts +18 -0
  35. package/dist/components/icons/TextAlign.d.ts.map +1 -0
  36. package/dist/components/icons/TextAlign.js +134 -0
  37. package/dist/components/image/AltDialog.d.ts +23 -0
  38. package/dist/components/image/AltDialog.d.ts.map +1 -0
  39. package/dist/components/image/AltDialog.js +61 -0
  40. package/dist/components/image/ImageToolbar.d.ts +25 -0
  41. package/dist/components/image/ImageToolbar.d.ts.map +1 -0
  42. package/dist/components/image/ImageToolbar.js +80 -0
  43. package/dist/components/image/InsertImageHandler.d.ts +33 -0
  44. package/dist/components/image/InsertImageHandler.d.ts.map +1 -0
  45. package/dist/components/image/InsertImageHandler.js +55 -0
  46. package/dist/components/media/MediaDialog.d.ts +44 -0
  47. package/dist/components/media/MediaDialog.d.ts.map +1 -0
  48. package/dist/components/media/MediaDialog.js +389 -0
  49. package/dist/components/media/MediaToolbar.d.ts +20 -0
  50. package/dist/components/media/MediaToolbar.d.ts.map +1 -0
  51. package/dist/components/media/MediaToolbar.js +41 -0
  52. package/dist/components/media/MediaWrapper.d.ts +20 -0
  53. package/dist/components/media/MediaWrapper.d.ts.map +1 -0
  54. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +23 -0
  55. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts.map +1 -0
  56. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +58 -0
  57. package/dist/components/respArea/DragInTheBlank/choice.d.ts +56 -0
  58. package/dist/components/respArea/DragInTheBlank/choice.d.ts.map +1 -0
  59. package/dist/components/respArea/DragInTheBlank/choice.js +156 -0
  60. package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
  61. package/dist/components/respArea/ExplicitConstructedResponse.d.ts.map +1 -0
  62. package/dist/components/respArea/ExplicitConstructedResponse.js +67 -0
  63. package/dist/components/respArea/InlineDropdown.d.ts +18 -0
  64. package/dist/components/respArea/InlineDropdown.d.ts.map +1 -0
  65. package/dist/components/respArea/InlineDropdown.js +91 -0
  66. package/dist/components/respArea/MathTemplated.d.ts +19 -0
  67. package/dist/components/respArea/MathTemplated.d.ts.map +1 -0
  68. package/dist/components/respArea/MathTemplated.js +97 -0
  69. package/dist/components/respArea/ToolbarIcon.d.ts +14 -0
  70. package/dist/components/respArea/ToolbarIcon.d.ts.map +1 -0
  71. package/dist/components/respArea/ToolbarIcon.js +17 -0
  72. package/dist/constants.d.ts +14 -0
  73. package/dist/constants.d.ts.map +1 -0
  74. package/dist/constants.js +4 -0
  75. package/dist/extensions/css.d.ts +12 -0
  76. package/dist/extensions/css.d.ts.map +1 -0
  77. package/dist/extensions/css.js +115 -0
  78. package/dist/extensions/custom-toolbar-wrapper.d.ts +11 -0
  79. package/dist/extensions/custom-toolbar-wrapper.d.ts.map +1 -0
  80. package/dist/extensions/custom-toolbar-wrapper.js +58 -0
  81. package/dist/extensions/div-node.d.ts +11 -0
  82. package/dist/extensions/div-node.d.ts.map +1 -0
  83. package/dist/extensions/div-node.js +25 -0
  84. package/dist/extensions/extended-table.d.ts +11 -0
  85. package/dist/extensions/extended-table.d.ts.map +1 -0
  86. package/dist/extensions/extended-table.js +15 -0
  87. package/dist/extensions/image-component.d.ts +22 -0
  88. package/dist/extensions/image-component.d.ts.map +1 -0
  89. package/dist/extensions/image-component.js +200 -0
  90. package/dist/extensions/image.d.ts +11 -0
  91. package/dist/extensions/image.d.ts.map +1 -0
  92. package/dist/extensions/image.js +42 -0
  93. package/dist/extensions/index.d.ts +17 -0
  94. package/dist/extensions/index.d.ts.map +1 -0
  95. package/dist/extensions/index.js +65 -0
  96. package/dist/extensions/math.d.ts +15 -0
  97. package/dist/extensions/math.d.ts.map +1 -0
  98. package/dist/extensions/math.js +150 -0
  99. package/dist/extensions/media.d.ts +19 -0
  100. package/dist/extensions/media.d.ts.map +1 -0
  101. package/dist/extensions/media.js +147 -0
  102. package/dist/extensions/responseArea.d.ts +28 -0
  103. package/dist/extensions/responseArea.d.ts.map +1 -0
  104. package/dist/extensions/responseArea.js +259 -0
  105. package/dist/index.d.ts +13 -0
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.js +6 -0
  108. package/dist/styles/editorContainerStyles.d.ts +135 -0
  109. package/dist/styles/editorContainerStyles.d.ts.map +1 -0
  110. package/dist/theme.d.ts +10 -0
  111. package/dist/theme.d.ts.map +1 -0
  112. package/dist/utils/helper.d.ts +10 -0
  113. package/dist/utils/helper.d.ts.map +1 -0
  114. package/dist/utils/helper.js +7 -0
  115. package/dist/utils/size.d.ts +10 -0
  116. package/dist/utils/size.d.ts.map +1 -0
  117. package/dist/utils/size.js +14 -0
  118. package/package.json +71 -0
  119. package/src/components/CharacterPicker.tsx +210 -0
  120. package/src/components/EditableHtml.tsx +416 -0
  121. package/src/components/MenuBar.tsx +558 -0
  122. package/src/components/TiptapContainer.tsx +228 -0
  123. package/src/components/characters/characterUtils.ts +457 -0
  124. package/src/components/characters/custom-popper.tsx +48 -0
  125. package/src/components/common/done-button.tsx +37 -0
  126. package/src/components/common/toolbar-buttons.tsx +132 -0
  127. package/src/components/icons/CssIcon.tsx +25 -0
  128. package/src/components/icons/RespArea.tsx +81 -0
  129. package/src/components/icons/TableIcons.tsx +62 -0
  130. package/src/components/icons/TextAlign.tsx +124 -0
  131. package/src/components/image/AltDialog.tsx +92 -0
  132. package/src/components/image/ImageToolbar.tsx +109 -0
  133. package/src/components/image/InsertImageHandler.ts +121 -0
  134. package/src/components/media/MediaDialog.tsx +606 -0
  135. package/src/components/media/MediaToolbar.tsx +59 -0
  136. package/src/components/media/MediaWrapper.tsx +49 -0
  137. package/src/components/respArea/DragInTheBlank/DragInTheBlank.tsx +86 -0
  138. package/src/components/respArea/DragInTheBlank/choice.tsx +266 -0
  139. package/src/components/respArea/ExplicitConstructedResponse.tsx +122 -0
  140. package/src/components/respArea/InlineDropdown.tsx +152 -0
  141. package/src/components/respArea/MathTemplated.tsx +134 -0
  142. package/src/components/respArea/ToolbarIcon.tsx +76 -0
  143. package/src/constants.ts +15 -0
  144. package/src/extensions/css.tsx +230 -0
  145. package/src/extensions/custom-toolbar-wrapper.tsx +88 -0
  146. package/src/extensions/div-node.tsx +46 -0
  147. package/src/extensions/extended-table.ts +34 -0
  148. package/src/extensions/image-component.tsx +303 -0
  149. package/src/extensions/image.tsx +64 -0
  150. package/src/extensions/index.tsx +91 -0
  151. package/src/extensions/math.tsx +285 -0
  152. package/src/extensions/media.tsx +198 -0
  153. package/src/extensions/responseArea.tsx +404 -0
  154. package/src/index.tsx +15 -0
  155. package/src/styles/editorContainerStyles.ts +155 -0
  156. package/src/theme.ts +11 -0
  157. package/src/utils/helper.tsx +27 -0
  158. package/src/utils/size.ts +42 -0
@@ -0,0 +1,460 @@
1
+ import { PIE_TOOLBAR__CLASS as e } from "../constants.js";
2
+ import { DoneButton as t } from "./common/done-button.js";
3
+ import { ToolbarIcon as n } from "./respArea/ToolbarIcon.js";
4
+ import { spanishConfig as r, specialConfig as i } from "./characters/characterUtils.js";
5
+ import a from "./icons/TextAlign.js";
6
+ import o from "./icons/CssIcon.js";
7
+ import { AddColumn as s, AddRow as c, RemoveColumn as l, RemoveRow as u, RemoveTable as d } from "./icons/TableIcons.js";
8
+ import { CharacterIcon as f, CharacterPicker as p } from "./CharacterPicker.js";
9
+ import { useMemo as m, useState as h } from "react";
10
+ import { useEditorState as g } from "@tiptap/react";
11
+ import { styled as _, useTheme as v } from "@mui/material/styles";
12
+ import { NodeSelection as y } from "prosemirror-state";
13
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
14
+ import S from "classnames";
15
+ import C from "@mui/icons-material/Delete";
16
+ import w from "@mui/icons-material/FormatBold";
17
+ import T from "@mui/icons-material/FormatItalic";
18
+ import E from "@mui/icons-material/FormatStrikethrough";
19
+ import D from "@mui/icons-material/Code";
20
+ import O from "@mui/icons-material/GridOn";
21
+ import k from "@mui/icons-material/FormatListBulleted";
22
+ import A from "@mui/icons-material/FormatListNumbered";
23
+ import j from "@mui/icons-material/FormatUnderlined";
24
+ import M from "@mui/icons-material/Functions";
25
+ import N from "@mui/icons-material/Image";
26
+ import P from "@mui/icons-material/Redo";
27
+ import F from "@mui/icons-material/Undo";
28
+ import I from "@mui/icons-material/FormatQuote";
29
+ import ee from "@mui/icons-material/Theaters";
30
+ import L from "@mui/icons-material/VolumeUp";
31
+ import R from "@mui/icons-material/BorderAll";
32
+ //#region src/components/MenuBar.tsx
33
+ var z = () => /* @__PURE__ */ b("svg", {
34
+ xmlns: "http://www.w3.org/2000/svg",
35
+ height: "24px",
36
+ viewBox: "0 0 24 24",
37
+ width: "24px",
38
+ fill: "none",
39
+ children: /* @__PURE__ */ b("path", {
40
+ 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",
41
+ fill: "currentColor"
42
+ })
43
+ }), B = () => /* @__PURE__ */ b("svg", {
44
+ xmlns: "http://www.w3.org/2000/svg",
45
+ height: "24px",
46
+ viewBox: "0 0 24 24",
47
+ width: "24px",
48
+ fill: "none",
49
+ children: /* @__PURE__ */ b("path", {
50
+ 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",
51
+ fill: "currentColor"
52
+ })
53
+ }), V = () => /* @__PURE__ */ b("svg", {
54
+ width: "30",
55
+ height: "28",
56
+ viewBox: "0 0 30 28",
57
+ fill: "none",
58
+ xmlns: "http://www.w3.org/2000/svg",
59
+ style: {
60
+ width: "20px",
61
+ height: "18px"
62
+ },
63
+ children: /* @__PURE__ */ b("path", {
64
+ 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",
65
+ fill: "currentColor"
66
+ })
67
+ });
68
+ function H({ editor: _, classes: v, activePlugins: H, toolbarOpts: U, responseAreaProps: W, onChange: G, autoWidthToolbar: K }) {
69
+ let [q, J] = h(!1), Y = U ?? {}, X = g({
70
+ editor: _,
71
+ selector: (e) => {
72
+ let { selection: t } = e.editor?.state || {}, n;
73
+ t instanceof y && (n = t.node);
74
+ 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");
75
+ return {
76
+ currentNode: n,
77
+ hideDefaultToolbar: r,
78
+ hasTextSelectionInTable: i,
79
+ isFocused: e.editor?.isFocused,
80
+ isBold: e.editor.isActive("bold") ?? !1,
81
+ canBold: e.editor.can().chain().toggleBold().run() ?? !1,
82
+ isTable: e.editor.isActive("table") ?? !1,
83
+ tableHasBorder: e.editor.getAttributes("table")?.border === "1",
84
+ canTable: e.editor.can().chain().insertTable().run() ?? !1,
85
+ isItalic: e.editor.isActive("italic") ?? !1,
86
+ canItalic: e.editor.can().chain().toggleItalic().run() ?? !1,
87
+ isStrike: e.editor.isActive("strike") ?? !1,
88
+ canStrike: e.editor.can().chain().toggleStrike().run() ?? !1,
89
+ isCode: e.editor.isActive("code") ?? !1,
90
+ canCode: e.editor.can().chain().toggleCode().run() ?? !1,
91
+ canClearMarks: e.editor.can().chain().unsetAllMarks().run() ?? !1,
92
+ isUnderline: e.editor.isActive("underline") ?? !1,
93
+ isSubScript: e.editor.isActive("subscript") ?? !1,
94
+ isSuperScript: e.editor.isActive("superscript") ?? !1,
95
+ isParagraph: e.editor.isActive("paragraph") ?? !1,
96
+ isHeading1: e.editor.isActive("heading", { level: 1 }) ?? !1,
97
+ isHeading2: e.editor.isActive("heading", { level: 2 }) ?? !1,
98
+ isHeading3: e.editor.isActive("heading", { level: 3 }) ?? !1,
99
+ isHeading4: e.editor.isActive("heading", { level: 4 }) ?? !1,
100
+ isHeading5: e.editor.isActive("heading", { level: 5 }) ?? !1,
101
+ isHeading6: e.editor.isActive("heading", { level: 6 }) ?? !1,
102
+ isBulletList: e.editor.isActive("bulletList") ?? !1,
103
+ isOrderedList: e.editor.isActive("orderedList") ?? !1,
104
+ isCodeBlock: e.editor.isActive("codeBlock") ?? !1,
105
+ isBlockquote: e.editor.isActive("blockquote") ?? !1,
106
+ canUndo: e.editor.can().chain().undo().run() ?? !1,
107
+ canRedo: e.editor.can().chain().redo().run() ?? !1
108
+ };
109
+ }
110
+ }), Z = !!K, Q = S(v.toolbar, e, {
111
+ [v.toolbarWithNoDone]: !0,
112
+ [v.toolbarTop]: Y.position === "top",
113
+ [v.toolbarRight]: Y.alignment === "right",
114
+ [v.focused]: Y.alwaysVisible || X.isFocused && !_._toolbarOpened,
115
+ [v.autoWidth]: Z,
116
+ [v.fullWidth]: !Z,
117
+ [v.hidden]: Y.isHidden === !0
118
+ }), $ = Y.minWidth === void 0 ? {} : { minWidth: Y.minWidth }, te = (e) => {
119
+ e.preventDefault();
120
+ }, ne = m(() => [
121
+ {
122
+ icon: /* @__PURE__ */ b(O, {}),
123
+ onClick: (e) => e.chain().focus().insertTable({
124
+ rows: 2,
125
+ cols: 2,
126
+ withHeaderRow: !1
127
+ }).run(),
128
+ hidden: (e) => !H?.includes("table") || e.isTable,
129
+ isActive: (e) => e.isTable,
130
+ isDisabled: (e) => !e.canTable
131
+ },
132
+ {
133
+ icon: /* @__PURE__ */ b(c, {}),
134
+ onClick: (e) => e.chain().focus().addRowAfter().run(),
135
+ hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
136
+ isActive: (e) => e.isTable,
137
+ isDisabled: (e) => !e.canTable
138
+ },
139
+ {
140
+ icon: /* @__PURE__ */ b(u, {}),
141
+ onClick: (e) => e.chain().focus().deleteRow().run(),
142
+ hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
143
+ isActive: (e) => e.isTable,
144
+ isDisabled: (e) => !e.canTable
145
+ },
146
+ {
147
+ icon: /* @__PURE__ */ b(s, {}),
148
+ onClick: (e) => e.chain().focus().addColumnAfter().run(),
149
+ hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
150
+ isActive: (e) => e.isTable,
151
+ isDisabled: (e) => !e.canTable
152
+ },
153
+ {
154
+ icon: /* @__PURE__ */ b(l, {}),
155
+ onClick: (e) => e.chain().focus().deleteColumn().run(),
156
+ hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
157
+ isActive: (e) => e.isTable,
158
+ isDisabled: (e) => !e.canTable
159
+ },
160
+ {
161
+ icon: /* @__PURE__ */ b(d, {}),
162
+ onClick: (e) => e.chain().focus().deleteTable().run(),
163
+ hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
164
+ isActive: (e) => e.isTable,
165
+ isDisabled: (e) => !e.canTable
166
+ },
167
+ {
168
+ icon: /* @__PURE__ */ b(R, {}),
169
+ onClick: (e) => {
170
+ let t = e.getAttributes("table"), n = {
171
+ ...t,
172
+ border: t.border === "0" ? "1" : "0"
173
+ };
174
+ e.commands.updateAttributes("table", n);
175
+ },
176
+ hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
177
+ isActive: (e) => e.tableHasBorder,
178
+ isDisabled: (e) => !e.canTable
179
+ },
180
+ {
181
+ icon: /* @__PURE__ */ b(w, {}),
182
+ onClick: (e) => e.chain().focus().toggleBold().run(),
183
+ hidden: () => !H?.includes("bold"),
184
+ isActive: (e) => e.isBold,
185
+ isDisabled: (e) => !e.canBold
186
+ },
187
+ {
188
+ icon: /* @__PURE__ */ b(T, {}),
189
+ onClick: (e) => e.chain().focus().toggleItalic().run(),
190
+ hidden: () => !H?.includes("italic"),
191
+ isActive: (e) => e.isItalic,
192
+ isDisabled: (e) => !e.canItalic
193
+ },
194
+ {
195
+ icon: /* @__PURE__ */ b(E, {}),
196
+ onClick: (e) => e.chain().focus().toggleStrike().run(),
197
+ hidden: () => !H?.includes("strikethrough"),
198
+ isActive: (e) => e.isStrike,
199
+ isDisabled: (e) => !e.canStrike
200
+ },
201
+ {
202
+ icon: /* @__PURE__ */ b(D, {}),
203
+ onClick: (e) => e.chain().focus().toggleCode().run(),
204
+ hidden: () => !H?.includes("code"),
205
+ isActive: (e) => e.isCode,
206
+ isDisabled: (e) => !e.canCode
207
+ },
208
+ {
209
+ icon: /* @__PURE__ */ b(j, {}),
210
+ onClick: (e) => e.chain().focus().toggleUnderline().run(),
211
+ hidden: () => !H?.includes("underline"),
212
+ isActive: (e) => e.isUnderline
213
+ },
214
+ {
215
+ icon: /* @__PURE__ */ b(B, {}),
216
+ onClick: (e) => e.chain().focus().toggleSubscript().run(),
217
+ hidden: () => !H?.includes("subscript"),
218
+ isActive: (e) => e.isSubScript
219
+ },
220
+ {
221
+ icon: /* @__PURE__ */ b(z, {}),
222
+ onClick: (e) => e.chain().focus().toggleSuperscript().run(),
223
+ hidden: () => !H?.includes("superscript"),
224
+ isActive: (e) => e.isSuperScript
225
+ },
226
+ {
227
+ icon: /* @__PURE__ */ b(N, {}),
228
+ hidden: () => !H?.includes("image"),
229
+ onClick: (e) => e.chain().focus().setImageUploadNode().run()
230
+ },
231
+ {
232
+ icon: /* @__PURE__ */ b(ee, {}),
233
+ hidden: () => !H?.includes("video"),
234
+ onClick: (e) => e.chain().focus().insertMedia({ type: "video" }).run()
235
+ },
236
+ {
237
+ icon: /* @__PURE__ */ b(L, {}),
238
+ hidden: () => !H?.includes("audio"),
239
+ onClick: (e) => e.chain().focus().insertMedia({
240
+ type: "audio",
241
+ tag: "audio"
242
+ }).run()
243
+ },
244
+ {
245
+ icon: /* @__PURE__ */ b(o, {}),
246
+ hidden: () => !H?.includes("css"),
247
+ onClick: (e) => e.commands.openCSSClassDialog()
248
+ },
249
+ {
250
+ icon: /* @__PURE__ */ b(I, {}),
251
+ hidden: () => !H?.includes("blockquote"),
252
+ onClick: (e) => e.chain().focus().toggleBlockquote().run(),
253
+ isActive: (e) => e.isBlockquote
254
+ },
255
+ {
256
+ icon: /* @__PURE__ */ b(V, {}),
257
+ hidden: () => !H?.includes("h3"),
258
+ onClick: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(),
259
+ isActive: (e) => e.isHeading3
260
+ },
261
+ {
262
+ icon: /* @__PURE__ */ b(M, {}),
263
+ hidden: () => !H?.includes("math"),
264
+ onClick: (e) => e.chain().focus().insertMath("").run()
265
+ },
266
+ {
267
+ icon: /* @__PURE__ */ b(f, { letter: "ñ" }),
268
+ hidden: () => !H?.includes("languageCharacters"),
269
+ onClick: () => J(r)
270
+ },
271
+ {
272
+ icon: /* @__PURE__ */ b(f, { letter: "€" }),
273
+ hidden: () => H?.filter((e) => e === "languageCharacters").length !== 2,
274
+ onClick: () => J(i)
275
+ },
276
+ {
277
+ icon: /* @__PURE__ */ b(a, { editor: _ }),
278
+ hidden: () => !H?.includes("text-align"),
279
+ onClick: () => {}
280
+ },
281
+ {
282
+ icon: /* @__PURE__ */ b(k, {}),
283
+ hidden: () => !H?.includes("bulleted-list"),
284
+ onClick: (e) => e.chain().focus().toggleBulletList().run(),
285
+ isActive: (e) => e.isBulletList
286
+ },
287
+ {
288
+ icon: /* @__PURE__ */ b(A, {}),
289
+ hidden: () => !H?.includes("numbered-list"),
290
+ onClick: (e) => e.chain().focus().toggleOrderedList().run(),
291
+ isActive: (e) => e.isOrderedList
292
+ },
293
+ {
294
+ icon: /* @__PURE__ */ b(F, {}),
295
+ hidden: () => !H?.includes("undo"),
296
+ onClick: (e) => e.chain().focus().undo().run(),
297
+ isDisabled: (e) => !e.canUndo
298
+ },
299
+ {
300
+ icon: /* @__PURE__ */ b(P, {}),
301
+ hidden: () => !H?.includes("redo"),
302
+ onClick: (e) => e.chain().focus().redo().run(),
303
+ isDisabled: (e) => !e.canRedo
304
+ }
305
+ ], [H, _]), re = X.hideDefaultToolbar && X.currentNode?.type?.name === "drag_in_the_blank";
306
+ return /* @__PURE__ */ x("div", {
307
+ className: Q,
308
+ style: { ...$ },
309
+ onMouseDown: te,
310
+ children: [
311
+ re && /* @__PURE__ */ b("div", {
312
+ className: v.defaultToolbar,
313
+ tabIndex: "1",
314
+ children: /* @__PURE__ */ b("div", {
315
+ className: v.buttonsContainer,
316
+ children: /* @__PURE__ */ b("button", {
317
+ type: "button",
318
+ className: v.button,
319
+ onClick: (e) => {
320
+ e.preventDefault(), _.chain().focus().deleteSelection().run(), G?.(_.getHTML());
321
+ },
322
+ "aria-label": "Delete response area",
323
+ children: /* @__PURE__ */ b(C, {})
324
+ })
325
+ })
326
+ }),
327
+ !X.hideDefaultToolbar && /* @__PURE__ */ x("div", {
328
+ className: v.defaultToolbar,
329
+ tabIndex: "1",
330
+ children: [
331
+ /* @__PURE__ */ b("div", {
332
+ className: v.buttonsContainer,
333
+ children: ne.filter((e) => !e.hidden?.(X)).map((e, t) => {
334
+ let n = e.isDisabled?.(X), r = e.isActive?.(X);
335
+ return /* @__PURE__ */ b("button", {
336
+ disabled: n,
337
+ onClick: (t) => {
338
+ t.preventDefault(), e.onClick(_);
339
+ },
340
+ className: S(v.button, { [v.active]: r }),
341
+ children: e.icon
342
+ }, t);
343
+ })
344
+ }),
345
+ H?.includes("responseArea") && /* @__PURE__ */ b("button", {
346
+ onClick: () => {
347
+ _.chain().focus().insertResponseArea(W.type).run();
348
+ },
349
+ className: v.button,
350
+ children: /* @__PURE__ */ b(n, {})
351
+ }),
352
+ Y.showDone && /* @__PURE__ */ b(t, { onClick: () => {
353
+ G?.(_.getHTML()), _.commands.blur();
354
+ } })
355
+ ]
356
+ }),
357
+ q && /* @__PURE__ */ b(p, {
358
+ editor: _,
359
+ opts: {
360
+ ...q,
361
+ renderPopOver: (e, t) => console.log("Show popover", t),
362
+ closePopOver: () => console.log("Close popover")
363
+ },
364
+ onClose: () => J(!1)
365
+ })
366
+ ]
367
+ });
368
+ }
369
+ var U = (e) => {
370
+ v();
371
+ let t = {
372
+ defaultToolbar: "defaultToolbar",
373
+ buttonsContainer: "buttonsContainer",
374
+ button: "button",
375
+ active: "active",
376
+ disabled: "disabled",
377
+ isActive: "isActive",
378
+ toolbar: "toolbar",
379
+ toolbarWithNoDone: "toolbarWithNoDone",
380
+ toolbarTop: "toolbarTop",
381
+ toolbarRight: "toolbarRight",
382
+ fullWidth: "fullWidth",
383
+ hidden: "hidden",
384
+ autoWidth: "autoWidth",
385
+ focused: "focused",
386
+ iconRoot: "iconRoot",
387
+ label: "label",
388
+ shared: "shared"
389
+ };
390
+ return /* @__PURE__ */ b(W, { children: /* @__PURE__ */ b(H, {
391
+ ...e,
392
+ classes: t
393
+ }) });
394
+ }, W = _("div")(({ theme: e }) => ({
395
+ "& .defaultToolbar": {
396
+ display: "flex",
397
+ width: "100%",
398
+ justifyContent: "space-between"
399
+ },
400
+ "& .buttonsContainer": {
401
+ alignItems: "center",
402
+ display: "flex",
403
+ width: "100%"
404
+ },
405
+ "& .button": {
406
+ color: "grey",
407
+ display: "inline-flex",
408
+ padding: "2px",
409
+ background: "none",
410
+ border: "none",
411
+ cursor: "pointer",
412
+ "&:hover": { color: "black" },
413
+ "&:focus": { outline: `2px solid ${e.palette.grey[700]}` }
414
+ },
415
+ "& .active": { color: "black" },
416
+ "& .disabled": {
417
+ opacity: .7,
418
+ cursor: "not-allowed",
419
+ "& :hover": { color: "grey" }
420
+ },
421
+ "& .isActive": {
422
+ background: "var(--purple)",
423
+ color: "var(--white)"
424
+ },
425
+ "& .toolbar": {
426
+ position: "absolute",
427
+ zIndex: 20,
428
+ cursor: "pointer",
429
+ justifyContent: "space-between",
430
+ background: "var(--editable-html-toolbar-bg, #efefef)",
431
+ minWidth: "280px",
432
+ margin: "5px 0 0 0",
433
+ padding: "2px",
434
+ 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)",
435
+ boxSizing: "border-box",
436
+ display: "flex",
437
+ opacity: 0,
438
+ pointerEvents: "none"
439
+ },
440
+ "& .toolbarWithNoDone": { minWidth: "265px" },
441
+ "& .toolbarTop": { top: "-45px" },
442
+ "& .toolbarRight": { right: 0 },
443
+ "& .fullWidth": { width: "100%" },
444
+ "& .hidden": { visibility: "hidden" },
445
+ "& .autoWidth": { width: "auto" },
446
+ "& .focused": {
447
+ opacity: 1,
448
+ pointerEvents: "auto"
449
+ },
450
+ "& .iconRoot": {
451
+ width: "28px",
452
+ height: "28px",
453
+ padding: "4px",
454
+ verticalAlign: "top"
455
+ },
456
+ "& .label": { color: "var(--editable-html-toolbar-check, #00bb00)" },
457
+ "& .shared": { display: "flex" }
458
+ }));
459
+ //#endregion
460
+ export { U 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
+ declare function TiptapContainer(props: any): JSX.Element;
10
+ export default TiptapContainer;
11
+ //# sourceMappingURL=TiptapContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TiptapContainer.d.ts","sourceRoot":"","sources":["../../src/components/TiptapContainer.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAuIH,iBAAS,eAAe,CAAC,KAAK,KAAA,eAkF7B;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,157 @@
1
+ import { valueToSize as e } from "../utils/size.js";
2
+ import t from "./MenuBar.js";
3
+ import { useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
4
+ import { styled as o } from "@mui/material/styles";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { color as l } from "@pie-lib/render-ui";
7
+ //#region src/components/TiptapContainer.tsx
8
+ var u = o("div", { shouldForwardProp: (e) => !["noBorder", "error"].includes(e) })(({ theme: e, noBorder: t, error: n }) => ({
9
+ position: "relative",
10
+ padding: "0px",
11
+ border: t ? "none" : "1px solid #ccc",
12
+ borderRadius: "4px",
13
+ cursor: "text",
14
+ "& [data-slate-editor=\"true\"]": {
15
+ wordBreak: "break-word",
16
+ overflow: "visible",
17
+ maxHeight: "500px",
18
+ padding: "5px"
19
+ },
20
+ "&:first-child": { marginTop: 0 },
21
+ "& ul, & ol": {
22
+ padding: "0 1rem",
23
+ margin: "1.25rem 1rem 1.25rem 0.4rem"
24
+ },
25
+ "& ul li p, & ol li p": {
26
+ marginTop: "0.25em",
27
+ marginBottom: "0.25em"
28
+ },
29
+ "& h1, & h2, & h3, & h4, & h5, & h6": {
30
+ lineHeight: 1.1,
31
+ marginTop: "2.5rem",
32
+ textWrap: "pretty"
33
+ },
34
+ "& h1, & h2": {
35
+ marginTop: "3.5rem",
36
+ marginBottom: "1.5rem"
37
+ },
38
+ "& h1": { fontSize: "1.4rem" },
39
+ "& h2": { fontSize: "1.2rem" },
40
+ "& h3": { fontSize: "1.1rem" },
41
+ "& h4, & h5, & h6": { fontSize: "1rem" },
42
+ "& code": {
43
+ backgroundColor: "var(--purple-light)",
44
+ borderRadius: "0.4rem",
45
+ color: "var(--black)",
46
+ fontSize: "0.85rem",
47
+ padding: "0.25em 0.3em"
48
+ },
49
+ "& pre": {
50
+ background: "var(--black)",
51
+ borderRadius: "0.5rem",
52
+ color: "var(--white)",
53
+ fontFamily: "'JetBrainsMono', monospace",
54
+ margin: "1.5rem 0",
55
+ padding: "0.75rem 1rem",
56
+ "& code": {
57
+ background: "none",
58
+ color: "inherit",
59
+ fontSize: "0.8rem",
60
+ padding: 0
61
+ }
62
+ },
63
+ "& blockquote": {
64
+ background: "#f9f9f9",
65
+ borderLeft: "5px solid #ccc",
66
+ margin: "1.5em 10px",
67
+ padding: ".5em 10px"
68
+ },
69
+ "& hr": {
70
+ border: "none",
71
+ borderTop: "1px solid var(--gray-2)",
72
+ margin: "2rem 0"
73
+ },
74
+ "& p": { margin: "0" },
75
+ "& table": {
76
+ tableLayout: "fixed",
77
+ width: "100%",
78
+ borderCollapse: "collapse",
79
+ color: l.text(),
80
+ backgroundColor: l.background()
81
+ },
82
+ "& table:not([border=\"1\"]) tr": { borderTop: "1px solid #dfe2e5" },
83
+ "& td, th": {
84
+ padding: ".6em 1em",
85
+ textAlign: "center"
86
+ },
87
+ "& table:not([border=\"1\"]) td, th": { border: "1px solid #dfe2e5" },
88
+ ...n && { border: `2px solid ${e.palette.error.main} !important` }
89
+ })), d = o("div", { shouldForwardProp: (e) => !["disableScrollbar", "highlightShape"].includes(e) })(({ theme: e, disableScrollbar: t, highlightShape: n }) => ({
90
+ position: "relative",
91
+ padding: "0px",
92
+ overflowY: "auto",
93
+ color: l.text(),
94
+ backgroundColor: n ? e.palette.action.selected : l.background(),
95
+ ...t && {
96
+ "&::-webkit-scrollbar": { display: "none" },
97
+ scrollbarWidth: "none",
98
+ "-ms-overflow-style": "none"
99
+ }
100
+ })), f = o("div", { shouldForwardProp: (e) => e !== "noPadding" })(({ noPadding: e }) => ({ padding: e ? 0 : "10px 8px" }));
101
+ function p(o) {
102
+ let [l, p] = a(null), m = i(null), { editor: h, disabled: g, children: _, disableScrollbar: v, activePlugins: y, toolbarOpts: b, responseAreaProps: x, autoFocus: S, minWidth: C, width: w, maxWidth: T, minHeight: E, height: D, maxHeight: O, highlightShape: k, ref: A } = o;
103
+ n(() => {
104
+ h && S && Promise.resolve().then(() => {
105
+ h.commands.focus("end");
106
+ });
107
+ }, [h, S]), n(() => {
108
+ if (o.adjustWidthForLimit) {
109
+ let e = document.createElement("p");
110
+ e.style.visibility = "hidden", e.style.position = "absolute", e.textContent = "W".repeat(o.charactersLimit), m.current.appendChild(e), p(`${e.offsetWidth + 27}px`), e.remove();
111
+ }
112
+ }, [o.adjustWidthForLimit, o.charactersLimit]);
113
+ let j = r(() => ({
114
+ width: e(l || w),
115
+ minWidth: e(C),
116
+ maxWidth: e(T),
117
+ height: e(D),
118
+ minHeight: e(E),
119
+ maxHeight: e(O)
120
+ }), [
121
+ l,
122
+ C,
123
+ w,
124
+ T,
125
+ E,
126
+ D,
127
+ O
128
+ ]);
129
+ return /* @__PURE__ */ c(u, {
130
+ noBorder: b && b.noBorder,
131
+ error: b && b.error,
132
+ className: o.className,
133
+ style: {
134
+ width: j.width,
135
+ minWidth: j.minWidth,
136
+ maxWidth: j.maxWidth
137
+ },
138
+ ref: m,
139
+ children: [/* @__PURE__ */ s(d, {
140
+ disableScrollbar: v,
141
+ highlightShape: k,
142
+ children: /* @__PURE__ */ s(f, {
143
+ noPadding: b && b.noPadding,
144
+ children: _
145
+ })
146
+ }), h && /* @__PURE__ */ s(t, {
147
+ editor: h,
148
+ responseAreaProps: x,
149
+ toolbarOpts: b,
150
+ activePlugins: y,
151
+ onChange: o.onChange,
152
+ autoWidthToolbar: o.autoWidthToolbar
153
+ })]
154
+ });
155
+ }
156
+ //#endregion
157
+ export { p as default };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/editable-html-tip-tap/src/components/characters/characterUtils.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 spanishConfig: {
10
+ characters: string[][];
11
+ };
12
+ export declare const specialConfig: {
13
+ hasPreview: boolean;
14
+ characters: ({
15
+ unicode: string;
16
+ description: string;
17
+ write: string;
18
+ label: string;
19
+ extraProps?: undefined;
20
+ } | {
21
+ unicode: string;
22
+ description: string;
23
+ write: string;
24
+ label: string;
25
+ extraProps: {
26
+ style: {
27
+ gridRow: string;
28
+ };
29
+ };
30
+ })[][];
31
+ };
32
+ export declare const characterIcons: {
33
+ spanish: string;
34
+ special: string;
35
+ };
36
+ //# sourceMappingURL=characterUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"characterUtils.d.ts","sourceRoot":"","sources":["../../../src/components/characters/characterUtils.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,eAAO,MAAM,aAAa;;CAOzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;CAgbzB,CAAC;AAEF,eAAO,MAAM,cAAc;;;CAG1B,CAAC"}