@firecms/editor 3.0.0-3.0.0-canary.8.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/LICENSE +21 -0
- package/dist/components/editor-bubble-item.d.ts +9 -0
- package/dist/components/editor-bubble.d.ts +7 -0
- package/dist/components/editor-command-item.d.ts +20 -0
- package/dist/components/editor-command.d.ts +24 -0
- package/dist/components/editor.d.ts +51 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/editor.d.ts +9 -0
- package/dist/editor_extensions.d.ts +6 -0
- package/dist/extensions/Image.d.ts +4 -0
- package/dist/extensions/_image-resizer.d.ts +2 -0
- package/dist/extensions/custom-keymap.d.ts +12 -0
- package/dist/extensions/drag-and-drop.d.ts +8 -0
- package/dist/extensions/index.d.ts +11 -0
- package/dist/extensions/slash-command.d.ts +29 -0
- package/dist/extensions/updated-image.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +1163 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +193 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/selectors/ai-selector.d.ts +0 -0
- package/dist/selectors/color-selector.d.ts +8 -0
- package/dist/selectors/link-selector.d.ts +8 -0
- package/dist/selectors/node-selector.d.ts +14 -0
- package/dist/selectors/text-buttons.d.ts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils/remove_classes.d.ts +1 -0
- package/dist/utils/useDebouncedCallback.d.ts +1 -0
- package/dist/utils/utils.d.ts +7 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 FireCMS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type Editor } from "@tiptap/react";
|
|
3
|
+
interface EditorBubbleItemProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
onSelect?: (editor: Editor) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const EditorBubbleItem: import("react").ForwardRefExoticComponent<EditorBubbleItemProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default EditorBubbleItem;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type BubbleMenuProps } from "@tiptap/react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export interface EditorBubbleProps extends Omit<BubbleMenuProps, "editor"> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const EditorBubble: import("react").ForwardRefExoticComponent<EditorBubbleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default EditorBubble;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Editor, type Range } from "@tiptap/core";
|
|
3
|
+
interface EditorCommandItemProps {
|
|
4
|
+
onCommand: ({ editor, range }: {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
range: Range;
|
|
7
|
+
}) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const EditorCommandItem: import("react").ForwardRefExoticComponent<EditorCommandItemProps & Omit<{
|
|
10
|
+
children?: import("react").ReactNode;
|
|
11
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "onSelect" | "value" | "disabled"> & {
|
|
12
|
+
disabled?: boolean | undefined;
|
|
13
|
+
onSelect?: ((value: string) => void) | undefined;
|
|
14
|
+
value?: string | undefined;
|
|
15
|
+
forceMount?: boolean | undefined;
|
|
16
|
+
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export declare const EditorCommandEmpty: import("react").ForwardRefExoticComponent<{
|
|
18
|
+
children?: import("react").ReactNode;
|
|
19
|
+
} & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export default EditorCommandItem;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Range } from "@tiptap/core";
|
|
3
|
+
export declare const queryAtom: import("jotai").PrimitiveAtom<string> & {
|
|
4
|
+
init: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const rangeAtom: import("jotai").PrimitiveAtom<Range | null> & {
|
|
7
|
+
init: Range | null;
|
|
8
|
+
};
|
|
9
|
+
export declare const EditorCommandOut: ({ query, range, }: {
|
|
10
|
+
query: string;
|
|
11
|
+
range: Range;
|
|
12
|
+
}) => JSX.Element;
|
|
13
|
+
export declare const EditorCommand: import("react").ForwardRefExoticComponent<Omit<{
|
|
14
|
+
children?: import("react").ReactNode;
|
|
15
|
+
} & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
16
|
+
label?: string | undefined;
|
|
17
|
+
shouldFilter?: boolean | undefined;
|
|
18
|
+
filter?: ((value: string, search: string) => number) | undefined;
|
|
19
|
+
defaultValue?: string | undefined;
|
|
20
|
+
value?: string | undefined;
|
|
21
|
+
onValueChange?: ((value: string) => void) | undefined;
|
|
22
|
+
loop?: boolean | undefined;
|
|
23
|
+
vimBindings?: boolean | undefined;
|
|
24
|
+
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare const editorStore: {
|
|
3
|
+
get: <Value>(atom: import("jotai").Atom<Value>) => Value;
|
|
4
|
+
set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
|
|
5
|
+
sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
|
|
6
|
+
dev_subscribe_store: (l: (action: {
|
|
7
|
+
type: "write";
|
|
8
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
9
|
+
} | {
|
|
10
|
+
type: "async-write";
|
|
11
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
12
|
+
} | {
|
|
13
|
+
type: "sub";
|
|
14
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
15
|
+
} | {
|
|
16
|
+
type: "unsub";
|
|
17
|
+
} | {
|
|
18
|
+
type: "restore";
|
|
19
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
20
|
+
}) => void, rev: 2) => () => void;
|
|
21
|
+
dev_get_mounted_atoms: () => IterableIterator<import("jotai").Atom<unknown>>;
|
|
22
|
+
dev_get_atom_state: (a: import("jotai").Atom<unknown>) => ({
|
|
23
|
+
d: Map<import("jotai").Atom<unknown>, any & ({
|
|
24
|
+
e: unknown;
|
|
25
|
+
} | {
|
|
26
|
+
v: unknown;
|
|
27
|
+
})>;
|
|
28
|
+
} & ({
|
|
29
|
+
e: unknown;
|
|
30
|
+
} | {
|
|
31
|
+
v: unknown;
|
|
32
|
+
})) | undefined;
|
|
33
|
+
dev_get_mounted: (a: import("jotai").Atom<unknown>) => {
|
|
34
|
+
l: Set<() => void>;
|
|
35
|
+
t: Set<import("jotai").Atom<unknown>>;
|
|
36
|
+
u?: (() => void) | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
|
|
39
|
+
} | {
|
|
40
|
+
get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
|
|
41
|
+
set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: import("jotai").WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
|
|
42
|
+
sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
|
|
43
|
+
dev_subscribe_store?: undefined;
|
|
44
|
+
dev_get_mounted_atoms?: undefined;
|
|
45
|
+
dev_get_atom_state?: undefined;
|
|
46
|
+
dev_get_mounted?: undefined;
|
|
47
|
+
dev_restore_atoms?: undefined;
|
|
48
|
+
};
|
|
49
|
+
export declare const EditorRoot: ({ children }: {
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { useCurrentEditor as useEditor } from "@tiptap/react";
|
|
2
|
+
export { type Editor } from "@tiptap/core";
|
|
3
|
+
export type { JSONContent } from "@tiptap/react";
|
|
4
|
+
export { EditorRoot } from "./editor";
|
|
5
|
+
export { EditorBubble } from "./editor-bubble";
|
|
6
|
+
export { EditorBubbleItem } from "./editor-bubble-item";
|
|
7
|
+
export { EditorCommand } from "./editor-command";
|
|
8
|
+
export { EditorCommandItem, EditorCommandEmpty } from "./editor-command-item";
|
package/dist/editor.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type JSONContent } from "./components";
|
|
2
|
+
export type FireCMSEditorProps = {
|
|
3
|
+
initialContent?: JSONContent | string;
|
|
4
|
+
onMarkdownContentChange?: (content: string) => void;
|
|
5
|
+
onJsonContentChange?: (content: JSONContent | null) => void;
|
|
6
|
+
onHtmlContentChange?: (content: string) => void;
|
|
7
|
+
handleImageUpload: (file: File) => Promise<string>;
|
|
8
|
+
};
|
|
9
|
+
export declare const FireCMSEditor: ({ handleImageUpload, initialContent, onJsonContentChange, onHtmlContentChange, onMarkdownContentChange }: FireCMSEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const placeholder: import("@tiptap/core").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any>;
|
|
2
|
+
export declare const tiptapLink: import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any>;
|
|
3
|
+
export declare const taskList: import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any>;
|
|
4
|
+
export declare const taskItem: import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any>;
|
|
5
|
+
export declare const horizontalRule: import("@tiptap/core").Node<import("@tiptap/extension-horizontal-rule").HorizontalRuleOptions, any>;
|
|
6
|
+
export declare const starterKit: import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Plugin } from "prosemirror-state";
|
|
2
|
+
export type UploadFn = (image: File) => Promise<string>;
|
|
3
|
+
export declare const dropImagePlugin: (upload: UploadFn) => Plugin<any>;
|
|
4
|
+
export declare const createImageExtension: (uploadFn: UploadFn) => import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
declare module "@tiptap/core" {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
customkeymap: {
|
|
5
|
+
/**
|
|
6
|
+
* Select text between node boundaries
|
|
7
|
+
*/
|
|
8
|
+
selectTextWithinNodeBoundaries: () => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const CustomKeymap: Extension<any, any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
2
|
+
import TiptapLink from "@tiptap/extension-link";
|
|
3
|
+
import TiptapImage from "@tiptap/extension-image";
|
|
4
|
+
import { TaskItem } from "@tiptap/extension-task-item";
|
|
5
|
+
import { TaskList } from "@tiptap/extension-task-list";
|
|
6
|
+
import { InputRule } from "@tiptap/core";
|
|
7
|
+
declare const PlaceholderExtension: import("@tiptap/core").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any>;
|
|
8
|
+
declare const Horizontal: import("@tiptap/core").Node<import("@tiptap/extension-horizontal-rule").HorizontalRuleOptions, any>;
|
|
9
|
+
export { PlaceholderExtension as Placeholder, StarterKit, Horizontal as HorizontalRule, TiptapLink, TiptapImage, TaskItem, TaskList, InputRule, };
|
|
10
|
+
export * from "./slash-command";
|
|
11
|
+
export { getPrevText } from "../utils/utils";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Editor, type Range, Extension } from "@tiptap/core";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
declare const Command: Extension<any, any>;
|
|
4
|
+
declare const renderItems: () => {
|
|
5
|
+
onStart: (props: {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
clientRect: DOMRect;
|
|
8
|
+
}) => void;
|
|
9
|
+
onUpdate: (props: {
|
|
10
|
+
editor: Editor;
|
|
11
|
+
clientRect: DOMRect;
|
|
12
|
+
}) => void;
|
|
13
|
+
onKeyDown: (props: {
|
|
14
|
+
event: KeyboardEvent;
|
|
15
|
+
}) => any;
|
|
16
|
+
onExit: () => void;
|
|
17
|
+
};
|
|
18
|
+
export interface SuggestionItem {
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
icon: ReactNode;
|
|
22
|
+
searchTerms?: string[];
|
|
23
|
+
command?: (props: {
|
|
24
|
+
editor: Editor;
|
|
25
|
+
range: Range;
|
|
26
|
+
}) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const createSuggestionItems: (items: SuggestionItem[]) => SuggestionItem[];
|
|
29
|
+
export { Command, renderItems };
|
package/dist/index.d.ts
ADDED