@lax-wp/editor 0.1.9 → 0.2.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.
Files changed (31) hide show
  1. package/dist/components/EditorSidebar.d.ts +7 -0
  2. package/dist/components/common/CropImageModal.d.ts +8 -0
  3. package/dist/components/common/FileUpload.d.ts +16 -0
  4. package/dist/components/common/SvgIcon.d.ts +2 -0
  5. package/dist/components/common/TabSwitch.d.ts +14 -0
  6. package/dist/components/redline/FloatingRedlineContainer.d.ts +1 -0
  7. package/dist/components/redline/RedlinePanel.d.ts +3 -1
  8. package/dist/components/shared/InsertLinkButton.d.ts +1 -4
  9. package/dist/components/sidebar/ExpandableSidebar.d.ts +16 -0
  10. package/dist/components/sidebar/content/AddElementContent.d.ts +4 -0
  11. package/dist/components/sidebar/content/ExportContent.d.ts +7 -0
  12. package/dist/components/sidebar/content/ImageContent.d.ts +15 -0
  13. package/dist/components/sidebar/content/SearchContent.d.ts +8 -0
  14. package/dist/components/sidebar/content/index.d.ts +4 -0
  15. package/dist/components/sidebar/content/page-sttings/PageSettings.d.ts +8 -0
  16. package/dist/components/sidebar/index.d.ts +2 -0
  17. package/dist/components/toolbar/Divider.d.ts +1 -1
  18. package/dist/components/toolbar/OverflowToolbar.d.ts +6 -0
  19. package/dist/components/toolbar/home/UndoRedoActions.d.ts +1 -0
  20. package/dist/components/toolbar/index.d.ts +0 -1
  21. package/dist/components/toolbar/page/PageBackgroundColorPicker.d.ts +0 -1
  22. package/dist/config/EditorConfig.d.ts +3 -2
  23. package/dist/constants/Heading.d.ts +15 -14
  24. package/dist/constants/Toolbar.d.ts +1 -24
  25. package/dist/contexts/ToolbarContext.d.ts +0 -6
  26. package/dist/extensions/CustomImageExtension.d.ts +3 -0
  27. package/dist/extensions/plugins/DragDropPlugin.d.ts +3 -0
  28. package/dist/hooks/useSearchAndReplace.d.ts +19 -0
  29. package/dist/index.es.js +10937 -10332
  30. package/dist/index.umd.js +86 -78
  31. package/package.json +2 -1
