@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
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Button } from "../../../Button";
|
|
3
|
+
import { getControlSizeTokens } from "../../../core";
|
|
4
|
+
import FieldLabel from "../../../FieldLabel";
|
|
5
|
+
import { Popover } from "../../../Popover";
|
|
6
|
+
import { CORNER_BUTTON_SIZE, RAIL_THICKNESS } from "./TableTools.constants";
|
|
7
|
+
export const TableToolsPanel = styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 0.75rem;
|
|
11
|
+
min-width: 250px;
|
|
12
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
13
|
+
`;
|
|
14
|
+
export const TableToolsSection = styled.div `
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: 0.5rem;
|
|
18
|
+
`;
|
|
19
|
+
export const TableToolsSectionTitle = styled(FieldLabel) `
|
|
20
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
21
|
+
font-size: 0.6875rem;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
line-height: 1rem;
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
`;
|
|
26
|
+
export const InsertGrid = styled.div `
|
|
27
|
+
display: grid;
|
|
28
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
29
|
+
gap: 0.5rem;
|
|
30
|
+
`;
|
|
31
|
+
export const Field = styled.label `
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: 0.25rem;
|
|
35
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
36
|
+
font-size: 0.75rem;
|
|
37
|
+
line-height: 1rem;
|
|
38
|
+
`;
|
|
39
|
+
export const SwitchRow = styled.div `
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
gap: 0.75rem;
|
|
44
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
45
|
+
font-size: 0.75rem;
|
|
46
|
+
line-height: 1rem;
|
|
47
|
+
`;
|
|
48
|
+
export const RailRoot = styled.div `
|
|
49
|
+
display: flex;
|
|
50
|
+
position: fixed;
|
|
51
|
+
top: ${({ $rect }) => `${$rect.top}px`};
|
|
52
|
+
left: ${({ $rect }) => `${$rect.left}px`};
|
|
53
|
+
z-index: 1500;
|
|
54
|
+
width: ${({ $rect }) => `${$rect.width}px`};
|
|
55
|
+
height: ${({ $rect }) => `${$rect.height}px`};
|
|
56
|
+
|
|
57
|
+
top: ${({ $rect, $kind }) => $kind === "column" ? `${$rect.top + 5}px` : `${$rect.top}px`};
|
|
58
|
+
|
|
59
|
+
left: ${({ $rect, $kind }) => $kind === "row" ? `${$rect.left + 4}px` : `${$rect.left}px`};
|
|
60
|
+
|
|
61
|
+
button {
|
|
62
|
+
margin: auto;
|
|
63
|
+
width: 100%;
|
|
64
|
+
height: 100%;
|
|
65
|
+
|
|
66
|
+
width: ${({ $kind }) => $kind === "column" ? "30px" : RAIL_THICKNESS + "px"};
|
|
67
|
+
|
|
68
|
+
height: ${({ $kind }) => $kind === "row" ? "30px" : RAIL_THICKNESS + "px"};
|
|
69
|
+
|
|
70
|
+
min-height: 0;
|
|
71
|
+
padding: 0;
|
|
72
|
+
border-radius: 10px;
|
|
73
|
+
background-color: ${({ theme }) => theme.palette.background.paper};
|
|
74
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
75
|
+
|
|
76
|
+
&:hover {
|
|
77
|
+
background-color: ${({ theme }) => theme.palette.primary.main};
|
|
78
|
+
color: white;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
export const MenuPanel = styled.div `
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
min-width: 220px;
|
|
86
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
87
|
+
`;
|
|
88
|
+
export const MenuDropdown = styled(Popover.Dropdown) `
|
|
89
|
+
min-width: 180px;
|
|
90
|
+
border-radius: 5px;
|
|
91
|
+
border: 1px solid ${({ theme }) => theme.palette.divider};
|
|
92
|
+
background-color: ${({ theme }) => theme.palette.input.background};
|
|
93
|
+
box-shadow: none;
|
|
94
|
+
padding: 5px;
|
|
95
|
+
`;
|
|
96
|
+
export const MenuGroup = styled.div `
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
gap: 1px;
|
|
100
|
+
padding-top: ${({ $withDivider }) => ($withDivider ? "5px" : 0)};
|
|
101
|
+
margin-top: ${({ $withDivider }) => ($withDivider ? "5px" : 0)};
|
|
102
|
+
border-top: ${({ $withDivider, theme }) => $withDivider ? `1px solid ${theme.palette.divider}` : 0};
|
|
103
|
+
`;
|
|
104
|
+
export const MenuButton = styled(Button) `
|
|
105
|
+
min-width: 100%;
|
|
106
|
+
height: ${getControlSizeTokens("sm").menuRowHeight}px;
|
|
107
|
+
min-height: ${getControlSizeTokens("sm").menuRowHeight}px;
|
|
108
|
+
padding: 0 ${getControlSizeTokens("sm").menuItemPaddingX}px;
|
|
109
|
+
border: none;
|
|
110
|
+
border-radius: 3px;
|
|
111
|
+
color: ${({ $danger, theme }) => $danger ? theme.palette.error.main : theme.palette.text.primary};
|
|
112
|
+
font-weight: normal;
|
|
113
|
+
justify-content: flex-start;
|
|
114
|
+
width: 100%;
|
|
115
|
+
|
|
116
|
+
.button-label {
|
|
117
|
+
display: inline-block;
|
|
118
|
+
min-width: 0;
|
|
119
|
+
width: 100%;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
text-align: left;
|
|
122
|
+
text-overflow: ellipsis;
|
|
123
|
+
white-space: nowrap;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-position="left"] {
|
|
127
|
+
color: currentColor;
|
|
128
|
+
opacity: 0.8;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:hover {
|
|
132
|
+
background-color: ${({ theme }) => theme.palette.action.hover};
|
|
133
|
+
color: ${({ $danger, theme }) => $danger ? theme.palette.error.main : theme.palette.text.primary};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&:active {
|
|
137
|
+
translate: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&:focus {
|
|
141
|
+
text-decoration: none;
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
export const CornerRoot = styled.div `
|
|
145
|
+
display: flex;
|
|
146
|
+
position: fixed;
|
|
147
|
+
top: ${({ $top }) => `${$top}px`};
|
|
148
|
+
left: ${({ $left }) => `${$left}px`};
|
|
149
|
+
z-index: 1500;
|
|
150
|
+
width: ${CORNER_BUTTON_SIZE}px;
|
|
151
|
+
height: ${CORNER_BUTTON_SIZE}px;
|
|
152
|
+
|
|
153
|
+
button {
|
|
154
|
+
width: 100%;
|
|
155
|
+
height: 100%;
|
|
156
|
+
min-height: 0;
|
|
157
|
+
padding: 0;
|
|
158
|
+
border-radius: 6px;
|
|
159
|
+
background-color: ${({ theme }) => theme.palette.background.paper};
|
|
160
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
161
|
+
|
|
162
|
+
&:hover {
|
|
163
|
+
background-color: ${({ theme }) => theme.palette.primary.main};
|
|
164
|
+
color: white;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
2
|
+
import type { TableMap } from "@tiptap/pm/tables";
|
|
3
|
+
import type { Editor } from "@tiptap/react";
|
|
4
|
+
import type { MouseEvent as ReactMouseEvent, ReactNode } from "react";
|
|
5
|
+
export type TableInsertOptions = {
|
|
6
|
+
rows: number;
|
|
7
|
+
cols: number;
|
|
8
|
+
withHeaderRow: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type TableToolsContentProps = {
|
|
11
|
+
editor: Editor | null;
|
|
12
|
+
showInsert?: boolean;
|
|
13
|
+
onInsert?: () => void;
|
|
14
|
+
onAction?: () => void;
|
|
15
|
+
};
|
|
16
|
+
export type TableToolsPopoverProps = {
|
|
17
|
+
editor: Editor | null;
|
|
18
|
+
};
|
|
19
|
+
export type TableRailsProps = {
|
|
20
|
+
editor: Editor | null;
|
|
21
|
+
};
|
|
22
|
+
export type RailKind = "row" | "column";
|
|
23
|
+
export type OpenMenuKind = RailKind | "table";
|
|
24
|
+
export type Point = {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
};
|
|
28
|
+
export type RailRect = {
|
|
29
|
+
top: number;
|
|
30
|
+
left: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
};
|
|
34
|
+
export type TableContext = {
|
|
35
|
+
node: ProseMirrorNode;
|
|
36
|
+
pos: number;
|
|
37
|
+
start: number;
|
|
38
|
+
map: TableMap;
|
|
39
|
+
};
|
|
40
|
+
export type TableRailTarget = {
|
|
41
|
+
kind: RailKind;
|
|
42
|
+
rowIndex: number;
|
|
43
|
+
colIndex: number;
|
|
44
|
+
tableElement: HTMLTableElement;
|
|
45
|
+
tableRect: RailRect;
|
|
46
|
+
tableContext: TableContext;
|
|
47
|
+
rowRect: RailRect;
|
|
48
|
+
columnRect: RailRect;
|
|
49
|
+
};
|
|
50
|
+
export type RailTarget = TableRailTarget;
|
|
51
|
+
export type TableToolAction = {
|
|
52
|
+
label: string;
|
|
53
|
+
leftSection: ReactNode;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
danger?: boolean;
|
|
56
|
+
onClick: () => void;
|
|
57
|
+
};
|
|
58
|
+
export type TableToolActionGroup = {
|
|
59
|
+
label: string;
|
|
60
|
+
actions: TableToolAction[];
|
|
61
|
+
};
|
|
62
|
+
export type RailAction = TableToolAction;
|
|
63
|
+
export type RailActionGroup = TableToolActionGroup;
|
|
64
|
+
export type TableCornerMenuProps = {
|
|
65
|
+
editor: Editor | null;
|
|
66
|
+
target: TableRailTarget;
|
|
67
|
+
opened: boolean;
|
|
68
|
+
onOpen: () => void;
|
|
69
|
+
onClose: () => void;
|
|
70
|
+
onAction: () => void;
|
|
71
|
+
onMouseEnter: () => void;
|
|
72
|
+
onMouseLeave: () => void;
|
|
73
|
+
onMouseDown: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
74
|
+
};
|
|
75
|
+
export type TableAction = TableToolAction;
|
|
76
|
+
export type TableActionGroup = TableToolActionGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Table2Icon } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Button } from "../../../Button";
|
|
5
|
+
import { Popover } from "../../../Popover";
|
|
6
|
+
import { hasTableExtension, isTableActive } from "./TableTools.selectors";
|
|
7
|
+
import { TableToolsContent } from "./TableInsertControls";
|
|
8
|
+
export const TableToolsPopover = ({ editor }) => {
|
|
9
|
+
const [opened, setOpened] = useState(false);
|
|
10
|
+
const selected = opened || isTableActive(editor);
|
|
11
|
+
return (_jsxs(Popover, { opened: opened, onChange: setOpened, position: "bottom", width: 285, trapFocus: true, children: [_jsx(Popover.Target, { children: _jsx(Button, { size: "xs", variant: "outlined", title: "Table", "aria-label": "Table", selected: selected, disabled: !hasTableExtension(editor), style: { padding: "1px 6px" }, children: _jsx(Table2Icon, { size: 14 }) }) }), _jsx(Popover.Dropdown, { children: _jsx(TableToolsContent, { editor: editor, showInsert: true, onInsert: () => setOpened(false) }) })] }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from "./TableTools";
|
|
2
|
+
export { hasTableExtension, isTableActive } from "./TableTools.selectors";
|
|
3
|
+
export type { OpenMenuKind, Point, RailAction, RailActionGroup, RailKind, RailRect, RailTarget, TableAction, TableActionGroup, TableContext, TableCornerMenuProps, TableInsertOptions, TableRailTarget, TableRailsProps, TableToolAction, TableToolActionGroup, TableToolsContentProps, TableToolsPopoverProps, } from "./TableTools.types";
|
|
@@ -5,6 +5,9 @@ export declare enum Controls {
|
|
|
5
5
|
ITALIC = "italic",
|
|
6
6
|
UNDERLINE = "underline",
|
|
7
7
|
STRIKE = "strike",
|
|
8
|
+
CLEAR_FORMATTING = "clearFormatting",
|
|
9
|
+
CODE = "code",
|
|
10
|
+
CODE_BLOCK = "codeBlock",
|
|
8
11
|
HEADING_1 = "heading_1",
|
|
9
12
|
HEADING_2 = "heading_2",
|
|
10
13
|
HEADING_3 = "heading_3",
|
|
@@ -16,5 +19,8 @@ export declare enum Controls {
|
|
|
16
19
|
TEXT_ALIGN_RIGHT = "textAlignRight",
|
|
17
20
|
TEXT_ALIGN_JUSTIFIED = "textAlignJustified",
|
|
18
21
|
FONT = "font",
|
|
19
|
-
COLOR = "color"
|
|
22
|
+
COLOR = "color",
|
|
23
|
+
HIGHLIGHT = "highlight",
|
|
24
|
+
LINK = "link",
|
|
25
|
+
TABLE = "table"
|
|
20
26
|
}
|
|
@@ -6,6 +6,9 @@ export var Controls;
|
|
|
6
6
|
Controls["ITALIC"] = "italic";
|
|
7
7
|
Controls["UNDERLINE"] = "underline";
|
|
8
8
|
Controls["STRIKE"] = "strike";
|
|
9
|
+
Controls["CLEAR_FORMATTING"] = "clearFormatting";
|
|
10
|
+
Controls["CODE"] = "code";
|
|
11
|
+
Controls["CODE_BLOCK"] = "codeBlock";
|
|
9
12
|
Controls["HEADING_1"] = "heading_1";
|
|
10
13
|
Controls["HEADING_2"] = "heading_2";
|
|
11
14
|
Controls["HEADING_3"] = "heading_3";
|
|
@@ -18,4 +21,7 @@ export var Controls;
|
|
|
18
21
|
Controls["TEXT_ALIGN_JUSTIFIED"] = "textAlignJustified";
|
|
19
22
|
Controls["FONT"] = "font";
|
|
20
23
|
Controls["COLOR"] = "color";
|
|
24
|
+
Controls["HIGHLIGHT"] = "highlight";
|
|
25
|
+
Controls["LINK"] = "link";
|
|
26
|
+
Controls["TABLE"] = "table";
|
|
21
27
|
})(Controls || (Controls = {}));
|
|
@@ -4,7 +4,11 @@ export declare enum Extensions {
|
|
|
4
4
|
Underline = "underline",
|
|
5
5
|
Bold = "bold",
|
|
6
6
|
Italic = "italic",
|
|
7
|
+
Code = "code",
|
|
8
|
+
CodeBlock = "codeBlock",
|
|
7
9
|
Color = "color",
|
|
10
|
+
Highlight = "highlight",
|
|
11
|
+
Link = "link",
|
|
8
12
|
TextStyle = "textStyle",
|
|
9
13
|
Strike = "strike",
|
|
10
14
|
BulletList = "bulletList",
|
|
@@ -5,7 +5,11 @@ export var Extensions;
|
|
|
5
5
|
Extensions["Underline"] = "underline";
|
|
6
6
|
Extensions["Bold"] = "bold";
|
|
7
7
|
Extensions["Italic"] = "italic";
|
|
8
|
+
Extensions["Code"] = "code";
|
|
9
|
+
Extensions["CodeBlock"] = "codeBlock";
|
|
8
10
|
Extensions["Color"] = "color";
|
|
11
|
+
Extensions["Highlight"] = "highlight";
|
|
12
|
+
Extensions["Link"] = "link";
|
|
9
13
|
Extensions["TextStyle"] = "textStyle";
|
|
10
14
|
Extensions["Strike"] = "strike";
|
|
11
15
|
Extensions["BulletList"] = "bulletList";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare enum HighlightColors {
|
|
2
|
+
Yellow = "rgba(250, 204, 21, 0.38)",
|
|
3
|
+
Green = "rgba(34, 197, 94, 0.34)",
|
|
4
|
+
Blue = "rgba(59, 130, 246, 0.34)",
|
|
5
|
+
Pink = "rgba(236, 72, 153, 0.32)",
|
|
6
|
+
Purple = "rgba(168, 85, 247, 0.34)",
|
|
7
|
+
Orange = "rgba(249, 115, 22, 0.34)"
|
|
8
|
+
}
|
|
9
|
+
export default HighlightColors;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var HighlightColors;
|
|
2
|
+
(function (HighlightColors) {
|
|
3
|
+
HighlightColors["Yellow"] = "rgba(250, 204, 21, 0.38)";
|
|
4
|
+
HighlightColors["Green"] = "rgba(34, 197, 94, 0.34)";
|
|
5
|
+
HighlightColors["Blue"] = "rgba(59, 130, 246, 0.34)";
|
|
6
|
+
HighlightColors["Pink"] = "rgba(236, 72, 153, 0.32)";
|
|
7
|
+
HighlightColors["Purple"] = "rgba(168, 85, 247, 0.34)";
|
|
8
|
+
HighlightColors["Orange"] = "rgba(249, 115, 22, 0.34)";
|
|
9
|
+
})(HighlightColors || (HighlightColors = {}));
|
|
10
|
+
export default HighlightColors;
|
|
@@ -6,7 +6,10 @@ export declare enum SlashCommands {
|
|
|
6
6
|
Heading4 = "Heading 4",
|
|
7
7
|
BulletList = "Bullet List",
|
|
8
8
|
NumberedList = "Numbered List",
|
|
9
|
+
Code = "Code",
|
|
10
|
+
CodeBlock = "Code Block",
|
|
9
11
|
CurrentDate = "Current Date",
|
|
10
12
|
CurrentTimestamp = "Current Timestamp",
|
|
11
|
-
Image = "Image"
|
|
13
|
+
Image = "Image",
|
|
14
|
+
Table = "Table"
|
|
12
15
|
}
|
|
@@ -7,7 +7,10 @@ export var SlashCommands;
|
|
|
7
7
|
SlashCommands["Heading4"] = "Heading 4";
|
|
8
8
|
SlashCommands["BulletList"] = "Bullet List";
|
|
9
9
|
SlashCommands["NumberedList"] = "Numbered List";
|
|
10
|
+
SlashCommands["Code"] = "Code";
|
|
11
|
+
SlashCommands["CodeBlock"] = "Code Block";
|
|
10
12
|
SlashCommands["CurrentDate"] = "Current Date";
|
|
11
13
|
SlashCommands["CurrentTimestamp"] = "Current Timestamp";
|
|
12
14
|
SlashCommands["Image"] = "Image";
|
|
15
|
+
SlashCommands["Table"] = "Table";
|
|
13
16
|
})(SlashCommands || (SlashCommands = {}));
|
|
@@ -62,7 +62,6 @@ const CommandDescription = styled.div `
|
|
|
62
62
|
color: ${({ theme }) => theme.palette.text.secondary};
|
|
63
63
|
text-overflow: ellipsis;
|
|
64
64
|
overflow: hidden;
|
|
65
|
-
white-space: nowrap;
|
|
66
65
|
`;
|
|
67
66
|
const updateScrollView = (container, item) => {
|
|
68
67
|
const containerHeight = container.offsetHeight;
|
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import { Extension, Editor } from "@tiptap/core";
|
|
2
3
|
import { HandleImageUpload } from "../Plugins/UploadImagesPlugin.js";
|
|
3
4
|
import { SlashCommands } from "../Enums";
|
|
4
|
-
type
|
|
5
|
+
export type SlashCommandRange = {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
};
|
|
9
|
+
export type SlashCommandActionProps = {
|
|
10
|
+
editor: Editor;
|
|
11
|
+
range: SlashCommandRange;
|
|
12
|
+
};
|
|
13
|
+
export type CustomSlashCommand = {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
searchTerms?: string[];
|
|
18
|
+
icon?: ComponentType<{
|
|
19
|
+
size?: number;
|
|
20
|
+
}>;
|
|
21
|
+
command: (props: SlashCommandActionProps) => void;
|
|
22
|
+
};
|
|
5
23
|
interface SlashCommandOptions {
|
|
6
24
|
handleImageUpload?: HandleImageUpload;
|
|
7
|
-
commands?:
|
|
25
|
+
commands?: SlashCommands[];
|
|
26
|
+
customCommands?: CustomSlashCommand[];
|
|
27
|
+
getCustomCommands?: () => CustomSlashCommand[];
|
|
8
28
|
}
|
|
9
29
|
declare const getSlashCommand: (options?: SlashCommandOptions) => Extension;
|
|
10
30
|
export default getSlashCommand;
|
|
@@ -11,22 +11,23 @@ import { Extension } from "@tiptap/core";
|
|
|
11
11
|
import Suggestion from "@tiptap/suggestion";
|
|
12
12
|
import { ReactRenderer } from "@tiptap/react";
|
|
13
13
|
import tippy from "tippy.js";
|
|
14
|
-
import { Heading1, Heading2, Heading3, Heading4, List, ListOrdered, Text, Image as ImageIcon, Calendar, ClockIcon, } from "lucide-react";
|
|
14
|
+
import { Heading1, Heading2, Heading3, Heading4, List, ListOrdered, Text, Image as ImageIcon, Calendar, CodeIcon, ClockIcon, SquareCodeIcon, Table2Icon, } from "lucide-react";
|
|
15
15
|
import { startImageUpload, } from "../Plugins/UploadImagesPlugin.js";
|
|
16
16
|
import { PluginKey } from "@tiptap/pm/state";
|
|
17
17
|
import SlashCommandList from "./SlashCommandList";
|
|
18
18
|
import { SlashCommands } from "../Enums";
|
|
19
19
|
import moment from "moment/moment.js";
|
|
20
|
+
import { DEFAULT_CODE_BLOCK_LANGUAGE } from "../Utils/codeBlockUtils";
|
|
20
21
|
const SlashCommandPluginKey = new PluginKey("slash-command");
|
|
21
22
|
const getCommandItems = (values, options) => {
|
|
22
|
-
var _a;
|
|
23
|
+
var _a, _b;
|
|
23
24
|
if ((_a = options === null || options === void 0 ? void 0 : options.commands) === null || _a === void 0 ? void 0 : _a.includes(SlashCommands.Image)) {
|
|
24
25
|
// Assert that options.handleImageUpload is defined
|
|
25
26
|
if (!options.handleImageUpload) {
|
|
26
27
|
throw new Error("options.handleImageUpload is required when using the Image command.");
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
const builtInItems = [
|
|
30
31
|
{
|
|
31
32
|
title: SlashCommands.Text,
|
|
32
33
|
description: "Just start typing with plain text.",
|
|
@@ -115,6 +116,29 @@ const getCommandItems = (values, options) => {
|
|
|
115
116
|
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
116
117
|
},
|
|
117
118
|
},
|
|
119
|
+
{
|
|
120
|
+
title: SlashCommands.Code,
|
|
121
|
+
description: "Start typing inline code.",
|
|
122
|
+
searchTerms: ["inline", "monospace"],
|
|
123
|
+
icon: CodeIcon,
|
|
124
|
+
command: ({ editor, range }) => {
|
|
125
|
+
editor.chain().focus().deleteRange(range).setCode().run();
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
title: SlashCommands.CodeBlock,
|
|
130
|
+
description: "Create a syntax-highlighted code block.",
|
|
131
|
+
searchTerms: ["code", "pre", "snippet"],
|
|
132
|
+
icon: SquareCodeIcon,
|
|
133
|
+
command: ({ editor, range }) => {
|
|
134
|
+
editor
|
|
135
|
+
.chain()
|
|
136
|
+
.focus()
|
|
137
|
+
.deleteRange(range)
|
|
138
|
+
.setCodeBlock({ language: DEFAULT_CODE_BLOCK_LANGUAGE })
|
|
139
|
+
.run();
|
|
140
|
+
},
|
|
141
|
+
},
|
|
118
142
|
{
|
|
119
143
|
title: SlashCommands.CurrentDate,
|
|
120
144
|
description: "Insert the current date.",
|
|
@@ -170,14 +194,36 @@ const getCommandItems = (values, options) => {
|
|
|
170
194
|
input.click();
|
|
171
195
|
},
|
|
172
196
|
},
|
|
173
|
-
|
|
174
|
-
|
|
197
|
+
{
|
|
198
|
+
title: SlashCommands.Table,
|
|
199
|
+
description: "Insert a 3 by 3 table.",
|
|
200
|
+
searchTerms: ["grid", "rows", "columns"],
|
|
201
|
+
icon: Table2Icon,
|
|
202
|
+
command: ({ editor, range }) => {
|
|
203
|
+
editor
|
|
204
|
+
.chain()
|
|
205
|
+
.focus()
|
|
206
|
+
.deleteRange(range)
|
|
207
|
+
.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
208
|
+
.run();
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
].filter((item) => {
|
|
175
212
|
if (options === null || options === void 0 ? void 0 : options.commands) {
|
|
176
213
|
return options.commands.includes(item.title);
|
|
177
214
|
}
|
|
178
215
|
return true;
|
|
179
|
-
})
|
|
180
|
-
|
|
216
|
+
});
|
|
217
|
+
const customItems = (((_b = options === null || options === void 0 ? void 0 : options.getCustomCommands) === null || _b === void 0 ? void 0 : _b.call(options)) ||
|
|
218
|
+
(options === null || options === void 0 ? void 0 : options.customCommands) ||
|
|
219
|
+
[]).map((command) => ({
|
|
220
|
+
title: command.title,
|
|
221
|
+
description: command.description || "",
|
|
222
|
+
searchTerms: command.searchTerms,
|
|
223
|
+
icon: command.icon || Text,
|
|
224
|
+
command: command.command,
|
|
225
|
+
}));
|
|
226
|
+
return [...builtInItems, ...customItems].filter((item) => {
|
|
181
227
|
var _a, _b;
|
|
182
228
|
if (typeof (values === null || values === void 0 ? void 0 : values.query) === "string" && ((_a = values === null || values === void 0 ? void 0 : values.query) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
183
229
|
const search = (_b = values === null || values === void 0 ? void 0 : values.query) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { Extension } from "@tiptap/core";
|
|
2
2
|
import { HandleImageUpload } from "../Plugins";
|
|
3
|
-
import {
|
|
3
|
+
import type { CustomSlashCommand } from "./getSlashCommand";
|
|
4
|
+
import { Extensions, SlashCommands } from "../Enums";
|
|
5
|
+
export type ExtensionPreset = "minimal" | "basic" | "full";
|
|
4
6
|
export type ExtensionType = (typeof Extensions)[keyof typeof Extensions];
|
|
7
|
+
export declare const BASIC_EXTENSIONS: ExtensionType[];
|
|
8
|
+
export declare const MINIMAL_EXTENSIONS: ExtensionType[];
|
|
9
|
+
export declare const FULL_EXTENSIONS: ExtensionType[];
|
|
10
|
+
export declare const resolveExtensions: ({ disabledExtensions, extensionPreset, extensions, }: {
|
|
11
|
+
disabledExtensions?: ExtensionType[];
|
|
12
|
+
extensionPreset?: ExtensionPreset;
|
|
13
|
+
extensions?: ExtensionType[];
|
|
14
|
+
}) => ExtensionType[];
|
|
5
15
|
interface GetTipTapExtensionsProps {
|
|
16
|
+
disabledExtensions?: ExtensionType[];
|
|
6
17
|
extensions?: ExtensionType[];
|
|
7
|
-
slashCommands?:
|
|
18
|
+
slashCommands?: SlashCommands[];
|
|
19
|
+
customSlashCommands?: CustomSlashCommand[];
|
|
20
|
+
getCustomSlashCommands?: () => CustomSlashCommand[];
|
|
8
21
|
handleImageUpload?: HandleImageUpload;
|
|
9
22
|
}
|
|
10
23
|
declare const getTipTapExtensions: (props: GetTipTapExtensionsProps) => Extension[];
|