@edifice.io/react 2.6.10-develop-b2school.20261023141442 → 2.6.10-develop-pedago.20261023145636

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 (179) hide show
  1. package/dist/components/Checkbox/Checkbox.js +1 -1
  2. package/dist/components/Layout/Layout.js +4 -12
  3. package/dist/components/Layout/components/Header.js +4 -4
  4. package/dist/components/Layout/components/NavLink.d.ts +3 -3
  5. package/dist/components/Layout/components/NavLink.js +3 -5
  6. package/dist/editor.js +2 -0
  7. package/dist/homepage.js +24 -74
  8. package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +6 -2
  9. package/dist/hooks/useZendeskGuide/useZendeskGuide.js +8 -11
  10. package/dist/icons.js +402 -406
  11. package/dist/modules/HelpZone/HelpZone.js +8 -6
  12. package/dist/modules/HelpZone/HelpZoneContainer.js +5 -2
  13. package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +110 -91
  14. package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +123 -96
  15. package/dist/modules/editor/components/Editor/Editor.d.ts +0 -5
  16. package/dist/modules/editor/components/Editor/Editor.js +0 -3
  17. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +5 -8
  18. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +5 -8
  19. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextSize.js +7 -3
  20. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -2
  21. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +6 -4
  22. package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +29 -0
  23. package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +22 -0
  24. package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +6 -3
  25. package/dist/modules/editor/components/Toolbar/LinkToolbar.js +29 -7
  26. package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +3 -2
  27. package/dist/modules/editor/components/Toolbar/TableToolbar.js +65 -45
  28. package/dist/modules/editor/hooks/index.d.ts +1 -0
  29. package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
  30. package/dist/modules/editor/hooks/useCommentEditor.js +12 -4
  31. package/dist/modules/editor/hooks/useEditorState.d.ts +20 -0
  32. package/dist/modules/editor/hooks/useEditorState.js +16 -0
  33. package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
  34. package/dist/modules/editor/hooks/useLinkToolbar.js +2 -1
  35. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
  36. package/dist/modules/editor/hooks/useTipTapEditor.js +81 -24
  37. package/dist/modules/homepage/components/Communities/Communities.js +4 -4
  38. package/dist/modules/homepage/components/Header/Header.js +22 -28
  39. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +1 -5
  40. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +1 -1
  41. package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +1 -1
  42. package/dist/modules/homepage/components/Notifications/NotificationList.js +8 -7
  43. package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +12 -7
  44. package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +4 -7
  45. package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +5 -1
  46. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +12 -10
  47. package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +9 -3
  48. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +12 -6
  49. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +10 -12
  50. package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +10 -9
  51. package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
  52. package/dist/modules/homepage/{hooks → components/SchoolSpace}/useUserSchools.d.ts +2 -2
  53. package/dist/modules/homepage/{hooks → components/SchoolSpace}/useUserSchools.js +4 -4
  54. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +2 -2
  55. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +2 -2
  56. package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +1 -3
  57. package/dist/modules/homepage/components/UserSpace/UserSpace.js +7 -13
  58. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +2 -4
  59. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +2 -3
  60. package/dist/modules/homepage/components/index.d.ts +1 -9
  61. package/dist/modules/icons/components/index.d.ts +0 -2
  62. package/dist/modules/modals/ResourceModal/ResourceModal.js +16 -9
  63. package/dist/modules/modals/ResourceModal/apps/BlogPublic.js +9 -13
  64. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
  65. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
  66. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -0
  67. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +2 -0
  68. package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +4 -0
  69. package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +2 -1
  70. package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +3 -0
  71. package/dist/node_modules/.pnpm/@tiptap_extension-floating-menu@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm@3.32.0/node_modules/@tiptap/extension-floating-menu/dist/index.js +159 -0
  72. package/dist/node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js +341 -0
  73. package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +549 -0
  74. package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +489 -0
  75. package/dist/node_modules/.pnpm/prosemirror-transform@1.12.4/node_modules/prosemirror-transform/dist/index.js +659 -0
  76. package/package.json +35 -43
  77. package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +0 -2
  78. package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +0 -8
  79. package/dist/modules/homepage/components/Agenda/Agenda.d.ts +0 -10
  80. package/dist/modules/homepage/components/Agenda/Agenda.js +0 -54
  81. package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +0 -1
  82. package/dist/modules/homepage/components/Agenda/AgendaContainer.js +0 -14
  83. package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +0 -10
  84. package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +0 -30
  85. package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +0 -14
  86. package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +0 -27
  87. package/dist/modules/homepage/components/Agenda/index.d.ts +0 -3
  88. package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +0 -24
  89. package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +0 -45
  90. package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +0 -4
  91. package/dist/modules/homepage/components/Agenda/services/api/index.js +0 -5
  92. package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +0 -19
  93. package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +0 -26
  94. package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +0 -9
  95. package/dist/modules/homepage/components/BriefMe/BriefMe.js +0 -59
  96. package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +0 -4
  97. package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +0 -17
  98. package/dist/modules/homepage/components/BriefMe/index.d.ts +0 -4
  99. package/dist/modules/homepage/components/BriefMe/types.d.ts +0 -17
  100. package/dist/modules/homepage/components/BriefMe/types.js +0 -8
  101. package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +0 -31
  102. package/dist/modules/homepage/components/BriefMe/useBriefMe.js +0 -51
  103. package/dist/modules/homepage/components/Cantine/Cantine.d.ts +0 -7
  104. package/dist/modules/homepage/components/Cantine/Cantine.js +0 -44
  105. package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +0 -4
  106. package/dist/modules/homepage/components/Cantine/CantineContainer.js +0 -18
  107. package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +0 -24
  108. package/dist/modules/homepage/components/Cantine/CantineModal.js +0 -88
  109. package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +0 -7
  110. package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +0 -12
  111. package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +0 -5
  112. package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +0 -22
  113. package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +0 -6
  114. package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +0 -28
  115. package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +0 -12
  116. package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +0 -60
  117. package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +0 -11
  118. package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +0 -20
  119. package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +0 -24
  120. package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +0 -65
  121. package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +0 -23
  122. package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +0 -43
  123. package/dist/modules/homepage/components/Cantine/index.d.ts +0 -7
  124. package/dist/modules/homepage/components/Cantine/types.d.ts +0 -42
  125. package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +0 -16
  126. package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +0 -48
  127. package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +0 -4
  128. package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +0 -12
  129. package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +0 -1
  130. package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +0 -6
  131. package/dist/modules/homepage/components/GenerationHdf/index.d.ts +0 -3
  132. package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +0 -10
  133. package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +0 -68
  134. package/dist/modules/homepage/components/Header/AccountActionListPopover.d.ts +0 -13
  135. package/dist/modules/homepage/components/Header/AccountActionListPopover.js +0 -26
  136. package/dist/modules/homepage/components/Header/ActionItem.d.ts +0 -38
  137. package/dist/modules/homepage/components/Header/ActionItem.js +0 -34
  138. package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +0 -5
  139. package/dist/modules/homepage/components/Header/MyAppsPopover.js +0 -28
  140. package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +0 -32
  141. package/dist/modules/homepage/components/Qwant/Qwant.d.ts +0 -4
  142. package/dist/modules/homepage/components/Qwant/Qwant.js +0 -41
  143. package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +0 -1
  144. package/dist/modules/homepage/components/Qwant/QwantContainer.js +0 -10
  145. package/dist/modules/homepage/components/Qwant/index.d.ts +0 -3
  146. package/dist/modules/homepage/components/Rss/Rss.d.ts +0 -11
  147. package/dist/modules/homepage/components/Rss/Rss.js +0 -64
  148. package/dist/modules/homepage/components/Rss/RssContainer.d.ts +0 -1
  149. package/dist/modules/homepage/components/Rss/RssContainer.js +0 -45
  150. package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +0 -13
  151. package/dist/modules/homepage/components/Rss/RssFeedForm.js +0 -69
  152. package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +0 -11
  153. package/dist/modules/homepage/components/Rss/RssFeedsModal.js +0 -58
  154. package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +0 -25
  155. package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +0 -43
  156. package/dist/modules/homepage/components/Rss/index.d.ts +0 -6
  157. package/dist/modules/homepage/components/Rss/services/api/index.d.ts +0 -5
  158. package/dist/modules/homepage/components/Rss/services/api/index.js +0 -5
  159. package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +0 -38
  160. package/dist/modules/homepage/components/Rss/services/api/rssService.js +0 -51
  161. package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +0 -28
  162. package/dist/modules/homepage/components/Rss/services/queries/rss.js +0 -71
  163. package/dist/modules/homepage/components/Rss/types.d.ts +0 -25
  164. package/dist/modules/homepage/components/Rss/utils.d.ts +0 -7
  165. package/dist/modules/homepage/components/Rss/utils.js +0 -19
  166. package/dist/modules/homepage/components/Universalis/Universalis.d.ts +0 -8
  167. package/dist/modules/homepage/components/Universalis/Universalis.js +0 -62
  168. package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +0 -1
  169. package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +0 -16
  170. package/dist/modules/homepage/components/Universalis/index.d.ts +0 -3
  171. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +0 -16
  172. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +0 -15
  173. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +0 -21
  174. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +0 -47
  175. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +0 -2
  176. package/dist/modules/icons/components/IconAddWidget.d.ts +0 -7
  177. package/dist/modules/icons/components/IconAddWidget.js +0 -12
  178. package/dist/modules/icons/components/IconLogout.d.ts +0 -7
  179. package/dist/modules/icons/components/IconLogout.js +0 -13
