@tiptap/react 2.0.0-beta.10 → 2.0.0-beta.103

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 (301) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +2 -2
  3. package/dist/packages/core/src/CommandManager.d.ts +20 -0
  4. package/dist/packages/core/src/Editor.d.ts +147 -0
  5. package/dist/packages/core/src/EventEmitter.d.ts +11 -0
  6. package/dist/packages/core/src/Extension.d.ts +227 -0
  7. package/dist/packages/core/src/ExtensionManager.d.ts +18 -0
  8. package/dist/packages/core/src/InputRule.d.ts +42 -0
  9. package/dist/packages/core/src/Mark.d.ts +319 -0
  10. package/dist/packages/core/src/Node.d.ts +388 -0
  11. package/dist/packages/core/src/NodeView.d.ts +27 -0
  12. package/dist/packages/core/src/PasteRule.d.ts +42 -0
  13. package/dist/packages/core/src/Tracker.d.ts +11 -0
  14. package/dist/packages/core/src/commands/blur.d.ts +12 -0
  15. package/dist/packages/core/src/commands/clearContent.d.ts +12 -0
  16. package/dist/packages/core/src/commands/clearNodes.d.ts +12 -0
  17. package/dist/packages/core/src/commands/command.d.ts +12 -0
  18. package/dist/packages/core/src/commands/createParagraphNear.d.ts +12 -0
  19. package/dist/packages/core/src/commands/deleteNode.d.ts +13 -0
  20. package/dist/packages/core/src/commands/deleteRange.d.ts +12 -0
  21. package/dist/packages/core/src/commands/deleteSelection.d.ts +12 -0
  22. package/dist/packages/core/src/commands/enter.d.ts +12 -0
  23. package/dist/packages/core/src/commands/exitCode.d.ts +12 -0
  24. package/dist/packages/core/src/commands/extendMarkRange.d.ts +13 -0
  25. package/dist/packages/core/src/commands/first.d.ts +12 -0
  26. package/dist/packages/core/src/commands/focus.d.ts +14 -0
  27. package/dist/packages/core/src/commands/forEach.d.ts +14 -0
  28. package/dist/packages/core/src/commands/insertContent.d.ts +16 -0
  29. package/dist/packages/core/src/commands/insertContentAt.d.ts +16 -0
  30. package/dist/packages/core/src/commands/joinBackward.d.ts +12 -0
  31. package/dist/packages/core/src/commands/joinForward.d.ts +12 -0
  32. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +12 -0
  33. package/dist/packages/core/src/commands/lift.d.ts +13 -0
  34. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +12 -0
  35. package/dist/packages/core/src/commands/liftListItem.d.ts +13 -0
  36. package/dist/packages/core/src/commands/newlineInCode.d.ts +12 -0
  37. package/dist/packages/core/src/commands/resetAttributes.d.ts +13 -0
  38. package/dist/packages/core/src/commands/scrollIntoView.d.ts +12 -0
  39. package/dist/packages/core/src/commands/selectAll.d.ts +12 -0
  40. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +12 -0
  41. package/dist/packages/core/src/commands/selectNodeForward.d.ts +12 -0
  42. package/dist/packages/core/src/commands/selectParentNode.d.ts +12 -0
  43. package/dist/packages/core/src/commands/setContent.d.ts +13 -0
  44. package/dist/packages/core/src/commands/setMark.d.ts +13 -0
  45. package/dist/packages/core/src/commands/setMeta.d.ts +12 -0
  46. package/dist/packages/core/src/commands/setNode.d.ts +13 -0
  47. package/dist/packages/core/src/commands/setNodeSelection.d.ts +12 -0
  48. package/dist/packages/core/src/commands/setTextSelection.d.ts +12 -0
  49. package/dist/packages/core/src/commands/sinkListItem.d.ts +13 -0
  50. package/dist/packages/core/src/commands/splitBlock.d.ts +14 -0
  51. package/dist/packages/core/src/commands/splitListItem.d.ts +13 -0
  52. package/dist/packages/core/src/commands/toggleList.d.ts +13 -0
  53. package/dist/packages/core/src/commands/toggleMark.d.ts +18 -0
  54. package/dist/packages/core/src/commands/toggleNode.d.ts +13 -0
  55. package/dist/packages/core/src/commands/toggleWrap.d.ts +13 -0
  56. package/dist/packages/core/src/commands/undoInputRule.d.ts +12 -0
  57. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +12 -0
  58. package/dist/packages/core/src/commands/unsetMark.d.ts +18 -0
  59. package/dist/packages/core/src/commands/updateAttributes.d.ts +13 -0
  60. package/dist/packages/core/src/commands/wrapIn.d.ts +13 -0
  61. package/dist/packages/core/src/commands/wrapInList.d.ts +13 -0
  62. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +2 -0
  63. package/dist/packages/core/src/extensions/commands.d.ts +98 -0
  64. package/dist/packages/core/src/extensions/editable.d.ts +2 -0
  65. package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -0
  66. package/dist/packages/core/src/extensions/index.d.ts +6 -0
  67. package/dist/packages/core/src/extensions/keymap.d.ts +2 -0
  68. package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
  69. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +7 -0
  70. package/dist/packages/core/src/helpers/createChainableState.d.ts +5 -0
  71. package/dist/packages/core/src/helpers/createDocument.d.ts +3 -0
  72. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +7 -0
  73. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +2 -0
  74. package/dist/packages/core/src/helpers/findChildren.d.ts +3 -0
  75. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +6 -0
  76. package/dist/packages/core/src/helpers/findParentNode.d.ts +9 -0
  77. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +8 -0
  78. package/dist/packages/core/src/helpers/generateHTML.d.ts +2 -0
  79. package/dist/packages/core/src/helpers/generateJSON.d.ts +2 -0
  80. package/dist/packages/core/src/helpers/generateText.d.ts +5 -0
  81. package/dist/packages/core/src/helpers/getAttributes.d.ts +3 -0
  82. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -0
  83. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -0
  84. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
  85. package/dist/packages/core/src/helpers/getExtensionField.d.ts +2 -0
  86. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -0
  87. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -0
  88. package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -0
  89. package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -0
  90. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -0
  91. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -0
  92. package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -0
  93. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -0
  94. package/dist/packages/core/src/helpers/getSchema.d.ts +3 -0
  95. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +3 -0
  96. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +2 -0
  97. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +2 -0
  98. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +2 -0
  99. package/dist/packages/core/src/helpers/getText.d.ts +6 -0
  100. package/dist/packages/core/src/helpers/getTextBetween.d.ts +6 -0
  101. package/dist/packages/core/src/helpers/getTextSeralizersFromSchema.d.ts +3 -0
  102. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -0
  103. package/dist/packages/core/src/helpers/isActive.d.ts +2 -0
  104. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
  105. package/dist/packages/core/src/helpers/isList.d.ts +2 -0
  106. package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -0
  107. package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -0
  108. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -0
  109. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -0
  110. package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -0
  111. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
  112. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -0
  113. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -0
  114. package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
  115. package/dist/packages/core/src/index.d.ts +60 -0
  116. package/dist/packages/core/src/inputRules/markInputRule.d.ts +12 -0
  117. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +12 -0
  118. package/dist/packages/core/src/inputRules/textInputRule.d.ts +9 -0
  119. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +14 -0
  120. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +23 -0
  121. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +12 -0
  122. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +9 -0
  123. package/dist/packages/core/src/style.d.ts +1 -0
  124. package/dist/packages/core/src/types.d.ts +210 -0
  125. package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -0
  126. package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -0
  127. package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -0
  128. package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -0
  129. package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
  130. package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
  131. package/dist/packages/core/src/utilities/isClass.d.ts +1 -0
  132. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -0
  133. package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
  134. package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
  135. package/dist/packages/core/src/utilities/isObject.d.ts +1 -0
  136. package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -0
  137. package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
  138. package/dist/packages/core/src/utilities/isString.d.ts +1 -0
  139. package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
  140. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -0
  141. package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -0
  142. package/dist/packages/core/src/utilities/minMax.d.ts +1 -0
  143. package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -0
  144. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -0
  145. package/dist/packages/extension-blockquote/src/blockquote.d.ts +24 -0
  146. package/dist/packages/extension-blockquote/src/index.d.ts +3 -0
  147. package/dist/packages/extension-bold/src/bold.d.ts +27 -0
  148. package/dist/packages/extension-bold/src/index.d.ts +3 -0
  149. package/dist/packages/extension-bubble-menu/src/bubble-menu-plugin.d.ts +43 -0
  150. package/dist/packages/extension-bubble-menu/src/bubble-menu.d.ts +6 -0
  151. package/dist/packages/extension-bubble-menu/src/index.d.ts +4 -0
  152. package/dist/packages/extension-bullet-list/src/bullet-list.d.ts +17 -0
  153. package/dist/packages/extension-bullet-list/src/index.d.ts +3 -0
  154. package/dist/packages/extension-character-count/src/character-count.d.ts +28 -0
  155. package/dist/packages/extension-character-count/src/index.d.ts +3 -0
  156. package/dist/packages/extension-code/src/code.d.ts +25 -0
  157. package/dist/packages/extension-code/src/index.d.ts +3 -0
  158. package/dist/packages/extension-code-block/src/code-block.d.ts +26 -0
  159. package/dist/packages/extension-code-block/src/index.d.ts +3 -0
  160. package/dist/packages/extension-code-block-lowlight/src/code-block-lowlight.d.ts +6 -0
  161. package/dist/packages/extension-code-block-lowlight/src/index.d.ts +3 -0
  162. package/dist/packages/extension-code-block-lowlight/src/lowlight-plugin.d.ts +6 -0
  163. package/dist/packages/extension-collaboration/src/collaboration.d.ts +30 -0
  164. package/dist/packages/extension-collaboration/src/helpers/isChangeOrigin.d.ts +2 -0
  165. package/dist/packages/extension-collaboration/src/index.d.ts +4 -0
  166. package/dist/packages/extension-collaboration-cursor/src/collaboration-cursor.d.ts +37 -0
  167. package/dist/packages/extension-collaboration-cursor/src/index.d.ts +3 -0
  168. package/dist/packages/extension-color/src/color.d.ts +20 -0
  169. package/dist/packages/extension-color/src/index.d.ts +3 -0
  170. package/dist/packages/extension-document/src/document.d.ts +2 -0
  171. package/dist/packages/extension-document/src/index.d.ts +3 -0
  172. package/dist/packages/extension-dropcursor/src/dropcursor.d.ts +7 -0
  173. package/dist/packages/extension-dropcursor/src/index.d.ts +3 -0
  174. package/dist/packages/extension-floating-menu/src/floating-menu-plugin.d.ts +40 -0
  175. package/dist/packages/extension-floating-menu/src/floating-menu.d.ts +6 -0
  176. package/dist/packages/extension-floating-menu/src/index.d.ts +4 -0
  177. package/dist/packages/extension-focus/src/focus.d.ts +6 -0
  178. package/dist/packages/extension-focus/src/index.d.ts +3 -0
  179. package/dist/packages/extension-font-family/src/font-family.d.ts +21 -0
  180. package/dist/packages/extension-font-family/src/index.d.ts +3 -0
  181. package/dist/packages/extension-gapcursor/src/gapcursor.d.ts +15 -0
  182. package/dist/packages/extension-gapcursor/src/index.d.ts +3 -0
  183. package/dist/packages/extension-hard-break/src/hard-break.d.ts +16 -0
  184. package/dist/packages/extension-hard-break/src/index.d.ts +3 -0
  185. package/dist/packages/extension-heading/src/heading.d.ts +26 -0
  186. package/dist/packages/extension-heading/src/index.d.ts +3 -0
  187. package/dist/packages/extension-highlight/src/highlight.d.ts +30 -0
  188. package/dist/packages/extension-highlight/src/index.d.ts +3 -0
  189. package/dist/packages/extension-history/src/history.d.ts +20 -0
  190. package/dist/packages/extension-history/src/index.d.ts +3 -0
  191. package/dist/packages/extension-horizontal-rule/src/horizontal-rule.d.ts +15 -0
  192. package/dist/packages/extension-horizontal-rule/src/index.d.ts +3 -0
  193. package/dist/packages/extension-image/src/image.d.ts +21 -0
  194. package/dist/packages/extension-image/src/index.d.ts +3 -0
  195. package/dist/packages/extension-italic/src/index.d.ts +3 -0
  196. package/dist/packages/extension-italic/src/italic.d.ts +27 -0
  197. package/dist/packages/extension-link/src/helpers/autolink.d.ts +7 -0
  198. package/dist/packages/extension-link/src/helpers/clickHandler.d.ts +7 -0
  199. package/dist/packages/extension-link/src/helpers/pasteHandler.d.ts +9 -0
  200. package/dist/packages/extension-link/src/index.d.ts +3 -0
  201. package/dist/packages/extension-link/src/link.d.ts +44 -0
  202. package/dist/packages/extension-list-item/src/index.d.ts +3 -0
  203. package/dist/packages/extension-list-item/src/list-item.d.ts +5 -0
  204. package/dist/packages/extension-mention/src/index.d.ts +3 -0
  205. package/dist/packages/extension-mention/src/mention.d.ts +14 -0
  206. package/dist/packages/extension-ordered-list/src/index.d.ts +3 -0
  207. package/dist/packages/extension-ordered-list/src/ordered-list.d.ts +17 -0
  208. package/dist/packages/extension-paragraph/src/index.d.ts +3 -0
  209. package/dist/packages/extension-paragraph/src/paragraph.d.ts +15 -0
  210. package/dist/packages/extension-placeholder/src/index.d.ts +3 -0
  211. package/dist/packages/extension-placeholder/src/placeholder.d.ts +15 -0
  212. package/dist/packages/extension-strike/src/index.d.ts +3 -0
  213. package/dist/packages/extension-strike/src/strike.d.ts +25 -0
  214. package/dist/packages/extension-subscript/src/index.d.ts +3 -0
  215. package/dist/packages/extension-subscript/src/subscript.d.ts +23 -0
  216. package/dist/packages/extension-superscript/src/index.d.ts +3 -0
  217. package/dist/packages/extension-superscript/src/superscript.d.ts +23 -0
  218. package/dist/packages/extension-table/src/TableView.d.ts +17 -0
  219. package/dist/packages/extension-table/src/index.d.ts +4 -0
  220. package/dist/packages/extension-table/src/table.d.ts +55 -0
  221. package/dist/packages/extension-table/src/utilities/createCell.d.ts +2 -0
  222. package/dist/packages/extension-table/src/utilities/createTable.d.ts +2 -0
  223. package/dist/packages/extension-table/src/utilities/deleteTableWhenAllCellsSelected.d.ts +2 -0
  224. package/dist/packages/extension-table/src/utilities/getTableNodeTypes.d.ts +4 -0
  225. package/dist/packages/extension-table/src/utilities/isCellSelection.d.ts +2 -0
  226. package/dist/packages/extension-table-cell/src/index.d.ts +3 -0
  227. package/dist/packages/extension-table-cell/src/table-cell.d.ts +5 -0
  228. package/dist/packages/extension-table-header/src/index.d.ts +3 -0
  229. package/dist/packages/extension-table-header/src/table-header.d.ts +5 -0
  230. package/dist/packages/extension-table-row/src/index.d.ts +3 -0
  231. package/dist/packages/extension-table-row/src/table-row.d.ts +5 -0
  232. package/dist/packages/extension-task-item/src/index.d.ts +3 -0
  233. package/dist/packages/extension-task-item/src/task-item.d.ts +7 -0
  234. package/dist/packages/extension-task-list/src/index.d.ts +3 -0
  235. package/dist/packages/extension-task-list/src/task-list.d.ts +16 -0
  236. package/dist/packages/extension-text/src/index.d.ts +3 -0
  237. package/dist/packages/extension-text/src/text.d.ts +2 -0
  238. package/dist/packages/extension-text-align/src/index.d.ts +3 -0
  239. package/dist/packages/extension-text-align/src/text-align.d.ts +21 -0
  240. package/dist/packages/extension-text-style/src/index.d.ts +3 -0
  241. package/dist/packages/extension-text-style/src/text-style.d.ts +15 -0
  242. package/dist/packages/extension-typography/src/index.d.ts +3 -0
  243. package/dist/packages/extension-typography/src/typography.d.ts +23 -0
  244. package/dist/packages/extension-underline/src/index.d.ts +3 -0
  245. package/dist/packages/extension-underline/src/underline.d.ts +23 -0
  246. package/dist/packages/html/src/generateHTML.d.ts +2 -0
  247. package/dist/packages/html/src/generateJSON.d.ts +2 -0
  248. package/dist/packages/html/src/getHTMLFromFragment.d.ts +2 -0
  249. package/dist/packages/html/src/index.d.ts +2 -0
  250. package/dist/packages/react/src/BubbleMenu.d.ts +3 -1
  251. package/dist/packages/react/src/EditorContent.d.ts +2 -2
  252. package/dist/packages/react/src/FloatingMenu.d.ts +8 -0
  253. package/dist/packages/react/src/NodeViewContent.d.ts +2 -2
  254. package/dist/packages/react/src/NodeViewWrapper.d.ts +2 -2
  255. package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +10 -5
  256. package/dist/packages/react/src/ReactRenderer.d.ts +13 -10
  257. package/dist/packages/react/src/index.d.ts +1 -0
  258. package/dist/packages/react/src/useEditor.d.ts +2 -1
  259. package/dist/packages/react/src/useReactNodeView.d.ts +1 -1
  260. package/dist/packages/starter-kit/src/index.d.ts +3 -0
  261. package/dist/packages/starter-kit/src/starter-kit.d.ts +37 -0
  262. package/dist/packages/suggestion/src/findSuggestionMatch.d.ts +15 -0
  263. package/dist/packages/suggestion/src/index.d.ts +4 -0
  264. package/dist/packages/suggestion/src/suggestion.d.ts +49 -0
  265. package/dist/tests/cypress/integration/core/can.spec.d.ts +1 -0
  266. package/dist/tests/cypress/integration/core/editorProps.spec.d.ts +1 -0
  267. package/dist/tests/cypress/integration/core/extendExtensions.spec.d.ts +1 -0
  268. package/dist/tests/cypress/integration/core/extendMarkRange.spec.d.ts +1 -0
  269. package/dist/tests/cypress/integration/core/extensionOptions.spec.d.ts +1 -0
  270. package/dist/tests/cypress/integration/core/fromString.spec.d.ts +1 -0
  271. package/dist/tests/cypress/integration/core/generateHTML.spec.d.ts +1 -0
  272. package/dist/tests/cypress/integration/core/generateJSON.spec.d.ts +1 -0
  273. package/dist/tests/cypress/integration/core/isActive.spec.d.ts +1 -0
  274. package/dist/tests/cypress/integration/core/isClass.spec.d.ts +1 -0
  275. package/dist/tests/cypress/integration/core/mergeAttributes.spec.d.ts +1 -0
  276. package/dist/tests/cypress/integration/core/mergeDeep.spec.d.ts +1 -0
  277. package/dist/tests/cypress/integration/core/pluginOrder.spec.d.ts +1 -0
  278. package/dist/tests/cypress/integration/extensions/bold.spec.d.ts +1 -0
  279. package/dist/tests/cypress/integration/extensions/codeBlockLowlight.spec.d.ts +1 -0
  280. package/dist/tests/cypress/integration/html/generateHTML.spec.d.ts +1 -0
  281. package/dist/tests/cypress/integration/html/generateJSON.spec.d.ts +1 -0
  282. package/dist/tiptap-react.cjs.js +143 -60
  283. package/dist/tiptap-react.cjs.js.map +1 -1
  284. package/dist/tiptap-react.esm.js +137 -53
  285. package/dist/tiptap-react.esm.js.map +1 -1
  286. package/dist/tiptap-react.umd.js +147 -65
  287. package/dist/tiptap-react.umd.js.map +1 -1
  288. package/package.json +17 -9
  289. package/src/BubbleMenu.tsx +35 -14
  290. package/src/EditorContent.tsx +8 -7
  291. package/src/FloatingMenu.tsx +51 -0
  292. package/src/NodeViewContent.tsx +9 -6
  293. package/src/NodeViewWrapper.tsx +11 -9
  294. package/src/ReactNodeViewRenderer.tsx +74 -28
  295. package/src/ReactRenderer.tsx +37 -14
  296. package/src/index.ts +1 -0
  297. package/src/useEditor.ts +10 -4
  298. package/src/useReactNodeView.ts +1 -2
  299. package/CHANGELOG.md +0 -88
  300. package/dist/tiptap-react.bundle.umd.min.js +0 -54
  301. package/dist/tiptap-react.bundle.umd.min.js.map +0 -1
