@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
@@ -0,0 +1,35 @@
1
+ import { CSSProperties, InputHTMLAttributes, ReactNode } from 'react';
2
+ export interface RadioTileProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'children' | 'className' | 'style'> {
3
+ /**
4
+ * Label of the tile. Also used as the accessible name of the radio input.
5
+ */
6
+ label: ReactNode;
7
+ /**
8
+ * Optional image: an URL, or any React node (e.g. a background preview).
9
+ */
10
+ image?: string | ReactNode;
11
+ /**
12
+ * Layout of a tile with both an image and a label.
13
+ * Ignored when there is no image or when the label is hidden.
14
+ */
15
+ orientation?: 'horizontal' | 'vertical';
16
+ /**
17
+ * Visually hide the label (it stays available to screen readers).
18
+ * Use it with an `image` to render an image-only tile.
19
+ */
20
+ hideLabel?: boolean;
21
+ /**
22
+ * Additional CSS class names applied to the tile (root element).
23
+ */
24
+ className?: string;
25
+ /**
26
+ * Inline styles applied to the tile (root element).
27
+ */
28
+ style?: CSSProperties;
29
+ }
30
+ /**
31
+ * A radio input presented as a selectable tile, with a label, an image or both.
32
+ * Group tiles together by giving them the same `name`.
33
+ */
34
+ declare const RadioTile: import('react').ForwardRefExoticComponent<RadioTileProps & import('react').RefAttributes<HTMLInputElement>>;
35
+ export default RadioTile;
@@ -0,0 +1,22 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import clsx from "clsx";
4
+ const RadioTile = /* @__PURE__ */ forwardRef(({
5
+ label,
6
+ image,
7
+ orientation = "horizontal",
8
+ hideLabel = !1,
9
+ className,
10
+ style,
11
+ ...inputProps
12
+ }, ref) => {
13
+ const hasImage = image != null && image !== !1;
14
+ return /* @__PURE__ */ jsxs("label", { className: clsx("radio-tile", `radio-tile--${hasImage ? hideLabel ? "image" : orientation === "vertical" ? "vertical" : "horizontal" : "text"}`, className), style, children: [
15
+ /* @__PURE__ */ jsx("input", { ref, type: "radio", className: "radio-tile__input visually-hidden", ...inputProps }),
16
+ hasImage && /* @__PURE__ */ jsx("span", { className: "radio-tile__image", children: typeof image == "string" ? /* @__PURE__ */ jsx("img", { src: image, alt: "", loading: "lazy" }) : image }),
17
+ /* @__PURE__ */ jsx("span", { className: clsx("radio-tile__label", hideLabel && "visually-hidden"), children: label })
18
+ ] });
19
+ });
20
+ export {
21
+ RadioTile as default
22
+ };
@@ -0,0 +1,2 @@
1
+ export { default as RadioTile } from './RadioTile';
2
+ export * from './RadioTile';
@@ -16,6 +16,25 @@ function findNodeById(data, id) {
16
16
  }
17
17
  }
18
18
  }