@@ -21,7 +21,11 @@ const EditorToolbarTextSize = ({
21
21
  action: () => editor == null ? void 0 : editor.chain().focus().scrollIntoView().setCustomHeading({
22
22
  level: 1
23
23
  }).run(),
24
- visibility: hasExtension("customHeading", editor)
24
+ // The extension's command is still `setCustomHeading`, but
25
+ // useTipTapEditor.ts pins the node's name back to 'heading' (to match
26
+ // already-stored content) - check for that name, not the published
27
+ // package's own 'customHeading' default.
28
+ visibility: hasExtension("heading", editor)
25
29
  }, {
26
30
  id: "title-2",
27
31
  label: t("tiptap.toolbar.size.h2"),
@@ -29,11 +33,11 @@ const EditorToolbarTextSize = ({
29
33
  action: () => editor == null ? void 0 : editor.chain().focus().setCustomHeading({
30
34
  level: 2
31
35
  }).run(),
32
- visibility: hasExtension("customHeading", editor)
36
+ visibility: hasExtension("heading", editor)
33
37
  }, {
34
38
  id: "divider",
35
39
  type: "divider",
36
- visibility: hasExtension("customHeading", editor) && hasExtension("fontSize", editor)
40
+ visibility: hasExtension("heading", editor) && hasExtension("fontSize", editor)
37
41
  }, {
38
42
  id: "big-text",
39
43
  label: t("tiptap.toolbar.size.big"),
@@ -3,6 +3,7 @@ import { useState, useEffect, Fragment as Fragment$1 } from "react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import SvgIconTextTypo from "../../../icons/components/IconTextTypo.js";
5
5
  import { useEditorContext } from "../../hooks/useEditorContext.js";
6
+ import { useEditorState } from "../../hooks/useEditorState.js";
6
7
  import Tooltip from "../../../../components/Tooltip/Tooltip.js";
7
8
  import IconButton from "../../../../components/Button/IconButton.js";
8
9
  import Dropdown from "../../../../components/Dropdown/Dropdown.js";
@@ -13,11 +14,11 @@ const EditorToolbarTypography = ({
13
14
  t
14
15
  } = useTranslation(), {
15
16
  editor
16
- } = useEditorContext(), [value, setValue] = useState("sans-serif");
17
+ } = useEditorContext(), [value, setValue] = useState("sans-serif"), editorState = useEditorState(editor);
17
18
  useEffect(() => {
18
19
  const textStyle = editor == null ? void 0 : editor.getAttributes("textStyle");
19
20
  setValue((textStyle == null ? void 0 : textStyle.fontFamily) ?? "");
20
- }, [editor, editor == null ? void 0 : editor.state]);
21
+ }, [editor, editorState]);
21
22
  const options = [{
22
23
  value: "",
23
24
  label: t("tiptap.toolbar.typo.sans")
@@ -29,6 +29,7 @@ import { EditorToolbarTextSize } from "./EditorToolbar.TextSize.js";
29
29
  import { EditorToolbarTypography } from "./EditorToolbar.Typography.js";
30
30
  import { EditorToolbarCantoo } from "./EditorToolbar.Cantoo.js";
31
31
  import { useEditorContext } from "../../hooks/useEditorContext.js";
32
+ import { useEditorState } from "../../hooks/useEditorState.js";
32
33
  import { useActionOptions } from "../../hooks/useActionOptions.js";
33
34
  import { useSpeechRecognition } from "../../hooks/useSpeechRecognition.js";
34
35
  import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
@@ -42,7 +43,7 @@ const EditorToolbar = ({
42
43
  } = useTranslation(), {
43
44
  id,
44
45
  editor
45
- } = useEditorContext(), [plusOptions, listOptions, alignmentOptions] = useActionOptions(editor, toggleMathsModal, mediaLibraryRef), {
46
+ } = useEditorContext(), editorState = useEditorState(editor), [plusOptions, listOptions, alignmentOptions] = useActionOptions(editor, toggleMathsModal, mediaLibraryRef), {
46
47
  isAvailable: canRecognizeSpeech,
47
48
  isActive: speechRecognition,
48
49
  toggle: toggleSpeechRecognition
@@ -72,7 +73,8 @@ const EditorToolbar = ({
72
73
  },
73
74
  name: "undo",
74
75
  tooltip: t("editor.option.undo"),
75
- visibility: showIf(hasExtension("history", editor))
76
+ // v3's StarterKit renamed the undo/redo extension from 'history' to 'undoRedo'.
77
+ visibility: showIf(hasExtension("undoRedo", editor))
76
78
  },
77
79
  //--------------- REDO ---------------//
78
80
  {
@@ -85,7 +87,7 @@ const EditorToolbar = ({
85
87
  },
86
88
  name: "redo",
87
89
  tooltip: t("editor.option.redo"),
88
- visibility: showIf(hasExtension("history", editor))
90
+ visibility: showIf(hasExtension("undoRedo", editor))
89
91
  },
90
92
  //-------------------------------------//
91
93
  {
@@ -348,7 +350,7 @@ const EditorToolbar = ({
348
350
  visibility: showIf(hasExtension("textAlign", editor))
349
351
  }
350
352
  ];
351
- }, [alignmentOptions, canRecognizeSpeech, editor, listOptions, mediaLibraryRef, plusOptions, speechRecognition, t, toggleSpeechRecognition]);
353
+ }, [alignmentOptions, canRecognizeSpeech, editor, editorState, listOptions, mediaLibraryRef, plusOptions, speechRecognition, t, toggleSpeechRecognition]);
352
354
  return /* @__PURE__ */ jsx("div", { className: "sticky-top z-1 editor-toolbar rounded-3", children: /* @__PURE__ */ jsx(Toolbar, { items: toolbarItems, variant: "no-shadow", className: "rounded-top-3", isBlock: !0, align: "left", ariaControls: id }) });
353
355
  };
354
356
  export {
@@ -0,0 +1,29 @@
1
+ import { Placement, VirtualElement } from '@floating-ui/dom';
2
+ export declare const FLOATING_MENU_Z_INDEX = 999;
3
+ /**
4
+ * Builds the `options` prop shared by every BubbleMenu/FloatingMenu in the
5
+ * editor toolbar - only `placement` and `offset` vary from one menu to the
6
+ * next.
7
+ */
8
+ export declare function getFloatingMenuOptions({ placement, offset, }: {
9
+ placement: Placement;
10
+ offset: {
11
+ mainAxis: number;
12
+ crossAxis: number;
13
+ };
14
+ }): {
15
+ placement: Placement;
16
+ offset: {
17
+ mainAxis: number;
18
+ crossAxis: number;
19
+ };
20
+ strategy: "absolute";
21
+ };
22
+ /**
23
+ * Wraps an already-memoized virtual element in a stable
24
+ * `getReferencedVirtualElement` callback. v3's BubbleMenu re-runs a
25
+ * `dispatch` effect whenever this prop's identity changes; combined with
26
+ * `useEditorState` (which re-renders on every transaction), an inline
27
+ * `() => reference` here causes an infinite render loop.
28
+ */
29
+ export declare function useReferencedVirtualElement(reference: VirtualElement): () => VirtualElement;
@@ -0,0 +1,22 @@
1
+ import { useCallback } from "react";
2
+ const FLOATING_MENU_Z_INDEX = 999;
3
+ function getFloatingMenuOptions({
4
+ placement,
5
+ offset
6
+ }) {
7
+ return {
8
+ placement,
9
+ // tiptap builds its middleware array from named fields only - a raw
10
+ // `middleware: [offset(...)]` key is silently ignored.
11
+ offset,
12
+ strategy: "absolute"
13
+ };
14
+ }
15
+ function useReferencedVirtualElement(reference) {
16
+ return useCallback(() => reference, [reference]);
17
+ }
18
+ export {
19
+ FLOATING_MENU_Z_INDEX,
20
+ getFloatingMenuOptions,
21
+ useReferencedVirtualElement
22
+ };
@@ -1,15 +1,18 @@
1
+ import { HyperlinkAttributes } from '@edifice.io/tiptap-extensions/hyperlink';
2
+ import { LinkerAttributes } from '@edifice.io/tiptap-extensions/linker';
1
3
  import { Editor } from '@tiptap/react';
4
+ type LinkAttrs = LinkerAttributes | HyperlinkAttributes;
2
5
  interface LinkToolbarProps {
3
6
  /**
4
7
  * editor instance
5
8
  */
6
9
  editor: Editor | null;
7
10
  /** Handle Edit event */
8
- onEdit: (attrs: any) => void;
11
+ onEdit: (attrs: LinkAttrs | undefined) => void;
9
12
  /** Handle Open event */
10
- onOpen: (attrs: any) => void;
13
+ onOpen: (attrs: LinkAttrs | undefined) => void;
11
14
  /** Handle Unlink event */
12
- onUnlink: (attrs: any) => void;
15
+ onUnlink: (attrs: LinkAttrs | undefined) => void;
13
16
  }
14
17
  declare const LinkToolbar: ({ editor, onEdit, onOpen, onUnlink, }: LinkToolbarProps) => import("react/jsx-runtime").JSX.Element;
15
18
  export default LinkToolbar;
@@ -1,13 +1,20 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
- import { useState, useMemo, useEffect } from "react";
3
- import { FloatingMenu } from "@tiptap/react";
2
+ import { useState, useMemo, useEffect, useCallback } from "react";
3
+ import { BubbleMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
4
4
  import { useTranslation } from "react-i18next";
5
+ import { useEditorState } from "../../hooks/useEditorState.js";
5
6
  import SvgIconEdit from "../../../icons/components/IconEdit.js";
6
7
  import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
7
8
  import SvgIconUnlink from "../../../icons/components/IconUnlink.js";
8
- import { tippyOptions } from "./LinkToolbar.TippyOptions.js";
9
+ import { FLOATING_MENU_Z_INDEX, getFloatingMenuOptions } from "./FloatingMenuOptions.js";
9
10
  import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
10
- const LinkToolbar = ({
11
+ const floatingOptions = getFloatingMenuOptions({
12
+ placement: "bottom",
13
+ offset: {
14
+ mainAxis: 10,
15
+ crossAxis: 0
16
+ }
17
+ }), LinkToolbar = ({
11
18
  editor,
12
19
  onEdit,
13
20
  onOpen,
@@ -15,7 +22,7 @@ const LinkToolbar = ({
15
22
  }) => {
16
23
  const {
17
24
  t
18
- } = useTranslation(), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
25
+ } = useTranslation(), editorState = useEditorState(editor), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
19
26
  type: "icon",
20
27
  name: "edit",
21
28
  props: {
@@ -52,9 +59,24 @@ const LinkToolbar = ({
52
59
  position: "bottom"
53
60
  }
54
61
  }], [onEdit, onOpen, onUnlink, t, linkAttrs]);
55
- return useEffect(() => {
62
+ useEffect(() => {
56
63
  editor != null && editor.isActive("linker") ? setLinkAttrs(editor.getAttributes("linker")) : editor != null && editor.isActive("hyperlink") ? setLinkAttrs(editor.getAttributes("hyperlink")) : setLinkAttrs(void 0);
57
- }, [editor == null ? void 0 : editor.state]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, tippyOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && ((editor == null ? void 0 : editor.isActive("linker")) || (editor == null ? void 0 : editor.isActive("hyperlink"))) || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: LinkToolbarItems }) }) });
64
+ }, [editor, editorState]);
65
+ const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && ((editor == null ? void 0 : editor.isActive("linker")) || (editor == null ? void 0 : editor.isActive("hyperlink"))) || !1, [editor]);
66
+ return /* @__PURE__ */ jsx(Fragment, { children: editor && // BubbleMenu, not FloatingMenu: `shouldShow` below overrides visibility
67
+ // either way, this only changes the default position reference.
68
+ /* @__PURE__ */ jsx(
69
+ BubbleMenu,
70
+ {
71
+ editor,
72
+ options: floatingOptions,
73
+ shouldShow: handleShouldShow,
74
+ style: {
75
+ zIndex: FLOATING_MENU_Z_INDEX
76
+ },
77
+ children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: LinkToolbarItems })
78
+ }
79
+ ) });
58
80
  };
