@tnd028/strapi-plugin-tiptap-editor 0.0.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/README.md +3 -0
- package/dist/_chunks/Alignment-B0f2-LO0.js +135 -0
- package/dist/_chunks/Alignment-qMOzO-n2.mjs +133 -0
- package/dist/_chunks/Blockquote-9wBGDz3L.mjs +34 -0
- package/dist/_chunks/Blockquote-DeGUfK27.js +36 -0
- package/dist/_chunks/Bold-C-0g6Ayd.mjs +46 -0
- package/dist/_chunks/Bold-ClnPsPHt.js +48 -0
- package/dist/_chunks/ColorAndHighlight-BMmtoSpj.js +217 -0
- package/dist/_chunks/ColorAndHighlight-t1Ui5tcL.mjs +215 -0
- package/dist/_chunks/Emoji-Bm1_vSh5.mjs +263 -0
- package/dist/_chunks/Emoji-C-LQZ4Z3.js +265 -0
- package/dist/_chunks/Heading-BDJqd1Qw.js +125 -0
- package/dist/_chunks/Heading-BycRob5M.mjs +123 -0
- package/dist/_chunks/HorizontalRule-CJlDmdma.js +34 -0
- package/dist/_chunks/HorizontalRule-CzQCeC3b.mjs +32 -0
- package/dist/_chunks/Iframe-DCBWSb0v.mjs +165 -0
- package/dist/_chunks/Iframe-Dyn_2cMB.js +167 -0
- package/dist/_chunks/ImagePlaceholder-C14kojd5.js +71 -0
- package/dist/_chunks/ImagePlaceholder-DtrSuhf_.mjs +69 -0
- package/dist/_chunks/Italic-BfpKX0KX.mjs +34 -0
- package/dist/_chunks/Italic-DdhVL78v.js +36 -0
- package/dist/_chunks/Link-BuYDqSqo.js +61 -0
- package/dist/_chunks/Link-DUV5Ybep.mjs +59 -0
- package/dist/_chunks/Lists-BKopoFR6.js +107 -0
- package/dist/_chunks/Lists-DsKxj3MD.mjs +105 -0
- package/dist/_chunks/Redo-1mEX1yOd.js +35 -0
- package/dist/_chunks/Redo-Ca3VQxSe.mjs +33 -0
- package/dist/_chunks/SearchAndReplace-DmU5DlWv.mjs +347 -0
- package/dist/_chunks/SearchAndReplace-DzNdbTWJ.js +349 -0
- package/dist/_chunks/Strikethrough-BygxCHak.mjs +121 -0
- package/dist/_chunks/Strikethrough-DQfR4OFk.js +123 -0
- package/dist/_chunks/Table-BhbZ2Blv.mjs +123 -0
- package/dist/_chunks/Table-DLaqBAbz.js +125 -0
- package/dist/_chunks/TiptapEditorInput-BDE09h5-.mjs +6802 -0
- package/dist/_chunks/TiptapEditorInput-vfLsCt1p.js +6854 -0
- package/dist/_chunks/Undo-BuT4OkoE.js +32 -0
- package/dist/_chunks/Undo-PL5n4axf.mjs +30 -0
- package/dist/_chunks/en-B4KWt_jN.js +4 -0
- package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
- package/dist/_chunks/index-ku90UbIF.mjs +1397 -0
- package/dist/_chunks/index-wYDv8vsJ.js +1398 -0
- package/dist/admin/index.js +6 -0
- package/dist/admin/index.mjs +6 -0
- package/dist/admin/src/components/ContentEditorInput.d.ts +10 -0
- package/dist/admin/src/components/GlobalStyling.d.ts +4 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/MediaLibraryModal.d.ts +27 -0
- package/dist/admin/src/components/PluginIcon.d.ts +2 -0
- package/dist/admin/src/components/TextEditorInput.d.ts +10 -0
- package/dist/admin/src/components/TiptapEditorInput.d.ts +6 -0
- package/dist/admin/src/components/editor/BaseEditor.d.ts +22 -0
- package/dist/admin/src/components/editor/ContentEditor.d.ts +10 -0
- package/dist/admin/src/components/editor/TextEditor.d.ts +10 -0
- package/dist/admin/src/components/editor/extensions/Heading.d.ts +2 -0
- package/dist/admin/src/components/editor/extensions/Iframe.d.ts +24 -0
- package/dist/admin/src/components/editor/extensions/Image.d.ts +3 -0
- package/dist/admin/src/components/editor/extensions/ImagePlaceholder.d.ts +15 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentEditPopover.d.ts +1 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentExtension.d.ts +3 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentInsertPopover.d.ts +13 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentRenderer.d.ts +1 -0
- package/dist/admin/src/components/editor/extensions/custom-component/Store.d.ts +20 -0
- package/dist/admin/src/components/editor/extensions/custom-component/types.d.ts +33 -0
- package/dist/admin/src/components/editor/extensions/fileHandler.d.ts +12 -0
- package/dist/admin/src/components/editor/extensions/link.d.ts +1 -0
- package/dist/admin/src/components/editor/extensions/noNewLine.d.ts +2 -0
- package/dist/admin/src/components/editor/extensions/resetMarksOnEnter.d.ts +2 -0
- package/dist/admin/src/components/editor/extensions/searchAndReplace.d.ts +53 -0
- package/dist/admin/src/components/editor/partials/EditorProvider.d.ts +13 -0
- package/dist/admin/src/components/editor/partials/LinkBubbleMenu.d.ts +5 -0
- package/dist/admin/src/components/editor/partials/LinkEditBlock.d.ts +9 -0
- package/dist/admin/src/components/editor/partials/LinkPopoverBlock.d.ts +8 -0
- package/dist/admin/src/components/editor/partials/ToolbarButton.d.ts +11 -0
- package/dist/admin/src/components/editor/partials/ToolbarButtons.d.ts +25 -0
- package/dist/admin/src/components/editor/toolbars/Alignment.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/Blockquote.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Bold.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/BulletList.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/ColorAndHighlight.d.ts +5 -0
- package/dist/admin/src/components/editor/toolbars/Emoji.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Heading.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/HorizontalRule.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Iframe.d.ts +3 -0
- package/dist/admin/src/components/editor/toolbars/ImagePlaceholder.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Italic.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Link.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Lists.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/OrderedList.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Redo.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/SearchAndReplace.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/Strikethrough.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Table.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/Undo.d.ts +4 -0
- package/dist/admin/src/components/editor/useEditor.d.ts +18 -0
- package/dist/admin/src/components/editor/utils.d.ts +28 -0
- package/dist/admin/src/components/ui/button.d.ts +9 -0
- package/dist/admin/src/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/admin/src/components/ui/input.d.ts +6 -0
- package/dist/admin/src/components/ui/label.d.ts +7 -0
- package/dist/admin/src/components/ui/separator.d.ts +7 -0
- package/dist/admin/src/components/ui/toggle.d.ts +17 -0
- package/dist/admin/src/components/ui/tooltip.d.ts +7 -0
- package/dist/admin/src/config/index.d.ts +2 -0
- package/dist/admin/src/config/pluginConfig.d.ts +20 -0
- package/dist/admin/src/config/types.d.ts +109 -0
- package/dist/admin/src/errorSlicer.d.ts +4 -0
- package/dist/admin/src/exports.d.ts +4 -0
- package/dist/admin/src/hooks/useDebounceCallback.d.ts +9 -0
- package/dist/admin/src/index.d.ts +25 -0
- package/dist/admin/src/pluginId.d.ts +5 -0
- package/dist/admin/src/theme/additional.d.ts +1 -0
- package/dist/admin/src/theme/colorScheme.d.ts +2 -0
- package/dist/admin/src/theme/colors.d.ts +1 -0
- package/dist/admin/src/theme/common.d.ts +1 -0
- package/dist/admin/src/theme/index.d.ts +2 -0
- package/dist/admin/src/types.d.ts +15 -0
- package/dist/admin/src/utils/dom.d.ts +7 -0
- package/dist/admin/src/utils/getTranslation.d.ts +7 -0
- package/dist/admin/src/utils/isImageResponsive.d.ts +8 -0
- package/dist/admin/src/utils/localStorage.d.ts +21 -0
- package/dist/admin/src/utils/prefixWithBackendUrl.d.ts +6 -0
- package/dist/admin/src/utils/utils.d.ts +7 -0
- package/dist/server/index.js +15 -0
- package/dist/server/index.mjs +16 -0
- package/dist/server/src/index.d.ts +7 -0
- package/package.json +116 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const index = require("../_chunks/index-wYDv8vsJ.js");
|
|
4
|
+
exports.default = index.index;
|
|
5
|
+
exports.defaultTheme = index.clonedDefaultTheme;
|
|
6
|
+
exports.setPluginConfig = index.setPluginConfig;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TiptapJSONInputProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Tiptap Editor custom field input (Content/Full Version).
|
|
5
|
+
* Renders the full-featured editor with all toolbars and extensions.
|
|
6
|
+
*/
|
|
7
|
+
declare const ContentEditorInput: React.NamedExoticComponent<TiptapJSONInputProps & React.RefAttributes<{
|
|
8
|
+
focus: () => void;
|
|
9
|
+
}>>;
|
|
10
|
+
export default ContentEditorInput;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Represents a media file from the Strapi Media Library.
|
|
4
|
+
*/
|
|
5
|
+
export interface MediaFile {
|
|
6
|
+
id: number;
|
|
7
|
+
url: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
caption: string;
|
|
10
|
+
name: string;
|
|
11
|
+
mime: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
formats?: any;
|
|
15
|
+
}
|
|
16
|
+
interface MediaLibraryModalProps {
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
onSelect: (file: MediaFile) => void;
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Modal component for selecting assets from the Strapi Media Library.
|
|
24
|
+
* Uses Strapi's internal MediaLib component.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MediaLibraryModal: import("react").MemoExoticComponent<({ isOpen, onClose, onSelect, multiple }: MediaLibraryModalProps) => import("react").ReactPortal | null>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TiptapJSONInputProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Tiptap Editor custom field input (Text/Simple Version).
|
|
5
|
+
* Renders a simplified editor with basic toolbars.
|
|
6
|
+
*/
|
|
7
|
+
declare const TextEditorInput: React.NamedExoticComponent<TiptapJSONInputProps & React.RefAttributes<{
|
|
8
|
+
focus: () => void;
|
|
9
|
+
}>>;
|
|
10
|
+
export default TextEditorInput;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type Content, Editor } from "@tiptap/react";
|
|
3
|
+
import { type UseEditorOptions } from "./useEditor";
|
|
4
|
+
/**
|
|
5
|
+
* Props for the BaseEditor component.
|
|
6
|
+
* Extends useEditor options but excludes some internal handlers.
|
|
7
|
+
*/
|
|
8
|
+
export interface BaseEditorProps extends Omit<UseEditorOptions, "onUpdate" | "editable"> {
|
|
9
|
+
/** Callback fired when editor content changes */
|
|
10
|
+
onChange?: (value: Content) => void;
|
|
11
|
+
/** Toolbar component to render above the editor */
|
|
12
|
+
toolbar?: React.ReactNode;
|
|
13
|
+
/** Additional class names for the container */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Whether the editor is disabled (read-only) */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Base Editor component that sets up the Tiptap editor instance,
|
|
20
|
+
* providers, and layout.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BaseEditor: import("react").ForwardRefExoticComponent<BaseEditorProps & import("react").RefAttributes<Editor | null>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ToolbarButtonsType } from "./partials/ToolbarButtons";
|
|
2
|
+
import { type BaseEditorProps } from "./BaseEditor";
|
|
3
|
+
export type ContentEditorProps = BaseEditorProps & {
|
|
4
|
+
toolbars?: ToolbarButtonsType[];
|
|
5
|
+
};
|
|
6
|
+
declare function ContentEditor({ toolbars, extensions, ...restProps }: ContentEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare namespace ContentEditor {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
export { ContentEditor };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ToolbarButtonsType } from "./partials/ToolbarButtons";
|
|
2
|
+
import { type BaseEditorProps } from "./BaseEditor";
|
|
3
|
+
export type TextEditorProps = BaseEditorProps & {
|
|
4
|
+
toolbars?: ToolbarButtonsType[];
|
|
5
|
+
};
|
|
6
|
+
declare function TextEditor({ toolbars, ...restProps }: TextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare namespace TextEditor {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
export { TextEditor };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
export interface IframeOptions {
|
|
3
|
+
allowFullscreen: boolean;
|
|
4
|
+
HTMLAttributes: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
declare module "@tiptap/core" {
|
|
9
|
+
interface Commands<ReturnType> {
|
|
10
|
+
iframe: {
|
|
11
|
+
/**
|
|
12
|
+
* Add an iframe
|
|
13
|
+
*/
|
|
14
|
+
setIframe: (options: {
|
|
15
|
+
src: string;
|
|
16
|
+
width?: string | number;
|
|
17
|
+
height?: string | number;
|
|
18
|
+
allowfullscreen?: boolean;
|
|
19
|
+
frameborder?: number;
|
|
20
|
+
}) => ReturnType;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export declare const Iframe: Node<IframeOptions, any>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NodeViewProps } from "@tiptap/core";
|
|
2
|
+
export declare const ImageExtension: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
|
|
3
|
+
export declare function TiptapImageComponent(props: NodeViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NodeViewProps } from "@tiptap/core";
|
|
2
|
+
import { Node } from "@tiptap/react";
|
|
3
|
+
export interface ImagePlaceholderOptions {
|
|
4
|
+
HTMLAttributes: Record<string, any>;
|
|
5
|
+
onEmbed: (url: string, editor: any) => void;
|
|
6
|
+
}
|
|
7
|
+
declare module "@tiptap/core" {
|
|
8
|
+
interface Commands<ReturnType> {
|
|
9
|
+
imagePlaceholder: {
|
|
10
|
+
insertImagePlaceholder: () => ReturnType;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const ImagePlaceholder: Node<ImagePlaceholderOptions, any>;
|
|
15
|
+
export declare function ImagePlaceholderComponent(props: NodeViewProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentEditPopover.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CustomComponentEditPopover: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ItemType {
|
|
3
|
+
type: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
}
|
|
8
|
+
interface Props {
|
|
9
|
+
items: ItemType[];
|
|
10
|
+
command: (props: any) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const CustomComponentInsertPopover: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<unknown>>;
|
|
13
|
+
export {};
|
package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentRenderer.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CustomComponentRenderer: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/core";
|
|
2
|
+
import { CustomComponentAttributes } from "./types";
|
|
3
|
+
interface EditState {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
editor: Editor | null;
|
|
6
|
+
pos: number | null;
|
|
7
|
+
attrs: CustomComponentAttributes | null;
|
|
8
|
+
provider: string | null;
|
|
9
|
+
contextName: string | null;
|
|
10
|
+
}
|
|
11
|
+
interface EditContextValue extends EditState {
|
|
12
|
+
open: (editor: Editor, pos: number, attrs: CustomComponentAttributes, provider?: string, contextName?: string) => void;
|
|
13
|
+
close: () => void;
|
|
14
|
+
update: (newAttrs: Partial<CustomComponentAttributes>) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const CustomComponentProvider: ({ children, }: {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const useCustomComponentEdit: () => EditContextValue;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type CustomComponentType = 'customButton' | 'customRelatedItem' | 'customEntity';
|
|
2
|
+
export interface CustomEntityAttributes {
|
|
3
|
+
entity_name: string;
|
|
4
|
+
entity_id: string;
|
|
5
|
+
custom_attrs: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export interface CustomButtonItem {
|
|
8
|
+
title: string;
|
|
9
|
+
url: string;
|
|
10
|
+
variant: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
11
|
+
size: 'small' | 'medium' | 'large';
|
|
12
|
+
arrow: 'none' | 'left' | 'right';
|
|
13
|
+
attributes: Record<string, string>;
|
|
14
|
+
class: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CustomButtonAttributes {
|
|
17
|
+
buttons: CustomButtonItem[];
|
|
18
|
+
align: 'left' | 'center' | 'right';
|
|
19
|
+
fullWidth: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface CustomRelatedPostAttributes {
|
|
22
|
+
label: string;
|
|
23
|
+
itemId: string;
|
|
24
|
+
layout: 'list' | 'grid';
|
|
25
|
+
maxItems: number;
|
|
26
|
+
}
|
|
27
|
+
export type CustomComponentAttributes = ({
|
|
28
|
+
type: 'customButton';
|
|
29
|
+
} & CustomButtonAttributes) | ({
|
|
30
|
+
type: 'customRelatedItem';
|
|
31
|
+
} & CustomRelatedPostAttributes) | ({
|
|
32
|
+
type: 'customEntity';
|
|
33
|
+
} & CustomEntityAttributes);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Editor, Extension } from "@tiptap/core";
|
|
2
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
3
|
+
import { FileError, FileValidationOptions } from "../utils";
|
|
4
|
+
type FileHandlePluginOptions = {
|
|
5
|
+
key?: PluginKey;
|
|
6
|
+
editor: Editor;
|
|
7
|
+
onPaste?: (editor: Editor, files: File[], pasteContent?: string) => void;
|
|
8
|
+
onDrop?: (editor: Editor, files: File[], pos: number) => void;
|
|
9
|
+
onValidationError?: (errors: FileError[]) => void;
|
|
10
|
+
} & FileValidationOptions;
|
|
11
|
+
export declare const FileHandler: Extension<Omit<FileHandlePluginOptions, "key" | "editor">, any>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Link: import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Extension, type Range } from "@tiptap/core";
|
|
2
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
3
|
+
declare module "@tiptap/core" {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
search: {
|
|
6
|
+
/**
|
|
7
|
+
* @description Set search term in extension.
|
|
8
|
+
*/
|
|
9
|
+
setSearchTerm: (searchTerm: string) => ReturnType;
|
|
10
|
+
/**
|
|
11
|
+
* @description Set replace term in extension.
|
|
12
|
+
*/
|
|
13
|
+
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
14
|
+
/**
|
|
15
|
+
* @description Replace first instance of search result with given replace term.
|
|
16
|
+
*/
|
|
17
|
+
replace: () => ReturnType;
|
|
18
|
+
/**
|
|
19
|
+
* @description Replace all instances of search result with given replace term.
|
|
20
|
+
*/
|
|
21
|
+
replaceAll: () => ReturnType;
|
|
22
|
+
/**
|
|
23
|
+
* @description Select the next search result.
|
|
24
|
+
*/
|
|
25
|
+
selectNextResult: () => ReturnType;
|
|
26
|
+
/**
|
|
27
|
+
* @description Select the previous search result.
|
|
28
|
+
*/
|
|
29
|
+
selectPreviousResult: () => ReturnType;
|
|
30
|
+
/**
|
|
31
|
+
* @description Set case sensitivity in extension.
|
|
32
|
+
*/
|
|
33
|
+
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export declare const searchAndReplacePluginKey: PluginKey<any>;
|
|
38
|
+
export interface SearchAndReplaceOptions {
|
|
39
|
+
searchResultClass: string;
|
|
40
|
+
selectedResultClass: string;
|
|
41
|
+
disableRegex: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface SearchAndReplaceStorage {
|
|
44
|
+
searchTerm: string;
|
|
45
|
+
replaceTerm: string;
|
|
46
|
+
results: Range[];
|
|
47
|
+
lastSearchTerm: string;
|
|
48
|
+
selectedResult: number;
|
|
49
|
+
lastSelectedResult: number;
|
|
50
|
+
caseSensitive: boolean;
|
|
51
|
+
lastCaseSensitiveState: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare const SearchAndReplace: Extension<SearchAndReplaceOptions, SearchAndReplaceStorage>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Editor } from "@tiptap/react";
|
|
3
|
+
export interface EditorContextProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
}
|
|
6
|
+
export declare const EditorContext: import("react").Context<EditorContextProps | null>;
|
|
7
|
+
interface EditorProviderProps {
|
|
8
|
+
editor: Editor;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const EditorProvider: ({ editor, children }: EditorProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const useEditorContext: () => EditorContextProps;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface LinkEditorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
defaultUrl?: string;
|
|
4
|
+
defaultText?: string;
|
|
5
|
+
defaultIsNewTab?: boolean;
|
|
6
|
+
onSave: (url: string, text?: string, isNewTab?: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const LinkEditBlock: import("react").ForwardRefExoticComponent<LinkEditorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default LinkEditBlock;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TooltipContentProps } from "@radix-ui/react-tooltip";
|
|
3
|
+
import { Toggle } from "../../ui/toggle";
|
|
4
|
+
export interface ToolbarButtonProps extends React.ComponentPropsWithoutRef<typeof Toggle> {
|
|
5
|
+
isActive?: boolean;
|
|
6
|
+
tooltip?: React.ReactNode;
|
|
7
|
+
tooltipOptions?: TooltipContentProps;
|
|
8
|
+
hasArrow?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const ToolbarButton: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export default ToolbarButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const ToolbarDefinitions: {
|
|
3
|
+
heading: import("react").LazyExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
4
|
+
bold: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
5
|
+
italic: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
6
|
+
strikethrough: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
7
|
+
lists: import("react").LazyExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
8
|
+
blockquote: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
9
|
+
alignment: import("react").LazyExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
10
|
+
horizontalRule: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
11
|
+
color: import("react").LazyExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
link: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
13
|
+
image: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
14
|
+
emoji: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
15
|
+
table: import("react").LazyExoticComponent<() => import("react/jsx-runtime").JSX.Element | null>;
|
|
16
|
+
iframe: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
17
|
+
undo: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
18
|
+
redo: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("./ToolbarButton").ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
19
|
+
searchAndReplace: import("react").LazyExoticComponent<typeof import("../toolbars/SearchAndReplace").SearchAndReplaceToolbar>;
|
|
20
|
+
};
|
|
21
|
+
export type ToolbarButtonsType = keyof typeof ToolbarDefinitions | "Separator" | "FlexGap";
|
|
22
|
+
declare const ToolbarButtons: React.FC<{
|
|
23
|
+
toolbars?: ToolbarButtonsType[];
|
|
24
|
+
}>;
|
|
25
|
+
export { ToolbarButtons };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AlignmentToolbar: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ToolbarButtonProps } from "../partials/ToolbarButton";
|
|
3
|
+
declare const BlockquoteToolbar: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { BlockquoteToolbar };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ToolbarButtonProps } from "../partials/ToolbarButton";
|
|
3
|
+
declare const BulletListToolbar: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { BulletListToolbar };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Extension } from "@tiptap/core";
|
|
2
|
+
import type { ColorOptions } from "@tiptap/extension-color";
|
|
3
|
+
import type { HighlightOptions } from "@tiptap/extension-highlight";
|
|
4
|
+
export type TextStylingExtensions = Extension<ColorOptions, any> | Extension<HighlightOptions, any>;
|
|
5
|
+
export declare const ColorAndHighlightToolbar: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HeadingToolbar: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ToolbarButtonProps } from "../partials/ToolbarButton";
|
|
3
|
+
declare const HorizontalRuleToolbar: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { HorizontalRuleToolbar };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ToolbarButtonProps } from "../partials/ToolbarButton";
|
|
3
|
+
declare const ImagePlaceholderToolbar: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { ImagePlaceholderToolbar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ListsToolbar: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ToolbarButtonProps } from "../partials/ToolbarButton";
|
|
3
|
+
declare const OrderedListToolbar: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { OrderedListToolbar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SearchAndReplaceToolbar(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ToolbarButtonProps } from "../partials/ToolbarButton";
|
|
3
|
+
declare const StrikeThroughToolbar: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { StrikeThroughToolbar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TableToolbar: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Content, type Editor, type Extensions, type UseEditorOptions as UseEditorPrimitiveOptions } from "@tiptap/react";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the useEditor hook.
|
|
4
|
+
* Extends Tiptap's built-in options with additional features like throttling and output format.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseEditorOptions extends Omit<UseEditorPrimitiveOptions, "onUpdate" | "onBlur"> {
|
|
7
|
+
value?: Content;
|
|
8
|
+
throttleDelay?: number;
|
|
9
|
+
output?: "html" | "json" | "text";
|
|
10
|
+
onUpdate?: (value: Content) => void;
|
|
11
|
+
onBlur?: (content: Content) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const createExtensions: () => Extensions;
|
|
14
|
+
/**
|
|
15
|
+
* Hook to initialize and configure the Tiptap editor.
|
|
16
|
+
* Handles value updates, throttling, and output formatting.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useEditor: ({ content, extensions, editorProps: { attributes: editorAttributes, ...editorProps }, throttleDelay, output, onUpdate, onCreate, onBlur, value, ...options }: UseEditorOptions) => Editor | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/core";
|
|
2
|
+
export type FileError = {
|
|
3
|
+
file: File | string;
|
|
4
|
+
reason: "type" | "size" | "invalidBase64" | "base64NotAllowed";
|
|
5
|
+
};
|
|
6
|
+
export type FileValidationOptions = {
|
|
7
|
+
allowedMimeTypes: string[];
|
|
8
|
+
maxFileSize?: number;
|
|
9
|
+
allowBase64: boolean;
|
|
10
|
+
};
|
|
11
|
+
type FileInput = File | {
|
|
12
|
+
src: string | File;
|
|
13
|
+
alt?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const isUrl: (text: string, options?: {
|
|
17
|
+
requireHostname: boolean;
|
|
18
|
+
allowBase64?: boolean;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
export declare const sanitizeUrl: (url: string | null | undefined, options?: {
|
|
21
|
+
allowBase64?: boolean;
|
|
22
|
+
}) => string | undefined;
|
|
23
|
+
export declare const filterFiles: <T extends FileInput>(files: T[], options: FileValidationOptions) => [T[], FileError[]];
|
|
24
|
+
export declare const NODE_HANDLES_SELECTED_STYLE_CLASSNAME = "node-handles-selected-style";
|
|
25
|
+
export declare function isValidUrl(url: string): boolean;
|
|
26
|
+
export declare const duplicateContent: (editor: Editor) => void;
|
|
27
|
+
export declare function getUrlFromString(str: string): string | null | undefined;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export { Button };
|