@@ -0,0 +1,49 @@
1
+ import { Editor, Range } from '@tiptap/core';
2
+ import { Plugin, PluginKey } from 'prosemirror-state';
3
+ import { EditorView } from 'prosemirror-view';
4
+ export interface SuggestionOptions {
5
+ pluginKey?: PluginKey;
6
+ editor: Editor;
7
+ char?: string;
8
+ allowSpaces?: boolean;
9
+ startOfLine?: boolean;
10
+ prefixSpace?: boolean;
11
+ decorationTag?: string;
12
+ decorationClass?: string;
13
+ command?: (props: {
14
+ editor: Editor;
15
+ range: Range;
16
+ props: any;
17
+ }) => void;
18
+ items?: (props: {
19
+ query: string;
20
+ editor: Editor;
21
+ }) => any[] | Promise<any[]>;
22
+ render?: () => {
23
+ onStart?: (props: SuggestionProps) => void;
24
+ onUpdate?: (props: SuggestionProps) => void;
25
+ onExit?: (props: SuggestionProps) => void;
26
+ onKeyDown?: (props: SuggestionKeyDownProps) => boolean;
27
+ };
28
+ allow?: (props: {
29
+ editor: Editor;
30
+ range: Range;
31
+ }) => boolean;
32
+ }
33
+ export interface SuggestionProps {
34
+ editor: Editor;
35
+ range: Range;
36
+ query: string;
37
+ text: string;
38
+ items: any[];
39
+ command: (props: any) => void;
40
+ decorationNode: Element | null;
41
+ clientRect: (() => DOMRect) | null;
42
+ }
43
+ export interface SuggestionKeyDownProps {
44
+ view: EditorView;
45
+ event: KeyboardEvent;
46
+ range: Range;
47
+ }
48
+ export declare const SuggestionPluginKey: PluginKey<any, any>;
49
+ export declare function Suggestion({ pluginKey, editor, char, allowSpaces, prefixSpace, startOfLine, decorationTag, decorationClass, command, items, render, allow, }: SuggestionOptions): Plugin<any, any>;
@@ -0,0 +1 @@
1
+ export {};
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var core = require('@tiptap/core');
6
6
  var React = require('react');