19
+ function modifyNode(data, callback) {
20
+ return doModify(data, callback) || data;
21
+ }
22
+ function doModify(current, callback, parent) {
23
+ var _a;
24
+ const result = callback(current, parent);
25
+ if ((_a = result == null ? void 0 : result.children) != null && _a.length) {
26
+ const children = [];
27
+ for (const child of (result == null ? void 0 : result.children) || []) {
28
+ const res = doModify(child, callback, result);
29
+ res && children.push(res);
30
+ }
31
+ return {
32
+ ...result,
33
+ children
34
+ };
35
+ }
36
+ return result;
37
+ }
19
38
  function findPathById(tree, nodeId) {
20
39
  let path = [];
21
40
  function traverse(node, currentPath) {
@@ -40,5 +59,6 @@ function findPathById(tree, nodeId) {
40
59
  }
41
60
  export {
42
61
  findNodeById,
43
- findPathById
62
+ findPathById,
63
+ modifyNode
44
64
  };
@@ -45,6 +45,7 @@ export * from './PreventPropagation';
45
45
  export * from './PromotionCard';
46
46
  export * from './Radio';
47
47
  export * from './RadioCard';
48
+ export * from './RadioTile';
48
49
  export * from './SearchBar';
49
50
  export * from './SegmentedControl';
50
51
  export * from './Select';
package/dist/editor.js CHANGED
@@ -26,6 +26,7 @@ import { EditorToolbar } from "./modules/editor/components/EditorToolbar/EditorT
26
26
  import { useActionOptions } from "./modules/editor/hooks/useActionOptions.js";
27
27
  import { useCantooEditor } from "./modules/editor/hooks/useCantooEditor.js";
28
28
  import { useCommentEditor } from "./modules/editor/hooks/useCommentEditor.js";
29
+ import { useEditorState } from "./modules/editor/hooks/useEditorState.js";
29
30
  import { useImageModal } from "./modules/editor/hooks/useImageModal.js";
30
31
  import { useImageSelection } from "./modules/editor/hooks/useImageSelection.js";
31
32
  import { useLinkToolbar } from "./modules/editor/hooks/useLinkToolbar.js";
@@ -67,6 +68,7 @@ export {
67
68
  useCommentEditor,
68
69
  useEditor,
69
70
  useEditorContext,
71
+ useEditorState,
70
72
  useImageModal,
71
73
  useImageSelection,
72
74
  useLinkToolbar,
@@ -3,6 +3,7 @@ export * from './useBookmark';
3
3
  export * from './useBreakpoint';
4
4
  export * from './useBrowserInfo';
5
5
  export * from './useCantoo';
6
+ export * from './useCarbonioUnread';
6
7
  export * from './useCheckable';
7
8
  export * from './useClickOutside';
8
9
  export * from './useConversation';
@@ -23,6 +24,7 @@ export * from './useIsAdmlcOrAdmc';
23
24
  export * from './useKeyPress';
24
25
  export * from './useLibraryUrl';
25
26
  export * from './useMediaLibrary';
27
+ export * from './useNextcloudSearch';
26
28
  export * from './usePublicConf';
27
29
  export * from './useScreeb';
28
30
  export * from './useScrollToTop';
@@ -1,4 +1,4 @@
1
- export type Background = 'default' | 'pink-200' | 'yellow-200' | 'orange-200' | 'blue-200' | 'green-200';
1
+ export type Background = 'default' | 'pink-200' | 'yellow-200' | 'orange-200' | 'blue-200' | 'green-200' | 'crna';
2
2
  declare const _default: () => {
3
3
  betaEnabled: boolean | undefined;
4
4
  background: Background;
@@ -0,0 +1 @@
1
+ export { default as useCarbonioUnread } from './useCarbonioUnread';
@@ -0,0 +1,5 @@
1
+ declare const useCarbonioUnread: () => {
2
+ readonly hasCarbonioWorkflow: boolean | Record<string, boolean>;
3
+ readonly unreadCount: number;
4
+ };
5
+ export default useCarbonioUnread;
@@ -0,0 +1,24 @@
1
+ import { odeServices } from "@edifice.io/client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
4
+ const CARBONIO_PREAUTH_WORKFLOW = "org.entcore.auth.controllers.CarbonioPreauthController|preauth", useCarbonioUnread = () => {
5
+ const hasCarbonioWorkflow = useHasWorkflow(CARBONIO_PREAUTH_WORKFLOW) || !1, {
6
+ data
7
+ } = useQuery({
8
+ queryKey: ["carbonio", "unread", "count"],
9
+ queryFn: () => odeServices.http().get("/auth/carbonio/unread", {
10
+ disableNotifications: !0
11
+ }),
12
+ enabled: hasCarbonioWorkflow,
13
+ staleTime: 5 * 60 * 1e3,
14
+ // Each call queries the Carbonio server: a failure means no badge, not another try.
15
+ retry: !1
16
+ });
17
+ return {
18
+ hasCarbonioWorkflow,
19
+ unreadCount: (data == null ? void 0 : data.count) ?? 0
20
+ };
21
+ };
22
+ export {
23
+ useCarbonioUnread as default
24
+ };
@@ -0,0 +1 @@
1
+ export { default as useNextcloudSearch } from './useNextcloudSearch';
@@ -0,0 +1,14 @@
1
+ import { ID, NextcloudDocument } from '@edifice.io/client';
2
+ import { TreeItem } from '../../components/Tree/types';
3
+ export type NextcloudFolderNode = TreeItem & {
4
+ files?: NextcloudDocument[];
5
+ };
6
+ export default function useNextcloudSearch(rootId: string, rootName: string, userId?: string): {
7
+ root: NextcloudFolderNode;
8
+ needsAuth: boolean;
9
+ isCheckingAuth: boolean;
10
+ isAuthError: boolean;
11
+ refetchAuthStatus: () => void;
12
+ loadContent: (folderId?: ID) => void;
13
+ loadError: unknown;
14
+ };
@@ -0,0 +1,64 @@
1
+ import { useState, useCallback } from "react";
2
+ import { odeServices } from "@edifice.io/client";
3
+ import { useQueryClient, useQuery } from "@tanstack/react-query";
4
+ import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
5
+ function useNextcloudSearch(rootId, rootName, userId) {
6
+ var _a;
7
+ const [root, setRoot] = useState({
8
+ id: rootId,
9
+ name: rootName,
10
+ section: !0
11
+ }), updateFolder = useCallback((folderId, subfolders, files) => {
12
+ setRoot((prev) => {
13
+ const node = findNodeById(prev, folderId);
14
+ if (!node) return prev;
15
+ const children = subfolders.map((f) => {
16
+ var _a2;
17
+ const existing = (_a2 = node.children) == null ? void 0 : _a2.find((c) => c.id === f.path);
18
+ return existing ? {
19
+ ...existing,
20
+ name: f.name
21
+ } : {
22
+ id: f.path,
23
+ name: f.name
24
+ };
25
+ });
26
+ return modifyNode(prev, (n) => n.id === node.id ? {
27
+ ...n,
28
+ children,
29
+ files
30
+ } : n);
31
+ });
32
+ }, []), queryClient = useQueryClient(), oauth2StatusQuery = useQuery({
33
+ queryKey: ["nextcloud", "oauth2-status", userId],
34
+ queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
35
+ enabled: !!userId
36
+ }), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
37
+ if (!userId) return;
38
+ const path = folderId === rootId ? void 0 : folderId;
39
+ try {
40
+ const payload = await queryClient.fetchQuery({
41
+ queryKey: ["nextcloud", "documents", userId, path ?? "/"],
42
+ queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
43
+ staleTime: 6e4
44
+ }), subfolders = [], files = [], currentPath = path ?? "/";
45
+ payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
46
+ doc.isFolder ? subfolders.push(doc) : files.push(doc);
47
+ }), setLoadError(null), updateFolder(folderId, subfolders, files);
48
+ } catch (error) {
49
+ setLoadError(error);
50
+ }
51
+ }, [rootId, userId, queryClient, updateFolder]);
52
+ return {
53
+ root,
54
+ needsAuth,
55
+ isCheckingAuth: oauth2StatusQuery.isLoading,
56
+ isAuthError: oauth2StatusQuery.isError,
57
+ refetchAuthStatus: oauth2StatusQuery.refetch,
58
+ loadContent,
59
+ loadError
60
+ };
61
+ }
62
+ export {
63
+ useNextcloudSearch as default
64
+ };
@@ -9,6 +9,6 @@ export interface UseZendeskGuideAPI {
9
9
  /**
10
10
  * Add Zendesk Guide
11
11
  *
12
- * @param headerColor Overrides the widget panel's theme color.
12
+ * @param headerColor Overrides the widget panel's header color.
13
13
  */
14
14
  export default function useZendeskGuide(headerColor?: string): UseZendeskGuideAPI;