@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
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
2
+ import { useState, useRef, useEffect } from "react";
3
3
  import clsx from "clsx";
4
4
  import { createPortal } from "react-dom";
5
5
  import { useTranslation } from "react-i18next";
@@ -16,20 +16,22 @@ const HelpZone = ({
16
16
  }) => {
17
17
  const {
18
18
  t
19
- } = useTranslation(), [portalRoot, setPortalRoot] = useState(null), [isCompact, setIsCompact] = useState(!1);
19
+ } = useTranslation(), [portalRoot, setPortalRoot] = useState(null), [isCompact, setIsCompact] = useState(!1), questionButtonRef = useRef(null);
20
20
  if (useEffect(() => (document.body.classList.add("help-zone-active"), setPortalRoot(document.getElementById("portal")), () => {
21
21
  document.body.classList.remove("help-zone-active");
22
22
  }), []), useEffect(() => {
23
23
  if (isCompact)
24
24
  return;
25
- const goCompact = () => setIsCompact(!0);
25
+ const goCompact = () => setIsCompact(!0), handleClick = (event) => {
26
+ questionButtonRef.current && event.target instanceof Node && questionButtonRef.current.contains(event.target) || goCompact();
27
+ };
26
28
  return document.addEventListener("scroll", goCompact, {
27
29
  capture: !0,
28
30
  passive: !0
29
- }), () => {
31
+ }), document.addEventListener("click", handleClick), () => {
30
32
  document.removeEventListener("scroll", goCompact, {
31
33
  capture: !0
32
- });
34
+ }), document.removeEventListener("click", handleClick);
33
35
  };
34
36
  }, [isCompact]), !isReady || !portalRoot)
35
37
  return null;
@@ -42,7 +44,7 @@ const HelpZone = ({
42
44
  "help-zone-logo--full": !isCompact
43
45
  }), children: isCompact ? /* @__PURE__ */ jsx(SvgIconLogoEdificeSmall, { width: 18, height: 18 }) : /* @__PURE__ */ jsx(SvgIconLogoEdificeFull, { width: 81, height: 18 }) }) }) }),
44
46
  /* @__PURE__ */ jsx("span", { className: "help-zone-divider" }),
45
- /* @__PURE__ */ jsx(ButtonBeta, { className: "help-zone-question", "aria-label": t("help-zone.support.open"), color: "tertiary", variant: "ghost", onClick: handleOpenHelpZone, children: /* @__PURE__ */ jsx(Tooltip, { message: t("help-zone.support.open"), placement: "top", children: /* @__PURE__ */ jsx(SvgIconQuestion, { width: 24, height: 24, color: "white" }) }) })
47
+ /* @__PURE__ */ jsx(ButtonBeta, { ref: questionButtonRef, className: "help-zone-question", "aria-label": t("help-zone.support.open"), color: "tertiary", variant: "ghost", onClick: handleOpenHelpZone, children: /* @__PURE__ */ jsx(Tooltip, { message: t("help-zone.support.open"), placement: "top", children: /* @__PURE__ */ jsx(SvgIconQuestion, { width: 24, height: 24, color: "white" }) }) })
46
48
  ] }), portalRoot);
47
49
  };