7
7
  var extensionBubbleMenu = require('@tiptap/extension-bubble-menu');
8
+ var extensionFloatingMenu = require('@tiptap/extension-floating-menu');
8
9
  var ReactDOM = require('react-dom');
9
10
 
10
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -13,19 +14,29 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
14
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
14
15
 
15
16
  const BubbleMenu = props => {
16
- const element = React.useRef(null);
17
+ const [element, setElement] = React.useState(null);
17
18
  React.useEffect(() => {
18
- const { editor, keepInBounds = true } = props;
19
- editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
19
+ if (!element) {
20
+ return;
21
+ }
22
+ if (props.editor.isDestroyed) {
23
+ return;
24
+ }
25
+ const { pluginKey = 'bubbleMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
26
+ const plugin = extensionBubbleMenu.BubbleMenuPlugin({
27
+ pluginKey,
20
28
  editor,
21
- element: element.current,
22
- keepInBounds,
23
- }));
24
- return () => {
25
- editor.unregisterPlugin(extensionBubbleMenu.BubbleMenuPluginKey);
26
- };
27
- }, []);
28
- return (React__default['default'].createElement("div", { ref: element, className: props.className }, props.children));
29
+ element,
30
+ tippyOptions,
31
+ shouldShow,
32
+ });
33
+ editor.registerPlugin(plugin);
34
+ return () => editor.unregisterPlugin(pluginKey);
35
+ }, [
36
+ props.editor,
37
+ element,
38
+ ]);
39
+ return (React__default["default"].createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
29
40
  };
