@edifice.io/react 2.6.9 → 2.6.10-chore-tiptap-v3.20261021191834

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/components/RadioTile/RadioTile.d.ts +35 -0
  2. package/dist/components/RadioTile/RadioTile.js +22 -0
  3. package/dist/components/RadioTile/index.d.ts +2 -0
  4. package/dist/components/Tree/utilities/tree.js +21 -1
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/editor.js +2 -0
  7. package/dist/hooks/index.d.ts +2 -0
  8. package/dist/hooks/useBackground/useBackground.d.ts +1 -1
  9. package/dist/hooks/useCarbonioUnread/index.d.ts +1 -0
  10. package/dist/hooks/useCarbonioUnread/useCarbonioUnread.d.ts +5 -0
  11. package/dist/hooks/useCarbonioUnread/useCarbonioUnread.js +24 -0
  12. package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
  13. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +14 -0
  14. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +64 -0
  15. package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +1 -1
  16. package/dist/index.js +160 -150
  17. package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +110 -91
  18. package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +123 -96
  19. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +5 -8
  20. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +5 -8
  21. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -2
  22. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +6 -4
  23. package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +29 -0
  24. package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +22 -0
  25. package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +6 -3
  26. package/dist/modules/editor/components/Toolbar/LinkToolbar.js +29 -7
  27. package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +3 -2
  28. package/dist/modules/editor/components/Toolbar/TableToolbar.js +65 -45
  29. package/dist/modules/editor/hooks/index.d.ts +1 -0
  30. package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
  31. package/dist/modules/editor/hooks/useCommentEditor.js +12 -4
  32. package/dist/modules/editor/hooks/useEditorState.d.ts +20 -0
  33. package/dist/modules/editor/hooks/useEditorState.js +16 -0
  34. package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
  35. package/dist/modules/editor/hooks/useLinkToolbar.js +2 -1
  36. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
  37. package/dist/modules/editor/hooks/useTipTapEditor.js +72 -24
  38. package/dist/modules/homepage/components/Header/Header.js +10 -3
  39. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
  40. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +102 -0
  41. package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
  42. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +4 -2
  43. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +38 -11
  44. package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +4 -0
  45. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
  46. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +48 -0
  47. package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +2 -1
  48. package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +3 -0
  49. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
  50. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
  51. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
  52. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +120 -0
  53. package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
  54. package/dist/modules/multimedia/Workspace/Workspace.js +8 -5
  55. package/dist/modules/multimedia/index.d.ts +1 -0
  56. package/dist/multimedia.js +16 -12
  57. 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
  58. 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
  59. package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +419 -0
  60. package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +489 -0
  61. package/dist/node_modules/.pnpm/prosemirror-transform@1.12.2/node_modules/prosemirror-transform/dist/index.js +607 -0
  62. package/package.json +35 -43
  63. package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +0 -2
  64. package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +0 -8