48
50
  export {
@@ -1,13 +1,16 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import HelpZone from "./HelpZone.js";
3
3
  import useZendeskGuide from "../../hooks/useZendeskGuide/useZendeskGuide.js";
4
+ function getHeaderColor() {
5
+ return getComputedStyle(document.documentElement).getPropertyValue("--primitive-blue-400").trim();
6
+ }
4
7
  function HelpZoneContainer() {
5
- const {
8
+ const headerColor = getHeaderColor(), {
6
9
  isReady,
7
10
  isOpen,
8
11
  open,
9
12
  close
10
- } = useZendeskGuide();
13
+ } = useZendeskGuide(headerColor);
11
14
  return /* @__PURE__ */ jsx(HelpZone, { isReady, isOpen, onOpen: open, onClose: close });
12
15
  }
13
16
  export {
@@ -1,8 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
- import { BubbleMenu } from "@tiptap/react";
2
+ import { useState, useEffect, useCallback, useMemo } 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 { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
7
+ import { getFloatingMenuOptions, useReferencedVirtualElement, FLOATING_MENU_Z_INDEX } from "../Toolbar/FloatingMenuOptions.js";
6
8
  import SvgIconImageSizeLarge from "../../../icons/components/IconImageSizeLarge.js";
7
9
  import SvgIconImageSizeMedium from "../../../icons/components/IconImageSizeMedium.js";
8
10
  import SvgIconImageSizeSmall from "../../../icons/components/IconImageSizeSmall.js";
@@ -15,90 +17,93 @@ const BubbleMenuEditImage = ({
15
17
  }) => {
16
18
  const {
17
19
  t
18
- } = useTranslation(), {
19
- selection
20
- } = editor.view.state, selectedNode = editor.view.state.doc.nodeAt(selection.anchor), handleButtonClick = (buttonSize) => {
21
- editor.chain().focus().setAttributes({
20
+ } = useTranslation(), editorState = useEditorState(editor), [currentSize, setCurrentSize] = useState(null), [currentWidth, setCurrentWidth] = useState(null);
21
+ useEffect(() => {
22
+ var _a, _b;
23
+ const {
24
+ selection
25
+ } = editor.view.state, selectedNode = editor.view.state.doc.nodeAt(selection.anchor);
26
+ setCurrentSize(((_a = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _a.size) ?? null), setCurrentWidth(((_b = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _b.width) ?? null);
27
+ }, [editor, editorState]);
28
+ const handleButtonClick = useCallback((buttonSize) => {
29
+ editor.chain().focus().updateAttributes("custom-image", {
22
30
  width: buttonSize.width,
23
31
  height: buttonSize.height,
24
32
  size: buttonSize.size
25
33
  }).run();
26
- }, ImageSizeItems = useMemo(() => {
27
- var _a, _b, _c, _d, _e, _f;
28
- return [{
29
- type: "button",
30
- name: "edit",
31
- props: {
32
- size: "lg",
33
- color: "secondary",
34
- leftIcon: /* @__PURE__ */ jsx(SvgIconWand, {}),
35
- "aria-label": t("tiptap.tooltip.bubblemenu.image.edit"),
36
- children: t("tiptap.bubblemenu.edit"),
37
- onClick: onEditImage
38
- },
39
- tooltip: {
40
- message: t("tiptap.tooltip.bubblemenu.image.edit"),
41
- position: "top"
42
- }
43
- }, {
44
- type: "divider",
45
- name: "div-4"
46
- }, {
47
- type: "icon",
48
- name: "small",
49
- props: {
50
- icon: /* @__PURE__ */ jsx(SvgIconImageSizeSmall, {}),
51
- "aria-label": t("tiptap.tooltip.bubblemenu.image.small"),
52
- color: "tertiary",
53
- className: ((_a = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _a.size) === "small" && ((_b = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _b.width) === 250 ? "is-selected" : "",
54
- onClick: () => handleButtonClick({
55
- size: "small",
56
- width: 250,
57
- height: "auto"
58
- })
59
- },
60
- tooltip: {
61
- message: t("tiptap.tooltip.bubblemenu.image.small"),
62
- position: "top"
63
- }
64
- }, {
65
- type: "icon",
66
- name: "medium",
67
- props: {
68
- icon: /* @__PURE__ */ jsx(SvgIconImageSizeMedium, {}),
69
- "aria-label": t("tiptap.tooltip.bubblemenu.image.medium"),
70
- color: "tertiary",
71
- className: ((_c = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _c.size) === "medium" && ((_d = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _d.width) === 350 ? "is-selected" : "",
72
- onClick: () => handleButtonClick({
73
- size: "medium",
74
- width: 350,
75
- height: "auto"
76
- })
77
- },
78
- tooltip: {
79
- message: t("tiptap.tooltip.bubblemenu.image.medium"),
80
- position: "top"
81
- }
82
- }, {
83
- type: "icon",
84
- name: "large",
85
- props: {
86
- icon: /* @__PURE__ */ jsx(SvgIconImageSizeLarge, {}),
87
- "aria-label": t("tiptap.tooltip.bubblemenu.image.big"),
88
- color: "tertiary",
89
- className: ((_e = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _e.size) === "large" && ((_f = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _f.width) === 500 ? "is-selected" : "",
90
- onClick: () => handleButtonClick({
91
- size: "large",
92
- width: 500,
93
- height: "auto"
94
- })
95
- },
96
- tooltip: {
97
- message: t("tiptap.tooltip.bubblemenu.image.big"),
98
- position: "top"
99
- }
100
- }];
101
- }, [t, selectedNode]), tippyOptions = useMemo(() => {
34
+ }, [editor]), ImageSizeItems = useMemo(() => [{
35
+ type: "button",
36
+ name: "edit",
37
+ props: {
38
+ size: "lg",
39
+ color: "secondary",
40
+ leftIcon: /* @__PURE__ */ jsx(SvgIconWand, {}),
41
+ "aria-label": t("tiptap.tooltip.bubblemenu.image.edit"),
42
+ children: t("tiptap.bubblemenu.edit"),
43
+ onClick: onEditImage
44
+ },
45
+ tooltip: {
46
+ message: t("tiptap.tooltip.bubblemenu.image.edit"),
47
+ position: "top"
48
+ }
49
+ }, {
50
+ type: "divider",
51
+ name: "div-4"
52
+ }, {
53
+ type: "icon",
54
+ name: "small",
55
+ props: {
56
+ icon: /* @__PURE__ */ jsx(SvgIconImageSizeSmall, {}),
57
+ "aria-label": t("tiptap.tooltip.bubblemenu.image.small"),
58
+ color: "tertiary",
59
+ className: currentSize === "small" && currentWidth === 250 ? "is-selected" : "",
60
+ onClick: () => handleButtonClick({
61
+ size: "small",
62
+ width: 250,
63
+ height: "auto"
64
+ })
65
+ },
66
+ tooltip: {
67
+ message: t("tiptap.tooltip.bubblemenu.image.small"),
68
+ position: "top"
69
+ }
70
+ }, {
71
+ type: "icon",
72
+ name: "medium",
73
+ props: {
74
+ icon: /* @__PURE__ */ jsx(SvgIconImageSizeMedium, {}),
75
+ "aria-label": t("tiptap.tooltip.bubblemenu.image.medium"),
76
+ color: "tertiary",
77
+ className: currentSize === "medium" && currentWidth === 350 ? "is-selected" : "",
78
+ onClick: () => handleButtonClick({
79
+ size: "medium",
80
+ width: 350,
81
+ height: "auto"
82
+ })
83
+ },
84
+ tooltip: {
85
+ message: t("tiptap.tooltip.bubblemenu.image.medium"),
86
+ position: "top"
87
+ }
88
+ }, {
89
+ type: "icon",
90
+ name: "large",
91
+ props: {
92
+ icon: /* @__PURE__ */ jsx(SvgIconImageSizeLarge, {}),
93
+ "aria-label": t("tiptap.tooltip.bubblemenu.image.big"),
94
+ color: "tertiary",
95
+ className: currentSize === "large" && currentWidth === 500 ? "is-selected" : "",
96
+ onClick: () => handleButtonClick({
97
+ size: "large",
98
+ width: 500,
99
+ height: "auto"
100
+ })
101
+ },
102
+ tooltip: {
103
+ message: t("tiptap.tooltip.bubblemenu.image.big"),
104
+ position: "top"
105
+ }
106
+ }], [t, currentSize, currentWidth, onEditImage, handleButtonClick]), reference = useMemo(() => {
102
107
  function adjustRect(rect) {
103
108
  let yOffset = 0;
104
109
  if (window.visualViewport) {
@@ -108,12 +113,7 @@ const BubbleMenuEditImage = ({
108
113
  return new DOMRect(rect.x, rect.y - yOffset, rect.width, rect.height);
109
114
  }
110
115
  return {
111
- placement: "bottom-start",
112
- offset: [0, 0],
113
- zIndex: 999,
114
- duration: 100,
115
- // Try to get the bounding rect of the table.
116
- getReferenceClientRect: () => {
116
+ getBoundingClientRect: () => {
117
117
  const parentDiv = editor != null && editor.isActive("custom-image") ? editor.state.selection.$anchor : null;
118
118
  if (parentDiv) {
119
119
  const parentDomNode = editor == null ? void 0 : editor.view.nodeDOM(parentDiv.pos);
@@ -125,10 +125,29 @@ const BubbleMenuEditImage = ({
125
125
  return new DOMRect(0, 0, 100, 100);
126
126
  }
127
127
  };
128
- }, [editor]);
129
- return /* @__PURE__ */ jsx(BubbleMenu, { className: openEditImage ? "d-none" : "", shouldShow: ({
128
+ }, [editor]), floatingOptions = useMemo(() => getFloatingMenuOptions({
129
+ placement: "bottom-start",
130
+ offset: {
131
+ mainAxis: 0,
132
+ crossAxis: 0
133
+ }
134
+ }), []), getReferencedVirtualElement = useReferencedVirtualElement(reference), handleShouldShow = useCallback(({
130
135
  editor: editor2
131
- }) => editor2.isActive("custom-image") && !openEditImage, editor, tippyOptions, children: editable && /* @__PURE__ */ jsx(Toolbar, { className: "p-8", items: ImageSizeItems }) });
136
+ }) => editor2.isActive("custom-image") && !openEditImage, [openEditImage]);
137
+ return /* @__PURE__ */ jsx(
138
+ BubbleMenu,
139
+ {
140
+ className: openEditImage ? "d-none" : "",
141
+ shouldShow: handleShouldShow,
142
+ editor,
143
+ options: floatingOptions,
144
+ getReferencedVirtualElement,
145
+ style: {
146
+ zIndex: FLOATING_MENU_Z_INDEX
147
+ },
148
+ children: editable && /* @__PURE__ */ jsx(Toolbar, { className: "p-8", items: ImageSizeItems }, `toolbar-${currentSize}-${currentWidth}`)
149
+ }
150
+ );
132
151
  };
133
152
  export {
134
153
  BubbleMenuEditImage as default
@@ -1,8 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
- import { BubbleMenu } from "@tiptap/react";
2
+ import { useState, useEffect, useMemo, 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 { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
7
+ import { getFloatingMenuOptions, useReferencedVirtualElement, FLOATING_MENU_Z_INDEX } from "../Toolbar/FloatingMenuOptions.js";
6
8
  import SvgIconAlertTriangle from "../../../icons/components/IconAlertTriangle.js";
7
9
  import SvgIconDelete from "../../../icons/components/IconDelete.js";
8
10
  import SvgIconInfoCircle from "../../../icons/components/IconInfoCircle.js";
@@ -14,98 +16,105 @@ const BubbleMenuEditInformationPane = ({
14
16
  }) => {
15
17
  const {
16
18
  t
17
- } = useTranslation(), {
18
- selection
19
- } = editor.view.state, selectedNode = selection.$from.node(1), InformationPaneTypeItems = useMemo(() => {
20
- var _a, _b, _c, _d;
21
- return [{
22
- type: "icon",
23
- name: "info",
24
- props: {
25
- size: "lg",
26
- icon: /* @__PURE__ */ jsx(SvgIconInfoCircle, {}),
27
- "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.info"),
28
- className: ((_a = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _a.type) === "info" ? "is-selected" : "",
29
- onClick: () => editor.chain().focus().updateAttributes("information-pane", {
30
- type: "info"
31
- }).run()
32
- },
33
- tooltip: {
34
- message: t("tiptap.tooltip.bubblemenu.information.pane.info"),
35
- position: "top"
36
- }
37
- }, {
38
- type: "icon",
39
- name: "success",
40
- props: {
41
- size: "lg",
42
- icon: /* @__PURE__ */ jsx(SvgIconSuccessOutline, {}),
43
- "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.success"),
44
- className: ((_b = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _b.type) === "success" ? "is-selected" : "",
45
- onClick: () => editor.chain().focus().updateAttributes("information-pane", {
46
- type: "success"
47
- }).run()
48
- },
49
- tooltip: {
50
- message: t("tiptap.tooltip.bubblemenu.information.pane.success"),
51
- position: "top"
52
- }
53
- }, {
54
- type: "icon",
55
- name: "warning",
56
- props: {
57
- size: "lg",
58
- icon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}),
59
- "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.warning"),
60
- className: ((_c = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _c.type) === "warning" ? "is-selected" : "",
61
- onClick: () => editor.chain().focus().updateAttributes("information-pane", {
62
- type: "warning"
63
- }).run()
64
- },
65
- tooltip: {
66
- message: t("tiptap.tooltip.bubblemenu.information.pane.warning"),
67
- position: "top"
19
+ } = useTranslation(), editorState = useEditorState(editor), [currentType, setCurrentType] = useState(null);
20
+ useEffect(() => {
21
+ var _a;
22
+ const {
23
+ $anchor
24
+ } = editor.view.state.selection;
25
+ let selectedNode = null;
26
+ for (let depth = $anchor.depth; depth >= 0; depth--) {
27
+ const node = $anchor.node(depth);
28
+ if (node.type.name === "information-pane") {
29
+ selectedNode = node;
30
+ break;
68
31
  }
69
- }, {
70
- type: "icon",
71
- name: "question",
72
- props: {
73
- size: "lg",
74
- icon: /* @__PURE__ */ jsx(SvgIconQuestion, {}),
75
- "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.question"),
76
- className: ((_d = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _d.type) === "question" ? "is-selected" : "",
77
- onClick: () => editor.chain().focus().updateAttributes("information-pane", {
78
- type: "question"
79
- }).run()
80
- },
81
- tooltip: {
82
- message: t("tiptap.tooltip.bubblemenu.information.pane.question"),
83
- position: "top"
84
- }
85
- }, {
86
- type: "divider",
87
- name: "div-4"
88
- }, {
89
- type: "button",
90
- name: "delete",
91
- props: {
92
- size: "lg",
93
- leftIcon: /* @__PURE__ */ jsx(SvgIconDelete, {}),
94
- "aria-label": t("tiptap.bubblemenu.delete"),
95
- children: t("tiptap.bubblemenu.delete"),
96
- onClick: () => editor.chain().focus().deleteNode("information-pane").run()
97
- },
98
- tooltip: {
99
- message: t("tiptap.bubblemenu.delete"),
100
- position: "top"
101
- }
102
- }];
103
- }, [t, selectedNode]), tippyOptions = useMemo(() => ({
104
- placement: "bottom",
105
- offset: [0, 0],
106
- zIndex: 999,
107
- duration: 100,
108
- getReferenceClientRect: () => {
32
+ }
33
+ setCurrentType(((_a = selectedNode == null ? void 0 : selectedNode.attrs) == null ? void 0 : _a.type) ?? null);
34
+ }, [editor, editorState]);
35
+ const InformationPaneTypeItems = useMemo(() => [{
36
+ type: "icon",
37
+ name: "info",
38
+ props: {
39
+ size: "lg",
40
+ icon: /* @__PURE__ */ jsx(SvgIconInfoCircle, {}),
41
+ "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.info"),
42
+ className: currentType === "info" ? "is-selected" : "",
43
+ onClick: () => editor.chain().focus().updateAttributes("information-pane", {
44
+ type: "info"
45
+ }).run()
46
+ },
47
+ tooltip: {
48
+ message: t("tiptap.tooltip.bubblemenu.information.pane.info"),
49
+ position: "top"
50
+ }
51
+ }, {
52
+ type: "icon",
53
+ name: "success",
54
+ props: {
55
+ size: "lg",
56
+ icon: /* @__PURE__ */ jsx(SvgIconSuccessOutline, {}),
57
+ "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.success"),
58
+ className: currentType === "success" ? "is-selected" : "",
59
+ onClick: () => editor.chain().focus().updateAttributes("information-pane", {
60
+ type: "success"
61
+ }).run()
62
+ },
63
+ tooltip: {
64
+ message: t("tiptap.tooltip.bubblemenu.information.pane.success"),
65
+ position: "top"
66
+ }
67
+ }, {
68
+ type: "icon",
69
+ name: "warning",
70
+ props: {
71
+ size: "lg",
72
+ icon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}),
73
+ "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.warning"),
74
+ className: currentType === "warning" ? "is-selected" : "",
75
+ onClick: () => editor.chain().focus().updateAttributes("information-pane", {
76
+ type: "warning"
77
+ }).run()
78
+ },
79
+ tooltip: {
80
+ message: t("tiptap.tooltip.bubblemenu.information.pane.warning"),
81
+ position: "top"
82
+ }
83
+ }, {
84
+ type: "icon",
85
+ name: "question",
86
+ props: {
87
+ size: "lg",
88
+ icon: /* @__PURE__ */ jsx(SvgIconQuestion, {}),
89
+ "aria-label": t("tiptap.tooltip.bubblemenu.information.pane.question"),
90
+ className: currentType === "question" ? "is-selected" : "",
91
+ onClick: () => editor.chain().focus().updateAttributes("information-pane", {
92
+ type: "question"
93
+ }).run()
94
+ },
95
+ tooltip: {
96
+ message: t("tiptap.tooltip.bubblemenu.information.pane.question"),
97
+ position: "top"
98
+ }
99
+ }, {
100
+ type: "divider",
101
+ name: "div-4"
102
+ }, {
103
+ type: "button",
104
+ name: "delete",
105
+ props: {
106
+ size: "lg",
107
+ leftIcon: /* @__PURE__ */ jsx(SvgIconDelete, {}),
108
+ "aria-label": t("tiptap.bubblemenu.delete"),
109
+ children: t("tiptap.bubblemenu.delete"),
110
+ onClick: () => editor.chain().focus().deleteNode("information-pane").run()
111
+ },
112
+ tooltip: {
113
+ message: t("tiptap.bubblemenu.delete"),
114
+ position: "top"
115
+ }
116
+ }], [t, editor, currentType]), reference = useMemo(() => ({
117
+ getBoundingClientRect: () => {
109
118
  const {
110
119
  state
111
120
  } = editor, {
@@ -126,10 +135,28 @@ const BubbleMenuEditInformationPane = ({
126
135
  }
127
136
  return new DOMRect(0, 0, 0, 0);
128
137
  }
129
- }), [editor]);
130
- return /* @__PURE__ */ jsx(BubbleMenu, { shouldShow: ({
138
+ }), [editor]), floatingOptions = useMemo(() => getFloatingMenuOptions({
139
+ placement: "bottom",
140
+ offset: {
141
+ mainAxis: 0,
142
+ crossAxis: 0
143
+ }
144
+ }), []), getReferencedVirtualElement = useReferencedVirtualElement(reference), handleShouldShow = useCallback(({
131
145
  editor: editor2
132
- }) => editor2.isActive("information-pane"), editor, tippyOptions, children: editable && /* @__PURE__ */ jsx(Toolbar, { className: "p-8", items: InformationPaneTypeItems }) });
146
+ }) => editor2.isActive("information-pane"), []);
147
+ return /* @__PURE__ */ jsx(
148
+ BubbleMenu,
149
+ {
150
+ shouldShow: handleShouldShow,
151
+ editor,
152
+ options: floatingOptions,
153
+ getReferencedVirtualElement,
154
+ style: {
155
+ zIndex: FLOATING_MENU_Z_INDEX
156
+ },
157
+ children: editable && /* @__PURE__ */ jsx(Toolbar, { className: "p-8", items: InformationPaneTypeItems })
158
+ }
159
+ );
133
160
  };
134
161
  export {
135
162
  BubbleMenuEditInformationPane as default
@@ -3,11 +3,6 @@ import { Content, Extensions, FocusPosition, JSONContent } from '@tiptap/react';
3
3
  export interface EditorRef {
4
4
  /** Get the current content. */
5
5
  getContent: (as: 'html' | 'json' | 'plain') => undefined | string | JSONContent;
6
- /**
7
- * Whether the editor has no content (TipTap's `editor.isEmpty`).
8
- * Evaluated on each access, so it always reflects the current document.
9
- */
10
- readonly isEmpty: boolean;
11
6
  /** Get speech synthetisis current state */
12
7
  isSpeeching: () => boolean;
13
8
  /** [De]activate speech synthetisis */
@@ -60,9 +60,6 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
60
60
  throw `[Editor] Unknown content format ${as}`;
61
61
  }
62
62
  },
63
- get isEmpty() {
64
- return (editor == null ? void 0 : editor.isEmpty) ?? !0;
65
- },
66
63
  toogleSpeechSynthetisis: speechSynthetisis.toggle,
67
64
  isSpeeching: () => speechSynthetisis.isActivated,
68
65
  setFocus: (position) => {
@@ -3,6 +3,7 @@ import { useState, useMemo, useCallback, useEffect } from "react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import SvgIconTextHighlight from "../../../icons/components/IconTextHighlight.js";
5
5
  import { useEditorContext } from "../../hooks/useEditorContext.js";
6
+ import { useEditorState } from "../../hooks/useEditorState.js";
6
7
  import { DefaultPalette } from "../../../../components/ColorPicker/ColorPalette.js";
7
8
  import Tooltip from "../../../../components/Tooltip/Tooltip.js";
8
9
  import IconButton from "../../../../components/Button/IconButton.js";
@@ -16,20 +17,16 @@ const EditorToolbarHighlightColor = ({
16
17
  t
17
18
  } = useTranslation(), {
18
19
  editor
19
- } = useEditorContext(), [color, setColor] = useState("#4A4A4A"), isActive = useMemo(
20
- () => editor == null ? void 0 : editor.isActive("customHighlight", {
21
- color: /^#([0-9a-f]{3}){1,2}$/i
22
- }),
23
- // eslint-disable-next-line react-hooks/exhaustive-deps
24
- [editor, editor == null ? void 0 : editor.state]
25
- ), applyColor = useCallback((value) => {
20
+ } = useEditorContext(), [color, setColor] = useState("#4A4A4A"), editorState = useEditorState(editor), isActive = useMemo(() => editor == null ? void 0 : editor.isActive("customHighlight", {
21
+ color: /^#([0-9a-f]{3}){1,2}$/i
22
+ }), [editor, editorState]), applyColor = useCallback((value) => {
26
23
  value === color || value === "" ? (setColor(""), editor == null || editor.chain().focus().unsetHighlight().run()) : (setColor(value), editor == null || editor.chain().focus().setHighlight({
27
24
  color: value
28
25
  }).run());
29
26
  }, [color, editor]);
30
27
  useEffect(() => {
31
28
  setColor((editor == null ? void 0 : editor.getAttributes("customHighlight").color) ?? "");
32
- }, [editor, editor == null ? void 0 : editor.state]);
29
+ }, [editor, editorState]);
33
30
  const palettes = [{
34
31
  ...DefaultPalette,
35
32
  reset: {
@@ -3,6 +3,7 @@ import { useState, useMemo, useCallback, useEffect } from "react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import SvgIconTextColor from "../../../icons/components/IconTextColor.js";
5
5
  import { useEditorContext } from "../../hooks/useEditorContext.js";
6
+ import { useEditorState } from "../../hooks/useEditorState.js";
6
7
  import { DefaultPalette, AccessiblePalette } from "../../../../components/ColorPicker/ColorPalette.js";
7
8
  import Tooltip from "../../../../components/Tooltip/Tooltip.js";
8
9
  import IconButton from "../../../../components/Button/IconButton.js";
@@ -16,19 +17,15 @@ const EditorToolbarTextColor = ({
16
17
  t
17
18
  } = useTranslation(), {
18
19
  editor
19
- } = useEditorContext(), [color, setColor] = useState("#4A4A4A"), isActive = useMemo(
20
- () => editor == null ? void 0 : editor.isActive("textStyle", {
21
- color: /^#([0-9a-f]{3}){1,2}$/i
22
- }),
23
- // eslint-disable-next-line react-hooks/exhaustive-deps
24
- [editor, editor == null ? void 0 : editor.state]
25
- ), applyColor = useCallback((value) => {
20
+ } = useEditorContext(), [color, setColor] = useState("#4A4A4A"), editorState = useEditorState(editor), isActive = useMemo(() => editor == null ? void 0 : editor.isActive("textStyle", {
21
+ color: /^#([0-9a-f]{3}){1,2}$/i
22
+ }), [editor, editorState]), applyColor = useCallback((value) => {
26
23
  value === color ? (setColor(""), editor == null || editor.chain().focus().unsetColor().run()) : (setColor(value), editor == null || editor.chain().focus().setColor(value).run());
27
24
  }, [color, editor]);
28
25
  useEffect(() => {
29
26
  const textStyle = editor == null ? void 0 : editor.getAttributes("textStyle");
30
27
  setColor((textStyle == null ? void 0 : textStyle.color) ?? "#4A4A4A");
31
- }, [editor, editor == null ? void 0 : editor.state]);
28
+ }, [editor, editorState]);
32
29
  const palettes = [{
33
30
  ...DefaultPalette,
34
31
  label: t("tiptap.toolbar.color.text")