30
41
 
31
42
  class Editor extends core.Editor {
@@ -35,21 +46,53 @@ class Editor extends core.Editor {
35
46
  }
36
47
  }
37
48
 
49
+ const FloatingMenu = props => {
50
+ const [element, setElement] = React.useState(null);
51
+ React.useEffect(() => {
52
+ if (!element) {
53
+ return;
54
+ }
55
+ if (props.editor.isDestroyed) {
56
+ return;
57
+ }
58
+ const { pluginKey = 'floatingMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
59
+ const plugin = extensionFloatingMenu.FloatingMenuPlugin({
60
+ pluginKey,
61
+ editor,
62
+ element,
63
+ tippyOptions,
64
+ shouldShow,
65
+ });
66
+ editor.registerPlugin(plugin);
67
+ return () => editor.unregisterPlugin(pluginKey);
68
+ }, [
69
+ props.editor,
70
+ element,
71
+ ]);
72
+ return (React__default["default"].createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
73
+ };
74
+
38
75
  function useForceUpdate() {
39
76
  const [, setValue] = React.useState(0);
40
77
  return () => setValue(value => value + 1);
41
78
  }
42
- const useEditor = (options = {}) => {
79
+ const useEditor = (options = {}, deps = []) => {
43
80
  const [editor, setEditor] = React.useState(null);
44
81
  const forceUpdate = useForceUpdate();
45
82
  React.useEffect(() => {
46
83
  const instance = new Editor(options);
47
84
  setEditor(instance);
48
- instance.on('transaction', forceUpdate);
85
+ instance.on('transaction', () => {
86
+ requestAnimationFrame(() => {
87
+ requestAnimationFrame(() => {
88
+ forceUpdate();
89
+ });
90
+ });
91
+ });
49
92
  return () => {
50
93
  instance.destroy();
51
94
  };
52
- }, []);
95
+ }, deps);
53
96
  return editor;
54
97
  };
55
98
 
@@ -58,27 +101,35 @@ function isClassComponent(Component) {
58
101
  && Component.prototype
59
102
  && Component.prototype.isReactComponent);
60
103
  }
