@edifice.io/react 2.5.22 → 2.5.23-chore-tiptap-v3.20260930150159
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.
- package/dist/components/AppIcon/AppIcon.js +4 -1
- package/dist/components/Avatar/Avatar.d.ts +2 -2
- package/dist/components/Avatar/Avatar.js +2 -1
- package/dist/components/BetaSwitch/BetaSwitch.d.ts +13 -0
- package/dist/components/BetaSwitch/BetaSwitch.js +27 -0
- package/dist/components/BetaSwitch/index.d.ts +1 -0
- package/dist/components/ButtonBeta/ButtonBeta.d.ts +47 -0
- package/dist/components/ButtonBeta/ButtonBeta.js +34 -0
- package/dist/components/ButtonBeta/index.d.ts +2 -0
- package/dist/components/Dropdown/DropdownTrigger.d.ts +1 -1
- package/dist/components/Flex/Flex.js +5 -1
- package/dist/components/Logo/index.d.ts +1 -1
- package/dist/components/LogoBeta/LogoBeta.d.ts +7 -0
- package/dist/components/LogoBeta/LogoBeta.js +14 -0
- package/dist/components/LogoBeta/index.d.ts +2 -0
- package/dist/components/MediaViewer/MediaViewer.d.ts +1 -1
- package/dist/components/MediaViewer/MediaWrapper.d.ts +1 -1
- package/dist/components/PageLayout/PageLayout.d.ts +45 -0
- package/dist/components/PageLayout/PageLayout.js +94 -0
- package/dist/components/PageLayout/PageLayoutContext.d.ts +14 -0
- package/dist/components/PageLayout/PageLayoutContext.js +8 -0
- package/dist/components/PageLayout/components/PageLayoutBreadcrumb.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutBreadcrumb.js +10 -0
- package/dist/components/PageLayout/components/PageLayoutContent.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutContent.js +18 -0
- package/dist/components/PageLayout/components/PageLayoutHeader.d.ts +10 -0
- package/dist/components/PageLayout/components/PageLayoutHeader.js +18 -0
- package/dist/components/PageLayout/components/PageLayoutOverlay.d.ts +15 -0
- package/dist/components/PageLayout/components/PageLayoutOverlay.js +51 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarLeft.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarLeft.js +18 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarRight.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarRight.js +18 -0
- package/dist/components/PageLayout/hook/useOverlay.d.ts +5 -0
- package/dist/components/PageLayout/hook/useOverlay.js +15 -0
- package/dist/components/PageLayout/index.d.ts +4 -0
- package/dist/components/PageLayout/store/overlayStore.d.ts +15 -0
- package/dist/components/PageLayout/store/overlayStore.js +12 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/editor.js +2 -0
- package/dist/homepage.js +34 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useEdificeIcons/useEdificeIcons.js +10 -9
- package/dist/hooks/useScreeb/index.d.ts +1 -1
- package/dist/icons-nav.js +38 -28
- package/dist/index.js +215 -202
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +97 -90
- package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +111 -95
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +3 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.FloatingOptions.js +12 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +5 -4
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +10 -5
- package/dist/modules/editor/hooks/index.d.ts +1 -0
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useCommentEditor.js +1 -1
- package/dist/modules/editor/hooks/useEditorState.d.ts +20 -0
- package/dist/modules/editor/hooks/useEditorState.js +16 -0
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useTipTapEditor.js +4 -8
- package/dist/modules/homepage/components/Favorites/Favorites.d.ts +6 -0
- package/dist/modules/homepage/components/Favorites/Favorites.js +28 -0
- package/dist/modules/homepage/components/Favorites/FavoritesContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Favorites/FavoritesContainer.js +10 -0
- package/dist/modules/homepage/components/Favorites/index.d.ts +2 -0
- package/dist/modules/homepage/components/Header/Header.d.ts +9 -0
- package/dist/modules/homepage/components/Header/Header.js +80 -0
- package/dist/modules/homepage/components/Header/index.d.ts +2 -0
- package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +37 -0
- package/dist/modules/homepage/components/HomeCard/HomeCard.js +17 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardContent.d.ts +7 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardContent.js +10 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +18 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +22 -0
- package/dist/modules/homepage/components/HomeCard/index.d.ts +4 -0
- package/dist/modules/homepage/components/LastInfos/LastInfos.d.ts +49 -0
- package/dist/modules/homepage/components/LastInfos/LastInfos.js +58 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosContainer.d.ts +4 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosContainer.js +37 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosList.d.ts +13 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosList.js +31 -0
- package/dist/modules/homepage/components/LastInfos/index.d.ts +4 -0
- package/dist/modules/homepage/components/LastInfos/useLastInfos.d.ts +18 -0
- package/dist/modules/homepage/components/LastInfos/useLastInfos.js +25 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.d.ts +12 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +65 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashList.d.ts +12 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashList.js +10 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashListContainer.d.ts +5 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashListContainer.js +14 -0
- package/dist/modules/homepage/components/MessageFlashList/hooks/useMessageFlashList.d.ts +16 -0
- package/dist/modules/homepage/components/MessageFlashList/hooks/useMessageFlashList.js +19 -0
- package/dist/modules/homepage/components/MessageFlashList/index.d.ts +4 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/index.js +5 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/messagesFlashService.d.ts +20 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/messagesFlashService.js +21 -0
- package/dist/modules/homepage/components/MessageFlashList/services/queries/messagesFlash.d.ts +13 -0
- package/dist/modules/homepage/components/MessageFlashList/services/queries/messagesFlash.js +31 -0
- package/dist/modules/homepage/components/Notifications/Notification.d.ts +20 -0
- package/dist/modules/homepage/components/Notifications/Notification.js +16 -0
- package/dist/modules/homepage/components/Notifications/NotificationList.d.ts +18 -0
- package/dist/modules/homepage/components/Notifications/NotificationList.js +44 -0
- package/dist/modules/homepage/components/Notifications/NotificationListContainer.d.ts +9 -0
- package/dist/modules/homepage/components/Notifications/NotificationListContainer.js +20 -0
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.d.ts +5 -0
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +17 -0
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.d.ts +3 -0
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +19 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationItem.d.ts +24 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationItem.js +28 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationResource.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationResource.js +19 -0
- package/dist/modules/homepage/components/Notifications/components/SystemNotification.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/components/SystemNotification.js +20 -0
- package/dist/modules/homepage/components/Notifications/components/UserNotification.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/components/UserNotification.js +25 -0
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +27 -0
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +53 -0
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.d.ts +20 -0
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +26 -0
- package/dist/modules/homepage/components/Notifications/index.d.ts +6 -0
- package/dist/modules/homepage/components/Notifications/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/Notifications/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Notifications/services/api/notificationService.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/services/api/notificationService.js +22 -0
- package/dist/modules/homepage/components/Notifications/services/queries/notification.d.ts +20 -0
- package/dist/modules/homepage/components/Notifications/services/queries/notification.js +40 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.d.ts +15 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +29 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.d.ts +4 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +13 -0
- package/dist/modules/homepage/components/SchoolSpace/index.d.ts +3 -0
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.d.ts +6 -0
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.js +39 -0
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +13 -0
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +28 -0
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +7 -0
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +19 -0
- package/dist/modules/homepage/components/UserSpace/index.d.ts +3 -0
- package/dist/modules/homepage/components/index.d.ts +8 -0
- package/dist/modules/homepage/hooks/useWidget.d.ts +6 -0
- package/dist/modules/homepage/hooks/useWidget.js +83 -0
- package/dist/modules/homepage/hooks/useWidgetPreferences.d.ts +6 -0
- package/dist/modules/homepage/hooks/useWidgetPreferences.js +34 -0
- package/dist/modules/homepage/index.d.ts +1 -0
- package/dist/modules/icons/components/nav/IconCommunitiesBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconCommunitiesBeta.js +18 -0
- package/dist/modules/icons/components/nav/IconHomeBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconHomeBeta.js +13 -0
- package/dist/modules/icons/components/{IconStarFavorite.d.ts → nav/IconMessagesBeta.d.ts} +2 -2
- package/dist/modules/icons/components/nav/IconMessagesBeta.js +18 -0
- package/dist/modules/icons/components/nav/IconMyAppsBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconMyAppsBeta.js +13 -0
- package/dist/modules/icons/components/nav/IconNotificationBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconNotificationBeta.js +14 -0
- package/dist/modules/icons/components/nav/index.d.ts +5 -0
- package/dist/modules/modals/OnboardingModal/index.d.ts +1 -1
- package/dist/node_modules/.pnpm/@tiptap_extension-floating-menu@3.31.3_@floating-ui_dom@1.6.0_@tiptap_core@3.10.2_@tiptap_pm@3.10.2__@tiptap_pm@3.10.2/node_modules/@tiptap/extension-floating-menu/dist/index.js +159 -0
- package/dist/node_modules/.pnpm/@tiptap_react@3.10.2_@floating-ui_dom@1.6.0_@tiptap_core@3.10.2_@tiptap_pm@3.10.2__@tiptap_pm_dubv75vojf3t6hpx6vhaocpyzq/node_modules/@tiptap/react/dist/menus/index.js +89 -0
- package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +419 -0
- package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +489 -0
- package/dist/node_modules/.pnpm/prosemirror-transform@1.12.2/node_modules/prosemirror-transform/dist/index.js +607 -0
- package/dist/providers/EdificeClientProvider/EdificeClientProvider.d.ts +0 -7
- package/dist/utilities/create-selectors/createSelectors.d.ts +10 -0
- package/dist/utilities/create-selectors/createSelectors.js +11 -0
- package/package.json +47 -49
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +0 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +0 -8
|
@@ -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.10.2_@floating-ui_dom@1.6.0_@tiptap_core@3.10.2_@tiptap_pm@3.10.2__@tiptap_pm_dubv75vojf3t6hpx6vhaocpyzq/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 { offset } from "@floating-ui/dom";
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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,17 @@ const BubbleMenuEditImage = ({
|
|
|
125
125
|
return new DOMRect(0, 0, 100, 100);
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
}, [editor])
|
|
128
|
+
}, [editor]), floatingOptions = useMemo(() => ({
|
|
129
|
+
placement: "bottom-start",
|
|
130
|
+
middleware: [offset({
|
|
131
|
+
mainAxis: 0,
|
|
132
|
+
crossAxis: 0
|
|
133
|
+
})],
|
|
134
|
+
strategy: "absolute"
|
|
135
|
+
}), []);
|
|
129
136
|
return /* @__PURE__ */ jsx(BubbleMenu, { className: openEditImage ? "d-none" : "", shouldShow: ({
|
|
130
137
|
editor: editor2
|
|
131
|
-
}) => editor2.isActive("custom-image") && !openEditImage, editor,
|
|
138
|
+
}) => editor2.isActive("custom-image") && !openEditImage, editor, options: floatingOptions, getReferencedVirtualElement: () => reference, children: editable && /* @__PURE__ */ jsx(Toolbar, { className: "p-8", items: ImageSizeItems }, `toolbar-${currentSize}-${currentWidth}`) });
|
|
132
139
|
};
|
|
133
140
|
export {
|
|
134
141
|
BubbleMenuEditImage as default
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { BubbleMenu } from "@tiptap/react";
|
|
2
|
+
import { useState, useEffect, useMemo } from "react";
|
|
3
|
+
import { BubbleMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.10.2_@floating-ui_dom@1.6.0_@tiptap_core@3.10.2_@tiptap_pm@3.10.2__@tiptap_pm_dubv75vojf3t6hpx6vhaocpyzq/node_modules/@tiptap/react/dist/menus/index.js";
|
|
4
|
+
import { offset } from "@floating-ui/dom";
|
|
4
5
|
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
5
7
|
import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
|
|
6
8
|
import SvgIconAlertTriangle from "../../../icons/components/IconAlertTriangle.js";
|
|
7
9
|
import SvgIconDelete from "../../../icons/components/IconDelete.js";
|
|
@@ -14,98 +16,105 @@ const BubbleMenuEditInformationPane = ({
|
|
|
14
16
|
}) => {
|
|
15
17
|
const {
|
|
16
18
|
t
|
|
17
|
-
} = useTranslation(),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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"
|
|
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;
|
|
36
31
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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,17 @@ const BubbleMenuEditInformationPane = ({
|
|
|
126
135
|
}
|
|
127
136
|
return new DOMRect(0, 0, 0, 0);
|
|
128
137
|
}
|
|
129
|
-
}), [editor])
|
|
138
|
+
}), [editor]), floatingOptions = useMemo(() => ({
|
|
139
|
+
placement: "bottom",
|
|
140
|
+
middleware: [offset({
|
|
141
|
+
mainAxis: 0,
|
|
142
|
+
crossAxis: 0
|
|
143
|
+
})],
|
|
144
|
+
strategy: "absolute"
|
|
145
|
+
}), []);
|
|
130
146
|
return /* @__PURE__ */ jsx(BubbleMenu, { shouldShow: ({
|
|
131
147
|
editor: editor2
|
|
132
|
-
}) => editor2.isActive("information-pane"), editor,
|
|
148
|
+
}) => editor2.isActive("information-pane"), editor, options: floatingOptions, getReferencedVirtualElement: () => reference, children: editable && /* @__PURE__ */ jsx(Toolbar, { className: "p-8", items: InformationPaneTypeItems }) });
|
|
133
149
|
};
|
|
134
150
|
export {
|
|
135
151
|
BubbleMenuEditInformationPane as default
|
|
@@ -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
|
|
@@ -348,7 +349,7 @@ const EditorToolbar = ({
|
|
|
348
349
|
visibility: showIf(hasExtension("textAlign", editor))
|
|
349
350
|
}
|
|
350
351
|
];
|
|
351
|
-
}, [alignmentOptions, canRecognizeSpeech, editor, listOptions, mediaLibraryRef, plusOptions, speechRecognition, t, toggleSpeechRecognition]);
|
|
352
|
+
}, [alignmentOptions, canRecognizeSpeech, editor, editorState, listOptions, mediaLibraryRef, plusOptions, speechRecognition, t, toggleSpeechRecognition]);
|
|
352
353
|
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
354
|
};
|
|
354
355
|
export {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo, useEffect } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { BubbleMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.10.2_@floating-ui_dom@1.6.0_@tiptap_core@3.10.2_@tiptap_pm@3.10.2__@tiptap_pm_dubv75vojf3t6hpx6vhaocpyzq/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 {
|
|
9
|
+
import { floatingOptions } from "./LinkToolbar.FloatingOptions.js";
|
|
9
10
|
import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
|
|
10
11
|
const LinkToolbar = ({
|
|
11
12
|
editor,
|
|
@@ -15,7 +16,7 @@ const LinkToolbar = ({
|
|
|
15
16
|
}) => {
|
|
16
17
|
const {
|
|
17
18
|
t
|
|
18
|
-
} = useTranslation(), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
|
|
19
|
+
} = useTranslation(), editorState = useEditorState(editor), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
|
|
19
20
|
type: "icon",
|
|
20
21
|
name: "edit",
|
|
21
22
|
props: {
|
|
@@ -54,7 +55,7 @@ const LinkToolbar = ({
|
|
|
54
55
|
}], [onEdit, onOpen, onUnlink, t, linkAttrs]);
|
|
55
56
|
return useEffect(() => {
|
|
56
57
|
editor != null && editor.isActive("linker") ? setLinkAttrs(editor.getAttributes("linker")) : editor != null && editor.isActive("hyperlink") ? setLinkAttrs(editor.getAttributes("hyperlink")) : setLinkAttrs(void 0);
|
|
57
|
-
}, [editor
|
|
58
|
+
}, [editor, editorState]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(BubbleMenu, { editor, options: floatingOptions, 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 }) }) });
|
|
58
59
|
};
|
|
59
60
|
export {
|
|
60
61
|
LinkToolbar as default
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo, useEffect } from "react";
|
|
3
|
-
import { findParentNodeClosestToPos
|
|
3
|
+
import { findParentNodeClosestToPos } from "@tiptap/react";
|
|
4
|
+
import { FloatingMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.10.2_@floating-ui_dom@1.6.0_@tiptap_core@3.10.2_@tiptap_pm@3.10.2__@tiptap_pm_dubv75vojf3t6hpx6vhaocpyzq/node_modules/@tiptap/react/dist/menus/index.js";
|
|
5
|
+
import { offset } from "@floating-ui/dom";
|
|
4
6
|
import { useTranslation } from "react-i18next";
|
|
5
7
|
import SvgIconMergeCells from "../../../icons/components/IconMergeCells.js";
|
|
6
8
|
import SvgIconSplitCells from "../../../icons/components/IconSplitCells.js";
|
|
@@ -13,7 +15,7 @@ const TableToolbar = ({
|
|
|
13
15
|
}) => {
|
|
14
16
|
const {
|
|
15
17
|
t
|
|
16
|
-
} = useTranslation(), [isSpan, setSpan] = useState(void 0),
|
|
18
|
+
} = useTranslation(), [isSpan, setSpan] = useState(void 0), floatingOptions = useMemo(() => {
|
|
17
19
|
function adjustRect(rect) {
|
|
18
20
|
let yOffset = 0;
|
|
19
21
|
if (window.visualViewport) {
|
|
@@ -24,8 +26,11 @@ const TableToolbar = ({
|
|
|
24
26
|
}
|
|
25
27
|
return {
|
|
26
28
|
placement: "bottom",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
middleware: [offset({
|
|
30
|
+
mainAxis: 0,
|
|
31
|
+
crossAxis: 0
|
|
32
|
+
})],
|
|
33
|
+
strategy: "absolute",
|
|
29
34
|
// popperOptions: {modifiers: [ /*see popper v2 modifiers*/ ]},
|
|
30
35
|
// Try to get the bounding rect of the table.
|
|
31
36
|
getReferenceClientRect: () => {
|
|
@@ -46,7 +51,7 @@ const TableToolbar = ({
|
|
|
46
51
|
newSpan !== isSpan && setSpan(newSpan);
|
|
47
52
|
} else
|
|
48
53
|
isSpan && setSpan(void 0);
|
|
49
|
-
}, [editor, editor == null ? void 0 : editor.state, isSpan]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor,
|
|
54
|
+
}, [editor, editor == null ? void 0 : editor.state, isSpan]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, options: floatingOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
|
|
50
55
|
type: "dropdown",
|
|
51
56
|
name: "bkg-col",
|
|
52
57
|
// isEnable:
|
|
@@ -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
|
|
9
|
+
editor: import('@tiptap/core').Editor;
|
|
10
10
|
commentLength: number;
|
|
11
11
|
getComment: () => HTMLContent;
|
|
12
12
|
resetComment: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { Hyperlink } from "@edifice.io/tiptap-extensions/hyperlink";
|
|
3
|
-
import CharacterCount from "@tiptap/
|
|
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) => {
|
|
@@ -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("update", handleUpdate), () => {
|
|
10
|
+
editor.off("update", handleUpdate);
|
|
11
|
+
};
|
|
12
|
+
}, [editor]), updateCount;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useEditorState
|
|
16
|
+
};
|