@pie-lib/editable-html-tip-tap 2.1.2-next.31 → 2.1.2-next.36

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 (280) hide show
  1. package/CHANGELOG.json +32 -0
  2. package/CHANGELOG.md +2532 -0
  3. package/LICENSE.md +5 -0
  4. package/lib/components/CharacterPicker.js +201 -0
  5. package/lib/components/CharacterPicker.js.map +1 -0
  6. package/lib/components/EditableHtml.js +376 -0
  7. package/lib/components/EditableHtml.js.map +1 -0
  8. package/lib/components/MenuBar.js +697 -0
  9. package/lib/components/MenuBar.js.map +1 -0
  10. package/lib/components/TiptapContainer.js +234 -0
  11. package/lib/components/TiptapContainer.js.map +1 -0
  12. package/lib/components/characters/characterUtils.js +378 -0
  13. package/lib/components/characters/characterUtils.js.map +1 -0
  14. package/lib/components/characters/custom-popper.js +44 -0
  15. package/lib/components/characters/custom-popper.js.map +1 -0
  16. package/lib/components/common/done-button.js +34 -0
  17. package/lib/components/common/done-button.js.map +1 -0
  18. package/lib/components/common/toolbar-buttons.js +144 -0
  19. package/lib/components/common/toolbar-buttons.js.map +1 -0
  20. package/lib/components/icons/CssIcon.js +25 -0
  21. package/lib/components/icons/CssIcon.js.map +1 -0
  22. package/lib/components/icons/RespArea.js +72 -0
  23. package/lib/components/icons/RespArea.js.map +1 -0
  24. package/lib/components/icons/TableIcons.js +53 -0
  25. package/lib/components/icons/TableIcons.js.map +1 -0
  26. package/lib/components/icons/TextAlign.js +157 -0
  27. package/lib/components/icons/TextAlign.js.map +1 -0
  28. package/lib/components/image/AltDialog.js +98 -0
  29. package/lib/components/image/AltDialog.js.map +1 -0
  30. package/lib/components/image/ImageToolbar.js +137 -0
  31. package/lib/components/image/ImageToolbar.js.map +1 -0
  32. package/lib/components/image/InsertImageHandler.js +135 -0
  33. package/lib/components/image/InsertImageHandler.js.map +1 -0
  34. package/lib/components/media/MediaDialog.js +594 -0
  35. package/lib/components/media/MediaDialog.js.map +1 -0
  36. package/lib/components/media/MediaToolbar.js +74 -0
  37. package/lib/components/media/MediaToolbar.js.map +1 -0
  38. package/lib/components/media/MediaWrapper.js +67 -0
  39. package/lib/components/media/MediaWrapper.js.map +1 -0
  40. package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js +84 -0
  41. package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js.map +1 -0
  42. package/lib/components/respArea/DragInTheBlank/choice.js +250 -0
  43. package/lib/components/respArea/DragInTheBlank/choice.js.map +1 -0
  44. package/lib/components/respArea/ExplicitConstructedResponse.js +137 -0
  45. package/lib/components/respArea/ExplicitConstructedResponse.js.map +1 -0
  46. package/lib/components/respArea/InlineDropdown.js +210 -0
  47. package/lib/components/respArea/InlineDropdown.js.map +1 -0
  48. package/lib/components/respArea/MathTemplated.js +130 -0
  49. package/lib/components/respArea/MathTemplated.js.map +1 -0
  50. package/lib/components/respArea/ToolbarIcon.js +81 -0
  51. package/lib/components/respArea/ToolbarIcon.js.map +1 -0
  52. package/lib/components/respArea/inlineDropdownUtils.js +67 -0
  53. package/lib/components/respArea/inlineDropdownUtils.js.map +1 -0
  54. package/lib/constants.js +11 -0
  55. package/lib/constants.js.map +1 -0
  56. package/lib/extensions/css.js +217 -0
  57. package/lib/extensions/css.js.map +1 -0
  58. package/lib/extensions/custom-toolbar-wrapper.js +92 -0
  59. package/lib/extensions/custom-toolbar-wrapper.js.map +1 -0
  60. package/lib/extensions/div-node.js +83 -0
  61. package/lib/extensions/div-node.js.map +1 -0
  62. package/lib/extensions/ensure-empty-root-div.js +48 -0
  63. package/lib/extensions/ensure-empty-root-div.js.map +1 -0
  64. package/lib/extensions/ensure-list-item-content-is-div.js +64 -0
  65. package/lib/extensions/ensure-list-item-content-is-div.js.map +1 -0
  66. package/lib/extensions/extended-list-item.js +15 -0
  67. package/lib/extensions/extended-list-item.js.map +1 -0
  68. package/lib/extensions/extended-table-cell.js +22 -0
  69. package/lib/extensions/extended-table-cell.js.map +1 -0
  70. package/lib/extensions/extended-table.js +75 -0
  71. package/lib/extensions/extended-table.js.map +1 -0
  72. package/lib/extensions/heading-paragraph.js +61 -0
  73. package/lib/extensions/heading-paragraph.js.map +1 -0
  74. package/lib/extensions/image-component.js +348 -0
  75. package/lib/extensions/image-component.js.map +1 -0
  76. package/lib/extensions/image.js +134 -0
  77. package/lib/extensions/image.js.map +1 -0
  78. package/lib/extensions/index.js +46 -0
  79. package/lib/extensions/index.js.map +1 -0
  80. package/lib/extensions/math.js +342 -0
  81. package/lib/extensions/math.js.map +1 -0
  82. package/lib/extensions/media.js +243 -0
  83. package/lib/extensions/media.js.map +1 -0
  84. package/lib/extensions/responseArea.js +446 -0
  85. package/lib/extensions/responseArea.js.map +1 -0
  86. package/lib/index.js +37 -0
  87. package/lib/index.js.map +1 -0
  88. package/lib/styles/editorContainerStyles.js +137 -0
  89. package/lib/styles/editorContainerStyles.js.map +1 -0
  90. package/lib/theme.js +8 -0
  91. package/lib/theme.js.map +1 -0
  92. package/lib/utils/helper.js +73 -0
  93. package/lib/utils/helper.js.map +1 -0
  94. package/lib/utils/size.js +26 -0
  95. package/lib/utils/size.js.map +1 -0
  96. package/lib/utils/toolbar.js +19 -0
  97. package/lib/utils/toolbar.js.map +1 -0
  98. package/package.json +24 -40
  99. package/src/__tests__/EditableHtml.test.jsx +554 -0
  100. package/src/__tests__/constants.test.js +19 -0
  101. package/src/__tests__/div-to-paragraph-conversion.test.jsx +125 -0
  102. package/src/__tests__/extensions.test.js +208 -0
  103. package/src/__tests__/index.test.jsx +154 -0
  104. package/src/__tests__/size-utils.test.js +64 -0
  105. package/src/__tests__/theme.test.js +17 -0
  106. package/src/components/CharacterPicker.jsx +207 -0
  107. package/src/components/EditableHtml.jsx +440 -0
  108. package/src/components/MenuBar.jsx +556 -0
  109. package/src/components/TiptapContainer.jsx +219 -0
  110. package/src/components/__tests__/AltDialog.test.jsx +147 -0
  111. package/src/components/__tests__/CharacterPicker.test.jsx +261 -0
  112. package/src/components/__tests__/CssIcon.test.jsx +46 -0
  113. package/src/components/__tests__/DragInTheBlank.test.jsx +255 -0
  114. package/src/components/__tests__/ExplicitConstructedResponse.test.jsx +209 -0
  115. package/src/components/__tests__/ImageToolbar.test.jsx +128 -0
  116. package/src/components/__tests__/InlineDropdown.test.jsx +393 -0
  117. package/src/components/__tests__/InsertImageHandler.test.js +161 -0
  118. package/src/components/__tests__/MediaDialog.test.jsx +293 -0
  119. package/src/components/__tests__/MediaToolbar.test.jsx +74 -0
  120. package/src/components/__tests__/MediaWrapper.test.jsx +81 -0
  121. package/src/components/__tests__/MenuBar.test.jsx +250 -0
  122. package/src/components/__tests__/RespArea.test.jsx +122 -0
  123. package/src/components/__tests__/TableIcons.test.jsx +149 -0
  124. package/src/components/__tests__/TextAlign.test.jsx +167 -0
  125. package/src/components/__tests__/TiptapContainer.test.jsx +138 -0
  126. package/src/components/__tests__/characterUtils.test.js +166 -0
  127. package/src/components/__tests__/choice.test.jsx +171 -0
  128. package/src/components/__tests__/custom-popper.test.jsx +82 -0
  129. package/src/components/__tests__/done-button.test.jsx +54 -0
  130. package/src/components/__tests__/toolbar-buttons.test.jsx +234 -0
  131. package/src/components/characters/characterUtils.js +447 -0
  132. package/src/components/characters/custom-popper.js +38 -0
  133. package/src/components/common/done-button.jsx +27 -0
  134. package/src/components/common/toolbar-buttons.jsx +122 -0
  135. package/src/components/icons/CssIcon.jsx +15 -0
  136. package/src/components/icons/RespArea.jsx +71 -0
  137. package/src/components/icons/TableIcons.jsx +52 -0
  138. package/src/components/icons/TextAlign.jsx +114 -0
  139. package/src/components/image/AltDialog.jsx +82 -0
  140. package/src/components/image/ImageToolbar.jsx +99 -0
  141. package/src/components/image/InsertImageHandler.js +107 -0
  142. package/src/components/media/MediaDialog.jsx +596 -0
  143. package/src/components/media/MediaToolbar.jsx +49 -0
  144. package/src/components/media/MediaWrapper.jsx +39 -0
  145. package/src/components/respArea/DragInTheBlank/DragInTheBlank.jsx +76 -0
  146. package/src/components/respArea/DragInTheBlank/choice.jsx +256 -0
  147. package/src/components/respArea/ExplicitConstructedResponse.jsx +136 -0
  148. package/src/components/respArea/InlineDropdown.jsx +221 -0
  149. package/src/components/respArea/MathTemplated.jsx +124 -0
  150. package/src/components/respArea/ToolbarIcon.jsx +66 -0
  151. package/src/components/respArea/__tests__/MathTemplated.test.jsx +210 -0
  152. package/src/components/respArea/inlineDropdownUtils.js +79 -0
  153. package/src/constants.js +5 -0
  154. package/src/extensions/__tests__/css.test.js +196 -0
  155. package/src/extensions/__tests__/custom-toolbar-wrapper.test.jsx +180 -0
  156. package/src/extensions/__tests__/divNode.test.js +87 -0
  157. package/src/extensions/__tests__/ensure-empty-root-div.test.js +57 -0
  158. package/src/extensions/__tests__/ensure-list-item-content-is-div.test.js +44 -0
  159. package/src/extensions/__tests__/extended-list-item.test.js +13 -0
  160. package/src/extensions/__tests__/extended-table-cell.test.js +22 -0
  161. package/src/extensions/__tests__/extended-table.test.js +183 -0
  162. package/src/extensions/__tests__/image-component.test.jsx +345 -0
  163. package/src/extensions/__tests__/image.test.js +237 -0
  164. package/src/extensions/__tests__/math.test.js +604 -0
  165. package/src/extensions/__tests__/media-node-view.test.jsx +298 -0
  166. package/src/extensions/__tests__/media.test.js +271 -0
  167. package/src/extensions/__tests__/responseArea.test.js +601 -0
  168. package/src/extensions/css.js +220 -0
  169. package/src/extensions/custom-toolbar-wrapper.jsx +78 -0
  170. package/src/extensions/div-node.js +86 -0
  171. package/src/extensions/ensure-empty-root-div.js +47 -0
  172. package/src/extensions/ensure-list-item-content-is-div.js +62 -0
  173. package/src/extensions/extended-list-item.js +10 -0
  174. package/src/extensions/extended-table-cell.js +19 -0
  175. package/src/extensions/extended-table.js +60 -0
  176. package/src/extensions/heading-paragraph.js +53 -0
  177. package/src/extensions/image-component.jsx +338 -0
  178. package/src/extensions/image.js +109 -0
  179. package/src/extensions/index.js +81 -0
  180. package/src/extensions/math.js +325 -0
  181. package/src/extensions/media.js +188 -0
  182. package/src/extensions/responseArea.js +401 -0
  183. package/src/index.jsx +5 -0
  184. package/src/styles/editorContainerStyles.js +145 -0
  185. package/src/theme.js +1 -0
  186. package/src/utils/__tests__/helper.test.js +126 -0
  187. package/src/utils/__tests__/toolbar.test.js +43 -0
  188. package/src/utils/helper.js +69 -0
  189. package/src/utils/size.js +32 -0
  190. package/src/utils/toolbar.js +15 -0
  191. package/dist/components/CharacterPicker.d.ts +0 -31
  192. package/dist/components/CharacterPicker.js +0 -131
  193. package/dist/components/EditableHtml.d.ts +0 -11
  194. package/dist/components/EditableHtml.js +0 -291
  195. package/dist/components/MenuBar.d.ts +0 -11
  196. package/dist/components/MenuBar.js +0 -462
  197. package/dist/components/TiptapContainer.d.ts +0 -11
  198. package/dist/components/TiptapContainer.js +0 -154
  199. package/dist/components/characters/characterUtils.d.ts +0 -35
  200. package/dist/components/characters/characterUtils.js +0 -465
  201. package/dist/components/characters/custom-popper.d.ts +0 -14
  202. package/dist/components/characters/custom-popper.js +0 -32
  203. package/dist/components/common/done-button.d.ts +0 -30
  204. package/dist/components/common/done-button.js +0 -26
  205. package/dist/components/common/toolbar-buttons.d.ts +0 -38
  206. package/dist/components/common/toolbar-buttons.js +0 -91
  207. package/dist/components/icons/CssIcon.d.ts +0 -11
  208. package/dist/components/icons/CssIcon.js +0 -14
  209. package/dist/components/icons/RespArea.d.ts +0 -26
  210. package/dist/components/icons/RespArea.js +0 -42
  211. package/dist/components/icons/TableIcons.d.ts +0 -14
  212. package/dist/components/icons/TableIcons.js +0 -32
  213. package/dist/components/icons/TextAlign.d.ts +0 -18
  214. package/dist/components/icons/TextAlign.js +0 -134
  215. package/dist/components/image/AltDialog.d.ts +0 -22
  216. package/dist/components/image/AltDialog.js +0 -61
  217. package/dist/components/image/ImageToolbar.d.ts +0 -24
  218. package/dist/components/image/ImageToolbar.js +0 -80
  219. package/dist/components/image/InsertImageHandler.d.ts +0 -32
  220. package/dist/components/image/InsertImageHandler.js +0 -53
  221. package/dist/components/media/MediaDialog.d.ts +0 -43
  222. package/dist/components/media/MediaDialog.js +0 -389
  223. package/dist/components/media/MediaToolbar.d.ts +0 -19
  224. package/dist/components/media/MediaToolbar.js +0 -41
  225. package/dist/components/media/MediaWrapper.d.ts +0 -19
  226. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +0 -23
  227. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +0 -58
  228. package/dist/components/respArea/DragInTheBlank/choice.d.ts +0 -56
  229. package/dist/components/respArea/DragInTheBlank/choice.js +0 -156
  230. package/dist/components/respArea/ExplicitConstructedResponse.d.ts +0 -20
  231. package/dist/components/respArea/ExplicitConstructedResponse.js +0 -83
  232. package/dist/components/respArea/InlineDropdown.d.ts +0 -18
  233. package/dist/components/respArea/InlineDropdown.js +0 -119
  234. package/dist/components/respArea/MathTemplated.d.ts +0 -19
  235. package/dist/components/respArea/MathTemplated.js +0 -97
  236. package/dist/components/respArea/ToolbarIcon.d.ts +0 -14
  237. package/dist/components/respArea/ToolbarIcon.js +0 -17
  238. package/dist/components/respArea/inlineDropdownUtils.d.ts +0 -15
  239. package/dist/components/respArea/inlineDropdownUtils.js +0 -15
  240. package/dist/constants.d.ts +0 -13
  241. package/dist/constants.js +0 -4
  242. package/dist/extensions/css.d.ts +0 -11
  243. package/dist/extensions/css.js +0 -115
  244. package/dist/extensions/custom-toolbar-wrapper.d.ts +0 -11
  245. package/dist/extensions/custom-toolbar-wrapper.js +0 -61
  246. package/dist/extensions/div-node.d.ts +0 -10
  247. package/dist/extensions/div-node.js +0 -42
  248. package/dist/extensions/ensure-empty-root-div.d.ts +0 -14
  249. package/dist/extensions/ensure-empty-root-div.js +0 -24
  250. package/dist/extensions/ensure-list-item-content-is-div.d.ts +0 -15
  251. package/dist/extensions/ensure-list-item-content-is-div.js +0 -31
  252. package/dist/extensions/extended-list-item.d.ts +0 -13
  253. package/dist/extensions/extended-list-item.js +0 -5
  254. package/dist/extensions/extended-table-cell.d.ts +0 -10
  255. package/dist/extensions/extended-table-cell.js +0 -6
  256. package/dist/extensions/extended-table.d.ts +0 -17
  257. package/dist/extensions/extended-table.js +0 -34
  258. package/dist/extensions/heading-paragraph.d.ts +0 -17
  259. package/dist/extensions/heading-paragraph.js +0 -30
  260. package/dist/extensions/image-component.d.ts +0 -22
  261. package/dist/extensions/image-component.js +0 -220
  262. package/dist/extensions/image.d.ts +0 -10
  263. package/dist/extensions/image.js +0 -68
  264. package/dist/extensions/index.d.ts +0 -16
  265. package/dist/extensions/index.js +0 -64
  266. package/dist/extensions/math.d.ts +0 -15
  267. package/dist/extensions/math.js +0 -158
  268. package/dist/extensions/media.d.ts +0 -19
  269. package/dist/extensions/media.js +0 -149
  270. package/dist/extensions/responseArea.d.ts +0 -27
  271. package/dist/extensions/responseArea.js +0 -259
  272. package/dist/index.d.ts +0 -13
  273. package/dist/index.js +0 -7
  274. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +0 -16
  275. package/dist/styles/editorContainerStyles.d.ts +0 -134
  276. package/dist/theme.d.ts +0 -9
  277. package/dist/utils/helper.d.ts +0 -9
  278. package/dist/utils/helper.js +0 -27
  279. package/dist/utils/size.d.ts +0 -9
  280. package/dist/utils/size.js +0 -14