104
+ function isForwardRefComponent(Component) {
105
+ var _a;
106
+ return !!(typeof Component === 'object'
107
+ && ((_a = Component.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === 'Symbol(react.forward_ref)');
108
+ }
61
109
  class ReactRenderer {
62
- constructor(component, { props = {}, editor }) {
110
+ constructor(component, { editor, props = {}, as = 'div', className = '', }) {
63
111
  this.ref = null;
64
112
  this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString();
65
113
  this.component = component;
66
114
  this.editor = editor;
67
115
  this.props = props;
68
- this.element = document.createElement('div');
116
+ this.element = document.createElement(as);
69
117
  this.element.classList.add('react-renderer');
118
+ if (className) {
119
+ this.element.classList.add(...className.split(' '));
120
+ }
70
121
  this.render();
71
122
  }
72
123
  render() {
73
124
  var _a;
74
125
  const Component = this.component;
75
126
  const props = this.props;
76
- if (isClassComponent(Component)) {
127
+ if (isClassComponent(Component) || isForwardRefComponent(Component)) {
77
128
  props.ref = (ref) => {
78
129
  this.ref = ref;
79
130
  };
80
131
  }
81
- this.reactElement = React__default['default'].createElement(Component, Object.assign({}, props));
132
+ this.reactElement = React__default["default"].createElement(Component, { ...props });
82
133
  if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
83
134
  this.editor.contentComponent.setState({
84
135
  renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
@@ -105,7 +156,6 @@ class ReactRenderer {
105
156
  }
106
157
 
107
158
  const ReactNodeViewContext = React.createContext({
108
- isEditable: undefined,
109
159
  onDragStart: undefined,
110
160
  });
111
161
  const useReactNodeView = () => React.useContext(ReactNodeViewContext);
@@ -120,38 +170,53 @@ class ReactNodeView extends core.NodeView {
120
170
  extension: this.extension,
121
171
  getPos: () => this.getPos(),
122
172
  updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
173
+ deleteNode: () => this.deleteNode(),
123
174
  };
124
175
  if (!this.component.displayName) {
125
176
  const capitalizeFirstChar = (string) => {
126
177
  return string.charAt(0).toUpperCase() + string.substring(1);
127
178
  };
128
- // @ts-ignore
129
- this.component.displayName = capitalizeFirstChar(this.extension.config.name);
179
+ this.component.displayName = capitalizeFirstChar(this.extension.name);
130
180
  }
131
181
  const ReactNodeViewProvider = componentProps => {
132
- const [isEditable, setIsEditable] = React.useState(this.editor.isEditable);
133
- const onDragStart = this.onDragStart.bind(this);
134
- const onViewUpdate = () => setIsEditable(this.editor.isEditable);
135
182
  const Component = this.component;
136
- React.useEffect(() => {
137
- this.editor.on('viewUpdate', onViewUpdate);
138
- return () => {
139
- this.editor.off('viewUpdate', onViewUpdate);
140
- };
141
- }, []);
142
- return (React__default['default'].createElement(ReactNodeViewContext.Provider, { value: { onDragStart, isEditable } },
143
- React__default['default'].createElement(Component, Object.assign({}, componentProps))));
183
+ const onDragStart = this.onDragStart.bind(this);
184
+ const nodeViewContentRef = element => {
185
+ if (element
186
+ && this.contentDOMElement
187
+ && element.firstChild !== this.contentDOMElement) {
188
+ element.appendChild(this.contentDOMElement);
189
+ }
190
+ };
191
+ return (React__default["default"].createElement(ReactNodeViewContext.Provider, { value: { onDragStart, nodeViewContentRef } },
192
+ React__default["default"].createElement(Component, { ...componentProps })));
144
193
  };
145
194
  ReactNodeViewProvider.displayName = 'ReactNodeView';
195
+ this.contentDOMElement = this.node.isLeaf
196
+ ? null
197
+ : document.createElement(this.node.isInline ? 'span' : 'div');
198
+ if (this.contentDOMElement) {
199
+ // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari
200
+ // With this fix it seems to work fine
201
+ // See: https://github.com/ueberdosis/tiptap/issues/1197
202
+ this.contentDOMElement.style.whiteSpace = 'inherit';
203
+ }
204
+ let as = this.node.isInline ? 'span' : 'div';
205
+ if (this.options.as) {
206
+ as = this.options.as;
207
+ }
146
208
  this.renderer = new ReactRenderer(ReactNodeViewProvider, {
147
209
  editor: this.editor,
148
210
  props,
211
+ as,
212
+ className: `node-${this.node.type.name}`,
149
213
  });
150
214
  }
151
215
  get dom() {
152
216
  var _a;
153
- if (!((_a = this.renderer.element.firstElementChild) === null || _a === void 0 ? void 0 : _a.hasAttribute('data-node-view-wrapper'))) {
154
- throw Error('Please use the ReactViewWrapper component for your node view.');
217
+ if (this.renderer.element.firstElementChild
218
+ && !((_a = this.renderer.element.firstElementChild) === null || _a === void 0 ? void 0 : _a.hasAttribute('data-node-view-wrapper'))) {
219
+ throw Error('Please use the NodeViewWrapper component for your node view.');
155
220
  }
156
221
  return this.renderer.element;
157
222
  }
@@ -159,22 +224,34 @@ class ReactNodeView extends core.NodeView {
159
224
  if (this.node.isLeaf) {
160
225
  return null;
161
226
  }
162
- const contentElement = this.dom.querySelector('[data-node-view-content]');
163
- return contentElement || this.dom;
227
+ return this.contentDOMElement;
164
228
  }
165
229
  update(node, decorations) {
166
- if (typeof this.options.update === 'function') {
167
- return this.options.update(node, decorations);
168
- }
230
+ const updateProps = (props) => {
231
+ this.renderer.updateProps(props);
232
+ };
169
233
  if (node.type !== this.node.type) {
170
234
  return false;
171
235
  }
236
+ if (typeof this.options.update === 'function') {
237
+ const oldNode = this.node;
238
+ const oldDecorations = this.decorations;
239
+ this.node = node;
240
+ this.decorations = decorations;
241
+ return this.options.update({
242
+ oldNode,
243
+ oldDecorations,
244
+ newNode: node,
245
+ newDecorations: decorations,
246
+ updateProps: () => updateProps({ node, decorations }),
247
+ });
248
+ }
172
249
  if (node === this.node && this.decorations === decorations) {
173
250
  return true;
174
251
  }
175
252
  this.node = node;
176
253
  this.decorations = decorations;
177
- this.renderer.updateProps({ node, decorations });
254
+ updateProps({ node, decorations });
178
255
  return true;
179
256
  }
180
257
  selectNode() {
@@ -189,6 +266,7 @@ class ReactNodeView extends core.NodeView {
189
266
  }
190
267
  destroy() {
191
268
  this.renderer.destroy();
269
+ this.contentDOMElement = null;
192
270
  }
193
271
  }
194
272
  function ReactNodeViewRenderer(component, options) {
@@ -204,14 +282,14 @@ function ReactNodeViewRenderer(component, options) {
204
282
  }
205
283
 
206
284
  const Portals = ({ renderers }) => {
207
- return (React__default['default'].createElement(React__default['default'].Fragment, null, Array.from(renderers).map(([key, renderer]) => {
208
- return ReactDOM__default['default'].createPortal(renderer.reactElement, renderer.element, key);
285
+ return (React__default["default"].createElement(React__default["default"].Fragment, null, Array.from(renderers).map(([key, renderer]) => {
286
+ return ReactDOM__default["default"].createPortal(renderer.reactElement, renderer.element, key);
209
287
  })));
210
288
  };
211
- class PureEditorContent extends React__default['default'].Component {
289
+ class PureEditorContent extends React__default["default"].Component {
212
290
  constructor(props) {
213
291
  super(props);
214
- this.editorContentRef = React__default['default'].createRef();
292
+ this.editorContentRef = React__default["default"].createRef();
215
293
  this.state = {
216
294
  renderers: new Map(),
217
295
  };
@@ -229,13 +307,12 @@ class PureEditorContent extends React__default['default'].Component {
229
307
  return;
230
308
  }
231
309
  const element = this.editorContentRef.current;
232
- element.appendChild(editor.options.element.firstChild);
310
+ element.append(...editor.options.element.childNodes);
233
311
  editor.setOptions({
234
312
  element,
235
313
  });
236
314
  editor.contentComponent = this;
237
- // TODO: alternative to setTimeout?
238
- setTimeout(() => editor.createNodeViews(), 0);
315
+ editor.createNodeViews();
239
316
  }
240
317
  }
241
318
  componentWillUnmount() {
@@ -253,34 +330,42 @@ class PureEditorContent extends React__default['default'].Component {
253
330
  return;
254
331
  }
255
332
  const newElement = document.createElement('div');
256
- newElement.appendChild(editor.options.element.firstChild);
333
+ newElement.append(...editor.options.element.childNodes);
257
334
  editor.setOptions({
258
335
  element: newElement,
259
336
  });
260
337
  }
261
338
  render() {
262
- return (React__default['default'].createElement(React__default['default'].Fragment, null,
263
- React__default['default'].createElement("div", { ref: this.editorContentRef }),
264
- React__default['default'].createElement(Portals, { renderers: this.state.renderers })));
339
+ const { editor, ...rest } = this.props;
340
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
341
+ React__default["default"].createElement("div", { ref: this.editorContentRef, ...rest }),
342
+ React__default["default"].createElement(Portals, { renderers: this.state.renderers })));
265
343
  }
266
344
  }
267
- const EditorContent = React__default['default'].memo(PureEditorContent);
345
+ const EditorContent = React__default["default"].memo(PureEditorContent);
268
346
 
269
- const NodeViewWrapper = props => {
347
+ const NodeViewWrapper = React__default["default"].forwardRef((props, ref) => {
270
348
  const { onDragStart } = useReactNodeView();
271
349
  const Tag = props.as || 'div';
272
- return (React__default['default'].createElement(Tag, { className: props.className, "data-node-view-wrapper": "", onDragStart: onDragStart, style: { whiteSpace: 'normal' } }, props.children));
273
- };
350
+ return (React__default["default"].createElement(Tag, { ...props, ref: ref, "data-node-view-wrapper": "", onDragStart: onDragStart, style: {
351
+ ...props.style,
352
+ whiteSpace: 'normal',
353
+ } }));
354
+ });
274
355
 
275
356
  const NodeViewContent = props => {
276
- const { isEditable } = useReactNodeView();
277
357
  const Tag = props.as || 'div';
278
- return (React__default['default'].createElement(Tag, { className: props.className, "data-node-view-content": "", contentEditable: isEditable, style: { whiteSpace: 'pre-wrap' } }));
358
+ const { nodeViewContentRef } = useReactNodeView();
359
+ return (React__default["default"].createElement(Tag, { ...props, ref: nodeViewContentRef, "data-node-view-content": "", style: {
360
+ ...props.style,
361
+ whiteSpace: 'pre-wrap',
362
+ } }));
279
363
  };
280
364
 
281
365
  exports.BubbleMenu = BubbleMenu;
282
366
  exports.Editor = Editor;
283
367
  exports.EditorContent = EditorContent;
368
+ exports.FloatingMenu = FloatingMenu;
284
369
  exports.NodeViewContent = NodeViewContent;
285
370
  exports.NodeViewWrapper = NodeViewWrapper;
286
371
  exports.PureEditorContent = PureEditorContent;
@@ -290,9 +375,7 @@ exports.useEditor = useEditor;
290
375
  Object.keys(core).forEach(function (k) {
291
376
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
292
377
  enumerable: true,
293
- get: function () {
294
- return core[k];
295
- }
378
+ get: function () { return core[k]; }
296
379
  });
297
380
  });
298
381
  //# sourceMappingURL=tiptap-react.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-react.cjs.js","sources":["../src/BubbleMenu.tsx","../src/Editor.ts","../src/useEditor.ts","../src/ReactRenderer.tsx","../src/useReactNodeView.ts","../src/ReactNodeViewRenderer.tsx","../src/EditorContent.tsx","../src/NodeViewWrapper.tsx","../src/NodeViewContent.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react'\nimport { BubbleMenuPlugin, BubbleMenuPluginKey, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport type BubbleMenuProps = Omit<BubbleMenuPluginProps, 'element'> & {\n className?: string,\n}\n\nexport const BubbleMenu: React.FC<BubbleMenuProps> = props => {\n const element = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const { editor, keepInBounds = true } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n editor,\n element: element.current as HTMLElement,\n keepInBounds,\n }))\n\n return () => {\n editor.unregisterPlugin(BubbleMenuPluginKey)\n }\n }, [])\n\n return (\n <div ref={element} className={props.className}>\n {props.children}\n </div>\n )\n}\n","import React from 'react'\nimport { Editor as CoreEditor } from '@tiptap/core'\nimport { EditorContentProps, EditorContentState } from './EditorContent'\n\nexport class Editor extends CoreEditor {\n public contentComponent: React.Component<EditorContentProps, EditorContentState> | null = null\n}\n","import { useState, useEffect } from 'react'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n const forceUpdate = useForceUpdate()\n\n useEffect(() => {\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', forceUpdate)\n\n return () => {\n instance.destroy()\n }\n }, [])\n\n return editor\n}\n","import React from 'react'\nimport { AnyObject } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nexport interface ReactRendererOptions {\n as?: string,\n editor: Editor,\n props?: AnyObject,\n}\n\nexport class ReactRenderer {\n id: string\n\n editor: Editor\n\n component: any\n\n element: Element\n\n props: AnyObject\n\n reactElement: React.ReactNode\n\n ref: React.Component | null = null\n\n constructor(component: React.Component | React.FunctionComponent, { props = {}, editor }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor\n this.props = props\n this.element = document.createElement('div')\n this.element.classList.add('react-renderer')\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component)) {\n props.ref = (ref: React.Component) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n if (this.editor?.contentComponent) {\n this.editor.contentComponent.setState({\n renderers: this.editor.contentComponent.state.renderers.set(\n this.id,\n this,\n ),\n })\n }\n }\n\n updateProps(props: AnyObject = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n if (this.editor?.contentComponent) {\n const { renderers } = this.editor.contentComponent.state\n\n renderers.delete(this.id)\n\n this.editor.contentComponent.setState({\n renderers,\n })\n }\n }\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n isEditable: boolean,\n onDragStart: (event: DragEvent) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n isEditable: undefined,\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React, { useState, useEffect } from 'react'\nimport {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\nimport { ReactNodeViewContext } from './useReactNodeView'\n\ninterface ReactNodeViewRendererOptions {\n stopEvent: ((event: Event) => boolean) | null,\n update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null,\n}\n\nclass ReactNodeView extends NodeView<React.FunctionComponent, Editor> {\n\n renderer!: ReactRenderer\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n // @ts-ignore\n this.component.displayName = capitalizeFirstChar(this.extension.config.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const [isEditable, setIsEditable] = useState(this.editor.isEditable)\n const onDragStart = this.onDragStart.bind(this)\n const onViewUpdate = () => setIsEditable(this.editor.isEditable)\n const Component = this.component\n\n useEffect(() => {\n this.editor.on('viewUpdate', onViewUpdate)\n\n return () => {\n this.editor.off('viewUpdate', onViewUpdate)\n }\n }, [])\n\n return (\n <ReactNodeViewContext.Provider value={{ onDragStart, isEditable }}>\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the ReactViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n if (typeof this.options.update === 'function') {\n return this.options.update(node, decorations)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.renderer.updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n destroy() {\n this.renderer.destroy()\n }\n}\n\nexport function ReactNodeViewRenderer(component: any, options?: Partial<ReactNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import React from 'react'\nimport ReactDOM from 'react-dom'\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\n\nconst Portals: React.FC<{ renderers: Map<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Array.from(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(\n renderer.reactElement,\n renderer.element,\n key,\n )\n })}\n </>\n )\n}\n\nexport interface EditorContentProps {\n editor: Editor | null,\n}\n\nexport interface EditorContentState {\n renderers: Map<string, ReactRenderer>\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n\n this.state = {\n renderers: new Map(),\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.appendChild(editor.options.element.firstChild)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n // TODO: alternative to setTimeout?\n setTimeout(() => editor.createNodeViews(), 0)\n }\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.appendChild(editor.options.element.firstChild)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n return (\n <>\n <div ref={this.editorContentRef} />\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\nexport const EditorContent = React.memo(PureEditorContent)\n","import React from 'react'\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewWrapperProps {\n className?: string,\n as: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n className={props.className}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{ whiteSpace: 'normal' }}\n >\n {props.children}\n </Tag>\n )\n}\n","import React from 'react'\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewContentProps {\n className?: string,\n as: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const { isEditable } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n className={props.className}\n data-node-view-content=\"\"\n contentEditable={isEditable}\n style={{ whiteSpace: 'pre-wrap' }}\n />\n )\n}\n"],"names":["useRef","useEffect","BubbleMenuPlugin","BubbleMenuPluginKey","React","CoreEditor","useState","createContext","useContext","NodeView","ReactDOM"],"mappings":";;;;;;;;;;;;;;MAOa,UAAU,GAA8B,KAAK;IACxD,MAAM,OAAO,GAAGA,YAAM,CAAiB,IAAI,CAAC,CAAA;IAE5CC,eAAS,CAAC;QACR,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;QAE7C,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;YACrC,MAAM;YACN,OAAO,EAAE,OAAO,CAAC,OAAsB;YACvC,YAAY;SACb,CAAC,CAAC,CAAA;QAEH,OAAO;YACL,MAAM,CAAC,gBAAgB,CAACC,uCAAmB,CAAC,CAAA;SAC7C,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAEN,QACEC,iDAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAC1C,KAAK,CAAC,QAAQ,CACX,EACP;AACH;;MCzBa,MAAO,SAAQC,WAAU;IAAtC;;QACS,qBAAgB,GAAmE,IAAI,CAAA;KAC/F;;;ACFD,SAAS,cAAc;IACrB,MAAM,GAAG,QAAQ,CAAC,GAAGC,cAAQ,CAAC,CAAC,CAAC,CAAA;IAEhC,OAAO,MAAM,QAAQ,CAAC,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,CAAA;AAC3C,CAAC;MAEY,SAAS,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,CAAC;YAChB,OAAO,EAAE,UAAU;SACpB,CAAC,CAAA;KACH;IAED,MAAM;QACJ,QACEA;YACEA,iDAAK,GAAG,EAAE,IAAI,CAAC,gBAAgB,GAAI;YACnCA,wCAAC,OAAO,IAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAI,CAC3C,EACJ;KACF;CACF;MAEY,aAAa,GAAGA,yBAAK,CAAC,IAAI,CAAC,iBAAiB;;MCpG5C,eAAe,GAAmC,KAAK;IAClE,MAAM,EAAE,WAAW,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAC1C,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAA;IAE7B,QACEA,wCAAC,GAAG,IACF,SAAS,EAAE,KAAK,CAAC,SAAS,4BACH,EAAE,EACzB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAE/B,KAAK,CAAC,QAAQ,CACV,EACP;AACH;;MCda,eAAe,GAAmC,KAAK;IAClE,MAAM,EAAE,UAAU,EAAE,GAAG,gBAAgB,EAAE,CAAA;IACzC,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAA;IAE7B,QACEA,wCAAC,GAAG,IACF,SAAS,EAAE,KAAK,CAAC,SAAS,4BACH,EAAE,EACzB,eAAe,EAAE,UAAU,EAC3B,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,GACjC,EACH;AACH;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiptap-react.cjs.js","sources":["../src/BubbleMenu.tsx","../src/Editor.ts","../src/FloatingMenu.tsx","../src/useEditor.ts","../src/ReactRenderer.tsx","../src/useReactNodeView.ts","../src/ReactNodeViewRenderer.tsx","../src/EditorContent.tsx","../src/NodeViewWrapper.tsx","../src/NodeViewContent.tsx"],"sourcesContent":["import React, {\n useEffect, useState,\n} from 'react'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey'>, 'element'> & {\n className?: string,\n}\n\nexport const BubbleMenu: React.FC<BubbleMenuProps> = props => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const plugin = BubbleMenuPlugin({\n pluginKey,\n editor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n editor.registerPlugin(plugin)\n return () => editor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import React from 'react'\nimport { Editor as CoreEditor } from '@tiptap/core'\nimport { EditorContentProps, EditorContentState } from './EditorContent'\n\nexport class Editor extends CoreEditor {\n public contentComponent: React.Component<EditorContentProps, EditorContentState> | null = null\n}\n","import React, {\n useEffect, useState,\n} from 'react'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey'>, 'element'> & {\n className?: string,\n}\n\nexport const FloatingMenu: React.FC<FloatingMenuProps> = props => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n editor.registerPlugin(plugin)\n return () => editor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { useState, useEffect, DependencyList } from 'react'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n const forceUpdate = useForceUpdate()\n\n useEffect(() => {\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n forceUpdate()\n })\n })\n })\n\n return () => {\n instance.destroy()\n }\n }, deps)\n\n return editor\n}\n","import React from 'react'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n if (this.editor?.contentComponent) {\n this.editor.contentComponent.setState({\n renderers: this.editor.contentComponent.state.renderers.set(\n this.id,\n this,\n ),\n })\n }\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n if (this.editor?.contentComponent) {\n const { renderers } = this.editor.contentComponent.state\n\n renderers.delete(this.id)\n\n this.editor.contentComponent.setState({\n renderers,\n })\n }\n }\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\nimport {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n as?: string,\n}\n\nclass ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeViewRendererOptions> {\n\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (\n element\n && this.contentDOMElement\n && element.firstChild !== this.contentDOMElement\n ) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name}`,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n destroy() {\n this.renderer.destroy()\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(component: any, options?: Partial<ReactNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import React, { HTMLProps } from 'react'\nimport ReactDOM from 'react-dom'\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\n\nconst Portals: React.FC<{ renderers: Map<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Array.from(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(\n renderer.reactElement,\n renderer.element,\n key,\n )\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null,\n}\n\nexport interface EditorContentState {\n renderers: Map<string, ReactRenderer>\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n\n this.state = {\n renderers: new Map(),\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n }\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\nexport const EditorContent = React.memo(PureEditorContent)\n","import React from 'react'\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n ...props.style,\n whiteSpace: 'normal',\n }}\n />\n )\n})\n","import React from 'react'\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n ...props.style,\n whiteSpace: 'pre-wrap',\n }}\n />\n )\n}\n"],"names":["useState","useEffect","BubbleMen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