59
81
  export {
60
82
  LinkToolbar as default
@@ -1,6 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useState, useCallback, useEffect } from "react";
3
3
  import { useTranslation } from "react-i18next";
4
+ import { useEditorState } from "../../hooks/useEditorState.js";
4
5
  import Tooltip from "../../../../components/Tooltip/Tooltip.js";
5
6
  import Dropdown from "../../../../components/Dropdown/Dropdown.js";
6
7
  import ColorPickerItem from "../../../../components/ColorPicker/ColorPickerItem.js";
@@ -12,7 +13,7 @@ const TableToolbarCellColor = ({
12
13
  }) => {
13
14
  const {
14
15
  t
15
- } = useTranslation(), [color, setColor] = useState("transparent"), applyColor = useCallback((value) => {
16
+ } = useTranslation(), [color, setColor] = useState("transparent"), editorState = useEditorState(editor), applyColor = useCallback((value) => {
16
17
  editor == null || editor.chain().focus().setCellAttribute(
17
18
  "backgroundColor",
18
19
  // reset color is transparent here => remove bkg color
@@ -21,7 +22,7 @@ const TableToolbarCellColor = ({
21
22
  }, [editor, setColor]);
22
23
  useEffect(() => {
23
24
  setColor((editor == null ? void 0 : editor.getAttributes("tableCell").backgroundColor) ?? "transparent");
24
- }, [editor, editor == null ? void 0 : editor.state]);
25
+ }, [editor, editorState]);
25
26
  const palettes = [{
26
27
  ...DefaultPalette,
27
28
  label: t("tiptap.table.toolbar.cell.color"),
@@ -1,9 +1,12 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
- import { useState, useMemo, useEffect } from "react";
3
- import { findParentNodeClosestToPos, FloatingMenu } from "@tiptap/react";
2
+ import { useState, useMemo, useEffect, useCallback } from "react";
3
+ import { findParentNodeClosestToPos } from "@tiptap/react";
4
+ import { FloatingMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
4
5
  import { useTranslation } from "react-i18next";
5
6
  import SvgIconMergeCells from "../../../icons/components/IconMergeCells.js";
6
7
  import SvgIconSplitCells from "../../../icons/components/IconSplitCells.js";
8
+ import { useEditorState } from "../../hooks/useEditorState.js";
9
+ import { getFloatingMenuOptions, FLOATING_MENU_Z_INDEX } from "./FloatingMenuOptions.js";
7
10
  import { TableToolbarAddMenu } from "./TableToolbar.AddMenu.js";
8
11
  import { TableToolbarCellColor } from "./TableToolbar.CellColor.js";
9
12
  import { TableToolbarDelMenu } from "./TableToolbar.DelMenu.js";
@@ -13,7 +16,7 @@ const TableToolbar = ({
13
16
  }) => {
14
17
  const {
15
18
  t
16
- } = useTranslation(), [isSpan, setSpan] = useState(void 0), tippyOptions = useMemo(() => {
19
+ } = useTranslation(), [isSpan, setSpan] = useState(void 0), editorState = useEditorState(editor), floatingOptions = useMemo(() => {
17
20
  function adjustRect(rect) {
18
21
  let yOffset = 0;
19
22
  if (window.visualViewport) {
@@ -23,11 +26,15 @@ const TableToolbar = ({
23
26
  return new DOMRect(rect.x, rect.y - yOffset, rect.width, rect.height);
24
27
  }
25
28
  return {
26
- placement: "bottom",
27
- offset: [0, 0],
28
- zIndex: 999,
29
- // popperOptions: {modifiers: [ /*see popper v2 modifiers*/ ]},
30
- // Try to get the bounding rect of the table.
29
+ ...getFloatingMenuOptions({
30
+ placement: "bottom",
31
+ offset: {
32
+ mainAxis: 0,
33
+ crossAxis: 0
34
+ }
35
+ }),
36
+ // Dead in v3: FloatingMenu has no reference-rect override (unlike
37
+ // BubbleMenu's getReferencedVirtualElement), so this never runs.
31
38
  getReferenceClientRect: () => {
32
39
  const parentDiv = editor != null && editor.isActive("table") ? findParentNodeClosestToPos(editor.state.selection.$anchor, (node) => node.type.name === "table") : null;
33
40
  if (parentDiv) {
@@ -39,50 +46,63 @@ const TableToolbar = ({
39
46
  }
40
47
  };
41
48
  }, [editor]);
42
- return useEffect(() => {
49
+ useEffect(() => {
43
50
  const cellAttr = editor == null ? void 0 : editor.getAttributes("tableCell"), headAttr = editor == null ? void 0 : editor.getAttributes("tableHeader");
44
51
  if (typeof cellAttr < "u" || typeof headAttr < "u") {
45
52
  const newSpan = (cellAttr == null ? void 0 : cellAttr.colspan) > 1 || (cellAttr == null ? void 0 : cellAttr.rowspan) > 1 || (headAttr == null ? void 0 : headAttr.colspan) > 1 || (headAttr == null ? void 0 : headAttr.rowspan) > 1;
46
53
  newSpan !== isSpan && setSpan(newSpan);
47
54
  } else
48
55
  isSpan && setSpan(void 0);
49
- }, [editor, editor == null ? void 0 : editor.state, isSpan]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, tippyOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
50
- type: "dropdown",
51
- name: "bkg-col",
52
- // isEnable:
53
- // typeof editor?.getAttributes("tableCell") !== "undefined",
54
- props: {
55
- children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
56
- }
57
- }, {
58
- type: "icon",
59
- name: "mergeorsplit",
60
- // isEnable: typeof isSpan !== "undefined",
61
- props: {
62
- icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
63
- "aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
64
- onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
65
- },
66
- tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
67
- }, {
68
- type: "divider",
69
- name: "add-d0"
70
- }, {
71
- type: "dropdown",
72
- name: "add",
73
- props: {
74
- children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
75
- }
76
- }, {
77
- type: "divider",
78
- name: "add-d1"
79
- }, {
80
- type: "dropdown",
81
- name: "del",
82
- props: {
83
- children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
56
+ }, [editor, editorState, isSpan]);
57
+ const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, [editor]);
58
+ return /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(
59
+ FloatingMenu,
60
+ {
61
+ editor,
62
+ options: floatingOptions,
63
+ shouldShow: handleShouldShow,
64
+ style: {
65
+ zIndex: FLOATING_MENU_Z_INDEX
66
+ },
67
+ children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
68
+ type: "dropdown",
69
+ name: "bkg-col",
70
+ // isEnable:
71
+ // typeof editor?.getAttributes("tableCell") !== "undefined",
72
+ props: {
73
+ children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
74
+ }
75
+ }, {
76
+ type: "icon",
77
+ name: "mergeorsplit",
78
+ // isEnable: typeof isSpan !== "undefined",
79
+ props: {
80
+ icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
81
+ "aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
82
+ onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
83
+ },
84
+ tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
85
+ }, {
86
+ type: "divider",
87
+ name: "add-d0"
88
+ }, {
89
+ type: "dropdown",
90
+ name: "add",
91
+ props: {
92
+ children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
93
+ }
94
+ }, {
95
+ type: "divider",
96
+ name: "add-d1"
97
+ }, {
98
+ type: "dropdown",
99
+ name: "del",
100
+ props: {
101
+ children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
102
+ }
103
+ }] })
84
104
  }
85
- }] }) }) });
105
+ ) });
86
106
  };
