@monolith-forensics/monolith-ui 1.1.46 → 1.1.47
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/MonolithUIProvider/GlobalStyle.js +18 -0
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +1 -1
- package/dist/RichTextEditor/Enums/Extensions.d.ts +15 -0
- package/dist/RichTextEditor/Enums/Extensions.js +16 -0
- package/dist/RichTextEditor/Enums/SlashCommands.d.ts +13 -0
- package/dist/RichTextEditor/Enums/SlashCommands.js +14 -0
- package/dist/RichTextEditor/Extensions/SlashCommandList.d.ts +9 -0
- package/dist/RichTextEditor/Extensions/SlashCommandList.js +138 -0
- package/dist/RichTextEditor/Extensions/getSlashCommand.d.ts +10 -0
- package/dist/RichTextEditor/Extensions/getSlashCommand.js +296 -0
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.d.ts +11 -0
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +178 -0
- package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +16 -0
- package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +114 -0
- package/dist/RichTextEditor/RichTextEditor.d.ts +22 -0
- package/dist/RichTextEditor/RichTextEditor.js +302 -0
- package/dist/RichTextEditor/Toolbar/Control.d.ts +14 -0
- package/dist/RichTextEditor/Toolbar/Control.js +33 -0
- package/dist/RichTextEditor/Toolbar/Controls.d.ts +21 -0
- package/dist/RichTextEditor/Toolbar/Controls.js +120 -0
- package/dist/RichTextEditor/Toolbar/ControlsGroup.d.ts +8 -0
- package/dist/RichTextEditor/Toolbar/ControlsGroup.js +26 -0
- package/dist/RichTextEditor/Toolbar/Labels.d.ts +41 -0
- package/dist/RichTextEditor/Toolbar/Labels.js +46 -0
- package/dist/RichTextEditor/Toolbar/Toolbar.d.ts +7 -0
- package/dist/RichTextEditor/Toolbar/Toolbar.js +17 -0
- package/dist/RichTextEditor/Toolbar/index.d.ts +1 -0
- package/dist/RichTextEditor/Toolbar/index.js +1 -0
- package/dist/RichTextEditor/index.d.ts +3 -0
- package/dist/RichTextEditor/index.js +3 -0
- package/dist/Utilities/calculateFileHash.d.ts +8 -0
- package/dist/Utilities/calculateFileHash.js +38 -0
- package/dist/Utilities/readFileAsBuffer.d.ts +2 -0
- package/dist/Utilities/readFileAsBuffer.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +19 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/react";
|
|
2
|
+
interface ControlProps {
|
|
3
|
+
editor: Editor | null;
|
|
4
|
+
}
|
|
5
|
+
export declare const UndoControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const RedoControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const BoldControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const ItalicControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const UnderlineControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const StrikeThroughControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const Heading1Control: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const Heading2Control: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Heading3Control: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const Heading4Control: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const BulletListControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const OrderedListControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const AlignLeftControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const AlignRightControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const AlignCenterControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const AlignJustifiedControl: ({ editor }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconBold, IconItalic, IconUnderline, IconStrikethrough, IconH1, IconH2, IconH3, IconH4, IconList, IconListNumbers, IconAlignLeft, IconAlignRight, IconAlignCenter, IconAlignJustified, IconCornerUpLeft, IconCornerUpRight, } from "@tabler/icons-react";
|
|
3
|
+
import Control from "./Control";
|
|
4
|
+
export const UndoControl = ({ editor }) => {
|
|
5
|
+
return (_jsx(Control, { editor: editor, label: "undoControlLabel", operation: {
|
|
6
|
+
name: "undo",
|
|
7
|
+
}, icon: IconCornerUpLeft }));
|
|
8
|
+
};
|
|
9
|
+
export const RedoControl = ({ editor }) => {
|
|
10
|
+
return (_jsx(Control, { editor: editor, label: "redoControlLabel", operation: {
|
|
11
|
+
name: "redo",
|
|
12
|
+
}, icon: IconCornerUpRight }));
|
|
13
|
+
};
|
|
14
|
+
export const BoldControl = ({ editor }) => {
|
|
15
|
+
return (_jsx(Control, { editor: editor, label: "boldControlLabel", isActive: {
|
|
16
|
+
name: "bold",
|
|
17
|
+
}, operation: {
|
|
18
|
+
name: "toggleBold",
|
|
19
|
+
}, icon: IconBold }));
|
|
20
|
+
};
|
|
21
|
+
export const ItalicControl = ({ editor }) => {
|
|
22
|
+
return (_jsx(Control, { editor: editor, label: "italicControlLabel", isActive: {
|
|
23
|
+
name: "italic",
|
|
24
|
+
}, operation: {
|
|
25
|
+
name: "toggleItalic",
|
|
26
|
+
}, icon: IconItalic }));
|
|
27
|
+
};
|
|
28
|
+
export const UnderlineControl = ({ editor }) => {
|
|
29
|
+
return (_jsx(Control, { editor: editor, label: "underlineControlLabel", isActive: {
|
|
30
|
+
name: "underline",
|
|
31
|
+
}, operation: {
|
|
32
|
+
name: "toggleUnderline",
|
|
33
|
+
}, icon: IconUnderline }));
|
|
34
|
+
};
|
|
35
|
+
export const StrikeThroughControl = ({ editor }) => {
|
|
36
|
+
return (_jsx(Control, { editor: editor, label: "strikeControlLabel", isActive: {
|
|
37
|
+
name: "strike",
|
|
38
|
+
}, operation: {
|
|
39
|
+
name: "toggleStrike",
|
|
40
|
+
}, icon: IconStrikethrough }));
|
|
41
|
+
};
|
|
42
|
+
export const Heading1Control = ({ editor }) => {
|
|
43
|
+
return (_jsx(Control, { editor: editor, label: "h1ControlLabel", isActive: {
|
|
44
|
+
name: "heading",
|
|
45
|
+
attributes: { level: 1 },
|
|
46
|
+
}, operation: {
|
|
47
|
+
name: "toggleHeading",
|
|
48
|
+
attributes: { level: 1 },
|
|
49
|
+
}, icon: IconH1 }));
|
|
50
|
+
};
|
|
51
|
+
export const Heading2Control = ({ editor }) => {
|
|
52
|
+
return (_jsx(Control, { editor: editor, label: "h2ControlLabel", isActive: {
|
|
53
|
+
name: "heading",
|
|
54
|
+
attributes: { level: 2 },
|
|
55
|
+
}, operation: {
|
|
56
|
+
name: "toggleHeading",
|
|
57
|
+
attributes: { level: 2 },
|
|
58
|
+
}, icon: IconH2 }));
|
|
59
|
+
};
|
|
60
|
+
export const Heading3Control = ({ editor }) => {
|
|
61
|
+
return (_jsx(Control, { editor: editor, label: "h3ControlLabel", isActive: {
|
|
62
|
+
name: "heading",
|
|
63
|
+
attributes: { level: 3 },
|
|
64
|
+
}, operation: {
|
|
65
|
+
name: "toggleHeading",
|
|
66
|
+
attributes: { level: 3 },
|
|
67
|
+
}, icon: IconH3 }));
|
|
68
|
+
};
|
|
69
|
+
export const Heading4Control = ({ editor }) => {
|
|
70
|
+
return (_jsx(Control, { editor: editor, label: "h4ControlLabel", isActive: {
|
|
71
|
+
name: "heading",
|
|
72
|
+
attributes: { level: 4 },
|
|
73
|
+
}, operation: {
|
|
74
|
+
name: "toggleHeading",
|
|
75
|
+
attributes: { level: 4 },
|
|
76
|
+
}, icon: IconH4 }));
|
|
77
|
+
};
|
|
78
|
+
export const BulletListControl = ({ editor }) => {
|
|
79
|
+
return (_jsx(Control, { editor: editor, label: "bulletListControlLabel", isActive: {
|
|
80
|
+
name: "bulletList",
|
|
81
|
+
}, operation: {
|
|
82
|
+
name: "toggleBulletList",
|
|
83
|
+
}, icon: IconList }));
|
|
84
|
+
};
|
|
85
|
+
export const OrderedListControl = ({ editor }) => {
|
|
86
|
+
return (_jsx(Control, { editor: editor, label: "orderedListControlLabel", isActive: {
|
|
87
|
+
name: "orderedList",
|
|
88
|
+
}, operation: {
|
|
89
|
+
name: "toggleOrderedList",
|
|
90
|
+
}, icon: IconListNumbers }));
|
|
91
|
+
};
|
|
92
|
+
export const AlignLeftControl = ({ editor }) => {
|
|
93
|
+
return (_jsx(Control, { editor: editor, label: "alignLeftControlLabel", isActive: {
|
|
94
|
+
name: { textAlign: "left" },
|
|
95
|
+
}, operation: {
|
|
96
|
+
name: "setTextAlign",
|
|
97
|
+
attributes: "left",
|
|
98
|
+
}, icon: IconAlignLeft }));
|
|
99
|
+
};
|
|
100
|
+
export const AlignRightControl = ({ editor }) => {
|
|
101
|
+
return (_jsx(Control, { editor: editor, label: "alignRightControlLabel", isActive: {
|
|
102
|
+
name: { textAlign: "right" },
|
|
103
|
+
}, operation: {
|
|
104
|
+
name: "setTextAlign",
|
|
105
|
+
attributes: "right",
|
|
106
|
+
}, icon: IconAlignRight }));
|
|
107
|
+
};
|
|
108
|
+
export const AlignCenterControl = ({ editor }) => {
|
|
109
|
+
return (_jsx(Control, { editor: editor, label: "alignCenterControlLabel", isActive: {
|
|
110
|
+
name: { textAlign: "center" },
|
|
111
|
+
}, operation: {
|
|
112
|
+
name: "setTextAlign",
|
|
113
|
+
attributes: "center",
|
|
114
|
+
}, icon: IconAlignCenter }));
|
|
115
|
+
};
|
|
116
|
+
export const AlignJustifiedControl = ({ editor }) => {
|
|
117
|
+
return (_jsx(Control, { editor: editor, label: "alignJustifiedControlLabel", isActive: {
|
|
118
|
+
name: { textAlign: "justify" },
|
|
119
|
+
}, operation: { name: "setTextAlign", attributes: "justify" }, icon: IconAlignJustified }));
|
|
120
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ControlsGroupProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
declare const ControlsGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<ControlsGroupProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<ControlsGroupProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
8
|
+
export default ControlsGroup;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
const ControlsGroup = styled(forwardRef(({ className, children }, ref) => {
|
|
5
|
+
return (_jsx("div", { className: className + " controls-group", ref: ref, children: children }));
|
|
6
|
+
})) `
|
|
7
|
+
& {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: flex-start;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
& button {
|
|
13
|
+
border-radius: 0;
|
|
14
|
+
border: 1px solid ${({ theme }) => theme.palette.divider};
|
|
15
|
+
border-right: none;
|
|
16
|
+
}
|
|
17
|
+
& button:first-child {
|
|
18
|
+
border-radius: 5px 0 0 5px;
|
|
19
|
+
}
|
|
20
|
+
& button:last-child {
|
|
21
|
+
border-radius: 0 5px 5px 0;
|
|
22
|
+
border-right: 1px solid ${({ theme }) => theme.palette.divider};
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
ControlsGroup.displayName = "ControlsGroup";
|
|
26
|
+
export default ControlsGroup;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const Labels: {
|
|
2
|
+
linkControlLabel: string;
|
|
3
|
+
colorPickerControlLabel: string;
|
|
4
|
+
highlightControlLabel: string;
|
|
5
|
+
boldControlLabel: string;
|
|
6
|
+
italicControlLabel: string;
|
|
7
|
+
underlineControlLabel: string;
|
|
8
|
+
strikeControlLabel: string;
|
|
9
|
+
clearFormattingControlLabel: string;
|
|
10
|
+
unlinkControlLabel: string;
|
|
11
|
+
bulletListControlLabel: string;
|
|
12
|
+
orderedListControlLabel: string;
|
|
13
|
+
h1ControlLabel: string;
|
|
14
|
+
h2ControlLabel: string;
|
|
15
|
+
h3ControlLabel: string;
|
|
16
|
+
h4ControlLabel: string;
|
|
17
|
+
h5ControlLabel: string;
|
|
18
|
+
h6ControlLabel: string;
|
|
19
|
+
blockquoteControlLabel: string;
|
|
20
|
+
alignLeftControlLabel: string;
|
|
21
|
+
alignCenterControlLabel: string;
|
|
22
|
+
alignRightControlLabel: string;
|
|
23
|
+
alignJustifyControlLabel: string;
|
|
24
|
+
codeControlLabel: string;
|
|
25
|
+
codeBlockControlLabel: string;
|
|
26
|
+
subscriptControlLabel: string;
|
|
27
|
+
superscriptControlLabel: string;
|
|
28
|
+
unsetColorControlLabel: string;
|
|
29
|
+
hrControlLabel: string;
|
|
30
|
+
linkEditorInputLabel: string;
|
|
31
|
+
linkEditorInputPlaceholder: string;
|
|
32
|
+
linkEditorExternalLink: string;
|
|
33
|
+
linkEditorInternalLink: string;
|
|
34
|
+
linkEditorSave: string;
|
|
35
|
+
colorPickerCancel: string;
|
|
36
|
+
colorPickerClear: string;
|
|
37
|
+
colorPickerColorPicker: string;
|
|
38
|
+
colorPickerPalette: string;
|
|
39
|
+
colorPickerSave: string;
|
|
40
|
+
};
|
|
41
|
+
export default Labels;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const Labels = {
|
|
2
|
+
// Controls labels
|
|
3
|
+
linkControlLabel: "Link",
|
|
4
|
+
colorPickerControlLabel: "Text color",
|
|
5
|
+
highlightControlLabel: "Highlight text",
|
|
6
|
+
// colorControlLabel: (color) => `Set text color ${color}`,
|
|
7
|
+
boldControlLabel: "Bold",
|
|
8
|
+
italicControlLabel: "Italic",
|
|
9
|
+
underlineControlLabel: "Underline",
|
|
10
|
+
strikeControlLabel: "Strikethrough",
|
|
11
|
+
clearFormattingControlLabel: "Clear formatting",
|
|
12
|
+
unlinkControlLabel: "Remove link",
|
|
13
|
+
bulletListControlLabel: "Bullet list",
|
|
14
|
+
orderedListControlLabel: "Ordered list",
|
|
15
|
+
h1ControlLabel: "Heading 1",
|
|
16
|
+
h2ControlLabel: "Heading 2",
|
|
17
|
+
h3ControlLabel: "Heading 3",
|
|
18
|
+
h4ControlLabel: "Heading 4",
|
|
19
|
+
h5ControlLabel: "Heading 5",
|
|
20
|
+
h6ControlLabel: "Heading 6",
|
|
21
|
+
blockquoteControlLabel: "Blockquote",
|
|
22
|
+
alignLeftControlLabel: "Align text: left",
|
|
23
|
+
alignCenterControlLabel: "Align text: center",
|
|
24
|
+
alignRightControlLabel: "Align text: right",
|
|
25
|
+
alignJustifyControlLabel: "Align text: justify",
|
|
26
|
+
codeControlLabel: "Code",
|
|
27
|
+
codeBlockControlLabel: "Code block",
|
|
28
|
+
subscriptControlLabel: "Subscript",
|
|
29
|
+
superscriptControlLabel: "Superscript",
|
|
30
|
+
unsetColorControlLabel: "Unset color",
|
|
31
|
+
hrControlLabel: "Horizontal line",
|
|
32
|
+
// Link editor
|
|
33
|
+
linkEditorInputLabel: "Enter URL",
|
|
34
|
+
linkEditorInputPlaceholder: "https://example.com/",
|
|
35
|
+
linkEditorExternalLink: "Open link in a new tab",
|
|
36
|
+
linkEditorInternalLink: "Open link in the same tab",
|
|
37
|
+
linkEditorSave: "Save",
|
|
38
|
+
// Color picker control
|
|
39
|
+
colorPickerCancel: "Cancel",
|
|
40
|
+
colorPickerClear: "Clear color",
|
|
41
|
+
colorPickerColorPicker: "Color picker",
|
|
42
|
+
colorPickerPalette: "Color palette",
|
|
43
|
+
colorPickerSave: "Save",
|
|
44
|
+
// colorPickerColorLabel: (color) => `Set text color ${color}`,
|
|
45
|
+
};
|
|
46
|
+
export default Labels;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/react";
|
|
2
|
+
interface ToolbarProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
editor: Editor | null;
|
|
5
|
+
}
|
|
6
|
+
declare const Toolbar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<ToolbarProps, never>> & string & Omit<({ className, editor }: ToolbarProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
7
|
+
export default Toolbar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import ControlsGroup from "./ControlsGroup";
|
|
4
|
+
import { UndoControl, RedoControl, BoldControl, ItalicControl, UnderlineControl, StrikeThroughControl, Heading1Control, Heading2Control, Heading3Control, Heading4Control, BulletListControl, OrderedListControl, AlignLeftControl, AlignCenterControl, AlignRightControl, AlignJustifiedControl, } from "./Controls";
|
|
5
|
+
const Toolbar = styled(({ className, editor }) => {
|
|
6
|
+
return (_jsxs("div", { className: className, children: [_jsxs(ControlsGroup, { children: [_jsx(UndoControl, { editor: editor }), _jsx(RedoControl, { editor: editor })] }), _jsxs(ControlsGroup, { children: [_jsx(BoldControl, { editor: editor }), _jsx(ItalicControl, { editor: editor }), _jsx(UnderlineControl, { editor: editor }), _jsx(StrikeThroughControl, { editor: editor })] }), _jsxs(ControlsGroup, { children: [_jsx(Heading1Control, { editor: editor }), _jsx(Heading2Control, { editor: editor }), _jsx(Heading3Control, { editor: editor }), _jsx(Heading4Control, { editor: editor })] }), _jsxs(ControlsGroup, { children: [_jsx(BulletListControl, { editor: editor }), _jsx(OrderedListControl, { editor: editor })] }), _jsxs(ControlsGroup, { children: [_jsx(AlignLeftControl, { editor: editor }), _jsx(AlignCenterControl, { editor: editor }), _jsx(AlignRightControl, { editor: editor }), _jsx(AlignJustifiedControl, { editor: editor })] })] }));
|
|
7
|
+
}) `
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 5px;
|
|
13
|
+
margin-bottom: 10px;
|
|
14
|
+
border-radius: 5px 5px 0 0;
|
|
15
|
+
border: 1px solid transparent;
|
|
16
|
+
`;
|
|
17
|
+
export default Toolbar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Toolbar";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Toolbar";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Checksum = "MD5" | "SHA-1" | "SHA-256";
|
|
2
|
+
export declare const Checksums: Record<any, Checksum>;
|
|
3
|
+
declare const calculateFileHash: (file: File) => Promise<{
|
|
4
|
+
md5Hash: string;
|
|
5
|
+
sha1Hash: string;
|
|
6
|
+
sha256Hash: string;
|
|
7
|
+
}>;
|
|
8
|
+
export default calculateFileHash;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import readFileAsBuffer from "./readFileAsBuffer";
|
|
11
|
+
export const Checksums = {
|
|
12
|
+
MD5: "MD5",
|
|
13
|
+
SHA1: "SHA-1",
|
|
14
|
+
SHA256: "SHA-256",
|
|
15
|
+
};
|
|
16
|
+
const hashData = (buffer, checksum) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
if (checksum === Checksums.MD5) {
|
|
18
|
+
const { default: SparkMD5 } = yield import("spark-md5");
|
|
19
|
+
const spark = new SparkMD5.ArrayBuffer();
|
|
20
|
+
spark.append(buffer);
|
|
21
|
+
return spark.end();
|
|
22
|
+
}
|
|
23
|
+
const crypto = window.crypto;
|
|
24
|
+
if (!crypto || !crypto.subtle) {
|
|
25
|
+
throw new Error("Web Crypto API not available");
|
|
26
|
+
}
|
|
27
|
+
const hash = yield crypto.subtle.digest(checksum, buffer);
|
|
28
|
+
const hashArray = Array.from(new Uint8Array(hash));
|
|
29
|
+
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
30
|
+
});
|
|
31
|
+
const calculateFileHash = (file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const buffer = yield readFileAsBuffer(file);
|
|
33
|
+
const md5Hash = yield hashData(buffer, Checksums.MD5);
|
|
34
|
+
const sha1Hash = yield hashData(buffer, Checksums.SHA1);
|
|
35
|
+
const sha256Hash = yield hashData(buffer, Checksums.SHA256);
|
|
36
|
+
return { md5Hash, sha1Hash, sha256Hash };
|
|
37
|
+
});
|
|
38
|
+
export default calculateFileHash;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const readFileAsBuffer = (file) => {
|
|
2
|
+
return new Promise((resolve) => {
|
|
3
|
+
const reader = new FileReader();
|
|
4
|
+
reader.addEventListener("load", () => {
|
|
5
|
+
resolve(reader.result);
|
|
6
|
+
});
|
|
7
|
+
reader.readAsArrayBuffer(file);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export default readFileAsBuffer;
|
package/dist/index.d.ts
CHANGED
|
@@ -24,3 +24,4 @@ export { default as Table } from "./Table";
|
|
|
24
24
|
export { Column } from "./Table";
|
|
25
25
|
export { default as MonolithUIProvider } from "./MonolithUIProvider";
|
|
26
26
|
export { useMonolithUITheme } from "./MonolithUIProvider";
|
|
27
|
+
export { default as RichTextEditor, Extensions, SlashCommands, } from "./RichTextEditor";
|
package/dist/index.js
CHANGED
|
@@ -24,3 +24,4 @@ export { default as Table } from "./Table";
|
|
|
24
24
|
export { Column } from "./Table";
|
|
25
25
|
export { default as MonolithUIProvider } from "./MonolithUIProvider";
|
|
26
26
|
export { useMonolithUITheme } from "./MonolithUIProvider";
|
|
27
|
+
export { default as RichTextEditor, Extensions, SlashCommands, } from "./RichTextEditor";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monolith-forensics/monolith-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.47",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Matt Danner (Monolith Forensics LLC)",
|
|
@@ -24,6 +24,21 @@
|
|
|
24
24
|
"@floating-ui/react": "^0.26.16",
|
|
25
25
|
"@radix-ui/react-switch": "^1.0.7",
|
|
26
26
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
27
|
+
"@tabler/icons-react": "^3.11.0",
|
|
28
|
+
"@tiptap/extension-focus": "^2.5.9",
|
|
29
|
+
"@tiptap/extension-horizontal-rule": "^2.5.9",
|
|
30
|
+
"@tiptap/extension-image": "^2.5.9",
|
|
31
|
+
"@tiptap/extension-placeholder": "^2.5.9",
|
|
32
|
+
"@tiptap/extension-table": "^2.5.8",
|
|
33
|
+
"@tiptap/extension-table-cell": "^2.5.8",
|
|
34
|
+
"@tiptap/extension-table-header": "^2.5.8",
|
|
35
|
+
"@tiptap/extension-table-row": "^2.5.8",
|
|
36
|
+
"@tiptap/extension-text-align": "^2.5.8",
|
|
37
|
+
"@tiptap/extension-underline": "^2.5.8",
|
|
38
|
+
"@tiptap/pm": "^2.5.8",
|
|
39
|
+
"@tiptap/react": "^2.5.8",
|
|
40
|
+
"@tiptap/starter-kit": "^2.5.8",
|
|
41
|
+
"@tiptap/suggestion": "^2.5.9",
|
|
27
42
|
"deepmerge": "^4.3.1",
|
|
28
43
|
"lucide-react": "^0.378.0",
|
|
29
44
|
"moment": "^2.29.1",
|
|
@@ -35,7 +50,9 @@
|
|
|
35
50
|
"react-virtualized-auto-sizer": "^1.0.24",
|
|
36
51
|
"react-window": "^1.8.10",
|
|
37
52
|
"short-uuid": "^5.2.0",
|
|
53
|
+
"spark-md5": "^3.0.2",
|
|
38
54
|
"styled-components": "^6.1.11",
|
|
55
|
+
"tippy.js": "^6.3.7",
|
|
39
56
|
"use-debounce": "^10.0.0"
|
|
40
57
|
},
|
|
41
58
|
"peerDependencies": {
|
|
@@ -44,6 +61,7 @@
|
|
|
44
61
|
"devDependencies": {
|
|
45
62
|
"@types/overlayscrollbars": "^1.12.5",
|
|
46
63
|
"@types/react-window": "^1.8.8",
|
|
64
|
+
"@types/spark-md5": "^3.0.4",
|
|
47
65
|
"typescript": "^5.5.4"
|
|
48
66
|
}
|
|
49
67
|
}
|