@edifice.io/react 2.0.0-develop-rc.4 → 2.0.0-develop-rc.7
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/README.md +17 -88
- package/dist/components/Alert/Alert.js +5 -5
- package/dist/components/Table/TableExplorer.js +2 -2
- package/dist/components/TextArea/TextArea.js +2 -2
- package/dist/core/useConversation/useConversation.js +2 -2
- package/dist/core/useHasWorkflow/useHasWorkflow.js +1 -1
- package/dist/core/useHeader/useHeader.js +3 -3
- package/dist/core/useLibraryUrl/useLibraryUrl.js +2 -2
- package/dist/core/useMediaLibrary/useMediaLibrary.js +2 -2
- package/dist/core/useOdeIcons/useOdeIcons.d.ts +1 -1
- package/dist/core/useResource/useResource.d.ts +0 -1
- package/dist/core/useTrashedResource/useTrashedResource.js +2 -2
- package/dist/core/useUpload/useUpload.d.ts +4 -5
- package/dist/core/useUpload/useUpload.js +1 -1
- package/dist/core/useUploadFiles/useUploadFiles.d.ts +5 -5
- package/dist/core/useUploadFiles/useUploadFiles.js +3 -3
- package/dist/core/useWorkspaceFile/useWorkspaceFile.d.ts +4 -4
- package/dist/core/useWorkspaceFile/useWorkspaceFile.js +2 -2
- package/dist/core/useWorkspaceSearch/useWorkspaceSearch.d.ts +2 -2
- package/dist/core/useWorkspaceSearch/useWorkspaceSearch.js +1 -1
- package/dist/editor.js +3 -3
- package/dist/hooks/useBrowserInfo/useBrowserInfo.js +1 -1
- package/dist/hooks/useDropdown/useDropdown.d.ts +1 -1
- package/dist/hooks/useDropdown/useDropdown.js +2 -2
- package/dist/hooks/useDropzone/useDropzone.js +2 -2
- package/dist/hooks/useToast/useToast.js +1 -1
- package/dist/index.js +66 -66
- package/dist/modals.js +4 -4
- package/dist/modules/audience/ReactionChoice.js +2 -2
- package/dist/modules/audience/ReactionModal.js +1 -2
- package/dist/modules/audience/ReactionSummary.js +2 -2
- package/dist/modules/audience/ViewsCounter.js +2 -2
- package/dist/modules/audience/ViewsModal.js +2 -2
- package/dist/modules/audience/hooks/useReactions.d.ts +3 -5
- package/dist/modules/audience/hooks/useViews.d.ts +3 -3
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +2 -2
- package/dist/modules/editor/components/Editor/Editor.js +3 -3
- package/dist/modules/editor/components/Editor/MathsModal.d.ts +0 -1
- package/dist/modules/editor/components/Editor/MathsModal.js +1 -1
- package/dist/modules/editor/components/NodeView/AttachmentNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/AudioNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/ImageNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/LinkerNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/VideoNodeView.js +2 -2
- package/dist/modules/editor/components/Renderer/LinkerRenderer.js +1 -1
- package/dist/modules/editor/components/Renderer/MediaRenderer.js +1 -1
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +1 -1
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +4 -4
- package/dist/modules/editor/components/Toolbar/TableToolbar.d.ts +1 -1
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +5 -5
- package/dist/modules/editor/hooks/useImageModal.d.ts +1 -2
- package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +0 -1
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +2 -2
- package/dist/modules/modals/PublishModal/components/PublishModalFooter.js +1 -1
- package/dist/modules/modals/ResourceModal/ResourceModal.js +1 -1
- package/dist/modules/modals/ShareModal/ShareBookmarkLine.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +2 -2
- package/dist/modules/modals/ShareModal/utils/hasRight.d.ts +0 -1
- package/dist/modules/modals/ShareModal/utils/showShareRightLine.d.ts +0 -1
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.js +2 -2
- package/dist/modules/multimedia/Embed/Embed.js +2 -2
- package/dist/modules/multimedia/ImageEditor/components/ImageEditor.js +2 -2
- package/dist/modules/multimedia/ImageEditor/hooks/useHistoryTool.js +36 -38
- package/dist/modules/multimedia/Linker/ExternalLinker.js +5 -5
- package/dist/modules/multimedia/Linker/InternalLinker.js +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +3 -3
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +2 -2
- package/dist/modules/multimedia/UploadFiles/UploadFiles.d.ts +1 -1
- package/dist/modules/multimedia/VideoEmbed/VideoEmbed.js +2 -2
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.js +2 -2
- package/dist/modules/multimedia/Workspace/Workspace.js +4 -4
- package/dist/multimedia.js +16 -16
- package/dist/portal/Help/Help.d.ts +0 -1
- package/dist/portal/Layout/Layout.js +3 -3
- package/dist/utils/fileSize.js +1 -1
- package/dist/widgets/BookmarkedApps/BookmarkedApps.js +2 -2
- package/package.json +19 -28
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Edifice React
|
|
1
|
+
# Edifice React Library
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
@@ -7,104 +7,33 @@
|
|
|
7
7
|
|
|
8
8
|
We follow [WAI ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/) rules and [Bootstrap 5](https://getbootstrap.com/docs/5.0/components/accordion/) guidelines when making our components
|
|
9
9
|
|
|
10
|
-
###
|
|
10
|
+
### Install
|
|
11
11
|
|
|
12
|
-
```bash
|
|
13
|
-
pnpm run build
|
|
14
12
|
```
|
|
15
|
-
|
|
16
|
-
### Lint
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
pnpm run lint
|
|
13
|
+
pnpm add @edifice.io/react
|
|
20
14
|
```
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
### Modules
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
pnpm run fix
|
|
26
|
-
```
|
|
18
|
+
Optional modules are available as `sub-imports`. You can use them in specific applications:
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
pnpm run format
|
|
32
|
-
```
|
|
20
|
+
#### Audience
|
|
33
21
|
|
|
34
|
-
|
|
22
|
+
Module to track views or reactions on a resource in a specific application (e.g: Blog)
|
|
35
23
|
|
|
36
|
-
|
|
24
|
+
#### Editor
|
|
37
25
|
|
|
38
|
-
|
|
39
|
-
- Component file in PascalCase: `Button.tsx`
|
|
40
|
-
- Export types & interfaces inside Component file
|
|
41
|
-
- Stories file in PascalCase + `*.stories.tsx` : `Button.stories.tsx`
|
|
26
|
+
Rich Text Editor using Tiptap and our `multimedia` module.
|
|
42
27
|
|
|
43
|
-
|
|
44
|
-
src
|
|
45
|
-
-- ComponentFolder
|
|
46
|
-
-- Component.tsx
|
|
47
|
-
-- Component.stories.tsx
|
|
48
|
-
-- index.ts
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
- Re-export the Component inside his own `index` file: `index.ts`
|
|
52
|
-
- Export everything if Component has types & interfaces
|
|
53
|
-
|
|
54
|
-
```jsx
|
|
55
|
-
export { default as Component } from './Component';
|
|
56
|
-
export * from './Component';
|
|
57
|
-
```
|
|
28
|
+
#### Modals
|
|
58
29
|
|
|
59
|
-
|
|
30
|
+
- Onboarding Modal to greet user and give him some useful informations about an application.
|
|
31
|
+
- Publish Modal to publish a resource to the BPR application.
|
|
32
|
+
- Resource Modal can be used to create or edit information about a resource
|
|
33
|
+
- Share Modal allows a user to share one of his resource with specific roles to users
|
|
60
34
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```jsx
|
|
64
|
-
/**
|
|
65
|
-
* Primary UI component for user interaction
|
|
66
|
-
*/
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Interface description
|
|
70
|
-
|
|
71
|
-
- Always document typescript types and interface with JSDoc syntax. Used by Storybook to generate documentation.
|
|
72
|
-
|
|
73
|
-
```jsx
|
|
74
|
-
// Interface description (e.g: TreeViewProps.tsx)
|
|
75
|
-
export interface ButtonProps {
|
|
76
|
-
/**
|
|
77
|
-
* Is this the principal call to action on the page?
|
|
78
|
-
*/
|
|
79
|
-
primary?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* What background color to use
|
|
82
|
-
*/
|
|
83
|
-
backgroundColor?: string;
|
|
84
|
-
/**
|
|
85
|
-
* How large should the button be?
|
|
86
|
-
*/
|
|
87
|
-
size?: "small" | "medium" | "large";
|
|
88
|
-
/**
|
|
89
|
-
* Button contents
|
|
90
|
-
*/
|
|
91
|
-
label: string;
|
|
92
|
-
/**
|
|
93
|
-
* Optional click handler
|
|
94
|
-
*/
|
|
95
|
-
onClick?: () => void;
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Index file inside `src` folder
|
|
100
|
-
|
|
101
|
-
- Entry point of this React Library.
|
|
102
|
-
- Import your component inside `index.ts` file.
|
|
103
|
-
|
|
104
|
-
```jsx
|
|
105
|
-
export * from './Button';
|
|
106
|
-
```
|
|
35
|
+
#### Multimedia
|
|
107
36
|
|
|
108
|
-
|
|
37
|
+
All our multimedia components to use in applications or in modules.
|
|
109
38
|
|
|
110
|
-
|
|
39
|
+
- Linker, AudioRecorder, VideoRecorder, Iframe, Embed component, ...
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useLayoutEffect, useEffect } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
@@ -59,7 +59,7 @@ const Alert = /* @__PURE__ */ forwardRef(({
|
|
|
59
59
|
}, confirmClasses = {
|
|
60
60
|
"is-confirm": isConfirm
|
|
61
61
|
}, divContainerClasses = clsx("alert gap-12", mapping[type].classModifier, toastClasses, confirmClasses, position, className);
|
|
62
|
-
return
|
|
62
|
+
return isVisible ? /* @__PURE__ */ jsxs("div", { ref: refAlert, className: divContainerClasses, role: "alert", children: [
|
|
63
63
|
!isConfirm && mapping[type].icon,
|
|
64
64
|
/* @__PURE__ */ jsx("div", { className: "alert-content small", children }),
|
|
65
65
|
button && /* @__PURE__ */ jsxs("div", { className: "ms-12", children: [
|
|
@@ -71,9 +71,9 @@ const Alert = /* @__PURE__ */ forwardRef(({
|
|
|
71
71
|
autoClose && /* @__PURE__ */ jsx("div", { className: "alert-progress", style: {
|
|
72
72
|
transform: "scaleX(0)"
|
|
73
73
|
} })
|
|
74
|
-
] }) : null
|
|
75
|
-
})
|
|
74
|
+
] }) : null;
|
|
75
|
+
});
|
|
76
76
|
export {
|
|
77
77
|
Alert,
|
|
78
|
-
Alert
|
|
78
|
+
Alert as default
|
|
79
79
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
const TableExplorer = /* @__PURE__ */ forwardRef(({
|
|
4
4
|
children
|
|
5
|
-
}, ref) => /* @__PURE__ */ jsx(
|
|
5
|
+
}, ref) => /* @__PURE__ */ jsx("table", { ref, className: "table-explorer", children }));
|
|
6
6
|
export {
|
|
7
7
|
TableExplorer,
|
|
8
8
|
TableExplorer as default
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { useFormControl } from "../Form/FormContext.js";
|
|
@@ -27,7 +27,7 @@ const TextArea = /* @__PURE__ */ forwardRef(({
|
|
|
27
27
|
"form-control-plaintext": isReadOnly,
|
|
28
28
|
"no-validation-icon": noValidationIcon
|
|
29
29
|
}, className);
|
|
30
|
-
return /* @__PURE__ */ jsx(
|
|
30
|
+
return /* @__PURE__ */ jsx("textarea", { ref, id, className: classes, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps });
|
|
31
31
|
});
|
|
32
32
|
export {
|
|
33
33
|
TextArea,
|
|
@@ -10,7 +10,7 @@ function useHasWorkflow(workflow) {
|
|
|
10
10
|
if (typeof workflow == "string")
|
|
11
11
|
response = await mock.hasWorkflow(workflow);
|
|
12
12
|
else
|
|
13
|
-
throw "not.implemented.yet)";
|
|
13
|
+
throw new Error("not.implemented.yet)");
|
|
14
14
|
else
|
|
15
15
|
typeof workflow == "string" ? response = await odeServices.rights().sessionHasWorkflowRight(workflow) : response = await odeServices.rights().sessionHasWorkflowRights(workflow);
|
|
16
16
|
setState(response);
|
|
@@ -20,9 +20,9 @@ function useHeader({
|
|
|
20
20
|
username: user == null ? void 0 : user.firstName
|
|
21
21
|
}), bookmarkedApps = useBookmark(), communityWorkflow = useHasWorkflow("net.atos.entng.community.controllers.CommunityController|view"), conversationWorflow = useHasWorkflow("org.entcore.conversation.controllers.ConversationController|view"), searchWorkflow = useHasWorkflow("fr.openent.searchengine.controllers.SearchEngineController|view"), toggleCollapsedNav = useCallback(() => {
|
|
22
22
|
setIsCollapsed(!isCollapsed);
|
|
23
|
-
}, [isCollapsed]), handleLogout = async () => {
|
|
23
|
+
}, [isCollapsed]), handleLogout = useCallback(async () => {
|
|
24
24
|
await odeServices.session().logout(), window.location.href = (theme == null ? void 0 : theme.logoutCallback) ?? "/auth/login";
|
|
25
|
-
};
|
|
25
|
+
}, [theme == null ? void 0 : theme.logoutCallback]);
|
|
26
26
|
return useMemo(() => ({
|
|
27
27
|
title,
|
|
28
28
|
bookmarkedApps,
|
|
@@ -39,7 +39,7 @@ function useHeader({
|
|
|
39
39
|
isCollapsed,
|
|
40
40
|
toggleCollapsedNav,
|
|
41
41
|
handleLogout
|
|
42
|
-
}), [appsRef, bookmarkedApps, communityWorkflow, conversationWorflow, isAppsHovered, isCollapsed, popoverAppsId, popoverSearchId, searchWorkflow, title, toggleCollapsedNav, userAvatar, userName, welcomeUser]);
|
|
42
|
+
}), [appsRef, bookmarkedApps, communityWorkflow, conversationWorflow, handleLogout, isAppsHovered, isCollapsed, popoverAppsId, popoverSearchId, searchWorkflow, title, toggleCollapsedNav, userAvatar, userName, welcomeUser]);
|
|
43
43
|
}
|
|
44
44
|
export {
|
|
45
45
|
useHeader as default
|
|
@@ -15,7 +15,7 @@ const useLibraryUrl = () => {
|
|
|
15
15
|
libraryHost.endsWith("/") || (libraryHost = `${libraryHost}/`);
|
|
16
16
|
const platformURLParam = libraryUrlSplit == null ? void 0 : libraryUrlSplit[1], searchParams = `application%5B0%5D=${appName}&page=1&sort_field=views&sort_order=desc`;
|
|
17
17
|
return `${libraryHost}search/?${platformURLParam}&${searchParams}`;
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
export {
|
|
20
|
-
useLibraryUrl
|
|
20
|
+
useLibraryUrl as default
|
|
21
21
|
};
|
|
@@ -52,7 +52,7 @@ const useMediaLibrary = () => {
|
|
|
52
52
|
(_a = mediaLibraryRef.current) != null && _a.type && uploads && uploads.length > 0 && await remove(uploads);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
export {
|
|
57
|
-
useMediaLibrary
|
|
57
|
+
useMediaLibrary as default
|
|
58
58
|
};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { WorkspaceElement, WorkspaceVisibility } from 'edifice-ts-client';
|
|
2
1
|
import { Status } from '../../types';
|
|
3
|
-
declare const useUpload: (visibility?:
|
|
2
|
+
declare const useUpload: (visibility?: any, application?: string) => {
|
|
4
3
|
getUploadStatus: (upload: File | Blob) => Status | undefined;
|
|
5
4
|
setUploadStatus: (blob: File | Blob, status: Status) => void;
|
|
6
5
|
clearUploadStatus: (blob: File | Blob) => void;
|
|
7
6
|
uploadFile: (file: File, metadata?: {
|
|
8
7
|
duration: number;
|
|
9
|
-
}) => Promise<
|
|
8
|
+
}) => Promise<any>;
|
|
10
9
|
uploadAlternateFile: (original: File, replacement: File, metadata?: {
|
|
11
10
|
duration: number;
|
|
12
|
-
}) => Promise<
|
|
11
|
+
}) => Promise<any>;
|
|
13
12
|
uploadBlob: (blob: Blob, metadata?: {
|
|
14
13
|
filename?: string;
|
|
15
14
|
duration?: number;
|
|
16
|
-
}) => Promise<
|
|
15
|
+
}) => Promise<any>;
|
|
17
16
|
};
|
|
18
17
|
export default useUpload;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState, useCallback } from "react";
|
|
2
2
|
import { ERROR_CODE, odeServices } from "edifice-ts-client";
|
|
3
3
|
import useBrowserInfo from "../../hooks/useBrowserInfo/useBrowserInfo.js";
|
|
4
|
-
import useWorkspaceFile from "../useWorkspaceFile/useWorkspaceFile.js";
|
|
5
4
|
import { getOrGenerateBlobId } from "../../utils/blob.js";
|
|
5
|
+
import useWorkspaceFile from "../useWorkspaceFile/useWorkspaceFile.js";
|
|
6
6
|
const useUpload = (visibility, application = "media-library") => {
|
|
7
7
|
const [status, setStatus] = useState({}), {
|
|
8
8
|
browser,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WorkspaceElement, WorkspaceVisibility } from 'edifice-ts-client';
|
|
2
2
|
declare const useUploadFiles: ({ handleOnChange, visibility, application, }: {
|
|
3
3
|
handleOnChange: (uploadedFiles: WorkspaceElement[]) => void;
|
|
4
|
-
visibility?:
|
|
4
|
+
visibility?: any;
|
|
5
5
|
application?: string | undefined;
|
|
6
6
|
}) => {
|
|
7
7
|
/** List of files added from device */
|
|
@@ -9,9 +9,9 @@ declare const useUploadFiles: ({ handleOnChange, visibility, application, }: {
|
|
|
9
9
|
getUploadStatus: (upload: Blob | File) => import('../../types').Status | undefined;
|
|
10
10
|
clearUploadStatus: (blob: Blob | File) => void;
|
|
11
11
|
uploadedFiles: WorkspaceElement[];
|
|
12
|
-
editingImage:
|
|
13
|
-
setEditingImage: import('react').Dispatch<
|
|
14
|
-
getUrl: (resource?:
|
|
12
|
+
editingImage: any;
|
|
13
|
+
setEditingImage: import('react').Dispatch<any>;
|
|
14
|
+
getUrl: (resource?: any, timestamp?: boolean) => string;
|
|
15
15
|
updateImage: ({ blob, legend, altText: alt, }: {
|
|
16
16
|
blob: Blob;
|
|
17
17
|
legend: string;
|
|
@@ -19,7 +19,7 @@ declare const useUploadFiles: ({ handleOnChange, visibility, application, }: {
|
|
|
19
19
|
}) => Promise<void>;
|
|
20
20
|
uploadFile: (file: File, metadata?: {
|
|
21
21
|
duration: number;
|
|
22
|
-
} | undefined) => Promise<
|
|
22
|
+
} | undefined) => Promise<any>;
|
|
23
23
|
removeFile: (file: File) => Promise<void>;
|
|
24
24
|
};
|
|
25
25
|
export default useUploadFiles;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from "react";
|
|
2
2
|
import { useDropzoneContext } from "../../components/Dropzone/DropzoneContext.js";
|
|
3
|
-
import useWorkspaceFile from "../useWorkspaceFile/useWorkspaceFile.js";
|
|
4
3
|
import useUpload from "../useUpload/useUpload.js";
|
|
5
4
|
import useImageResizer from "../../hooks/useImageResizer/useImageResizer.js";
|
|
6
5
|
import { addTimestampToImageUrl } from "../../utils/addTimestampToUrl.js";
|
|
6
|
+
import useWorkspaceFile from "../useWorkspaceFile/useWorkspaceFile.js";
|
|
7
7
|
const useUploadFiles = ({
|
|
8
8
|
handleOnChange,
|
|
9
9
|
visibility,
|
|
@@ -95,7 +95,7 @@ const useUploadFiles = ({
|
|
|
95
95
|
uploadFile,
|
|
96
96
|
removeFile
|
|
97
97
|
};
|
|
98
|
-
}
|
|
98
|
+
};
|
|
99
99
|
export {
|
|
100
|
-
useUploadFiles
|
|
100
|
+
useUploadFiles as default
|
|
101
101
|
};
|
|
@@ -7,15 +7,15 @@ declare const useWorkspaceFile: () => {
|
|
|
7
7
|
legend?: string | undefined;
|
|
8
8
|
application?: string | undefined;
|
|
9
9
|
parentId?: string | undefined;
|
|
10
|
-
visibility?:
|
|
10
|
+
visibility?: any;
|
|
11
11
|
}) => Promise<string | {
|
|
12
|
-
file:
|
|
12
|
+
file: any;
|
|
13
13
|
src: string;
|
|
14
14
|
}>;
|
|
15
15
|
create: (file: File, params?: {
|
|
16
16
|
visibility?: WorkspaceVisibility;
|
|
17
17
|
application?: string | undefined;
|
|
18
|
-
}) => Promise<
|
|
19
|
-
remove: (file: WorkspaceElement | WorkspaceElement[]) => Promise<
|
|
18
|
+
}) => Promise<any>;
|
|
19
|
+
remove: (file: WorkspaceElement | WorkspaceElement[]) => Promise<any>;
|
|
20
20
|
};
|
|
21
21
|
export default useWorkspaceFile;
|
|
@@ -43,7 +43,7 @@ const useWorkspaceFile = () => ({
|
|
|
43
43
|
create: async (file, params) => await odeServices.workspace().saveFile(file, params),
|
|
44
44
|
// put,
|
|
45
45
|
remove: async (file) => !file || Array.isArray(file) && file.length === 0 ? Promise.resolve() : await odeServices.workspace().deleteFile(Array.isArray(file) ? file : [file])
|
|
46
|
-
})
|
|
46
|
+
});
|
|
47
47
|
export {
|
|
48
|
-
useWorkspaceFile
|
|
48
|
+
useWorkspaceFile as default
|
|
49
49
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ID, Role, WorkspaceElement, WorkspaceSearchFilter } from 'edifice-ts-client';
|
|
2
2
|
import { TreeNode } from '../../components';
|
|
3
3
|
export type FolderNode = TreeNode & {
|
|
4
4
|
files?: WorkspaceElement[];
|
|
5
5
|
};
|
|
6
6
|
export default function useWorkspaceSearch(rootId: string, rootName: string, filter: WorkspaceSearchFilter, format: Role | Role[] | null): {
|
|
7
7
|
root: FolderNode;
|
|
8
|
-
loadContent: (folderId?:
|
|
8
|
+
loadContent: (folderId?: any) => void;
|
|
9
9
|
};
|
|
@@ -32,7 +32,7 @@ function useWorkspaceSearch(rootId, rootName, filter, format) {
|
|
|
32
32
|
...result,
|
|
33
33
|
_id: "" + Math.round(Math.random() * 9999)
|
|
34
34
|
};
|
|
35
|
-
return ret.name = result.eType
|
|
35
|
+
return ret.name = result.eType === "folder" ? "folder id=" + ret._id : "file id=" + ret._id, ret;
|
|
36
36
|
}))) : await odeServices.workspace().listDocuments(filter, realWorkspaceId), subfolders = [], files = [];
|
|
37
37
|
payload.filter((f) => {
|
|
38
38
|
if (!format || f.eType === "folder") return !0;
|
package/dist/editor.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
2
2
|
import { default as default2 } from "./modules/editor/components/Editor/Editor.js";
|
|
3
|
-
import { EditorToolbar } from "./modules/editor/components/EditorToolbar/EditorToolbar.js";
|
|
4
3
|
import { default as default3 } from "./modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js";
|
|
5
4
|
import { default as default4 } from "./modules/editor/components/NodeView/AudioNodeView.js";
|
|
6
5
|
import { default as default5 } from "./modules/editor/components/NodeView/AttachmentNodeView.js";
|
|
7
6
|
import { default as default6 } from "./modules/editor/components/NodeView/ImageNodeView.js";
|
|
8
7
|
import { default as default7 } from "./modules/editor/components/NodeView/LinkerNodeView.js";
|
|
9
8
|
import { default as default8 } from "./modules/editor/components/NodeView/VideoNodeView.js";
|
|
9
|
+
import { default as default9 } from "./modules/editor/components/Toolbar/TableToolbar.js";
|
|
10
|
+
import { default as default10 } from "./modules/editor/components/Toolbar/LinkToolbar.js";
|
|
11
|
+
import { EditorToolbar } from "./modules/editor/components/EditorToolbar/EditorToolbar.js";
|
|
10
12
|
import { AttachmentRenderer } from "./modules/editor/components/Renderer/AttachmentRenderer.js";
|
|
11
13
|
import { AudioRenderer } from "./modules/editor/components/Renderer/AudioRenderer.js";
|
|
12
14
|
import { LinkerRenderer } from "./modules/editor/components/Renderer/LinkerRenderer.js";
|
|
13
15
|
import { MediaRenderer } from "./modules/editor/components/Renderer/MediaRenderer.js";
|
|
14
|
-
import { default as default9 } from "./modules/editor/components/Toolbar/TableToolbar.js";
|
|
15
|
-
import { default as default10 } from "./modules/editor/components/Toolbar/LinkToolbar.js";
|
|
16
16
|
import { useActionOptions } from "./modules/editor/hooks/useActionOptions.js";
|
|
17
17
|
import { useCommentEditor } from "./modules/editor/hooks/useCommentEditor.js";
|
|
18
18
|
import { EditorContext, useEditorContext } from "./modules/editor/hooks/useEditorContext.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import UAParser from "ua-parser-js";
|
|
2
2
|
function useBrowserInfo(userAgent) {
|
|
3
3
|
var _a, _b, _c;
|
|
4
|
-
const uaParser = new UAParser(userAgent), os = uaParser.getOS(), device = uaParser.getDevice(), browser = uaParser.getBrowser(), isIphone = ((_a = device.model) == null ? void 0 : _a.indexOf("iPhone"))
|
|
4
|
+
const uaParser = new UAParser(userAgent), os = uaParser.getOS(), device = uaParser.getDevice(), browser = uaParser.getBrowser(), isIphone = ((_a = device.model) == null ? void 0 : _a.indexOf("iPhone")) !== -1, isIpod = ((_b = device.model) == null ? void 0 : _b.indexOf("iPod")) !== -1, isIpad = ((_c = device.model) == null ? void 0 : _c.indexOf("iPad")) !== -1;
|
|
5
5
|
return {
|
|
6
6
|
os,
|
|
7
7
|
device,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import toast from "react-hot-toast";
|
|
3
|
-
import Alert from "../../components/Alert/Alert.js";
|
|
3
|
+
import { Alert } from "../../components/Alert/Alert.js";
|
|
4
4
|
const DEFAULT_POSITION = "top-right";
|
|
5
5
|
function useToast() {
|
|
6
6
|
return {
|