@@ -1,9 +1,12 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
- import { useState, useMemo, useEffect } from "react";
3
- import { findParentNodeClosestToPos, FloatingMenu } from "@tiptap/react";
2
+ import { useState, useMemo, useEffect, useCallback } from "react";
3
+ import { findParentNodeClosestToPos } from "@tiptap/react";
4
+ import { FloatingMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
4
5
  import { useTranslation } from "react-i18next";
5
6
  import SvgIconMergeCells from "../../../icons/components/IconMergeCells.js";
6
7
  import SvgIconSplitCells from "../../../icons/components/IconSplitCells.js";
8
+ import { useEditorState } from "../../hooks/useEditorState.js";
9
+ import { getFloatingMenuOptions, FLOATING_MENU_Z_INDEX } from "./FloatingMenuOptions.js";
7
10
  import { TableToolbarAddMenu } from "./TableToolbar.AddMenu.js";
8
11
  import { TableToolbarCellColor } from "./TableToolbar.CellColor.js";
9
12
  import { TableToolbarDelMenu } from "./TableToolbar.DelMenu.js";
@@ -13,7 +16,7 @@ const TableToolbar = ({
13
16
  }) => {
14
17
  const {
15
18
  t
16
- } = useTranslation(), [isSpan, setSpan] = useState(void 0), tippyOptions = useMemo(() => {
19
+ } = useTranslation(), [isSpan, setSpan] = useState(void 0), editorState = useEditorState(editor), floatingOptions = useMemo(() => {
17
20
  function adjustRect(rect) {
18
21
  let yOffset = 0;
19
22
  if (window.visualViewport) {
@@ -23,11 +26,15 @@ const TableToolbar = ({
23
26
  return new DOMRect(rect.x, rect.y - yOffset, rect.width, rect.height);
24
27
  }
25
28
  return {
26
- placement: "bottom",
27
- offset: [0, 0],
28
- zIndex: 999,
29
- // popperOptions: {modifiers: [ /*see popper v2 modifiers*/ ]},
30
- // Try to get the bounding rect of the table.
29
+ ...getFloatingMenuOptions({
30
+ placement: "bottom",
31
+ offset: {
32
+ mainAxis: 0,
33
+ crossAxis: 0
34
+ }
35
+ }),
36
+ // Dead in v3: FloatingMenu has no reference-rect override (unlike
37
+ // BubbleMenu's getReferencedVirtualElement), so this never runs.
31
38
  getReferenceClientRect: () => {
32
39
  const parentDiv = editor != null && editor.isActive("table") ? findParentNodeClosestToPos(editor.state.selection.$anchor, (node) => node.type.name === "table") : null;
33
40
  if (parentDiv) {
@@ -39,50 +46,63 @@ const TableToolbar = ({
39
46
  }
40
47
  };
41
48
  }, [editor]);
42
- return useEffect(() => {
49
+ useEffect(() => {
43
50
  const cellAttr = editor == null ? void 0 : editor.getAttributes("tableCell"), headAttr = editor == null ? void 0 : editor.getAttributes("tableHeader");
44
51
  if (typeof cellAttr < "u" || typeof headAttr < "u") {
45
52
  const newSpan = (cellAttr == null ? void 0 : cellAttr.colspan) > 1 || (cellAttr == null ? void 0 : cellAttr.rowspan) > 1 || (headAttr == null ? void 0 : headAttr.colspan) > 1 || (headAttr == null ? void 0 : headAttr.rowspan) > 1;
46
53
  newSpan !== isSpan && setSpan(newSpan);
47
54
  } else
48
55
  isSpan && setSpan(void 0);
49
- }, [editor, editor == null ? void 0 : editor.state, isSpan]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, tippyOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
50
- type: "dropdown",
51
- name: "bkg-col",
52
- // isEnable:
53
- // typeof editor?.getAttributes("tableCell") !== "undefined",
54
- props: {
55
- children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
56
- }
57
- }, {
58
- type: "icon",
59
- name: "mergeorsplit",
60
- // isEnable: typeof isSpan !== "undefined",
61
- props: {
62
- icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
63
- "aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
64
- onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
65
- },
66
- tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
67
- }, {
68
- type: "divider",
69
- name: "add-d0"
70
- }, {
71
- type: "dropdown",
72
- name: "add",
73
- props: {
74
- children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
75
- }
76
- }, {
77
- type: "divider",
78
- name: "add-d1"
79
- }, {
80
- type: "dropdown",
81
- name: "del",
82
- props: {
83
- children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
56
+ }, [editor, editorState, isSpan]);
57
+ const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, [editor]);
58
+ return /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(
59
+ FloatingMenu,
60
+ {
61
+ editor,
62
+ options: floatingOptions,
63
+ shouldShow: handleShouldShow,
64
+ style: {
65
+ zIndex: FLOATING_MENU_Z_INDEX
66
+ },
67
+ children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
68
+ type: "dropdown",
69
+ name: "bkg-col",
70
+ // isEnable:
71
+ // typeof editor?.getAttributes("tableCell") !== "undefined",
72
+ props: {
73
+ children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
74
+ }
75
+ }, {
76
+ type: "icon",
77
+ name: "mergeorsplit",
78
+ // isEnable: typeof isSpan !== "undefined",
79
+ props: {
80
+ icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
81
+ "aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
82
+ onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
83
+ },
84
+ tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
85
+ }, {
86
+ type: "divider",
87
+ name: "add-d0"
88
+ }, {
89
+ type: "dropdown",
90
+ name: "add",
91
+ props: {
92
+ children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
93
+ }
94
+ }, {
95
+ type: "divider",
96
+ name: "add-d1"
97
+ }, {
98
+ type: "dropdown",
99
+ name: "del",
100
+ props: {
101
+ children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
102
+ }
103
+ }] })
84
104
  }
85
- }] }) }) });
105
+ ) });
86
106
  };