87
107
  export {
88
108
  TableToolbar as default
@@ -1,6 +1,7 @@
1
1
  export * from './useActionOptions';
2
2
  export * from './useCommentEditor';
3
3
  export * from './useEditorContext';
4
+ export * from './useEditorState';
4
5
  export * from './useImageModal';
5
6
  export * from './useImageSelection';
6
7
  export * from './useLinkToolbar';
@@ -6,7 +6,7 @@ import { Content, HTMLContent } from '@tiptap/react';
6
6
  * @param content default rich content
7
7
  */
8
8
  export declare const useCommentEditor: (editable: boolean, content: Content, maxLength?: number) => {
9
- editor: import('@tiptap/core').Editor | null;
9
+ editor: import('@tiptap/core').Editor;
10
10
  commentLength: number;
11
11
  getComment: () => HTMLContent;
12
12
  resetComment: () => void;
@@ -1,14 +1,22 @@
1
1
  import { useState, useEffect } from "react";
2
2
  import { Hyperlink } from "@edifice.io/tiptap-extensions/hyperlink";
3
- import CharacterCount from "@tiptap/extension-character-count";
3
+ import { CharacterCount } from "@tiptap/extensions";
4
4
  import { useEditor } from "@tiptap/react";
5
5
  import StarterKit from "@tiptap/starter-kit";
6
6
  const useCommentEditor = (editable, content, maxLength = 800) => {
7
7
  const [commentLength, setCommentLength] = useState(0), editor = useEditor({
8
8
  editable,
9
- extensions: [StarterKit, Hyperlink, CharacterCount.configure({
10
- limit: maxLength
11
- })],
9
+ extensions: [
10
+ // v3's StarterKit bundles its own 'link' mark, which would compete with
11
+ // Hyperlink below for the same <a> tags. Disabled.
12
+ StarterKit.configure({
13
+ link: !1
14
+ }),
15
+ Hyperlink,
16
+ CharacterCount.configure({
17
+ limit: maxLength
18
+ })
19
+ ],
12
20
  content
13
21
  });
14
22
  return useEffect(() => {
@@ -0,0 +1,20 @@
1
+ import { Editor } from '@tiptap/react';
2
+ /**
3
+ * Hook to track editor state changes in Tiptap v3.
4
+ * Replaces the pattern of using `editor?.state` in useEffect dependencies.
5
+ *
6
+ * @param editor - The Tiptap editor instance
7
+ * @returns A counter that increments on each editor update
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * const { editor } = useEditorContext();
12
+ * const editorState = useEditorState(editor);
13
+ *
14
+ * useEffect(() => {
15
+ * const attrs = editor?.getAttributes('textStyle');
16
+ * // ... do something with attrs
17
+ * }, [editor, editorState]);
18
+ * ```
19
+ */
20
+ export declare const useEditorState: (editor: Editor | null | undefined) => number;
@@ -0,0 +1,16 @@
1
+ import { useState, useEffect } from "react";
2
+ const useEditorState = (editor) => {
3
+ const [updateCount, setUpdateCount] = useState(0);
4
+ return useEffect(() => {
5
+ if (!editor) return;
6
+ const handleUpdate = () => {
7
+ setUpdateCount((prev) => prev + 1);
8
+ };
9
+ return editor.on("transaction", handleUpdate), () => {
10
+ editor.off("transaction", handleUpdate);
11
+ };
12
+ }, [editor]), updateCount;
13
+ };
14
+ export {
15
+ useEditorState
16
+ };
@@ -12,7 +12,7 @@ import { MediaLibraryRef } from '../../multimedia';
12
12
  * }
13
13
  */
14
14
  export declare const useLinkToolbar: (editor: Editor | null, mediaLibraryRef: RefObject<MediaLibraryRef>) => {
15
- onEdit: (attrs: LinkerAttributes | HyperlinkAttributes) => void;
16
- onOpen: (attrs: LinkerAttributes) => void;
15
+ onEdit: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
16
+ onOpen: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
17
17
  onUnlink: () => void;
18
18
  };
@@ -2,6 +2,7 @@ import { useCallback } from "react";
2
2
  const useLinkToolbar = (editor, mediaLibraryRef) => ({
3
3
  onEdit: useCallback((attrs) => {
4
4
  var _a, _b;
5
+ if (!attrs) return;
5
6
  editor != null && editor.isActive("hyperlink") && editor.commands.extendMarkRange("hyperlink");
6
7
  const attrsLinker = attrs;
7
8
  if (attrsLinker["data-id"] || attrsLinker["data-app-prefix"])
@@ -25,7 +26,7 @@ const useLinkToolbar = (editor, mediaLibraryRef) => ({
25
26
  }
26
27
  }, [editor, mediaLibraryRef]),
27
28
  onOpen: (attrs) => {
28
- window.open(attrs.href || "about:blank", "_blank");
29
+ window.open((attrs == null ? void 0 : attrs.href) || "about:blank", "_blank");
29
30
  },
30
31
  onUnlink: () => {
31
32
  var _a, _b, _c, _d;
@@ -1,4 +1,4 @@
1
- import { Content, Extensions, FocusPosition } from '@tiptap/react';
1
+ import { Content, Editor, Extensions, FocusPosition } from '@tiptap/react';
2
2
  import { WorkspaceVisibility } from '@edifice.io/client';
3
3
  /**
4
4
  * Hook that creates a tiptap editor instance.
@@ -13,8 +13,8 @@ import { WorkspaceVisibility } from '@edifice.io/client';
13
13
  * @returns the editor instance and the editable state
14
14
  */
15
15
  export declare const useTipTapEditor: (editable: boolean, content: Content, focus?: FocusPosition, placeholder?: string, onContentChange?: ({ editor }: {
16
- editor: any;
16
+ editor: Editor;
17
17
  }) => void, visibility?: WorkspaceVisibility, extensions?: Extensions) => {
18
- editor: import('@tiptap/core').Editor | null;
18
+ editor: Editor;
19
19
  editable: boolean;
20
20
  };