@edifice.io/react 2.6.10-develop-integration.20261021201242 → 2.6.10-develop-pedago.20261022103835
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/editor.js +2 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/icons-apps.js +182 -184
- package/dist/index.js +192 -198
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +110 -91
- package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +123 -96
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -2
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +6 -4
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +29 -0
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +22 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +6 -3
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +29 -7
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +3 -2
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +65 -45
- 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 +12 -4
- package/dist/modules/editor/hooks/useEditorState.d.ts +20 -0
- package/dist/modules/editor/hooks/useEditorState.js +16 -0
- package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
- package/dist/modules/editor/hooks/useLinkToolbar.js +2 -1
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
- package/dist/modules/editor/hooks/useTipTapEditor.js +72 -24
- package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.js +9 -9
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +1 -2
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +2 -2
- package/dist/modules/icons/components/apps/index.d.ts +0 -1
- package/dist/modules/multimedia/FileCard/index.d.ts +0 -2
- 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 +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +7 -16
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +4 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +2 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +3 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +0 -2
- package/dist/modules/multimedia/index.d.ts +0 -1
- package/dist/multimedia.js +22 -26
- 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
- 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
- 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/package.json +35 -43
- package/dist/hooks/useGoogleDriveSearch/index.d.ts +0 -1
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +0 -19
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +0 -60
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +0 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +0 -8
- package/dist/modules/icons/components/apps/IconElea.d.ts +0 -7
- package/dist/modules/icons/components/apps/IconElea.js +0 -23
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +0 -25
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +0 -102
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +0 -24
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +0 -103
- package/dist/modules/multimedia/GoogleDrive/index.d.ts +0 -2
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +0 -61
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
const FLOATING_MENU_Z_INDEX = 999;
|
|
3
|
+
function getFloatingMenuOptions({
|
|
4
|
+
placement,
|
|
5
|
+
offset
|
|
6
|
+
}) {
|
|
7
|
+
return {
|
|
8
|
+
placement,
|
|
9
|
+
// tiptap builds its middleware array from named fields only - a raw
|
|
10
|
+
// `middleware: [offset(...)]` key is silently ignored.
|
|
11
|
+
offset,
|
|
12
|
+
strategy: "absolute"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function useReferencedVirtualElement(reference) {
|
|
16
|
+
return useCallback(() => reference, [reference]);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
FLOATING_MENU_Z_INDEX,
|
|
20
|
+
getFloatingMenuOptions,
|
|
21
|
+
useReferencedVirtualElement
|
|
22
|
+
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { HyperlinkAttributes } from '@edifice.io/tiptap-extensions/hyperlink';
|
|
2
|
+
import { LinkerAttributes } from '@edifice.io/tiptap-extensions/linker';
|
|
1
3
|
import { Editor } from '@tiptap/react';
|
|
4
|
+
type LinkAttrs = LinkerAttributes | HyperlinkAttributes;
|
|
2
5
|
interface LinkToolbarProps {
|
|
3
6
|
/**
|
|
4
7
|
* editor instance
|
|
5
8
|
*/
|
|
6
9
|
editor: Editor | null;
|
|
7
10
|
/** Handle Edit event */
|
|
8
|
-
onEdit: (attrs:
|
|
11
|
+
onEdit: (attrs: LinkAttrs | undefined) => void;
|
|
9
12
|
/** Handle Open event */
|
|
10
|
-
onOpen: (attrs:
|
|
13
|
+
onOpen: (attrs: LinkAttrs | undefined) => void;
|
|
11
14
|
/** Handle Unlink event */
|
|
12
|
-
onUnlink: (attrs:
|
|
15
|
+
onUnlink: (attrs: LinkAttrs | undefined) => void;
|
|
13
16
|
}
|
|
14
17
|
declare const LinkToolbar: ({ editor, onEdit, onOpen, onUnlink, }: LinkToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
export default LinkToolbar;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useEffect } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
3
|
+
import { BubbleMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
5
6
|
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
6
7
|
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
7
8
|
import SvgIconUnlink from "../../../icons/components/IconUnlink.js";
|
|
8
|
-
import {
|
|
9
|
+
import { FLOATING_MENU_Z_INDEX, getFloatingMenuOptions } from "./FloatingMenuOptions.js";
|
|
9
10
|
import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
|
|
10
|
-
const
|
|
11
|
+
const floatingOptions = getFloatingMenuOptions({
|
|
12
|
+
placement: "bottom",
|
|
13
|
+
offset: {
|
|
14
|
+
mainAxis: 10,
|
|
15
|
+
crossAxis: 0
|
|
16
|
+
}
|
|
17
|
+
}), LinkToolbar = ({
|
|
11
18
|
editor,
|
|
12
19
|
onEdit,
|
|
13
20
|
onOpen,
|
|
@@ -15,7 +22,7 @@ const LinkToolbar = ({
|
|
|
15
22
|
}) => {
|
|
16
23
|
const {
|
|
17
24
|
t
|
|
18
|
-
} = useTranslation(), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
|
|
25
|
+
} = useTranslation(), editorState = useEditorState(editor), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
|
|
19
26
|
type: "icon",
|
|
20
27
|
name: "edit",
|
|
21
28
|
props: {
|
|
@@ -52,9 +59,24 @@ const LinkToolbar = ({
|
|
|
52
59
|
position: "bottom"
|
|
53
60
|
}
|
|
54
61
|
}], [onEdit, onOpen, onUnlink, t, linkAttrs]);
|
|
55
|
-
|
|
62
|
+
useEffect(() => {
|
|
56
63
|
editor != null && editor.isActive("linker") ? setLinkAttrs(editor.getAttributes("linker")) : editor != null && editor.isActive("hyperlink") ? setLinkAttrs(editor.getAttributes("hyperlink")) : setLinkAttrs(void 0);
|
|
57
|
-
}, [editor
|
|
64
|
+
}, [editor, editorState]);
|
|
65
|
+
const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && ((editor == null ? void 0 : editor.isActive("linker")) || (editor == null ? void 0 : editor.isActive("hyperlink"))) || !1, [editor]);
|
|
66
|
+
return /* @__PURE__ */ jsx(Fragment, { children: editor && // BubbleMenu, not FloatingMenu: `shouldShow` below overrides visibility
|
|
67
|
+
// either way, this only changes the default position reference.
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
BubbleMenu,
|
|
70
|
+
{
|
|
71
|
+
editor,
|
|
72
|
+
options: floatingOptions,
|
|
73
|
+
shouldShow: handleShouldShow,
|
|
74
|
+
style: {
|
|
75
|
+
zIndex: FLOATING_MENU_Z_INDEX
|
|
76
|
+
},
|
|
77
|
+
children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: LinkToolbarItems })
|
|
78
|
+
}
|
|
79
|
+
) });
|
|
58
80
|
};
|
|
59
81
|
export {
|
|
60
82
|
LinkToolbar as default
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
4
5
|
import Tooltip from "../../../../components/Tooltip/Tooltip.js";
|
|
5
6
|
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
6
7
|
import ColorPickerItem from "../../../../components/ColorPicker/ColorPickerItem.js";
|
|
@@ -12,7 +13,7 @@ const TableToolbarCellColor = ({
|
|
|
12
13
|
}) => {
|
|
13
14
|
const {
|
|
14
15
|
t
|
|
15
|
-
} = useTranslation(), [color, setColor] = useState("transparent"), applyColor = useCallback((value) => {
|
|
16
|
+
} = useTranslation(), [color, setColor] = useState("transparent"), editorState = useEditorState(editor), applyColor = useCallback((value) => {
|
|
16
17
|
editor == null || editor.chain().focus().setCellAttribute(
|
|
17
18
|
"backgroundColor",
|
|
18
19
|
// reset color is transparent here => remove bkg color
|
|
@@ -21,7 +22,7 @@ const TableToolbarCellColor = ({
|
|
|
21
22
|
}, [editor, setColor]);
|
|
22
23
|
useEffect(() => {
|
|
23
24
|
setColor((editor == null ? void 0 : editor.getAttributes("tableCell").backgroundColor) ?? "transparent");
|
|
24
|
-
}, [editor,
|
|
25
|
+
}, [editor, editorState]);
|
|
25
26
|
const palettes = [{
|
|
26
27
|
...DefaultPalette,
|
|
27
28
|
label: t("tiptap.table.toolbar.cell.color"),
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useEffect } from "react";
|
|
3
|
-
import { findParentNodeClosestToPos
|
|
2
|
+
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
3
|
+
import { findParentNodeClosestToPos } from "@tiptap/react";
|
|
4
|
+
import { FloatingMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
|
|
4
5
|
import { useTranslation } from "react-i18next";
|
|
5
6
|
import SvgIconMergeCells from "../../../icons/components/IconMergeCells.js";
|
|
6
7
|
import SvgIconSplitCells from "../../../icons/components/IconSplitCells.js";
|
|
8
|
+
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
9
|
+
import { getFloatingMenuOptions, FLOATING_MENU_Z_INDEX } from "./FloatingMenuOptions.js";
|
|
7
10
|
import { TableToolbarAddMenu } from "./TableToolbar.AddMenu.js";
|
|
8
11
|
import { TableToolbarCellColor } from "./TableToolbar.CellColor.js";
|
|
9
12
|
import { TableToolbarDelMenu } from "./TableToolbar.DelMenu.js";
|
|
@@ -13,7 +16,7 @@ const TableToolbar = ({
|
|
|
13
16
|
}) => {
|
|
14
17
|
const {
|
|
15
18
|
t
|
|
16
|
-
} = useTranslation(), [isSpan, setSpan] = useState(void 0),
|
|
19
|
+
} = useTranslation(), [isSpan, setSpan] = useState(void 0), editorState = useEditorState(editor), floatingOptions = useMemo(() => {
|
|
17
20
|
function adjustRect(rect) {
|
|
18
21
|
let yOffset = 0;
|
|
19
22
|
if (window.visualViewport) {
|
|
@@ -23,11 +26,15 @@ const TableToolbar = ({
|
|
|
23
26
|
return new DOMRect(rect.x, rect.y - yOffset, rect.width, rect.height);
|
|
24
27
|
}
|
|
25
28
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
...getFloatingMenuOptions({
|
|
30
|
+
placement: "bottom",
|
|
31
|
+
offset: {
|
|
32
|
+
mainAxis: 0,
|
|
33
|
+
crossAxis: 0
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
// Dead in v3: FloatingMenu has no reference-rect override (unlike
|
|
37
|
+
// BubbleMenu's getReferencedVirtualElement), so this never runs.
|
|
31
38
|
getReferenceClientRect: () => {
|
|
32
39
|
const parentDiv = editor != null && editor.isActive("table") ? findParentNodeClosestToPos(editor.state.selection.$anchor, (node) => node.type.name === "table") : null;
|
|
33
40
|
if (parentDiv) {
|
|
@@ -39,50 +46,63 @@ const TableToolbar = ({
|
|
|
39
46
|
}
|
|
40
47
|
};
|
|
41
48
|
}, [editor]);
|
|
42
|
-
|
|
49
|
+
useEffect(() => {
|
|
43
50
|
const cellAttr = editor == null ? void 0 : editor.getAttributes("tableCell"), headAttr = editor == null ? void 0 : editor.getAttributes("tableHeader");
|
|
44
51
|
if (typeof cellAttr < "u" || typeof headAttr < "u") {
|
|
45
52
|
const newSpan = (cellAttr == null ? void 0 : cellAttr.colspan) > 1 || (cellAttr == null ? void 0 : cellAttr.rowspan) > 1 || (headAttr == null ? void 0 : headAttr.colspan) > 1 || (headAttr == null ? void 0 : headAttr.rowspan) > 1;
|
|
46
53
|
newSpan !== isSpan && setSpan(newSpan);
|
|
47
54
|
} else
|
|
48
55
|
isSpan && setSpan(void 0);
|
|
49
|
-
}, [editor,
|
|
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
|
-
|
|
56
|
+
}, [editor, editorState, isSpan]);
|
|
57
|
+
const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, [editor]);
|
|
58
|
+
return /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(
|
|
59
|
+
FloatingMenu,
|
|
60
|
+
{
|
|
61
|
+
editor,
|
|
62
|
+
options: floatingOptions,
|
|
63
|
+
shouldShow: handleShouldShow,
|
|
64
|
+
style: {
|
|
65
|
+
zIndex: FLOATING_MENU_Z_INDEX
|
|
66
|
+
},
|
|
67
|
+
children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
|
|
68
|
+
type: "dropdown",
|
|
69
|
+
name: "bkg-col",
|
|
70
|
+
// isEnable:
|
|
71
|
+
// typeof editor?.getAttributes("tableCell") !== "undefined",
|
|
72
|
+
props: {
|
|
73
|
+
children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
type: "icon",
|
|
77
|
+
name: "mergeorsplit",
|
|
78
|
+
// isEnable: typeof isSpan !== "undefined",
|
|
79
|
+
props: {
|
|
80
|
+
icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
|
|
81
|
+
"aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
|
|
82
|
+
onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
|
|
83
|
+
},
|
|
84
|
+
tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
|
|
85
|
+
}, {
|
|
86
|
+
type: "divider",
|
|
87
|
+
name: "add-d0"
|
|
88
|
+
}, {
|
|
89
|
+
type: "dropdown",
|
|
90
|
+
name: "add",
|
|
91
|
+
props: {
|
|
92
|
+
children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
type: "divider",
|
|
96
|
+
name: "add-d1"
|
|
97
|
+
}, {
|
|
98
|
+
type: "dropdown",
|
|
99
|
+
name: "del",
|
|
100
|
+
props: {
|
|
101
|
+
children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
|
|
102
|
+
}
|
|
103
|
+
}] })
|
|
84
104
|
}
|
|
85
|
-
|
|
105
|
+
) });
|
|
86
106
|
};
|
|
87
107
|
export {
|
|
88
108
|
TableToolbar as default
|
|
@@ -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,14 +1,22 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { Hyperlink } from "@edifice.io/tiptap-extensions/hyperlink";
|
|
3
|
-
import CharacterCount from "@tiptap/
|
|
3
|
+
import { CharacterCount } from "@tiptap/extensions";
|
|
4
4
|
import { useEditor } from "@tiptap/react";
|
|
5
5
|
import StarterKit from "@tiptap/starter-kit";
|
|
6
6
|
const useCommentEditor = (editable, content, maxLength = 800) => {
|
|
7
7
|
const [commentLength, setCommentLength] = useState(0), editor = useEditor({
|
|
8
8
|
editable,
|
|
9
|
-
extensions: [
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
extensions: [
|
|
10
|
+
// v3's StarterKit bundles its own 'link' mark, which would compete with
|
|
11
|
+
// Hyperlink below for the same <a> tags. Disabled.
|
|
12
|
+
StarterKit.configure({
|
|
13
|
+
link: !1
|
|
14
|
+
}),
|
|
15
|
+
Hyperlink,
|
|
16
|
+
CharacterCount.configure({
|
|
17
|
+
limit: maxLength
|
|
18
|
+
})
|
|
19
|
+
],
|
|
12
20
|
content
|
|
13
21
|
});
|
|
14
22
|
return useEffect(() => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to track editor state changes in Tiptap v3.
|
|
4
|
+
* Replaces the pattern of using `editor?.state` in useEffect dependencies.
|
|
5
|
+
*
|
|
6
|
+
* @param editor - The Tiptap editor instance
|
|
7
|
+
* @returns A counter that increments on each editor update
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const { editor } = useEditorContext();
|
|
12
|
+
* const editorState = useEditorState(editor);
|
|
13
|
+
*
|
|
14
|
+
* useEffect(() => {
|
|
15
|
+
* const attrs = editor?.getAttributes('textStyle');
|
|
16
|
+
* // ... do something with attrs
|
|
17
|
+
* }, [editor, editorState]);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const useEditorState: (editor: Editor | null | undefined) => number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const useEditorState = (editor) => {
|
|
3
|
+
const [updateCount, setUpdateCount] = useState(0);
|
|
4
|
+
return useEffect(() => {
|
|
5
|
+
if (!editor) return;
|
|
6
|
+
const handleUpdate = () => {
|
|
7
|
+
setUpdateCount((prev) => prev + 1);
|
|
8
|
+
};
|
|
9
|
+
return editor.on("transaction", handleUpdate), () => {
|
|
10
|
+
editor.off("transaction", handleUpdate);
|
|
11
|
+
};
|
|
12
|
+
}, [editor]), updateCount;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useEditorState
|
|
16
|
+
};
|
|
@@ -12,7 +12,7 @@ import { MediaLibraryRef } from '../../multimedia';
|
|
|
12
12
|
* }
|
|
13
13
|
*/
|
|
14
14
|
export declare const useLinkToolbar: (editor: Editor | null, mediaLibraryRef: RefObject<MediaLibraryRef>) => {
|
|
15
|
-
onEdit: (attrs: LinkerAttributes | HyperlinkAttributes) => void;
|
|
16
|
-
onOpen: (attrs: LinkerAttributes) => void;
|
|
15
|
+
onEdit: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
|
|
16
|
+
onOpen: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
|
|
17
17
|
onUnlink: () => void;
|
|
18
18
|
};
|
|
@@ -2,6 +2,7 @@ import { useCallback } from "react";
|
|
|
2
2
|
const useLinkToolbar = (editor, mediaLibraryRef) => ({
|
|
3
3
|
onEdit: useCallback((attrs) => {
|
|
4
4
|
var _a, _b;
|
|
5
|
+
if (!attrs) return;
|
|
5
6
|
editor != null && editor.isActive("hyperlink") && editor.commands.extendMarkRange("hyperlink");
|
|
6
7
|
const attrsLinker = attrs;
|
|
7
8
|
if (attrsLinker["data-id"] || attrsLinker["data-app-prefix"])
|
|
@@ -25,7 +26,7 @@ const useLinkToolbar = (editor, mediaLibraryRef) => ({
|
|
|
25
26
|
}
|
|
26
27
|
}, [editor, mediaLibraryRef]),
|
|
27
28
|
onOpen: (attrs) => {
|
|
28
|
-
window.open(attrs.href || "about:blank", "_blank");
|
|
29
|
+
window.open((attrs == null ? void 0 : attrs.href) || "about:blank", "_blank");
|
|
29
30
|
},
|
|
30
31
|
onUnlink: () => {
|
|
31
32
|
var _a, _b, _c, _d;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Content, Extensions, FocusPosition } from '@tiptap/react';
|
|
1
|
+
import { Content, Editor, Extensions, FocusPosition } from '@tiptap/react';
|
|
2
2
|
import { WorkspaceVisibility } from '@edifice.io/client';
|
|
3
3
|
/**
|
|
4
4
|
* Hook that creates a tiptap editor instance.
|
|
@@ -13,8 +13,8 @@ import { WorkspaceVisibility } from '@edifice.io/client';
|
|
|
13
13
|
* @returns the editor instance and the editable state
|
|
14
14
|
*/
|
|
15
15
|
export declare const useTipTapEditor: (editable: boolean, content: Content, focus?: FocusPosition, placeholder?: string, onContentChange?: ({ editor }: {
|
|
16
|
-
editor:
|
|
16
|
+
editor: Editor;
|
|
17
17
|
}) => void, visibility?: WorkspaceVisibility, extensions?: Extensions) => {
|
|
18
|
-
editor:
|
|
18
|
+
editor: Editor;
|
|
19
19
|
editable: boolean;
|
|
20
20
|
};
|
|
@@ -9,18 +9,14 @@ import { SpeechSynthesis } from "@edifice.io/tiptap-extensions/speech-synthesis"
|
|
|
9
9
|
import { TableCell } from "@edifice.io/tiptap-extensions/table-cell";
|
|
10
10
|
import { Mathematics } from "@tiptap/extension-mathematics";
|
|
11
11
|
import Color from "@tiptap/extension-color";
|
|
12
|
-
import Focus from "@tiptap/extension-focus";
|
|
13
12
|
import FontFamily from "@tiptap/extension-font-family";
|
|
14
|
-
import
|
|
13
|
+
import { TextStyleKit } from "@tiptap/extension-text-style";
|
|
14
|
+
import { Focus, Placeholder } from "@tiptap/extensions";
|
|
15
15
|
import Subscript from "@tiptap/extension-subscript";
|
|
16
16
|
import Superscript from "@tiptap/extension-superscript";
|
|
17
|
-
import Table from "@tiptap/extension-table";
|
|
18
|
-
import TableHeader from "@tiptap/extension-table-header";
|
|
19
|
-
import TableRow from "@tiptap/extension-table-row";
|
|
17
|
+
import { TableRow, TableHeader, Table } from "@tiptap/extension-table";
|
|
20
18
|
import TextAlign from "@tiptap/extension-text-align";
|
|
21
|
-
import TextStyle from "@tiptap/extension-text-style";
|
|
22
19
|
import Typography from "@tiptap/extension-typography";
|
|
23
|
-
import Underline from "@tiptap/extension-underline";
|
|
24
20
|
import { useEditor } from "@tiptap/react";
|
|
25
21
|
import StarterKit from "@tiptap/starter-kit";
|
|
26
22
|
import { useTranslation } from "react-i18next";
|
|
@@ -50,22 +46,72 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
|
|
|
50
46
|
// TipTap editor must be instantiated in editable mode for table columns to be resizable.
|
|
51
47
|
// It will then be set in the correct editable mode, by a useEffect below.
|
|
52
48
|
editable: !0,
|
|
53
|
-
extensions: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
extensions: [
|
|
50
|
+
// v3's StarterKit bundles its own heading/link nodes, which would compete with
|
|
51
|
+
// CustomHeading/Hyperlink below for the same HTML tags. Disabled.
|
|
52
|
+
// `underline` stays enabled (default) - same as the explicit Underline
|
|
53
|
+
// extension it replaces, no custom one added below.
|
|
54
|
+
StarterKit.configure({
|
|
55
|
+
heading: !1,
|
|
56
|
+
link: !1
|
|
57
|
+
}),
|
|
58
|
+
Focus.configure({
|
|
59
|
+
className: "has-focus",
|
|
60
|
+
mode: "all"
|
|
61
|
+
}),
|
|
62
|
+
Placeholder.configure({
|
|
63
|
+
placeholder: t(placeholder || "tiptap.placeholder")
|
|
64
|
+
}),
|
|
65
|
+
CustomHighlight.configure({
|
|
66
|
+
multicolor: !0
|
|
67
|
+
}),
|
|
68
|
+
// v3's TextStyleKit bundles its own color/fontFamily/fontSize, which would
|
|
69
|
+
// duplicate the Color/FontFamily/FontSize added below. Disabled.
|
|
70
|
+
// backgroundColor/lineHeight are also disabled: they're new in v3 (v2
|
|
71
|
+
// stripped these inline styles), and lineHeight would otherwise collide
|
|
72
|
+
// with our own @edifice.io/tiptap-extensions/line-height by name for
|
|
73
|
+
// any caller that adds it via this hook's `extensions` param.
|
|
74
|
+
TextStyleKit.configure({
|
|
75
|
+
color: !1,
|
|
76
|
+
fontFamily: !1,
|
|
77
|
+
fontSize: !1,
|
|
78
|
+
backgroundColor: !1,
|
|
79
|
+
lineHeight: !1
|
|
80
|
+
}),
|
|
81
|
+
Color,
|
|
82
|
+
Subscript,
|
|
83
|
+
Superscript,
|
|
84
|
+
Table.configure({
|
|
85
|
+
resizable: !0
|
|
86
|
+
}),
|
|
87
|
+
TableRow,
|
|
88
|
+
TableHeader,
|
|
89
|
+
TableCell,
|
|
90
|
+
TextAlign.configure({
|
|
91
|
+
types: ["heading", "paragraph", "video", "audio", "iframe"]
|
|
92
|
+
}),
|
|
93
|
+
CustomHeading.configure({
|
|
94
|
+
levels: [1, 2]
|
|
95
|
+
}),
|
|
96
|
+
Typography,
|
|
97
|
+
FontSize,
|
|
98
|
+
SpeechRecognition,
|
|
99
|
+
SpeechSynthesis.configure({
|
|
100
|
+
lang: (currentLanguage == null ? void 0 : currentLanguage.length) === 2 ? `${currentLanguage}-${currentLanguage.toUpperCase()}` : "fr-FR"
|
|
101
|
+
}),
|
|
102
|
+
Hyperlink,
|
|
103
|
+
FontFamily,
|
|
104
|
+
Mathematics,
|
|
105
|
+
Alert,
|
|
106
|
+
IframeNodeView(MediaRenderer),
|
|
107
|
+
VideoNodeView(MediaRenderer),
|
|
108
|
+
AudioNodeView(AudioRenderer),
|
|
109
|
+
LinkerNodeView(LinkerRenderer),
|
|
110
|
+
ImageNodeView(MediaRenderer, uploadFile),
|
|
111
|
+
AttachmentNodeView(AttachmentRenderer),
|
|
112
|
+
InformationPaneNodeView(InformationPaneRenderer),
|
|
113
|
+
...extensions || []
|
|
114
|
+
],
|
|
69
115
|
content,
|
|
70
116
|
// If the onContentChange callback is provided, we call it on every content change.
|
|
71
117
|
...onContentChange ? {
|
|
@@ -75,7 +121,9 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
|
|
|
75
121
|
return useEffect(() => {
|
|
76
122
|
editor == null || editor.setEditable(editable, !1);
|
|
77
123
|
}, [editor, editable]), useEffect(() => {
|
|
78
|
-
editor == null || editor.commands.setContent(content
|
|
124
|
+
editor == null || editor.commands.setContent(content, {
|
|
125
|
+
emitUpdate: !1
|
|
126
|
+
});
|
|
79
127
|
}, [content]), useEffect(() => {
|
|
80
128
|
focus && (editor == null || editor.commands.focus(focus));
|
|
81
129
|
}, [editor, focus, editable]), {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import useDate from "../../../../../hooks/useDate/useDate.js";
|
|
3
3
|
import Flex from "../../../../../components/Flex/Flex.js";
|
|
4
4
|
const CommonNotificationItem = ({
|
|
@@ -12,17 +12,17 @@ const CommonNotificationItem = ({
|
|
|
12
12
|
const {
|
|
13
13
|
formatTimeAgo,
|
|
14
14
|
formatDate
|
|
15
|
-
} = useDate()
|
|
16
|
-
/* @__PURE__ */ jsx("div", { className: "notification-item-message", dangerouslySetInnerHTML: {
|
|
17
|
-
__html: message
|
|
18
|
-
} }),
|
|
19
|
-
children,
|
|
20
|
-
/* @__PURE__ */ jsx("p", { className: "notification-item-date", title: formatDate(date, "LLL"), children: formatTimeAgo(date) })
|
|
21
|
-
] });
|
|
15
|
+
} = useDate();
|
|
22
16
|
return /* @__PURE__ */ jsx(Flex, { direction: "column", className: "notification-item", gap: "8", children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", wrap: "nowrap", gap: "8", children: [
|
|
23
17
|
/* @__PURE__ */ jsxs(Flex, { direction: "row", align: "start", gap: "8", className: "notification-item-content-wrapper", children: [
|
|
24
18
|
/* @__PURE__ */ jsx("div", { className: "notification-item-picture", children: picture }),
|
|
25
|
-
|
|
19
|
+
/* @__PURE__ */ jsx("a", { href: uri, className: "notification-item-link", "data-testid": "notification-item-content", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "8", children: [
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: "notification-item-message", dangerouslySetInnerHTML: {
|
|
21
|
+
__html: message
|
|
22
|
+
} }),
|
|
23
|
+
children,
|
|
24
|
+
/* @__PURE__ */ jsx("p", { className: "notification-item-date", title: formatDate(date, "LLL"), children: formatTimeAgo(date) })
|
|
25
|
+
] }) })
|
|
26
26
|
] }),
|
|
27
27
|
menu && /* @__PURE__ */ jsx("div", { className: "notification-item-menu", children: menu })
|
|
28
28
|
] }) });
|
|
@@ -36,8 +36,7 @@ export declare const getAppCodeAndI18nKey: (appCode: string) => [string, string]
|
|
|
36
36
|
* - Resolves the target URI from the model's `params` (handles both user and system naming conventions).
|
|
37
37
|
* - Converts the MongoDB `$date` timestamp to a JS `Date`.
|
|
38
38
|
* - Normalises the `type` field into a kebab-case `appCode` (e.g. `"BLOG_POST"` → `"blog-post"`).
|
|
39
|
-
* - Strips anchor tags from the message, keeping only the inner text as `<strong
|
|
40
|
-
* except for external notifications without `resourceUri` whose links are kept.
|
|
39
|
+
* - Strips anchor tags from the message, keeping only the inner text as `<strong>`.
|
|
41
40
|
*/
|
|
42
41
|
export declare const notificationAdapter: (notification: NotificationModel) => WebNotification;
|
|
43
42
|
export {};
|
|
@@ -6,7 +6,7 @@ const resolveNotificationResourceUri = (params, type, appCode, eventType) => {
|
|
|
6
6
|
for (const [key, value] of Object.entries(params))
|
|
7
7
|
if (typeof value == "string" && value.length > 0 && key.endsWith("Uri") && key !== "profilUri" && key !== "resourceFolderUri")
|
|
8
8
|
return value;
|
|
9
|
-
}, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"),
|
|
9
|
+
}, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"), getAppCodeAndI18nKey = (appCode) => {
|
|
10
10
|
appCode = appCode.toLowerCase();
|
|
11
11
|
let appI18nKey = appCode;
|
|
12
12
|
switch (appCode) {
|
|
@@ -39,7 +39,7 @@ const resolveNotificationResourceUri = (params, type, appCode, eventType) => {
|
|
|
39
39
|
}
|
|
40
40
|
return [appCode, appI18nKey];
|
|
41
41
|
}, notificationAdapter = (notification) => {
|
|
42
|
-
const type = notification.sender ? "user" : "system", [appCode, appI18nKey] = getAppCodeAndI18nKey(notification.type),
|
|
42
|
+
const type = notification.sender ? "user" : "system", [appCode, appI18nKey] = getAppCodeAndI18nKey(notification.type), uri = resolveNotificationResourceUri(notification.params, type, appCode, notification["event-type"] || notification.eventType), date = new Date(notification.date.$date), message = parseNotificationMessage(notification.message), base = {
|
|
43
43
|
id: notification._id,
|
|
44
44
|
uri,
|
|
45
45
|
message,
|
|
@@ -40,7 +40,6 @@ export { default as IconEducagri } from './IconEducagri';
|
|
|
40
40
|
export { default as IconEdumedia } from './IconEdumedia';
|
|
41
41
|
export { default as IconEdumoov } from './IconEdumoov';
|
|
42
42
|
export { default as IconEdutheque } from './IconEdutheque';
|
|
43
|
-
export { default as IconElea } from './IconElea';
|
|
44
43
|
export { default as IconElectron } from './IconElectron';
|
|
45
44
|
export { default as IconElyceepicardie } from './IconElyceepicardie';
|
|
46
45
|
export { default as IconEsidoc } from './IconEsidoc';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { default as FileCard } from './FileCard';
|
|
2
2
|
export * from './FileCard';
|
|
3
|
-
export { default as GoogleDriveFileCard } from './GoogleDriveFileCard';
|
|
4
|
-
export * from './GoogleDriveFileCard';
|
|
5
3
|
export { default as NextcloudFileCard } from './NextcloudFileCard';
|
|
6
4
|
export * from './NextcloudFileCard';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
1
|
import { App, ILinkedResource } from '@edifice.io/client';
|
|
3
2
|
/**
|
|
4
3
|
* Definition of an internal link.
|
|
@@ -33,11 +32,6 @@ export interface InternalLinkerProps {
|
|
|
33
32
|
applicationList?: ApplicationOption[];
|
|
34
33
|
/** Whether to show the application selector */
|
|
35
34
|
showApplicationSelector?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Rendered on the search row, where the application selector sits, for
|
|
38
|
-
* consumers that hide that selector but still need a filter of their own.
|
|
39
|
-
*/
|
|
40
|
-
searchFilter?: ReactNode;
|
|
41
35
|
/** Disable application selecetor */
|
|
42
36
|
disableApplicationSelector?: boolean;
|
|
43
37
|
/** Optional callback to filter resources after loading. Applied in addition to search filters. */
|
|
@@ -55,5 +49,5 @@ export interface InternalLinkerProps {
|
|
|
55
49
|
/** Label for the "load more" button. Defaults to the `bbm.linker.see.more` i18n key. */
|
|
56
50
|
loadMoreLabel?: string;
|
|
57
51
|
}
|
|
58
|
-
export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector,
|
|
52
|
+
export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
|
|
59
53
|
export default InternalLinker;
|