87
107
  export {
88
108
  TableToolbar as default
@@ -1,6 +1,7 @@
1
1
  export * from './useActionOptions';
2
2
  export * from './useCommentEditor';
3
3
  export * from './useEditorContext';
4
+ export * from './useEditorState';
4
5
  export * from './useImageModal';
5
6
  export * from './useImageSelection';
6
7
  export * from './useLinkToolbar';
@@ -6,7 +6,7 @@ import { Content, HTMLContent } from '@tiptap/react';
6
6
  * @param content default rich content
7
7
  */
8
8
  export declare const useCommentEditor: (editable: boolean, content: Content, maxLength?: number) => {
9
- editor: import('@tiptap/core').Editor | null;
9
+ editor: import('@tiptap/core').Editor;
10
10
  commentLength: number;
11
11
  getComment: () => HTMLContent;
12
12
  resetComment: () => void;
@@ -1,14 +1,22 @@
1
1
  import { useState, useEffect } from "react";
2
2
  import { Hyperlink } from "@edifice.io/tiptap-extensions/hyperlink";
3
- import CharacterCount from "@tiptap/extension-character-count";
3
+ import { CharacterCount } from "@tiptap/extensions";
4
4
  import { useEditor } from "@tiptap/react";
5
5
  import StarterKit from "@tiptap/starter-kit";
6
6
  const useCommentEditor = (editable, content, maxLength = 800) => {
7
7
  const [commentLength, setCommentLength] = useState(0), editor = useEditor({
8
8
  editable,
9
- extensions: [StarterKit, Hyperlink, CharacterCount.configure({
10
- limit: maxLength
11
- })],
9
+ extensions: [
10
+ // v3's StarterKit bundles its own 'link' mark, which would compete with
11
+ // Hyperlink below for the same <a> tags. Disabled.
12
+ StarterKit.configure({
13
+ link: !1
14
+ }),
15
+ Hyperlink,
16
+ CharacterCount.configure({
17
+ limit: maxLength
18
+ })
19
+ ],
12
20
  content
13
21
  });
14
22
  return useEffect(() => {
@@ -0,0 +1,20 @@
1
+ import { Editor } from '@tiptap/react';
2
+ /**
3
+ * Hook to track editor state changes in Tiptap v3.
4
+ * Replaces the pattern of using `editor?.state` in useEffect dependencies.
5
+ *
6
+ * @param editor - The Tiptap editor instance
7
+ * @returns A counter that increments on each editor update
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * const { editor } = useEditorContext();
12
+ * const editorState = useEditorState(editor);
13
+ *
14
+ * useEffect(() => {
15
+ * const attrs = editor?.getAttributes('textStyle');
16
+ * // ... do something with attrs
17
+ * }, [editor, editorState]);
18
+ * ```
19
+ */
20
+ export declare const useEditorState: (editor: Editor | null | undefined) => number;
@@ -0,0 +1,16 @@
1
+ import { useState, useEffect } from "react";
2
+ const useEditorState = (editor) => {
3
+ const [updateCount, setUpdateCount] = useState(0);
4
+ return useEffect(() => {
5
+ if (!editor) return;
6
+ const handleUpdate = () => {
7
+ setUpdateCount((prev) => prev + 1);
8
+ };
9
+ return editor.on("transaction", handleUpdate), () => {
10
+ editor.off("transaction", handleUpdate);
11
+ };
12
+ }, [editor]), updateCount;
13
+ };
14
+ export {
15
+ useEditorState
16
+ };
@@ -12,7 +12,7 @@ import { MediaLibraryRef } from '../../multimedia';
12
12
  * }
13
13
  */
14
14
  export declare const useLinkToolbar: (editor: Editor | null, mediaLibraryRef: RefObject<MediaLibraryRef>) => {
15
- onEdit: (attrs: LinkerAttributes | HyperlinkAttributes) => void;
16
- onOpen: (attrs: LinkerAttributes) => void;
15
+ onEdit: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
16
+ onOpen: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
17
17
  onUnlink: () => void;
18
18
  };
@@ -2,6 +2,7 @@ import { useCallback } from "react";
2
2
  const useLinkToolbar = (editor, mediaLibraryRef) => ({
3
3
  onEdit: useCallback((attrs) => {
4
4
  var _a, _b;
5
+ if (!attrs) return;
5
6
  editor != null && editor.isActive("hyperlink") && editor.commands.extendMarkRange("hyperlink");
6
7
  const attrsLinker = attrs;
7
8
  if (attrsLinker["data-id"] || attrsLinker["data-app-prefix"])
@@ -25,7 +26,7 @@ const useLinkToolbar = (editor, mediaLibraryRef) => ({
25
26
  }
26
27
  }, [editor, mediaLibraryRef]),
27
28
  onOpen: (attrs) => {
28
- window.open(attrs.href || "about:blank", "_blank");
29
+ window.open((attrs == null ? void 0 : attrs.href) || "about:blank", "_blank");
29
30
  },
30
31
  onUnlink: () => {
31
32
  var _a, _b, _c, _d;
@@ -1,4 +1,4 @@
1
- import { Content, Extensions, FocusPosition } from '@tiptap/react';
1
+ import { Content, Editor, Extensions, FocusPosition } from '@tiptap/react';
2
2
  import { WorkspaceVisibility } from '@edifice.io/client';
3
3
  /**
4
4
  * Hook that creates a tiptap editor instance.
@@ -13,8 +13,8 @@ import { WorkspaceVisibility } from '@edifice.io/client';
13
13
  * @returns the editor instance and the editable state
14
14
  */
15
15
  export declare const useTipTapEditor: (editable: boolean, content: Content, focus?: FocusPosition, placeholder?: string, onContentChange?: ({ editor }: {
16
- editor: any;
16
+ editor: Editor;
17
17
  }) => void, visibility?: WorkspaceVisibility, extensions?: Extensions) => {
18
- editor: import('@tiptap/core').Editor | null;
18
+ editor: Editor;
19
19
  editable: boolean;
20
20
  };
@@ -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 Placeholder from "@tiptap/extension-placeholder";
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: [StarterKit, Focus.configure({
54
- className: "has-focus",
55
- mode: "all"
56
- }), Placeholder.configure({
57
- placeholder: t(placeholder || "tiptap.placeholder")
58
- }), CustomHighlight.configure({
59
- multicolor: !0
60
- }), Underline, TextStyle, Color, Subscript, Superscript, Table.configure({
61
- resizable: !0
62
- }), TableRow, TableHeader, TableCell, TextAlign.configure({
63
- types: ["heading", "paragraph", "video", "audio", "iframe"]
64
- }), CustomHeading.configure({
65
- levels: [1, 2]
66
- }), Typography, FontSize, SpeechRecognition, SpeechSynthesis.configure({
67
- lang: (currentLanguage == null ? void 0 : currentLanguage.length) === 2 ? `${currentLanguage}-${currentLanguage.toUpperCase()}` : "fr-FR"
68
- }), Hyperlink, FontFamily, Mathematics, Alert, IframeNodeView(MediaRenderer), VideoNodeView(MediaRenderer), AudioNodeView(AudioRenderer), LinkerNodeView(LinkerRenderer), ImageNodeView(MediaRenderer, uploadFile), AttachmentNodeView(AttachmentRenderer), InformationPaneNodeView(InformationPaneRenderer), ...extensions || []],
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]), {
@@ -16,7 +16,7 @@ import SvgIconNotificationBeta from "../../../icons/components/nav/IconNotificat
16
16
  import { useHasNotificationToday } from "../Notifications/hooks/useNotificationList.js";
17
17
  import useConversation from "../../../../hooks/useConversation/useConversation.js";
18
18
  import useUser from "../../../../hooks/useUser/useUser.js";
19
- import useHasWorkflow from "../../../../hooks/useHasWorkflow/useHasWorkflow.js";
19
+ import useCarbonioUnread from "../../../../hooks/useCarbonioUnread/useCarbonioUnread.js";
20
20
  import { useEdificeTheme } from "../../../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
21
21
  import useHover from "../../../../hooks/useHover/useHover.js";
22
22
  import LogoBeta from "../../../../components/LogoBeta/LogoBeta.js";
@@ -37,7 +37,10 @@ const Header = ({
37
37
  } = useConversation(), {
38
38
  user,
39
39
  avatar
40
- } = useUser(), hasCarbonioPreauthWorkflow = useHasWorkflow("org.entcore.auth.controllers.CarbonioPreauthController|preauth") || !1, classes = clsx("header-beta d-print-none no-2d no-1d"), {
40
+ } = useUser(), {
41
+ hasCarbonioWorkflow,
42
+ unreadCount: carbonioUnreadCount
43
+ } = useCarbonioUnread(), classes = clsx("header-beta d-print-none no-2d no-1d"), {
41
44
  userAvatar,
42
45
  userName,
43
46
  communitiesWorkflow,
@@ -62,8 +65,12 @@ const Header = ({
62
65
  level: "danger"
63
66
  }, className: "position-absolute", children: messages })
64
67
  ] }) }),
65
- hasCarbonioPreauthWorkflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsxs("a", { className: "nav-link position-relative", href: "/auth/carbonio/preauth", target: "_blank", "data-testid": "header-messagerie-button", children: [
68
+ hasCarbonioWorkflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsxs("a", { className: "nav-link position-relative", href: "/auth/carbonio/preauth", target: "_blank", "data-testid": "header-messagerie-button", children: [
66
69
  /* @__PURE__ */ jsx(SvgIconMessagesBeta, {}),
70
+ carbonioUnreadCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: {
71
+ type: "notification",
72
+ level: "danger"
73
+ }, className: "position-absolute", children: carbonioUnreadCount }),
67
74
  /* @__PURE__ */ jsx(VisuallyHidden, { children: t("conversation") })
68
75
  ] }) }),
69
76
  /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/welcome", translate: t("navbar.applications"), "data-testid": "header-my-apps-button", children: /* @__PURE__ */ jsx(SvgIconMyAppsBeta, {}) }) }),
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { NextcloudDocument } from '@edifice.io/client';
3
+ import { CardProps } from '../../../components/Card';
4
+ export interface NextcloudFileCardProps extends CardProps {
5
+ doc: NextcloudDocument;
6
+ /**
7
+ * Id of the user who owns the Nextcloud document, used to build the preview URL.
8
+ */
9
+ userId: string;
10
+ /**
11
+ * Custom icon to override the default based on file type
12
+ * Can be a string or a React node
13
+ */
14
+ customIcon?: ReactNode;
15
+ /**
16
+ * Custom color class to override the default based on file type
17
+ * Example: "bg-purple-300" or any valid CSS class
18
+ */
19
+ customColor?: string;
20
+ }
21
+ declare const NextcloudFileCard: {
22
+ ({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: NextcloudFileCardProps): import("react/jsx-runtime").JSX.Element;
23
+ displayName: string;
24
+ };
25
+ export default NextcloudFileCard;
@@ -0,0 +1,102 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { DocumentHelper, odeServices } from "@edifice.io/client";
4
+ import clsx from "clsx";
5
+ import SvgIconLandscape from "../../icons/components/IconLandscape.js";
6
+ import SvgIconMic from "../../icons/components/IconMic.js";
7
+ import SvgIconTextPage from "../../icons/components/IconTextPage.js";
8
+ import SvgIconVideo from "../../icons/components/IconVideo.js";
9
+ import FileIcon from "./FileIcon.js";
10
+ import useThumbnail from "../../../hooks/useThumbnail/useThumbnail.js";
11
+ import Card from "../../../components/Card/Card.js";
12
+ const roleMappings = {
13
+ csv: {
14
+ icon: ".CSV",
15
+ color: "bg-orange-200"
16
+ },
17
+ xls: {
18
+ icon: ".XLS",
19
+ color: "bg-green-200"
20
+ },
21
+ doc: {
22
+ icon: ".DOC",
23
+ color: "bg-blue-200"
24
+ },
25
+ txt: {
26
+ icon: ".TXT",
27
+ color: "bg-blue-200"
28
+ },
29
+ pdf: {
30
+ icon: ".PDF",
31
+ color: "bg-red-200"
32
+ },
33
+ audio: {
34
+ icon: /* @__PURE__ */ jsx(SvgIconMic, { width: 22, height: 22 }),
35
+ color: "bg-red-200"
36
+ },
37
+ ppt: {
38
+ icon: ".PPT",
39
+ color: "bg-red-200"
40
+ },
41
+ img: {
42
+ icon: /* @__PURE__ */ jsx(SvgIconLandscape, { width: 22, height: 22 }),
43
+ color: "bg-green-200"
44
+ },
45
+ video: {
46
+ icon: /* @__PURE__ */ jsx(SvgIconVideo, { width: 22, height: 22 }),
47
+ color: "bg-purple-200"
48
+ },
49
+ zip: {
50
+ icon: ".ZIP",
51
+ color: "bg-gray-300"
52
+ },
53
+ md: {
54
+ icon: ".MD",
55
+ color: "bg-blue-200"
56
+ },
57
+ unknown: {
58
+ icon: /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
59
+ color: "bg-gray-300"
60
+ }
61
+ };
62
+ function getRoleMap(type, customIcon, customColor) {
63
+ return customIcon !== void 0 || customColor !== void 0 ? {
64
+ icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
65
+ color: customColor || "bg-gray-300",
66
+ hasShadow: !1
67
+ } : roleMappings[type] ?? roleMappings.unknown;
68
+ }
69
+ const NextcloudFileCard = ({
70
+ doc,
71
+ userId,
72
+ isClickable = !0,
73
+ isSelectable = !1,
74
+ isSelected = !1,
75
+ onClick,
76
+ className,
77
+ onSelect,
78
+ isFocused,
79
+ app,
80
+ customIcon,
81
+ customColor
82
+ }) => {
83
+ const ref = useRef(null), type = DocumentHelper.role(doc.contentType, !1), roleMap = getRoleMap(type ?? "unknown", customIcon, customColor), file = clsx("file position-relative rounded", (roleMap == null ? void 0 : roleMap.color) ?? "bg-yellow-200"), mediaSrc = type === "img" ? odeServices.nextcloud().getFileUrl(userId, doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
84
+ ref
85
+ }), imageStyles = hasThumbnail && {
86
+ backgroundImage: `url(${mediaSrc})`,
87
+ backgroundSize: "cover"
88
+ };
89
+ return /* @__PURE__ */ jsx(Card, { className: clsx("card-file", className), isClickable, isSelectable, isSelected, onClick, app, isFocused, onSelect, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
90
+ /* @__PURE__ */ jsx("div", { ref, className: file, style: {
91
+ aspectRatio: "16/10",
92
+ ...imageStyles
93
+ }, children: type !== "img" || !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
94
+ /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
95
+ /* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
96
+ /* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerDisplayName })
97
+ ] })
98
+ ] }) });
99
+ };
100
+ export {
101
+ NextcloudFileCard as default
102
+ };
@@ -1,2 +1,4 @@
1
1
  export { default as FileCard } from './FileCard';
2
2
  export * from './FileCard';
3
+ export { default as NextcloudFileCard } from './NextcloudFileCard';
4
+ export * from './NextcloudFileCard';
@@ -1,4 +1,4 @@
1
- import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
1
+ import { NextcloudDocument, WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
2
2
  import { TabsItemProps } from '../../../components';
3
3
  import { ExternalLinkTabProps } from './innertabs/ExternalLink';
4
4
  import { InternalLinkTabProps, InternalLinkTabResult } from './innertabs/InternalLink';
@@ -54,7 +54,7 @@ export interface MediaLibraryRef {
54
54
  /**
55
55
  * The resulting type depends on the actual selected Tab when modal is closed.
56
56
  */
57
- export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
57
+ export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | NextcloudDocument[] | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
58
58
  /**
59
59
  * MediaLibrary component properties
60
60
  */
@@ -65,6 +65,8 @@ export interface MediaLibraryProps {
65
65
  visibility: WorkspaceVisibility;
66
66
  /** Allow selecting / uploading multiple files at once ? */
67
67
  multiple?: boolean;
68
+ /** Restrict attachments to PDF files in Workspace and Upload. */
69
+ pdfOnly?: boolean;
68
70
  /**
69
71
  * Called when the user validates the modal (Add button).
70
72
  * @param result depends on which InnerTab is visible