@@ -0,0 +1,7 @@
1
+ import type { TEditorMode } from "@/constants/Toolbar";
2
+ interface EditorSidebarProps {
3
+ position?: 'left' | 'right';
4
+ currentMode: TEditorMode;
5
+ }
6
+ export declare const EditorSidebar: ({ position, currentMode }: EditorSidebarProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ interface CropImageModalProps {
2
+ open: boolean;
3
+ imageUrl: string;
4
+ onApply: (croppedImage: string) => void;
5
+ onCancel: () => void;
6
+ }
7
+ export declare const CropImageModal: React.FC<CropImageModalProps>;
8
+ export default CropImageModal;
@@ -0,0 +1,16 @@
1
+ import { type FC } from 'react';
2
+ type FileUploadProps = {
3
+ getFile: (file: any, fileName?: string) => void;
4
+ description?: string;
5
+ errorMessage?: string;
6
+ disabled?: boolean;
7
+ defaultFile?: any;
8
+ acceptedFiles?: string;
9
+ isLoading?: boolean;
10
+ asBase64?: boolean;
11
+ multiple?: boolean;
12
+ onDelete?: () => void;
13
+ hideSelectedFile?: boolean;
14
+ };
15
+ export declare const FileUpload: FC<FileUploadProps>;
16
+ export default FileUpload;
@@ -8,6 +8,8 @@ interface SvgIconProps {
8
8
  className?: string;
9
9
  /** Stroke width */
10
10
  strokeWidth?: number;
11
+ /** Fill color */
12
+ fillColor?: string;
11
13
  /** Click handler */
12
14
  onClick?: () => void;
13
15
  }
@@ -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 +1,3 @@
1
- export declare const RedlinePanel: () => import("react/jsx-runtime").JSX.Element | null;
1
+ export declare const RedlinePanel: ({ showFullRedlineItem }: {
2
+ showFullRedlineItem: boolean;
3
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1 @@
1
- import { type TToolbarType } from "@/constants/Toolbar";
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,16 @@
1
+ export interface SidebarTool {
2
+ id: string;
3
+ icon: React.ReactNode;
4
+ label: string;
5
+ content?: React.ReactNode;
6
+ notVisible?: boolean;
7
+ }
8
+ export interface ExpandableSidebarProps {
9
+ tools: SidebarTool[];
10
+ position?: 'left' | 'right';
11
+ isExpanded?: boolean;
12
+ defaultActiveTool?: string | null;
13
+ expandedWidth?: number;
14
+ toggleToolbar?: (isExpanded: boolean) => void;
15
+ }
16
+ export declare const ExpandableSidebar: ({ tools, position, isExpanded, defaultActiveTool, expandedWidth, toggleToolbar, }: ExpandableSidebarProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export interface AddElementContentProps {
2
+ onClose?: () => void;
3
+ }
4
+ export declare const AddElementContent: ({ onClose }: AddElementContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export interface ExportContentProps {
2
+ onExport?: (options: {
3
+ fileType: string;
4
+ }) => void;
5
+ onClose?: () => void;
6
+ }
7
+ export declare const ExportContent: ({ onExport, onClose }: ExportContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ export interface ImageContentProps {
2
+ onInsert?: (imageData: ImageData) => void;
3
+ onBack?: () => void;
4
+ onClose?: () => void;
5
+ }
6
+ export interface ImageData {
7
+ url: string;
8
+ fileName: string;
9
+ fileSize: number;
10
+ alignment: 'left' | 'center' | 'right' | 'full';
11
+ borderWeight: number;
12
+ borderColor: string;
13
+ cornerRadius: number;
14
+ }
15
+ export declare const ImageContent: ({ onInsert, onBack, onClose }: ImageContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { TEditorMode } from "@/constants/Toolbar";
2
+ export interface SearchContentProps {
3
+ onSearch?: (query: string) => void;
4
+ onReplace?: (searchTerm: string, replaceTerm: string) => void;
5
+ onClose?: () => void;
6
+ currentMode: TEditorMode;
7
+ }
8
+ export declare const SearchContent: ({ onClose, currentMode }: SearchContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { ExportContent, type ExportContentProps } from './ExportContent';
2
+ export { SearchContent, type SearchContentProps } from './SearchContent';
3
+ export { AddElementContent, type AddElementContentProps } from './AddElementContent';
4
+ export { ImageContent, type ImageContentProps, type ImageData } from './ImageContent';
@@ -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 {};
@@ -0,0 +1,2 @@
1
+ export { ExpandableSidebar, type ExpandableSidebarProps, type SidebarTool } from './ExpandableSidebar';
2
+ export * from './content';
@@ -1 +1 @@
1
- export declare const Divider: () => import("react/jsx-runtime").JSX.Element | null;
1
+ export declare const Divider: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { type ReactNode } from "react";
2
+ interface OverflowToolbarProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare const OverflowToolbar: ({ children }: OverflowToolbarProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1 @@
1
+ export declare const UndoRedoActions: () => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  export * from "./Toolbar";
2
- export * from "./ProfessionalToolbar";
3
2
  export * from "./ClassicToolbar";
4
3
  export * from "./home";
5
4
  export * from "./ItemGroup";
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  interface PageBackgroundColorPickerProps {
3
- id: string;
4
3
  selectedBGColor: string;
5
4
  setSelectedBGColor: (color: string) => void;
6
5
  }
@@ -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: "1rem";
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: "0.9rem";
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: "0.8rem";
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: "0.75rem";
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.7rem";
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.65rem";
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.7rem";
40
- readonly lineHeight: "1";
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 ["Home", "Insert", "Table", "Page", "Export"];
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;
@@ -10,6 +10,9 @@ export interface CustomImageExtensionAttributes {
10
10
  title?: string;
11
11
  width?: number;
12
12
  align?: AlignType;
13
+ borderWeight?: number;
14
+ borderColor?: string;
15
+ cornerRadius?: number;
13
16
  }
14
17
  export declare const CustomImageExtension: import("@tiptap/core").Node<CustomImageExtensionOptions, any>;
15
18
  export default CustomImageExtension;
@@ -0,0 +1,3 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export declare const DragDropPlugin: Extension<any, any>;
3
+ export default DragDropPlugin;
@@ -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
+ };