@@ -1,149 +0,0 @@
1
- import e from "../components/media/MediaDialog.js";
2
- import t from "../components/media/MediaToolbar.js";
3
- import { useEffect as n } from "react";
4
- import { NodeViewWrapper as r, ReactNodeViewRenderer as i } from "@tiptap/react";
5
- import { Node as a, mergeAttributes as o } from "@tiptap/core";
6
- import s from "react-dom";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
- //#region src/extensions/media.tsx
9
- var u = a.create({
10
- name: "media",
11
- group: "inline",
12
- inline: !0,
13
- atom: !0,
14
- addAttributes() {
15
- return {
16
- type: { default: "video" },
17
- src: { default: null },
18
- width: { default: null },
19
- height: { default: null },
20
- title: { default: null },
21
- starts: { default: null },
22
- ends: { default: null },
23
- editing: { default: !1 },
24
- tag: { default: "iframe" },
25
- url: { default: null }
26
- };
27
- },
28
- parseHTML() {
29
- return [{
30
- tag: "iframe[data-type=\"video\"]",
31
- getAttrs: (e) => ({
32
- type: "video",
33
- tag: "iframe",
34
- src: e.getAttribute("src"),
35
- width: e.getAttribute("width"),
36
- height: e.getAttribute("height"),
37
- title: e.dataset.title,
38
- starts: e.dataset.starts,
39
- ends: e.dataset.ends,
40
- url: e.dataset.url
41
- })
42
- }, {
43
- tag: "audio",
44
- getAttrs: (e) => ({
45
- type: "audio",
46
- tag: "audio",
47
- src: e.querySelector("source")?.getAttribute("src")
48
- })
49
- }];
50
- },
51
- renderHTML({ HTMLAttributes: e }) {
52
- let { tag: t, src: n, width: r, height: i } = e;
53
- return t === "audio" ? [
54
- "audio",
55
- {
56
- controls: "controls",
57
- controlsList: "nodownload"
58
- },
59
- ["source", {
60
- src: n,
61
- type: "audio/mp3"
62
- }]
63
- ] : ["iframe", o({
64
- "data-type": "video",
65
- frameborder: "0",
66
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
67
- allowfullscreen: "",
68
- src: n
69
- }, r ? { width: r } : {}, i ? { height: i } : {})];
70
- },
71
- addCommands() {
72
- return {
73
- insertMedia: (e) => ({ commands: t }) => t.insertContent({
74
- type: this.name,
75
- attrs: e
76
- }),
77
- updateMedia: (e) => ({ commands: t }) => t.updateAttributes(this.name, e)
78
- };
79
- },
80
- addNodeView() {
81
- return i((e) => /* @__PURE__ */ c(p, {
82
- ...e,
83
- options: this.options
84
- }));
85
- }
86
- }), d = () => {
87
- document.querySelectorAll(".insert-media-dialog").forEach((e) => e.remove());
88
- }, f = (t) => {
89
- let n = document.createElement("div"), { type: r, callback: i, options: a, ...o } = t, l = document.body.style.overflow;
90
- d(), n.className = "insert-media-dialog", document.body.style.overflow = "hidden";
91
- let u = (e, t) => {
92
- i(e, t), n.remove(), document.body.style.overflow = l;
93
- }, f = /* @__PURE__ */ c(e, {
94
- ...o,
95
- uploadSoundSupport: a.uploadSoundSupport,
96
- type: r,
97
- disablePortal: !0,
98
- open: !0,
99
- handleClose: u
100
- });
101
- s.render(f, n), document.body.appendChild(n);
102
- };
103
- function p({ editor: e, node: i, updateAttributes: a, deleteNode: o, options: s }) {
104
- let { type: u, src: d, width: p, height: m, tag: h } = i.attrs;
105
- return n(() => {
106
- d || f({
107
- ...i.attrs,
108
- options: s,
109
- edit: !0,
110
- callback: (t, n) => {
111
- t ? a(n) : o(), e.chain().focus().run();
112
- }
113
- });
114
- }, []), /* @__PURE__ */ l(r, {
115
- "data-type": u,
116
- style: {
117
- width: p,
118
- height: m
119
- },
120
- children: [h === "audio" ? /* @__PURE__ */ c("audio", {
121
- controls: !0,
122
- controlsList: "nodownload",
123
- children: /* @__PURE__ */ c("source", {
124
- type: "audio/mp3",
125
- src: d
126
- })
127
- }) : /* @__PURE__ */ c("iframe", {
128
- src: d,
129
- allowFullScreen: !0,
130
- frameBorder: "0",
131
- width: p,
132
- height: m
133
- }), /* @__PURE__ */ c(t, {
134
- onEdit: () => {
135
- f({
136
- ...i.attrs,
137
- options: s,
138
- edit: !0,
139
- callback: (t, n) => {
140
- t && a(n), e.chain().focus().run();
141
- }
142
- });
143
- },
144
- onRemove: o
145
- })]
146
- });
147
- }
148
- //#endregion
149
- export { u as Media };
@@ -1,27 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/editable-html-tip-tap/src/extensions/responseArea.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import { Extension } from '@tiptap/core';
10
- import { Node } from '@tiptap/react';
11
- export declare const ResponseAreaExtension: Extension<any, any>;
12
- /**
13
- * ExplicitConstructedResponse Node
14
- */
15
- export declare const ExplicitConstructedResponseNode: Node<any, any>;
16
- /**
17
- * MathTemplated Node
18
- */
19
- export declare const MathTemplatedNode: Node<any, any>;
20
- /**
21
- * DragInTheBlank Node
22
- */
23
- export declare const DragInTheBlankNode: Node<any, any>;
24
- /**
25
- * InlineDropdown Node
26
- */
27
- export declare const InlineDropdownNode: Node<any, any>;
@@ -1,259 +0,0 @@
1
- import e from "../components/respArea/ExplicitConstructedResponse.js";
2
- import t from "../components/respArea/DragInTheBlank/DragInTheBlank.js";
3
- import n from "../components/respArea/InlineDropdown.js";
4
- import r from "../components/respArea/MathTemplated.js";
5
- import "react";
6
- import { Node as i, ReactNodeViewRenderer as a } from "@tiptap/react";
7
- import { Extension as o } from "@tiptap/core";
8
- import { NodeSelection as s, Plugin as c, PluginKey as l, TextSelection as u } from "prosemirror-state";
9
- import { jsx as d } from "react/jsx-runtime";
10
- //#region src/extensions/responseArea.tsx
11
- var f = {}, p = (e) => String(e || "").replace(/-/g, "_"), m = (e) => e && e.attrs && e.attrs.index != null ? String(e.attrs.index) : null, h = (e, t) => {
12
- let n = [];
13
- return e.descendants((e, r) => {
14
- if (e.type && e.type.name === t) {
15
- let t = m(e);
16
- t != null && n.push({
17
- index: t,
18
- pos: r,
19
- node: e
20
- });
21
- }
22
- return !0;
23
- }), n;
24
- }, g = (e, t) => {
25
- let n = 0;
26
- return e.descendants((e) => (e.type && e.type.name === t && (n += 1), !0)), n;
27
- }, _ = ({ schema: e, typeName: t, index: n }) => {
28
- let r = e.nodes[t];
29
- return r ? r.create({
30
- index: String(n),
31
- id: String(n),
32
- value: ""
33
- }) : null;
34
- }, v = (e, t) => {
35
- let n = e.resolve(Math.min(t, e.content.size));
36
- return u.near(n, 1);
37
- }, y = o.create({
38
- name: "responseArea",
39
- addOptions() {
40
- return {
41
- maxResponseAreas: null,
42
- error: null,
43
- options: null,
44
- respAreaToolbar: null,
45
- onHandleAreaChange: null
46
- };
47
- },
48
- addProseMirrorPlugins() {
49
- if (!this.options.type) return [];
50
- let e = p(this.options.type);
51
- return [new c({
52
- key: new l(`response-area-watcher:${e}`),
53
- view: (t) => (f[e] === void 0 && (f[e] = 0, t.state.doc.descendants((t) => {
54
- if (t.type && t.type.name === e) {
55
- let n = m(t);
56
- if (n != null) {
57
- let t = parseInt(n, 10);
58
- !Number.isNaN(t) && t > f[e] && (f[e] = t);
59
- }
60
- }
61
- return !0;
62
- })), { update: (t, n) => {
63
- let r = t.state;
64
- if (n.doc.eq(r.doc)) return;
65
- let i = h(r.doc, e), a = h(n.doc, e);
66
- if (this.options.toolbar && (this.options.toolbar.disabled = i.length >= this.options.maxResponseAreas), a.length > i.length) {
67
- let e = new Set(i.map((e) => e.index)), t = a.filter((t) => !e.has(t.index));
68
- t.length && typeof this.options.onHandleAreaChange == "function" && this.options.onHandleAreaChange(t);
69
- }
70
- } })
71
- })];
72
- },
73
- addCommands() {
74
- return {
75
- insertResponseArea: (e) => ({ tr: t, state: n, dispatch: r, commands: i }) => {
76
- let a = p(e);
77
- if (g(n.doc, a) >= this.options.maxResponseAreas) return !1;
78
- f[a] === void 0 && (f[a] = 0);
79
- let o = f[a] + 1;
80
- f[a] += 1;
81
- let c = _({
82
- schema: n.schema,
83
- typeName: a,
84
- index: o
85
- });
86
- if (!c) return !1;
87
- let { selection: l } = n, u = l.from, d = (e) => {
88
- try {
89
- return t.insert(e, c), e;
90
- } catch {
91
- return null;
92
- }
93
- }, m = d(u);
94
- if (m ??= d(t.doc.content.size), m == null) return !1;
95
- if ([
96
- "math_templated",
97
- "inline_dropdown",
98
- "explicit_constructed_response"
99
- ].includes(a)) t.setSelection(s.create(t.doc, m));
100
- else {
101
- let e = m + c.nodeSize;
102
- t.setSelection(v(t.doc, e));
103
- }
104
- return r && (i.focus(), r(t)), !0;
105
- },
106
- refreshResponseArea: () => ({ tr: e, state: t, commands: n, dispatch: r }) => {
107
- let { selection: i } = t, a = i.$from.nodeAfter, o = i.from;
108
- return e.setNodeMarkup(o, void 0, {
109
- ...a?.attrs,
110
- updated: `${Date.now()}`
111
- }), e.setSelection(s.create(e.doc, o)), r && (n.focus(), r(e)), !0;
112
- }
113
- };
114
- }
115
- }), b = i.create({
116
- name: "explicit_constructed_response",
117
- group: "inline",
118
- inline: !0,
119
- atom: !0,
120
- addAttributes() {
121
- return {
122
- index: { default: null },
123
- value: { default: "" },
124
- updated: { default: "" }
125
- };
126
- },
127
- parseHTML() {
128
- return [{
129
- tag: "span[data-type=\"explicit_constructed_response\"]",
130
- getAttrs: (e) => ({
131
- index: e.dataset.index,
132
- value: e.dataset.value
133
- })
134
- }];
135
- },
136
- renderHTML({ HTMLAttributes: e }) {
137
- return ["span", {
138
- "data-type": "explicit_constructed_response",
139
- "data-index": e.index,
140
- "data-value": e.value
141
- }];
142
- },
143
- addNodeView() {
144
- return a((t) => /* @__PURE__ */ d(e, {
145
- ...t,
146
- options: this.options
147
- }));
148
- }
149
- }), x = i.create({
150
- name: "math_templated",
151
- group: "inline",
152
- inline: !0,
153
- atom: !0,
154
- addAttributes() {
155
- return {
156
- index: { default: null },
157
- value: { default: "" },
158
- updated: { default: "" }
159
- };
160
- },
161
- parseHTML() {
162
- return [{
163
- tag: "span[data-type=\"math_templated\"]",
164
- getAttrs: (e) => ({
165
- index: e.dataset.index,
166
- value: e.dataset.value
167
- })
168
- }];
169
- },
170
- renderHTML({ HTMLAttributes: e }) {
171
- return ["span", {
172
- "data-type": "math_templated",
173
- "data-index": e.index,
174
- "data-value": e.value
175
- }];
176
- },
177
- addNodeView() {
178
- return a((e) => /* @__PURE__ */ d(r, {
179
- ...e,
180
- options: this.options
181
- }));
182
- }
183
- }), S = i.create({
184
- name: "drag_in_the_blank",
185
- group: "inline",
186
- inline: !0,
187
- atom: !0,
188
- addAttributes() {
189
- return {
190
- index: { default: null },
191
- id: { default: null },
192
- value: { default: "" },
193
- inTable: { default: null },
194
- updated: { default: "" }
195
- };
196
- },
197
- parseHTML() {
198
- return [{
199
- tag: "span[data-type=\"drag_in_the_blank\"]",
200
- getAttrs: (e) => ({
201
- index: e.dataset.index,
202
- id: e.dataset.id,
203
- value: e.dataset.value,
204
- inTable: e.dataset.inTable
205
- })
206
- }];
207
- },
208
- renderHTML({ HTMLAttributes: e }) {
209
- return ["span", {
210
- "data-type": "drag_in_the_blank",
211
- "data-index": e.index,
212
- "data-id": e.id,
213
- "data-value": e.value,
214
- "data-in-table": e.inTable
215
- }];
216
- },
217
- addNodeView() {
218
- return a((e) => /* @__PURE__ */ d(t, {
219
- ...e,
220
- options: this.options
221
- }));
222
- }
223
- }), C = i.create({
224
- name: "inline_dropdown",
225
- group: "inline",
226
- inline: !0,
227
- atom: !0,
228
- addAttributes() {
229
- return {
230
- index: { default: null },
231
- value: { default: "" },
232
- updated: { default: "" }
233
- };
234
- },
235
- parseHTML() {
236
- return [{
237
- tag: "span[data-type=\"inline_dropdown\"]",
238
- getAttrs: (e) => ({
239
- index: e.dataset.index,
240
- value: e.dataset.value
241
- })
242
- }];
243
- },
244
- renderHTML({ HTMLAttributes: e }) {
245
- return ["span", {
246
- "data-type": "inline_dropdown",
247
- "data-index": e.index,
248
- "data-value": e.value
249
- }];
250
- },
251
- addNodeView() {
252
- return a((e) => /* @__PURE__ */ d(n, {
253
- ...e,
254
- options: this.options
255
- }));
256
- }
257
- });
258
- //#endregion
259
- export { S as DragInTheBlankNode, b as ExplicitConstructedResponseNode, C as InlineDropdownNode, x as MathTemplatedNode, y as ResponseAreaExtension };
package/dist/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/editable-html-tip-tap/src/index.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 StyledEditor, { EditableHtml } from './components/EditableHtml.js';
10
- import { ALL_PLUGINS, DEFAULT_PLUGINS } from './extensions/index.js';
11
- import { deleteInlineDropdownByIndex } from './components/respArea/inlineDropdownUtils.js';
12
- export { EditableHtml, ALL_PLUGINS, DEFAULT_PLUGINS, deleteInlineDropdownByIndex };
13
- export default StyledEditor;
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- import { ALL_PLUGINS as e, DEFAULT_PLUGINS as t } from "./extensions/index.js";
2
- import n from "./components/EditableHtml.js";
3
- import { deleteInlineDropdownByIndex as r } from "./components/respArea/inlineDropdownUtils.js";
4
- //#region src/index.tsx
5
- var i = n;
6
- //#endregion
7
- export { e as ALL_PLUGINS, t as DEFAULT_PLUGINS, n as EditableHtml, i as default, r as deleteInlineDropdownByIndex };
@@ -1,16 +0,0 @@
1
- //#region ../../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
2
- function e(t) {
3
- var n, r, i = "";
4
- if (typeof t == "string" || typeof t == "number") i += t;
5
- else if (typeof t == "object") if (Array.isArray(t)) {
6
- var a = t.length;
7
- for (n = 0; n < a; n++) t[n] && (r = e(t[n])) && (i && (i += " "), i += r);
8
- } else for (r in t) t[r] && (i && (i += " "), i += r);
9
- return i;
10
- }
11
- function t() {
12
- for (var t, n, r = 0, i = "", a = arguments.length; r < a; r++) (t = arguments[r]) && (n = e(t)) && (i && (i += " "), i += n);
13
- return i;
14
- }
15
- //#endregion
16
- export { t as default };
@@ -1,134 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/editable-html-tip-tap/src/styles/editorContainerStyles.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
- declare const styles: (theme: any) => {
10
- root: {
11
- position: string;
12
- padding: string;
13
- border: string;
14
- borderRadius: string;
15
- cursor: string;
16
- '& [data-slate-editor="true"]': {
17
- wordBreak: string;
18
- overflow: string;
19
- maxHeight: string;
20
- padding: string;
21
- };
22
- '&:first-child': {
23
- marginTop: number;
24
- };
25
- '& ul, & ol': {
26
- padding: string;
27
- margin: string;
28
- };
29
- '& ul li p, & ol li p': {
30
- marginTop: string;
31
- marginBottom: string;
32
- };
33
- '& h1, & h2, & h3, & h4, & h5, & h6': {
34
- lineHeight: number;
35
- marginTop: string;
36
- textWrap: string;
37
- };
38
- '& h1, & h2': {
39
- marginTop: string;
40
- marginBottom: string;
41
- };
42
- '& h1': {
43
- fontSize: string;
44
- };
45
- '& h2': {
46
- fontSize: string;
47
- };
48
- '& h3': {
49
- fontSize: string;
50
- };
51
- '& h4, & h5, & h6': {
52
- fontSize: string;
53
- };
54
- '& code': {
55
- backgroundColor: string;
56
- borderRadius: string;
57
- color: string;
58
- fontSize: string;
59
- padding: string;
60
- };
61
- '& pre': {
62
- background: string;
63
- borderRadius: string;
64
- color: string;
65
- fontFamily: string;
66
- margin: string;
67
- padding: string;
68
- '& code': {
69
- background: string;
70
- color: string;
71
- fontSize: string;
72
- padding: number;
73
- };
74
- };
75
- '& blockquote': {
76
- background: string;
77
- borderLeft: string;
78
- margin: string;
79
- padding: string;
80
- };
81
- '& hr': {
82
- border: string;
83
- borderTop: string;
84
- margin: string;
85
- };
86
- '& table': {
87
- tableLayout: string;
88
- width: string;
89
- borderCollapse: string;
90
- color: any;
91
- backgroundColor: any;
92
- };
93
- '& table:not([border="1"]) tr': {
94
- borderTop: string;
95
- };
96
- '& td, th': {
97
- padding: string;
98
- textAlign: string;
99
- };
100
- '& table:not([border="1"]) td, th': {
101
- border: string;
102
- };
103
- };
104
- children: {
105
- padding: string;
106
- };
107
- editorHolder: {
108
- position: string;
109
- padding: string;
110
- overflowY: string;
111
- color: any;
112
- backgroundColor: any;
113
- };
114
- disabledScrollbar: {
115
- '&::-webkit-scrollbar': {
116
- display: string;
117
- };
118
- scrollbarWidth: string;
119
- '-ms-overflow-style': string;
120
- };
121
- error: {
122
- border: string;
123
- };
124
- noBorder: {
125
- border: string;
126
- };
127
- noPadding: {
128
- padding: number;
129
- };
130
- toolbarOnTop: {
131
- marginTop: string;
132
- };
133
- };
134
- export default styles;
package/dist/theme.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/editable-html-tip-tap/src/theme.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 primary = "#304ffe";
@@ -1,9 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/editable-html-tip-tap/src/utils/helper.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 normalizeInitialMarkup: (markup: any) => any;
@@ -1,27 +0,0 @@
1
- //#region src/utils/helper.tsx
2
- var e = (e) => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), t = (e) => {
3
- let t = document.createElement("div");
4
- t.innerHTML = e;
5
- let n = Array.from(t.children);
6
- return n.length < 2 || !n.every((e) => e.tagName === "DIV") || !n.every((e) => e.attributes.length === 0) || !n.every((e) => Array.from(e.children).every((e) => {
7
- let t = e.tagName;
8
- return [
9
- "SPAN",
10
- "B",
11
- "I",
12
- "EM",
13
- "STRONG",
14
- "U",
15
- "SUB",
16
- "SUP",
17
- "A",
18
- "CODE",
19
- "BR"
20
- ].includes(t);
21
- })) ? e : `<p>${n.map((e) => e.innerHTML).join("<br>")}</p>`;
22
- }, n = (n) => {
23
- let r = String(n ?? "").trim();
24
- return r ? /<[^>]+>/.test(r) ? t(r) : `<div>${e(r)}</div>` : "<div></div>";
25
- };
26
- //#endregion
27
- export { n as normalizeInitialMarkup };
@@ -1,9 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/editable-html-tip-tap/src/utils/size.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 valueToSize: (v: any) => string | number | undefined;
@@ -1,14 +0,0 @@
1
- //#region src/utils/size.ts
2
- var e = (e) => {
3
- if (!e) return;
4
- let t = /^calc\((.*)\)$/;
5
- if (typeof e == "string") {
6
- if (e.endsWith("%")) return;
7
- if (e.endsWith("px") || e.endsWith("vh") || e.endsWith("vw") || e.endsWith("ch") || e.endsWith("em") || e.match(t)) return e;
8
- let n = parseInt(e, 10);
9
- return Number.isNaN(n) ? n : `${n}px`;
10
- }
11
- if (typeof e == "number") return `${e}px`;
12
- };
13
- //#endregion
14
- export { e as valueToSize };