@lax-wp/editor 0.1.8 → 0.2.0
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/components/EditorSidebar.d.ts +5 -0
- package/dist/components/common/SvgIcon.d.ts +2 -0
- package/dist/components/common/TabSwitch.d.ts +14 -0
- package/dist/components/redline/FloatingRedlineContainer.d.ts +1 -0
- package/dist/components/redline/RedlinePanel.d.ts +3 -1
- package/dist/components/shared/InsertLinkButton.d.ts +1 -4
- package/dist/components/sidebar/ExpandableSidebar.d.ts +15 -0
- package/dist/components/sidebar/content/AddElementContent.d.ts +8 -0
- package/dist/components/sidebar/content/ExportContent.d.ts +7 -0
- package/dist/components/sidebar/content/SearchContent.d.ts +6 -0
- package/dist/components/sidebar/content/index.d.ts +3 -0
- package/dist/components/sidebar/content/page-sttings/PageSettings.d.ts +8 -0
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/toolbar/Divider.d.ts +1 -1
- package/dist/components/toolbar/OverflowToolbar.d.ts +6 -0
- package/dist/components/toolbar/home/UndoRedoActions.d.ts +1 -0
- package/dist/components/toolbar/index.d.ts +0 -1
- package/dist/components/toolbar/page/PageBackgroundColorPicker.d.ts +0 -1
- package/dist/config/EditorConfig.d.ts +3 -2
- package/dist/constants/Heading.d.ts +15 -14
- package/dist/constants/Toolbar.d.ts +1 -24
- package/dist/contexts/ToolbarContext.d.ts +0 -6
- package/dist/hooks/useSearchAndReplace.d.ts +19 -0
- package/dist/index.es.js +11336 -10624
- package/dist/index.umd.js +92 -136
- package/package.json +1 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TabSwitchOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface TabSwitchProps {
|
|
8
|
+
options: TabSwitchOption[];
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const TabSwitch: React.FC<TabSwitchProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FloatingRedlineContainer: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const InsertLinkButton: ({ activeToolbarType }: {
|
|
3
|
-
activeToolbarType?: TToolbarType;
|
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const InsertLinkButton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface SidebarTool {
|
|
2
|
+
id: string;
|
|
3
|
+
icon: React.ReactNode;
|
|
4
|
+
label: string;
|
|
5
|
+
content?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface ExpandableSidebarProps {
|
|
8
|
+
tools: SidebarTool[];
|
|
9
|
+
position?: 'left' | 'right';
|
|
10
|
+
isExpanded?: boolean;
|
|
11
|
+
defaultActiveTool?: string | null;
|
|
12
|
+
expandedWidth?: number;
|
|
13
|
+
toggleToolbar?: (isExpanded: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const ExpandableSidebar: ({ tools, position, isExpanded, defaultActiveTool, expandedWidth, toggleToolbar, }: ExpandableSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface AddElementContentProps {
|
|
2
|
+
onAddImage?: () => void;
|
|
3
|
+
onAddTable?: () => void;
|
|
4
|
+
onAddCodeBlock?: () => void;
|
|
5
|
+
onAddDivider?: () => void;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const AddElementContent: ({ onAddImage, onAddTable, onAddCodeBlock, onAddDivider, onClose }: AddElementContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface SearchContentProps {
|
|
2
|
+
onSearch?: (query: string) => void;
|
|
3
|
+
onReplace?: (searchTerm: string, replaceTerm: string) => void;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const SearchContent: ({ onClose }: SearchContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type PageSize = 'A4' | 'A3' | 'Letter' | 'Legal' | 'Tabloid';
|
|
2
|
+
export type PageOrientation = 'portrait' | 'landscape';
|
|
3
|
+
interface PageSettingsProps {
|
|
4
|
+
onApply?: () => void;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const PageSettings: ({ onApply, onClose }: PageSettingsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Divider: () => import("react/jsx-runtime").JSX.Element
|
|
1
|
+
export declare const Divider: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UndoRedoActions: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Editor } from "@tiptap/react";
|
|
2
|
+
import { type TEditorMode } from "@/constants";
|
|
2
3
|
import type { InsertTableUsingDataProps } from "@/types/extensions/Table";
|
|
3
4
|
export interface AIAutocompletionConfig {
|
|
4
5
|
/** Enable/disable AI autocompletion */
|
|
@@ -11,6 +12,8 @@ export interface AIAutocompletionConfig {
|
|
|
11
12
|
fetchCompletion?: (text: string) => Promise<string>;
|
|
12
13
|
}
|
|
13
14
|
export interface EditorConfig {
|
|
15
|
+
/** Editor mode */
|
|
16
|
+
mode?: TEditorMode;
|
|
14
17
|
/** File name and id */
|
|
15
18
|
file?: {
|
|
16
19
|
name?: string;
|
|
@@ -24,8 +27,6 @@ export interface EditorConfig {
|
|
|
24
27
|
content?: string;
|
|
25
28
|
/** Enable/disable pagination */
|
|
26
29
|
enablePagination?: boolean;
|
|
27
|
-
/** Initial toolbar */
|
|
28
|
-
defaultToolbar?: string;
|
|
29
30
|
/** Calback debounce time for content change milliseconds */
|
|
30
31
|
debounceTimeForContentChange?: number;
|
|
31
32
|
/** AI Autocompletion configuration */
|
|
@@ -6,37 +6,38 @@ export declare const HEADING_OPTIONS: {
|
|
|
6
6
|
}[];
|
|
7
7
|
export declare const HEADING_STYLES: {
|
|
8
8
|
readonly h1: {
|
|
9
|
-
readonly fontSize: "
|
|
9
|
+
readonly fontSize: "1.5rem";
|
|
10
10
|
readonly fontWeight: "bold";
|
|
11
|
-
readonly lineHeight: "1";
|
|
11
|
+
readonly lineHeight: "1.2";
|
|
12
12
|
};
|
|
13
13
|
readonly h2: {
|
|
14
|
-
readonly fontSize: "
|
|
14
|
+
readonly fontSize: "1.25rem";
|
|
15
15
|
readonly fontWeight: "bold";
|
|
16
|
-
readonly lineHeight: "1";
|
|
16
|
+
readonly lineHeight: "1.2";
|
|
17
17
|
};
|
|
18
18
|
readonly h3: {
|
|
19
|
-
readonly fontSize: "
|
|
19
|
+
readonly fontSize: "1.1rem";
|
|
20
20
|
readonly fontWeight: "bold";
|
|
21
|
-
readonly lineHeight: "1";
|
|
21
|
+
readonly lineHeight: "1.2";
|
|
22
22
|
};
|
|
23
23
|
readonly h4: {
|
|
24
|
-
readonly fontSize: "
|
|
24
|
+
readonly fontSize: "1rem";
|
|
25
25
|
readonly fontWeight: "bold";
|
|
26
|
-
readonly lineHeight: "1";
|
|
26
|
+
readonly lineHeight: "1.2";
|
|
27
27
|
};
|
|
28
28
|
readonly h5: {
|
|
29
|
-
readonly fontSize: "0.
|
|
29
|
+
readonly fontSize: "0.875rem";
|
|
30
30
|
readonly fontWeight: "bold";
|
|
31
|
-
readonly lineHeight: "1";
|
|
31
|
+
readonly lineHeight: "1.2";
|
|
32
32
|
};
|
|
33
33
|
readonly h6: {
|
|
34
|
-
readonly fontSize: "0.
|
|
34
|
+
readonly fontSize: "0.75rem";
|
|
35
35
|
readonly fontWeight: "bold";
|
|
36
|
-
readonly lineHeight: "1";
|
|
36
|
+
readonly lineHeight: "1.2";
|
|
37
37
|
};
|
|
38
38
|
readonly paragraph: {
|
|
39
|
-
readonly fontSize: "0.
|
|
40
|
-
readonly
|
|
39
|
+
readonly fontSize: "0.875rem";
|
|
40
|
+
readonly fontWeight: "normal";
|
|
41
|
+
readonly lineHeight: "1.2";
|
|
41
42
|
};
|
|
42
43
|
};
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
export declare const TABS: readonly ["
|
|
1
|
+
export declare const TABS: readonly ["Text", "Table"];
|
|
2
2
|
export type TTabKey = (typeof TABS)[number];
|
|
3
|
-
export declare const TOOLBAR_TYPES_ENUM: {
|
|
4
|
-
CLASSIC: string;
|
|
5
|
-
PROFESSIONAL: string;
|
|
6
|
-
HIDE_TOOLBAR: string;
|
|
7
|
-
};
|
|
8
|
-
export type TToolbarType = (typeof TOOLBAR_TYPES_ENUM)[keyof typeof TOOLBAR_TYPES_ENUM];
|
|
9
|
-
export declare const TOOLBAR_TYPES: {
|
|
10
|
-
CLASSIC: {
|
|
11
|
-
name: string;
|
|
12
|
-
label: string;
|
|
13
|
-
height: number;
|
|
14
|
-
};
|
|
15
|
-
PROFESSIONAL: {
|
|
16
|
-
name: string;
|
|
17
|
-
label: string;
|
|
18
|
-
height: number;
|
|
19
|
-
};
|
|
20
|
-
NONE: {
|
|
21
|
-
name: string;
|
|
22
|
-
label: string;
|
|
23
|
-
height: number;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
3
|
export declare const EDITOR_MODE_ENUM: {
|
|
27
4
|
EDITING: string;
|
|
28
5
|
SUGGESTING: string;
|
|
@@ -3,12 +3,6 @@ import { type TEditorMode } from "@/constants/Toolbar";
|
|
|
3
3
|
import type { PageConfig } from "@/components/toolbar/page/PageSizeSelector";
|
|
4
4
|
import type { EditorConfig } from "@/config/EditorConfig";
|
|
5
5
|
export interface ToolbarContextType {
|
|
6
|
-
currentToolbar: string;
|
|
7
|
-
setCurrentToolbar: (toolbar: string) => void;
|
|
8
|
-
lastVisibleToolbar: string;
|
|
9
|
-
setLastVisibleToolbar: (toolbar: string) => void;
|
|
10
|
-
handleToolbarChange: (toolbarType: string) => void;
|
|
11
|
-
handleShowToolbar: () => void;
|
|
12
6
|
onPresentationModeToggle: () => void;
|
|
13
7
|
pageConfig: PageConfig;
|
|
14
8
|
setPageConfig: (config: PageConfig) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SearchMatch {
|
|
2
|
+
id: string;
|
|
3
|
+
from: number;
|
|
4
|
+
to: number;
|
|
5
|
+
text: string;
|
|
6
|
+
contextBefore: string;
|
|
7
|
+
contextAfter: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const useSearchAndReplace: () => {
|
|
10
|
+
searchQuery: string;
|
|
11
|
+
setSearchQuery: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
12
|
+
matches: SearchMatch[];
|
|
13
|
+
currentMatchIndex: number;
|
|
14
|
+
goToPrevious: () => void;
|
|
15
|
+
goToNext: () => void;
|
|
16
|
+
replaceCurrent: (replaceText: string) => void;
|
|
17
|
+
replaceAll: (replaceText: string) => void;
|
|
18
|
+
navigateToMatch: (index: number, matchList?: SearchMatch[], shouldFocus?: boolean) => void;
|
|
19
|
+
};
|