@monolith-forensics/monolith-ui 1.9.1-dev.9 → 1.9.3-dev.1
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/Charts/BarChart/BarChart.js +28 -14
- package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
- package/dist/Charts/BarChart/BarChart.styled.js +5 -1
- package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
- package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
- package/dist/Charts/ChartUtils/chartSizing.js +83 -0
- package/dist/Charts/ChartUtils/index.d.ts +1 -0
- package/dist/Charts/ChartUtils/index.js +1 -0
- package/dist/Charts/HeatMap/HeatMap.js +28 -7
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
- package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
- package/dist/Charts/LineChart/LineChart.js +34 -15
- package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
- package/dist/Charts/LineChart/LineChart.styled.js +5 -1
- package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
- package/dist/Charts/PieChart/PieChart.js +48 -33
- package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
- package/dist/Charts/PieChart/PieChart.styled.js +6 -1
- package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
- package/dist/DropDownMenu/components/MenuItemList.js +32 -12
- package/dist/DropDownMenu/components/StyledContent.js +1 -1
- package/dist/DropDownMenu/components/StyledInnerItemContainer.js +1 -0
- package/dist/FieldLabel/FieldLabel.js +3 -18
- package/dist/FileViewer/FileViewer.js +32 -8
- package/dist/FileViewer/viewers/ImageViewer.d.ts +1 -0
- package/dist/FileViewer/viewers/ImageViewer.js +36 -15
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +23 -0
- package/dist/RichTextEditor/Components/BubbleMenu.d.ts +3 -3
- package/dist/RichTextEditor/Components/BubbleMenu.js +190 -51
- package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
- package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
- package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
- package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
- package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
- package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
- package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
- package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
- package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
- package/dist/RichTextEditor/Enums/Controls.d.ts +7 -1
- package/dist/RichTextEditor/Enums/Controls.js +6 -0
- package/dist/RichTextEditor/Enums/Extensions.d.ts +4 -0
- package/dist/RichTextEditor/Enums/Extensions.js +4 -0
- package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
- package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
- package/dist/RichTextEditor/Enums/SlashCommands.d.ts +4 -1
- package/dist/RichTextEditor/Enums/SlashCommands.js +3 -0
- package/dist/RichTextEditor/Extensions/SlashCommandList.js +0 -1
- package/dist/RichTextEditor/Extensions/getSlashCommand.d.ts +23 -3
- package/dist/RichTextEditor/Extensions/getSlashCommand.js +53 -7
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.d.ts +15 -2
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +159 -24
- package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
- package/dist/RichTextEditor/RichTextEditor.d.ts +9 -4
- package/dist/RichTextEditor/RichTextEditor.js +352 -14
- package/dist/RichTextEditor/Toolbar/Control.d.ts +6 -2
- package/dist/RichTextEditor/Toolbar/Control.js +13 -6
- package/dist/RichTextEditor/Toolbar/Controls.d.ts +6 -0
- package/dist/RichTextEditor/Toolbar/Controls.js +118 -1
- package/dist/RichTextEditor/Toolbar/ControlsGroup.js +17 -6
- package/dist/RichTextEditor/Toolbar/Labels.d.ts +1 -0
- package/dist/RichTextEditor/Toolbar/Labels.js +1 -0
- package/dist/RichTextEditor/Toolbar/Toolbar.d.ts +1 -2
- package/dist/RichTextEditor/Toolbar/Toolbar.js +32 -67
- package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
- package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
- package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
- package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
- package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
- package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
- package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
- package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
- package/dist/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/SegmentedControl/SegmentedControl.styles.d.ts +1 -0
- package/dist/SegmentedControl/SegmentedControl.styles.js +30 -14
- package/dist/SegmentedControl/SegmentedControl.utils.d.ts +1 -0
- package/dist/SegmentedControl/SegmentedControl.utils.js +5 -2
- package/dist/Table/Table.js +4 -3
- package/dist/Table/TableComponents.d.ts +3 -0
- package/dist/Table/TableComponents.js +47 -0
- package/dist/Table/TableHeader.js +1 -1
- package/dist/Table/TableMenu/TableMenu.js +4 -3
- package/dist/Table/TableProvider.js +39 -0
- package/dist/Table/TableRow.js +1 -1
- package/dist/Table/types.d.ts +6 -0
- package/dist/Utilities/getImageTextContent.d.ts +78 -0
- package/dist/Utilities/getImageTextContent.js +222 -0
- package/dist/core/controlSizes.js +9 -9
- package/dist/theme/variants.js +46 -0
- package/package.json +8 -1
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import TiptapImage from "@tiptap/extension-image";
|
|
2
2
|
import StarterKit from "@tiptap/starter-kit";
|
|
3
|
+
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
3
4
|
import HorizontalRule from "@tiptap/extension-horizontal-rule";
|
|
4
5
|
import TextAlign from "@tiptap/extension-text-align";
|
|
5
6
|
import { Table, TableCell, TableHeader, TableRow, } from "@tiptap/extension-table";
|
|
6
7
|
import { Focus, Placeholder } from "@tiptap/extensions";
|
|
7
8
|
import { Color } from "@tiptap/extension-color";
|
|
9
|
+
import { Highlight } from "@tiptap/extension-highlight";
|
|
10
|
+
import { Link } from "@tiptap/extension-link";
|
|
8
11
|
import { TextStyle } from "@tiptap/extension-text-style";
|
|
9
12
|
import { InputRule, Extension } from "@tiptap/core";
|
|
13
|
+
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
14
|
+
import { common, createLowlight } from "lowlight";
|
|
10
15
|
import { ImageActionsPlugin, UploadImagesPlugin, } from "../Plugins";
|
|
11
16
|
import getSlashCommand from "./getSlashCommand";
|
|
12
17
|
import { Extensions } from "../Enums";
|
|
18
|
+
import { LINK_REL, LINK_TARGET, normalizeLinkUrl } from "../Utils/linkUtils";
|
|
19
|
+
import CodeBlockNodeView from "../Components/CodeBlockNodeView";
|
|
20
|
+
import { DEFAULT_CODE_BLOCK_LANGUAGE } from "../Utils/codeBlockUtils";
|
|
21
|
+
import { TABLE_CELL_MIN_WIDTH } from "../Utils/tableUtils";
|
|
22
|
+
const lowlight = createLowlight(common);
|
|
23
|
+
const CustomCodeBlockLowlight = CodeBlockLowlight.extend({
|
|
24
|
+
addAttributes() {
|
|
25
|
+
var _a;
|
|
26
|
+
return Object.assign(Object.assign({}, (_a = this.parent) === null || _a === void 0 ? void 0 : _a.call(this)), { wrap: {
|
|
27
|
+
default: false,
|
|
28
|
+
parseHTML: (element) => element.getAttribute("data-wrap") === "true",
|
|
29
|
+
renderHTML: (attributes) => attributes.wrap ? { "data-wrap": "true" } : {},
|
|
30
|
+
} });
|
|
31
|
+
},
|
|
32
|
+
addNodeView() {
|
|
33
|
+
return ReactNodeViewRenderer(CodeBlockNodeView);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
13
36
|
const CustomImage = TiptapImage.extend({
|
|
14
37
|
// Add data-uuid attribute to image
|
|
15
38
|
addAttributes() {
|
|
@@ -41,27 +64,107 @@ const CustomStorage = Extension.create({
|
|
|
41
64
|
};
|
|
42
65
|
},
|
|
43
66
|
});
|
|
44
|
-
const
|
|
67
|
+
export const BASIC_EXTENSIONS = [
|
|
68
|
+
Extensions.Bold,
|
|
69
|
+
Extensions.Italic,
|
|
70
|
+
Extensions.Underline,
|
|
71
|
+
Extensions.Strike,
|
|
72
|
+
Extensions.Code,
|
|
73
|
+
Extensions.BulletList,
|
|
74
|
+
Extensions.OrderedList,
|
|
75
|
+
Extensions.TextStyle,
|
|
76
|
+
Extensions.Color,
|
|
77
|
+
Extensions.Highlight,
|
|
78
|
+
Extensions.Link,
|
|
79
|
+
Extensions.TextAlign,
|
|
80
|
+
Extensions.Focus,
|
|
81
|
+
Extensions.CustomStorage,
|
|
82
|
+
];
|
|
83
|
+
export const MINIMAL_EXTENSIONS = [
|
|
84
|
+
Extensions.Focus,
|
|
85
|
+
Extensions.CustomStorage,
|
|
86
|
+
];
|
|
87
|
+
export const FULL_EXTENSIONS = [
|
|
88
|
+
...BASIC_EXTENSIONS,
|
|
89
|
+
Extensions.CodeBlock,
|
|
90
|
+
Extensions.HorizontalRule,
|
|
91
|
+
Extensions.Table,
|
|
92
|
+
Extensions.TableCell,
|
|
93
|
+
Extensions.TableHeader,
|
|
94
|
+
Extensions.TableRow,
|
|
95
|
+
Extensions.Placeholder,
|
|
96
|
+
Extensions.SlashCommand,
|
|
97
|
+
Extensions.BubbleMenu,
|
|
98
|
+
];
|
|
99
|
+
const EXTENSION_PRESETS = {
|
|
100
|
+
minimal: MINIMAL_EXTENSIONS,
|
|
101
|
+
basic: BASIC_EXTENSIONS,
|
|
102
|
+
full: FULL_EXTENSIONS,
|
|
103
|
+
};
|
|
104
|
+
export const resolveExtensions = ({ disabledExtensions = [], extensionPreset = "basic", extensions = [], }) => {
|
|
105
|
+
const disabled = new Set(disabledExtensions);
|
|
106
|
+
const resolved = new Set([
|
|
107
|
+
...(EXTENSION_PRESETS[extensionPreset] || BASIC_EXTENSIONS),
|
|
108
|
+
...extensions,
|
|
109
|
+
]);
|
|
110
|
+
if (resolved.has(Extensions.Color)) {
|
|
111
|
+
resolved.add(Extensions.TextStyle);
|
|
112
|
+
}
|
|
113
|
+
if (resolved.has(Extensions.Table)) {
|
|
114
|
+
resolved.add(Extensions.TableRow);
|
|
115
|
+
resolved.add(Extensions.TableCell);
|
|
116
|
+
resolved.add(Extensions.TableHeader);
|
|
117
|
+
}
|
|
118
|
+
disabled.forEach((extension) => resolved.delete(extension));
|
|
119
|
+
return Array.from(resolved);
|
|
120
|
+
};
|
|
121
|
+
const getTipTapExtensions = ({ disabledExtensions = [], extensions = [], slashCommands = [], customSlashCommands = [], getCustomSlashCommands, handleImageUpload, }) => {
|
|
122
|
+
const disabled = new Set(disabledExtensions);
|
|
123
|
+
const enabled = new Set(extensions);
|
|
124
|
+
const isEnabled = (extension) => enabled.has(extension) && !disabled.has(extension);
|
|
45
125
|
return [
|
|
46
126
|
{
|
|
47
127
|
name: "starterKit",
|
|
48
|
-
category: "default",
|
|
49
128
|
extension: StarterKit.configure({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
129
|
+
bold: isEnabled(Extensions.Bold) ? {} : false,
|
|
130
|
+
italic: isEnabled(Extensions.Italic) ? {} : false,
|
|
131
|
+
underline: isEnabled(Extensions.Underline) ? {} : false,
|
|
132
|
+
strike: isEnabled(Extensions.Strike) ? {} : false,
|
|
133
|
+
bulletList: isEnabled(Extensions.BulletList)
|
|
134
|
+
? {
|
|
135
|
+
HTMLAttributes: {
|
|
136
|
+
class: "",
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
: false,
|
|
140
|
+
orderedList: isEnabled(Extensions.OrderedList)
|
|
141
|
+
? {
|
|
142
|
+
HTMLAttributes: {
|
|
143
|
+
class: "",
|
|
144
|
+
},
|
|
145
|
+
}
|
|
146
|
+
: false,
|
|
147
|
+
listItem: isEnabled(Extensions.BulletList) ||
|
|
148
|
+
isEnabled(Extensions.OrderedList)
|
|
149
|
+
? {
|
|
150
|
+
HTMLAttributes: {
|
|
151
|
+
class: "",
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
: false,
|
|
155
|
+
listKeymap: isEnabled(Extensions.BulletList) ||
|
|
156
|
+
isEnabled(Extensions.OrderedList)
|
|
157
|
+
? {}
|
|
158
|
+
: false,
|
|
159
|
+
link: false,
|
|
160
|
+
code: isEnabled(Extensions.Code)
|
|
161
|
+
? {
|
|
162
|
+
HTMLAttributes: {
|
|
163
|
+
class: "editor-inline-code",
|
|
164
|
+
},
|
|
165
|
+
}
|
|
166
|
+
: false,
|
|
167
|
+
codeBlock: false,
|
|
65
168
|
horizontalRule: false,
|
|
66
169
|
dropcursor: {
|
|
67
170
|
color: "#DBEAFE",
|
|
@@ -70,24 +173,53 @@ const getTipTapExtensions = ({ extensions = [], slashCommands = [], handleImageU
|
|
|
70
173
|
gapcursor: false,
|
|
71
174
|
}),
|
|
72
175
|
},
|
|
176
|
+
{
|
|
177
|
+
name: Extensions.CodeBlock,
|
|
178
|
+
extension: CustomCodeBlockLowlight.configure({
|
|
179
|
+
lowlight,
|
|
180
|
+
defaultLanguage: DEFAULT_CODE_BLOCK_LANGUAGE,
|
|
181
|
+
enableTabIndentation: true,
|
|
182
|
+
HTMLAttributes: {
|
|
183
|
+
class: "editor-code-block",
|
|
184
|
+
},
|
|
185
|
+
}),
|
|
186
|
+
},
|
|
73
187
|
{
|
|
74
188
|
name: Extensions.TextStyle,
|
|
75
|
-
category: "default",
|
|
76
189
|
extension: TextStyle,
|
|
77
190
|
},
|
|
78
191
|
{
|
|
79
192
|
name: Extensions.Color,
|
|
80
|
-
category: "default",
|
|
81
193
|
extension: Color,
|
|
82
194
|
},
|
|
195
|
+
{
|
|
196
|
+
name: Extensions.Highlight,
|
|
197
|
+
extension: Highlight.configure({ multicolor: true }),
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: Extensions.Link,
|
|
201
|
+
extension: Link.configure({
|
|
202
|
+
autolink: true,
|
|
203
|
+
linkOnPaste: true,
|
|
204
|
+
openOnClick: false,
|
|
205
|
+
enableClickSelection: false,
|
|
206
|
+
defaultProtocol: "https",
|
|
207
|
+
protocols: ["http", "https"],
|
|
208
|
+
isAllowedUri: (url) => normalizeLinkUrl(url).isValid,
|
|
209
|
+
shouldAutoLink: (url) => normalizeLinkUrl(url).isValid,
|
|
210
|
+
HTMLAttributes: {
|
|
211
|
+
class: "editor-link",
|
|
212
|
+
target: LINK_TARGET,
|
|
213
|
+
rel: LINK_REL,
|
|
214
|
+
},
|
|
215
|
+
}),
|
|
216
|
+
},
|
|
83
217
|
{
|
|
84
218
|
name: Extensions.TextAlign,
|
|
85
|
-
category: "default",
|
|
86
219
|
extension: TextAlign.configure({ types: ["heading", "paragraph"] }),
|
|
87
220
|
},
|
|
88
221
|
{
|
|
89
222
|
name: Extensions.Focus,
|
|
90
|
-
category: "default",
|
|
91
223
|
extension: Focus.configure({ className: "has-focus", mode: "all" }),
|
|
92
224
|
},
|
|
93
225
|
// patch to fix horizontal rule bug: https://github.com/ueberdosis/tiptap/pull/3859#issuecomment-1536799740
|
|
@@ -114,6 +246,7 @@ const getTipTapExtensions = ({ extensions = [], slashCommands = [], handleImageU
|
|
|
114
246
|
name: Extensions.Table,
|
|
115
247
|
extension: Table.configure({
|
|
116
248
|
resizable: true,
|
|
249
|
+
cellMinWidth: TABLE_CELL_MIN_WIDTH,
|
|
117
250
|
}),
|
|
118
251
|
},
|
|
119
252
|
{
|
|
@@ -158,20 +291,22 @@ const getTipTapExtensions = ({ extensions = [], slashCommands = [], handleImageU
|
|
|
158
291
|
},
|
|
159
292
|
{
|
|
160
293
|
name: Extensions.CustomStorage,
|
|
161
|
-
category: "default",
|
|
162
294
|
extension: CustomStorage,
|
|
163
295
|
},
|
|
164
296
|
{
|
|
165
297
|
name: Extensions.SlashCommand,
|
|
166
298
|
extension: getSlashCommand({
|
|
167
299
|
commands: slashCommands,
|
|
300
|
+
customCommands: customSlashCommands,
|
|
301
|
+
getCustomCommands: getCustomSlashCommands,
|
|
168
302
|
handleImageUpload,
|
|
169
303
|
}),
|
|
170
304
|
},
|
|
171
305
|
]
|
|
172
306
|
.filter((ext) => {
|
|
173
|
-
|
|
174
|
-
|
|
307
|
+
if (ext.name === "starterKit")
|
|
308
|
+
return true;
|
|
309
|
+
return isEnabled(ext.name);
|
|
175
310
|
})
|
|
176
311
|
.map((ext) => ext.extension);
|
|
177
312
|
};
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
11
11
|
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
12
12
|
import { ReactRenderer } from "@tiptap/react";
|
|
13
13
|
import { CopyIcon, DownloadIcon, FullscreenIcon } from "lucide-react";
|
|
14
|
-
import styled from "styled-components";
|
|
14
|
+
import styled, { useTheme } from "styled-components";
|
|
15
15
|
import { Button } from "../../Button";
|
|
16
16
|
import { FileViewer } from "../../FileViewer";
|
|
17
17
|
import { useState } from "react";
|
|
@@ -19,10 +19,6 @@ const imageActionsKey = new PluginKey("image-actions");
|
|
|
19
19
|
const ImageActionsMenuRoot = styled.div `
|
|
20
20
|
display: flex;
|
|
21
21
|
gap: 4px;
|
|
22
|
-
padding: 4px;
|
|
23
|
-
border-radius: 5px;
|
|
24
|
-
|
|
25
|
-
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
|
|
26
22
|
|
|
27
23
|
button {
|
|
28
24
|
width: 24px;
|
|
@@ -30,16 +26,17 @@ const ImageActionsMenuRoot = styled.div `
|
|
|
30
26
|
}
|
|
31
27
|
`;
|
|
32
28
|
const ImageActionsMenu = ({ onCopy, onDownload, getFile, onMouseEnter, onMouseLeave, }) => {
|
|
29
|
+
const theme = useTheme();
|
|
33
30
|
const [viewerFile, setViewerFile] = useState(null);
|
|
34
31
|
const keepEditorFocus = (event) => {
|
|
35
32
|
event.preventDefault();
|
|
36
33
|
};
|
|
37
|
-
return (_jsxs(_Fragment, { children: [_jsxs(ImageActionsMenuRoot, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [_jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Copy image", title: "Copy image", onMouseDown: keepEditorFocus, onClick: onCopy, children: _jsx(CopyIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Download image", title: "Download image", onMouseDown: keepEditorFocus, onClick: onDownload, children: _jsx(DownloadIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "View image fullscreen", title: "View image fullscreen", onMouseDown: keepEditorFocus, onClick: () => {
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsxs(ImageActionsMenuRoot, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [_jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Copy image", title: "Copy image", onMouseDown: keepEditorFocus, onClick: onCopy, style: { backgroundColor: theme.palette.background.paper }, children: _jsx(CopyIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Download image", title: "Download image", onMouseDown: keepEditorFocus, onClick: onDownload, style: { backgroundColor: theme.palette.background.paper }, children: _jsx(DownloadIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "View image fullscreen", title: "View image fullscreen", onMouseDown: keepEditorFocus, onClick: () => {
|
|
38
35
|
const file = getFile();
|
|
39
36
|
if (file) {
|
|
40
37
|
setViewerFile(file);
|
|
41
38
|
}
|
|
42
|
-
}, children: _jsx(FullscreenIcon, { size: 14 }) })] }), _jsx(FileViewer, { file: viewerFile || undefined, open: Boolean(viewerFile), onClose: () => setViewerFile(null) })] }));
|
|
39
|
+
}, style: { backgroundColor: theme.palette.background.paper }, children: _jsx(FullscreenIcon, { size: 14 }) })] }), _jsx(FileViewer, { file: viewerFile || undefined, open: Boolean(viewerFile), onClose: () => setViewerFile(null) })] }));
|
|
43
40
|
};
|
|
44
41
|
const getImageFilename = (image) => {
|
|
45
42
|
var _a, _b;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/react";
|
|
2
|
-
import { ExtensionType } from "./Extensions/getTiptapExtensions";
|
|
2
|
+
import { ExtensionPreset, ExtensionType } from "./Extensions/getTiptapExtensions";
|
|
3
|
+
import type { CustomSlashCommand } from "./Extensions/getSlashCommand";
|
|
4
|
+
import { SlashCommands } from "./Enums";
|
|
3
5
|
import { HandleImageUrlUpload, HandleImageUpload } from "./Plugins/UploadImagesPlugin";
|
|
4
6
|
import { BubbleMenuOptions } from "./Components/BubbleMenu";
|
|
5
7
|
import { ToolbarOptions } from "./Toolbar/Toolbar";
|
|
6
|
-
type RichTextEditorProps = {
|
|
8
|
+
export type RichTextEditorProps = {
|
|
7
9
|
className?: string;
|
|
8
10
|
editorInstanceRef?: React.RefObject<Editor | null>;
|
|
9
11
|
extensions?: ExtensionType[];
|
|
10
|
-
|
|
12
|
+
disabledExtensions?: ExtensionType[];
|
|
13
|
+
extensionPreset?: ExtensionPreset;
|
|
14
|
+
slashCommands?: SlashCommands[];
|
|
15
|
+
customSlashCommands?: CustomSlashCommand[];
|
|
11
16
|
defaultValue?: string;
|
|
12
17
|
value?: string;
|
|
13
18
|
readOnly?: boolean;
|
|
@@ -23,5 +28,5 @@ type RichTextEditorProps = {
|
|
|
23
28
|
autoFocus?: boolean;
|
|
24
29
|
style?: React.CSSProperties;
|
|
25
30
|
};
|
|
31
|
+
export type { CustomSlashCommand, SlashCommandActionProps, SlashCommandRange, } from "./Extensions/getSlashCommand";
|
|
26
32
|
export declare const RichTextEditor: React.FC<RichTextEditorProps>;
|
|
27
|
-
export {};
|