@edifice.io/react 2.6.10-develop-pedago.20261022131512 → 2.6.10-develop-b2school.20261023141442
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/Checkbox/Checkbox.js +1 -1
- package/dist/components/Layout/Layout.js +12 -4
- package/dist/components/Layout/components/Header.js +4 -4
- package/dist/components/Layout/components/NavLink.d.ts +3 -3
- package/dist/components/Layout/components/NavLink.js +5 -3
- package/dist/editor.js +0 -2
- package/dist/homepage.js +74 -24
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -6
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +11 -8
- package/dist/icons.js +406 -402
- package/dist/modules/HelpZone/HelpZone.js +6 -8
- package/dist/modules/HelpZone/HelpZoneContainer.js +2 -5
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +91 -110
- package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +96 -123
- package/dist/modules/editor/components/Editor/Editor.d.ts +5 -0
- package/dist/modules/editor/components/Editor/Editor.js +3 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +8 -5
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +8 -5
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +2 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +4 -6
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +2 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +8 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +3 -6
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +7 -29
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +2 -3
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +45 -65
- package/dist/modules/editor/hooks/index.d.ts +0 -1
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useCommentEditor.js +4 -12
- package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
- package/dist/modules/editor/hooks/useLinkToolbar.js +1 -2
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
- package/dist/modules/editor/hooks/useTipTapEditor.js +24 -81
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/Agenda.js +54 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +14 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +30 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +14 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +27 -0
- package/dist/modules/homepage/components/Agenda/index.d.ts +3 -0
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +24 -0
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +45 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +19 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +26 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +9 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +59 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +4 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +17 -0
- package/dist/modules/homepage/components/BriefMe/index.d.ts +4 -0
- package/dist/modules/homepage/components/BriefMe/types.d.ts +17 -0
- package/dist/modules/homepage/components/BriefMe/types.js +8 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +31 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +51 -0
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/Cantine.js +44 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +18 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.js +88 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +12 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +5 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +22 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +6 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +28 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +12 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +60 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +11 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +20 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +65 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +23 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +43 -0
- package/dist/modules/homepage/components/Cantine/index.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/types.d.ts +42 -0
- package/dist/modules/homepage/components/Communities/Communities.js +4 -4
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +16 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +48 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +4 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +12 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +1 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +6 -0
- package/dist/modules/homepage/components/GenerationHdf/index.d.ts +3 -0
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +10 -0
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +68 -0
- package/dist/modules/homepage/components/Header/AccountActionListPopover.d.ts +13 -0
- package/dist/modules/homepage/components/Header/AccountActionListPopover.js +26 -0
- package/dist/modules/homepage/components/Header/ActionItem.d.ts +38 -0
- package/dist/modules/homepage/components/Header/ActionItem.js +34 -0
- package/dist/modules/homepage/components/Header/Header.js +28 -22
- package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +5 -0
- package/dist/modules/homepage/components/Header/MyAppsPopover.js +28 -0
- package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +32 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +5 -1
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +1 -1
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +1 -1
- package/dist/modules/homepage/components/Notifications/NotificationList.js +7 -8
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +7 -12
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +7 -4
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +1 -5
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +10 -12
- package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +3 -9
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +6 -12
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +12 -10
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +9 -10
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +4 -0
- package/dist/modules/homepage/components/Qwant/Qwant.js +41 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +10 -0
- package/dist/modules/homepage/components/Qwant/index.d.ts +3 -0
- package/dist/modules/homepage/components/Rss/Rss.d.ts +11 -0
- package/dist/modules/homepage/components/Rss/Rss.js +64 -0
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Rss/RssContainer.js +45 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +13 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +69 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +11 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +58 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +25 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +43 -0
- package/dist/modules/homepage/components/Rss/index.d.ts +6 -0
- package/dist/modules/homepage/components/Rss/services/api/index.d.ts +5 -0
- package/dist/modules/homepage/components/Rss/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +38 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +51 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +28 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +71 -0
- package/dist/modules/homepage/components/Rss/types.d.ts +25 -0
- package/dist/modules/homepage/components/Rss/utils.d.ts +7 -0
- package/dist/modules/homepage/components/Rss/utils.js +19 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +8 -0
- package/dist/modules/homepage/components/Universalis/Universalis.js +62 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +16 -0
- package/dist/modules/homepage/components/Universalis/index.d.ts +3 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +2 -2
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +2 -2
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +13 -7
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +3 -2
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +15 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +47 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
- package/dist/modules/homepage/components/index.d.ts +9 -1
- package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.d.ts +2 -2
- package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.js +4 -4
- package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
- package/dist/modules/icons/components/IconAddWidget.js +12 -0
- package/dist/modules/icons/components/IconLogout.d.ts +7 -0
- package/dist/modules/icons/components/IconLogout.js +13 -0
- package/dist/modules/icons/components/index.d.ts +2 -0
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -7
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +0 -4
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +1 -2
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +0 -3
- package/package.json +43 -35
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +0 -29
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +0 -22
- package/dist/modules/editor/hooks/useEditorState.d.ts +0 -20
- package/dist/modules/editor/hooks/useEditorState.js +0 -16
- 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 +0 -159
- 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 +0 -341
- package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +0 -549
- package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +0 -489
- package/dist/node_modules/.pnpm/prosemirror-transform@1.12.3/node_modules/prosemirror-transform/dist/index.js +0 -659
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { BubbleMenuPlugin } from "@tiptap/extension-bubble-menu";
|
|
2
|
-
import { useCurrentEditor } from "@tiptap/react";
|
|
3
|
-
import React, { useRef, useState, useEffect, useLayoutEffect } from "react";
|
|
4
|
-
import { createPortal } from "react-dom";
|
|
5
|
-
import { PluginKey } from "../../../../../../prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js";
|
|
6
|
-
import { FloatingMenuPlugin } from "../../../../../../@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";
|
|
7
|
-
function getAutoPluginKey(pluginKey, defaultName) {
|
|
8
|
-
return pluginKey ?? new PluginKey(defaultName);
|
|
9
|
-
}
|
|
10
|
-
const useIsomorphicLayoutEffect = typeof window < "u" ? useLayoutEffect : useEffect, PLUGIN_MANAGED_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
|
|
11
|
-
"left",
|
|
12
|
-
"opacity",
|
|
13
|
-
"position",
|
|
14
|
-
"top",
|
|
15
|
-
"visibility",
|
|
16
|
-
"width"
|
|
17
|
-
]), UNITLESS_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
|
|
18
|
-
"animationIterationCount",
|
|
19
|
-
"aspectRatio",
|
|
20
|
-
"borderImageOutset",
|
|
21
|
-
"borderImageSlice",
|
|
22
|
-
"borderImageWidth",
|
|
23
|
-
"columnCount",
|
|
24
|
-
"columns",
|
|
25
|
-
"fillOpacity",
|
|
26
|
-
"flex",
|
|
27
|
-
"flexGrow",
|
|
28
|
-
"flexShrink",
|
|
29
|
-
"fontWeight",
|
|
30
|
-
"gridArea",
|
|
31
|
-
"gridColumn",
|
|
32
|
-
"gridColumnEnd",
|
|
33
|
-
"gridColumnStart",
|
|
34
|
-
"gridRow",
|
|
35
|
-
"gridRowEnd",
|
|
36
|
-
"gridRowStart",
|
|
37
|
-
"lineClamp",
|
|
38
|
-
"lineHeight",
|
|
39
|
-
"opacity",
|
|
40
|
-
"order",
|
|
41
|
-
"orphans",
|
|
42
|
-
"scale",
|
|
43
|
-
"stopOpacity",
|
|
44
|
-
"strokeDasharray",
|
|
45
|
-
"strokeDashoffset",
|
|
46
|
-
"strokeMiterlimit",
|
|
47
|
-
"strokeOpacity",
|
|
48
|
-
"strokeWidth",
|
|
49
|
-
"tabSize",
|
|
50
|
-
"widows",
|
|
51
|
-
"zIndex",
|
|
52
|
-
"zoom"
|
|
53
|
-
]), ATTRIBUTE_EXCLUSIONS = /* @__PURE__ */ new Set([
|
|
54
|
-
"children",
|
|
55
|
-
"className",
|
|
56
|
-
"style"
|
|
57
|
-
]), DIRECT_PROPERTY_KEYS = /* @__PURE__ */ new Set(["tabIndex"]), FORWARDED_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
58
|
-
"accessKey",
|
|
59
|
-
"autoCapitalize",
|
|
60
|
-
"contentEditable",
|
|
61
|
-
"contextMenu",
|
|
62
|
-
"dir",
|
|
63
|
-
"draggable",
|
|
64
|
-
"enterKeyHint",
|
|
65
|
-
"hidden",
|
|
66
|
-
"id",
|
|
67
|
-
"lang",
|
|
68
|
-
"nonce",
|
|
69
|
-
"role",
|
|
70
|
-
"slot",
|
|
71
|
-
"spellCheck",
|
|
72
|
-
"tabIndex",
|
|
73
|
-
"title",
|
|
74
|
-
"translate"
|
|
75
|
-
]), SPECIAL_EVENT_NAMES = {
|
|
76
|
-
Blur: "focusout",
|
|
77
|
-
DoubleClick: "dblclick",
|
|
78
|
-
Focus: "focusin",
|
|
79
|
-
MouseEnter: "mouseenter",
|
|
80
|
-
MouseLeave: "mouseleave"
|
|
81
|
-
};
|
|
82
|
-
function isEventProp(key, value) {
|
|
83
|
-
return /^on[A-Z]/.test(key) && typeof value == "function";
|
|
84
|
-
}
|
|
85
|
-
function toAttributeName(key) {
|
|
86
|
-
return key.startsWith("aria-") || key.startsWith("data-"), key;
|
|
87
|
-
}
|
|
88
|
-
function isForwardedAttributeKey(key) {
|
|
89
|
-
return key.startsWith("aria-") || key.startsWith("data-") || FORWARDED_ATTRIBUTE_KEYS.has(key);
|
|
90
|
-
}
|
|
91
|
-
function toStylePropertyName(key) {
|
|
92
|
-
return key.startsWith("--") ? key : key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
93
|
-
}
|
|
94
|
-
function toEventConfig(key) {
|
|
95
|
-
var _SPECIAL_EVENT_NAMES$;
|
|
96
|
-
const useCapture = key.endsWith("Capture"), reactEventName = (useCapture ? key.slice(0, -7) : key).slice(2);
|
|
97
|
-
return {
|
|
98
|
-
eventName: (_SPECIAL_EVENT_NAMES$ = SPECIAL_EVENT_NAMES[reactEventName]) !== null && _SPECIAL_EVENT_NAMES$ !== void 0 ? _SPECIAL_EVENT_NAMES$ : reactEventName.toLowerCase(),
|
|
99
|
-
options: useCapture ? { capture: !0 } : void 0
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function createSyntheticEvent(element, nativeEvent) {
|
|
103
|
-
let defaultPrevented = nativeEvent.defaultPrevented, propagationStopped = !1;
|
|
104
|
-
const syntheticEvent = Object.create(nativeEvent);
|
|
105
|
-
return Object.defineProperties(syntheticEvent, {
|
|
106
|
-
nativeEvent: { value: nativeEvent },
|
|
107
|
-
currentTarget: { value: element },
|
|
108
|
-
target: { value: nativeEvent.target },
|
|
109
|
-
persist: { value: () => {
|
|
110
|
-
} },
|
|
111
|
-
isDefaultPrevented: { value: () => defaultPrevented },
|
|
112
|
-
isPropagationStopped: { value: () => propagationStopped },
|
|
113
|
-
preventDefault: { value: () => {
|
|
114
|
-
defaultPrevented = !0, nativeEvent.preventDefault();
|
|
115
|
-
} },
|
|
116
|
-
stopPropagation: { value: () => {
|
|
117
|
-
propagationStopped = !0, nativeEvent.stopPropagation();
|
|
118
|
-
} }
|
|
119
|
-
}), syntheticEvent;
|
|
120
|
-
}
|
|
121
|
-
function isDirectPropertyKey(key) {
|
|
122
|
-
return DIRECT_PROPERTY_KEYS.has(key);
|
|
123
|
-
}
|
|
124
|
-
function setDirectProperty(element, key, value) {
|
|
125
|
-
if (key === "tabIndex") {
|
|
126
|
-
element.tabIndex = Number(value);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
element[key] = value;
|
|
130
|
-
}
|
|
131
|
-
function clearDirectProperty(element, key) {
|
|
132
|
-
if (key === "tabIndex") {
|
|
133
|
-
element.removeAttribute("tabindex");
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const propertyValue = element[key];
|
|
137
|
-
if (typeof propertyValue == "boolean") {
|
|
138
|
-
element[key] = !1;
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (typeof propertyValue == "number") {
|
|
142
|
-
element[key] = 0;
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
element[key] = "";
|
|
146
|
-
}
|
|
147
|
-
function toStyleValue(styleName, value) {
|
|
148
|
-
return typeof value != "number" || value === 0 || styleName.startsWith("--") || UNITLESS_STYLE_PROPERTIES.has(styleName) ? String(value) : `${value}px`;
|
|
149
|
-
}
|
|
150
|
-
function removeStyleProperty(element, styleName) {
|
|
151
|
-
PLUGIN_MANAGED_STYLE_PROPERTIES.has(styleName) || element.style.removeProperty(toStylePropertyName(styleName));
|
|
152
|
-
}
|
|
153
|
-
function applyStyleProperty(element, styleName, value) {
|
|
154
|
-
PLUGIN_MANAGED_STYLE_PROPERTIES.has(styleName) || element.style.setProperty(toStylePropertyName(styleName), toStyleValue(styleName, value));
|
|
155
|
-
}
|
|
156
|
-
function syncAttributes(element, prevProps, nextProps) {
|
|
157
|
-
(/* @__PURE__ */ new Set([...Object.keys(prevProps), ...Object.keys(nextProps)])).forEach((key) => {
|
|
158
|
-
if (ATTRIBUTE_EXCLUSIONS.has(key) || !isForwardedAttributeKey(key) || isEventProp(key, prevProps[key]) || isEventProp(key, nextProps[key])) return;
|
|
159
|
-
const prevValue = prevProps[key], nextValue = nextProps[key];
|
|
160
|
-
if (prevValue === nextValue) return;
|
|
161
|
-
const attributeName = toAttributeName(key);
|
|
162
|
-
if (nextValue == null || nextValue === !1) {
|
|
163
|
-
isDirectPropertyKey(key) && clearDirectProperty(element, key), element.removeAttribute(attributeName);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (nextValue === !0) {
|
|
167
|
-
isDirectPropertyKey(key) && setDirectProperty(element, key, !0), element.setAttribute(attributeName, "");
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (isDirectPropertyKey(key)) {
|
|
171
|
-
setDirectProperty(element, key, nextValue);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
element.setAttribute(attributeName, String(nextValue));
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
function syncClassName(element, prevClassName, nextClassName) {
|
|
178
|
-
if (prevClassName !== nextClassName) {
|
|
179
|
-
if (nextClassName) {
|
|
180
|
-
element.className = nextClassName;
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
element.removeAttribute("class");
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function syncStyles(element, prevStyle, nextStyle) {
|
|
187
|
-
const previousStyle = prevStyle ?? {}, currentStyle = nextStyle ?? {};
|
|
188
|
-
(/* @__PURE__ */ new Set([...Object.keys(previousStyle), ...Object.keys(currentStyle)])).forEach((styleName) => {
|
|
189
|
-
const prevValue = previousStyle[styleName], nextValue = currentStyle[styleName];
|
|
190
|
-
if (prevValue !== nextValue) {
|
|
191
|
-
if (nextValue == null) {
|
|
192
|
-
removeStyleProperty(element, styleName);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
applyStyleProperty(element, styleName, nextValue);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
function syncEventListeners(element, prevListeners, nextProps) {
|
|
200
|
-
prevListeners.forEach(({ eventName, listener, options }) => {
|
|
201
|
-
element.removeEventListener(eventName, listener, options);
|
|
202
|
-
});
|
|
203
|
-
const nextListeners = [];
|
|
204
|
-
return Object.entries(nextProps).forEach(([key, value]) => {
|
|
205
|
-
if (!isEventProp(key, value)) return;
|
|
206
|
-
const { eventName, options } = toEventConfig(key), listener = (event) => {
|
|
207
|
-
value(createSyntheticEvent(element, event));
|
|
208
|
-
};
|
|
209
|
-
element.addEventListener(eventName, listener, options), nextListeners.push({
|
|
210
|
-
eventName,
|
|
211
|
-
listener,
|
|
212
|
-
options
|
|
213
|
-
});
|
|
214
|
-
}), nextListeners;
|
|
215
|
-
}
|
|
216
|
-
function useMenuElementProps(element, props) {
|
|
217
|
-
const previousPropsRef = useRef({}), listenersRef = useRef([]);
|
|
218
|
-
useIsomorphicLayoutEffect(() => {
|
|
219
|
-
const previousProps = previousPropsRef.current;
|
|
220
|
-
return syncClassName(element, previousProps.className, props.className), syncStyles(element, previousProps.style, props.style), syncAttributes(element, previousProps, props), listenersRef.current = syncEventListeners(element, listenersRef.current, props), previousPropsRef.current = props, () => {
|
|
221
|
-
listenersRef.current.forEach(({ eventName, listener, options }) => {
|
|
222
|
-
element.removeEventListener(eventName, listener, options);
|
|
223
|
-
}), listenersRef.current = [];
|
|
224
|
-
};
|
|
225
|
-
}, [element, props]);
|
|
226
|
-
}
|
|
227
|
-
const BubbleMenu = React.forwardRef(({ pluginKey, editor, updateDelay, resizeDelay, appendTo, shouldShow = null, getReferencedVirtualElement, options, children, ...restProps }, ref) => {
|
|
228
|
-
const menuEl = useRef(document.createElement("div")), resolvedPluginKey = useRef(getAutoPluginKey(pluginKey, "bubbleMenu")).current;
|
|
229
|
-
useMenuElementProps(menuEl.current, restProps), typeof ref == "function" ? ref(menuEl.current) : ref && (ref.current = menuEl.current);
|
|
230
|
-
const { editor: currentEditor } = useCurrentEditor(), pluginEditor = editor || currentEditor, bubbleMenuPluginProps = {
|
|
231
|
-
updateDelay,
|
|
232
|
-
resizeDelay,
|
|
233
|
-
appendTo,
|
|
234
|
-
pluginKey: resolvedPluginKey,
|
|
235
|
-
shouldShow,
|
|
236
|
-
getReferencedVirtualElement,
|
|
237
|
-
options
|
|
238
|
-
}, bubbleMenuPluginPropsRef = useRef(bubbleMenuPluginProps);
|
|
239
|
-
bubbleMenuPluginPropsRef.current = bubbleMenuPluginProps;
|
|
240
|
-
const [pluginInitialized, setPluginInitialized] = useState(!1), skipFirstUpdateRef = useRef(!0);
|
|
241
|
-
return useEffect(() => {
|
|
242
|
-
if (pluginEditor != null && pluginEditor.isDestroyed) return;
|
|
243
|
-
if (!pluginEditor) {
|
|
244
|
-
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
const bubbleMenuElement = menuEl.current;
|
|
248
|
-
bubbleMenuElement.style.visibility = "hidden", bubbleMenuElement.style.position = "absolute";
|
|
249
|
-
const plugin = BubbleMenuPlugin({
|
|
250
|
-
...bubbleMenuPluginPropsRef.current,
|
|
251
|
-
editor: pluginEditor,
|
|
252
|
-
element: bubbleMenuElement
|
|
253
|
-
});
|
|
254
|
-
pluginEditor.registerPlugin(plugin);
|
|
255
|
-
const createdPluginKey = bubbleMenuPluginPropsRef.current.pluginKey;
|
|
256
|
-
return skipFirstUpdateRef.current = !0, setPluginInitialized(!0), () => {
|
|
257
|
-
setPluginInitialized(!1), pluginEditor.unregisterPlugin(createdPluginKey), window.requestAnimationFrame(() => {
|
|
258
|
-
bubbleMenuElement.parentNode && bubbleMenuElement.parentNode.removeChild(bubbleMenuElement);
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
|
-
}, [pluginEditor]), useEffect(() => {
|
|
262
|
-
if (!(!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed)) {
|
|
263
|
-
if (skipFirstUpdateRef.current) {
|
|
264
|
-
skipFirstUpdateRef.current = !1;
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
pluginEditor.view.dispatch(pluginEditor.state.tr.setMeta(resolvedPluginKey, {
|
|
268
|
-
type: "updateOptions",
|
|
269
|
-
options: bubbleMenuPluginPropsRef.current
|
|
270
|
-
}));
|
|
271
|
-
}
|
|
272
|
-
}, [
|
|
273
|
-
pluginInitialized,
|
|
274
|
-
pluginEditor,
|
|
275
|
-
updateDelay,
|
|
276
|
-
resizeDelay,
|
|
277
|
-
shouldShow,
|
|
278
|
-
options,
|
|
279
|
-
appendTo,
|
|
280
|
-
getReferencedVirtualElement,
|
|
281
|
-
resolvedPluginKey
|
|
282
|
-
]), createPortal(children, menuEl.current);
|
|
283
|
-
}), FloatingMenu = React.forwardRef(({ pluginKey, editor, updateDelay, resizeDelay, appendTo, shouldShow = null, options, children, ...restProps }, ref) => {
|
|
284
|
-
const menuEl = useRef(document.createElement("div")), resolvedPluginKey = useRef(getAutoPluginKey(pluginKey, "floatingMenu")).current;
|
|
285
|
-
useMenuElementProps(menuEl.current, restProps), typeof ref == "function" ? ref(menuEl.current) : ref && (ref.current = menuEl.current);
|
|
286
|
-
const { editor: currentEditor } = useCurrentEditor(), pluginEditor = editor || currentEditor, floatingMenuPluginProps = {
|
|
287
|
-
updateDelay,
|
|
288
|
-
resizeDelay,
|
|
289
|
-
appendTo,
|
|
290
|
-
pluginKey: resolvedPluginKey,
|
|
291
|
-
shouldShow,
|
|
292
|
-
options
|
|
293
|
-
}, floatingMenuPluginPropsRef = useRef(floatingMenuPluginProps);
|
|
294
|
-
floatingMenuPluginPropsRef.current = floatingMenuPluginProps;
|
|
295
|
-
const [pluginInitialized, setPluginInitialized] = useState(!1), skipFirstUpdateRef = useRef(!0);
|
|
296
|
-
return useEffect(() => {
|
|
297
|
-
if (pluginEditor != null && pluginEditor.isDestroyed) return;
|
|
298
|
-
if (!pluginEditor) {
|
|
299
|
-
console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
const floatingMenuElement = menuEl.current;
|
|
303
|
-
floatingMenuElement.style.visibility = "hidden", floatingMenuElement.style.position = "absolute";
|
|
304
|
-
const plugin = FloatingMenuPlugin({
|
|
305
|
-
...floatingMenuPluginPropsRef.current,
|
|
306
|
-
editor: pluginEditor,
|
|
307
|
-
element: floatingMenuElement
|
|
308
|
-
});
|
|
309
|
-
pluginEditor.registerPlugin(plugin);
|
|
310
|
-
const createdPluginKey = floatingMenuPluginPropsRef.current.pluginKey;
|
|
311
|
-
return skipFirstUpdateRef.current = !0, setPluginInitialized(!0), () => {
|
|
312
|
-
setPluginInitialized(!1), pluginEditor.unregisterPlugin(createdPluginKey), window.requestAnimationFrame(() => {
|
|
313
|
-
floatingMenuElement.parentNode && floatingMenuElement.parentNode.removeChild(floatingMenuElement);
|
|
314
|
-
});
|
|
315
|
-
};
|
|
316
|
-
}, [pluginEditor]), useEffect(() => {
|
|
317
|
-
if (!(!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed)) {
|
|
318
|
-
if (skipFirstUpdateRef.current) {
|
|
319
|
-
skipFirstUpdateRef.current = !1;
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
pluginEditor.view.dispatch(pluginEditor.state.tr.setMeta(resolvedPluginKey, {
|
|
323
|
-
type: "updateOptions",
|
|
324
|
-
options: floatingMenuPluginPropsRef.current
|
|
325
|
-
}));
|
|
326
|
-
}
|
|
327
|
-
}, [
|
|
328
|
-
pluginInitialized,
|
|
329
|
-
pluginEditor,
|
|
330
|
-
updateDelay,
|
|
331
|
-
resizeDelay,
|
|
332
|
-
shouldShow,
|
|
333
|
-
options,
|
|
334
|
-
appendTo,
|
|
335
|
-
resolvedPluginKey
|
|
336
|
-
]), createPortal(children, menuEl.current);
|
|
337
|
-
});
|
|
338
|
-
export {
|
|
339
|
-
BubbleMenu,
|
|
340
|
-
FloatingMenu
|
|
341
|
-
};
|