neweditor 1.0.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/README.md +301 -0
- package/dist/components/BubbleItem.vue.d.ts +32 -0
- package/dist/components/Editor.vue.d.ts +53 -0
- package/dist/components/EditorBubbleMenu.vue.d.ts +14 -0
- package/dist/components/EditorHeader.vue.d.ts +13 -0
- package/dist/components/block/BlockActionButton.vue.d.ts +24 -0
- package/dist/components/block/BlockActionInput.vue.d.ts +13 -0
- package/dist/components/block/BlockActionSeparator.vue.d.ts +2 -0
- package/dist/components/block/BlockCard.vue.d.ts +27 -0
- package/dist/components/block/index.d.ts +4 -0
- package/dist/components/common/ColorPickerDropdown.vue.d.ts +27 -0
- package/dist/components/icon/MdiDeleteForeverOutline.vue.d.ts +2 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/toolbar/ToolbarItem.vue.d.ts +19 -0
- package/dist/components/toolbar/ToolbarSubItem.vue.d.ts +16 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbox/ToolboxItem.vue.d.ts +17 -0
- package/dist/components/toolbox/index.d.ts +1 -0
- package/dist/dev/App.vue.d.ts +2 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/extensions/audio/AudioView.vue.d.ts +5 -0
- package/dist/extensions/audio/BubbleItemAudioLink.vue.d.ts +18 -0
- package/dist/extensions/audio/index.d.ts +14 -0
- package/dist/extensions/blockquote/index.d.ts +4 -0
- package/dist/extensions/bold/index.d.ts +3 -0
- package/dist/extensions/bullet-list/index.d.ts +3 -0
- package/dist/extensions/clear-format/index.d.ts +4 -0
- package/dist/extensions/code/index.d.ts +4 -0
- package/dist/extensions/code-block/CodeBlockSelect.vue.d.ts +24 -0
- package/dist/extensions/code-block/CodeBlockViewRenderer.vue.d.ts +3 -0
- package/dist/extensions/code-block/code-block.d.ts +68 -0
- package/dist/extensions/code-block/index.d.ts +2 -0
- package/dist/extensions/code-block/lowlight-plugin.d.ts +2 -0
- package/dist/extensions/color/ColorBubbleItem.vue.d.ts +18 -0
- package/dist/extensions/color/ColorToolbarItem.vue.d.ts +19 -0
- package/dist/extensions/color/index.d.ts +4 -0
- package/dist/extensions/columns/column.d.ts +3 -0
- package/dist/extensions/columns/columns.d.ts +23 -0
- package/dist/extensions/columns/index.d.ts +2 -0
- package/dist/extensions/commands-menu/CommandsView.vue.d.ts +27 -0
- package/dist/extensions/commands-menu/commands.d.ts +3 -0
- package/dist/extensions/commands-menu/index.d.ts +1 -0
- package/dist/extensions/details/index.d.ts +6 -0
- package/dist/extensions/draggable/index.d.ts +13 -0
- package/dist/extensions/font-size/index.d.ts +5 -0
- package/dist/extensions/format-brush/index.d.ts +15 -0
- package/dist/extensions/format-brush/util.d.ts +27 -0
- package/dist/extensions/fullscreen/index.d.ts +6 -0
- package/dist/extensions/gap-cursor/gap-cursor-selection.d.ts +44 -0
- package/dist/extensions/gap-cursor/index.d.ts +41 -0
- package/dist/extensions/heading/index.d.ts +4 -0
- package/dist/extensions/highlight/HighlightBubbleItem.vue.d.ts +18 -0
- package/dist/extensions/highlight/HighlightToolbarItem.vue.d.ts +19 -0
- package/dist/extensions/highlight/index.d.ts +4 -0
- package/dist/extensions/history/index.d.ts +3 -0
- package/dist/extensions/iframe/BubbleItemIframeLink.vue.d.ts +18 -0
- package/dist/extensions/iframe/BubbleItemIframeSize.vue.d.ts +6 -0
- package/dist/extensions/iframe/IframeView.vue.d.ts +5 -0
- package/dist/extensions/iframe/index.d.ts +14 -0
- package/dist/extensions/image/BubbleItemImageAlt.vue.d.ts +18 -0
- package/dist/extensions/image/BubbleItemImageHref.vue.d.ts +18 -0
- package/dist/extensions/image/BubbleItemImageLink.vue.d.ts +18 -0
- package/dist/extensions/image/BubbleItemImageSize.vue.d.ts +18 -0
- package/dist/extensions/image/ImageView.vue.d.ts +6 -0
- package/dist/extensions/image/index.d.ts +6 -0
- package/dist/extensions/indent/index.d.ts +24 -0
- package/dist/extensions/index.d.ts +55 -0
- package/dist/extensions/italic/index.d.ts +3 -0
- package/dist/extensions/link/LinkBubbleButton.vue.d.ts +18 -0
- package/dist/extensions/link/index.d.ts +4 -0
- package/dist/extensions/list-keymap/index.d.ts +7 -0
- package/dist/extensions/node-selected/index.d.ts +6 -0
- package/dist/extensions/ordered-list/index.d.ts +3 -0
- package/dist/extensions/paragraph/index.d.ts +6 -0
- package/dist/extensions/range-selection/index.d.ts +22 -0
- package/dist/extensions/range-selection/range-selection.d.ts +64 -0
- package/dist/extensions/search-and-replace/SearchAndReplace.vue.d.ts +36 -0
- package/dist/extensions/search-and-replace/SearchAndReplacePlugin.d.ts +109 -0
- package/dist/extensions/search-and-replace/index.d.ts +34 -0
- package/dist/extensions/sidebar-toggle/index.d.ts +25 -0
- package/dist/extensions/strike/index.d.ts +3 -0
- package/dist/extensions/subscript/index.d.ts +3 -0
- package/dist/extensions/superscript/index.d.ts +3 -0
- package/dist/extensions/table/index.d.ts +6 -0
- package/dist/extensions/table/table-cell.d.ts +6 -0
- package/dist/extensions/table/table-header.d.ts +6 -0
- package/dist/extensions/table/table-row.d.ts +2 -0
- package/dist/extensions/table/util.d.ts +44 -0
- package/dist/extensions/task-list/index.d.ts +3 -0
- package/dist/extensions/text/index.d.ts +5 -0
- package/dist/extensions/text-align/index.d.ts +4 -0
- package/dist/extensions/text-style/index.d.ts +2 -0
- package/dist/extensions/trailing-node/index.d.ts +9 -0
- package/dist/extensions/underline/index.d.ts +3 -0
- package/dist/extensions/video/BubbleItemVideoLink.vue.d.ts +18 -0
- package/dist/extensions/video/BubbleItemVideoSize.vue.d.ts +18 -0
- package/dist/extensions/video/VideoView.vue.d.ts +5 -0
- package/dist/extensions/video/index.d.ts +14 -0
- package/dist/index.d.ts +9 -0
- package/dist/locales/index.d.ts +7 -0
- package/dist/rich-text-editor.es.js +56411 -0
- package/dist/style.css +10 -0
- package/dist/tiptap/core/index.d.ts +1 -0
- package/dist/tiptap/index.d.ts +6 -0
- package/dist/tiptap/pm/index.d.ts +19 -0
- package/dist/tiptap/vue-3/index.d.ts +1 -0
- package/dist/types/index.d.ts +139 -0
- package/dist/utils/anchor.d.ts +2 -0
- package/dist/utils/delete-node.d.ts +4 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/is-allowed-uri.d.ts +1 -0
- package/dist/utils/is-list-active.d.ts +12 -0
- package/dist/utils/is-node-empty.d.ts +4 -0
- package/package.json +115 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { default as ExtensionDocument } from '@tiptap/extension-document';
|
|
2
|
+
import { default as ExtensionHardBreak } from '@tiptap/extension-hard-break';
|
|
3
|
+
import { default as ExtensionHorizontalRule } from '@tiptap/extension-horizontal-rule';
|
|
4
|
+
import { CharacterCount, Dropcursor, Placeholder } from '@tiptap/extensions';
|
|
5
|
+
import { default as ExtensionBlockquote } from './blockquote';
|
|
6
|
+
import { default as ExtensionBold } from './bold';
|
|
7
|
+
import { default as ExtensionBulletList } from './bullet-list';
|
|
8
|
+
import { default as ExtensionCode } from './code';
|
|
9
|
+
import { default as ExtensionColor } from './color';
|
|
10
|
+
import { default as ExtensionDetails, DETAILS_BUBBLE_MENU_KEY } from './details';
|
|
11
|
+
import { default as ExtensionFontSize } from './font-size';
|
|
12
|
+
import { default as ExtensionHeading } from './heading';
|
|
13
|
+
import { default as ExtensionHighlight } from './highlight';
|
|
14
|
+
import { default as ExtensionHistory } from './history';
|
|
15
|
+
import { default as ExtensionItalic } from './italic';
|
|
16
|
+
import { default as ExtensionLink } from './link';
|
|
17
|
+
import { default as ExtensionListKeymap } from './list-keymap';
|
|
18
|
+
import { default as ExtensionOrderedList } from './ordered-list';
|
|
19
|
+
import { default as ExtensionParagraph } from './paragraph';
|
|
20
|
+
import { default as ExtensionStrike } from './strike';
|
|
21
|
+
import { default as ExtensionSubscript } from './subscript';
|
|
22
|
+
import { default as ExtensionSuperscript } from './superscript';
|
|
23
|
+
import { default as ExtensionTable, TABLE_BUBBLE_MENU_KEY } from './table';
|
|
24
|
+
import { default as ExtensionTaskList } from './task-list';
|
|
25
|
+
import { default as ExtensionTextAlign } from './text-align';
|
|
26
|
+
import { default as ExtensionUnderline } from './underline';
|
|
27
|
+
import { CODE_BLOCK_BUBBLE_MENU_KEY, ExtensionCodeBlock, ExtensionCodeBlockOptions } from './code-block';
|
|
28
|
+
import { default as ExtensionTextStyle } from './text-style';
|
|
29
|
+
import { ExtensionCommands } from '../extensions/commands-menu';
|
|
30
|
+
import { default as ExtensionAudio, AUDIO_BUBBLE_MENU_KEY } from './audio';
|
|
31
|
+
import { default as ExtensionClearFormat } from './clear-format';
|
|
32
|
+
import { COLUMNS_BUBBLE_MENU_KEY, ExtensionColumn, ExtensionColumns } from './columns';
|
|
33
|
+
import { default as ExtensionDraggable } from './draggable';
|
|
34
|
+
import { default as ExtensionFormatBrush } from './format-brush';
|
|
35
|
+
import { default as ExtensionGapcursor } from './gap-cursor';
|
|
36
|
+
import { default as ExtensionIframe, IFRAME_BUBBLE_MENU_KEY } from './iframe';
|
|
37
|
+
import { default as ExtensionImage, IMAGE_BUBBLE_MENU_KEY } from './image';
|
|
38
|
+
import { default as ExtensionIndent } from './indent';
|
|
39
|
+
import { default as ExtensionNodeSelected } from './node-selected';
|
|
40
|
+
import { ExtensionRangeSelection, RangeSelection } from './range-selection';
|
|
41
|
+
import { default as ExtensionSearchAndReplace } from './search-and-replace';
|
|
42
|
+
import { default as ExtensionText, TEXT_BUBBLE_MENU_KEY } from './text';
|
|
43
|
+
import { default as ExtensionTrailingNode } from './trailing-node';
|
|
44
|
+
import { default as ExtensionVideo, VIDEO_BUBBLE_MENU_KEY } from './video';
|
|
45
|
+
declare const allExtensions: (import('@tiptap/core').Node<import('..').ExtensionOptions & Partial<import('@tiptap/extension-blockquote').BlockquoteOptions>, any> | import('@tiptap/core').Mark<import('..').ExtensionOptions, any> | import('@tiptap/core').Node<any, any> | import('@tiptap/core').Node<import('..').ExtensionOptions, any> | import('@tiptap/core').Mark<import('..').ExtensionOptions & Partial<import('@tiptap/extension-code').CodeOptions>, any> | import('@tiptap/core').Mark<import('@tiptap/extension-text-style').TextStyleOptions, any> | import('@tiptap/core').Extension<import('..').ExtensionOptions & Partial<import('@tiptap/extension-text-style').ColorOptions>, any> | import('@tiptap/core').Node<import('..').ExtensionOptions & Partial<import('@tiptap/extension-details').DetailsOptions>, any> | import('@tiptap/core').Extension<import('./font-size').FontSizeOptions, any> | import('@tiptap/core').Node<import('..').ExtensionOptions & import('@tiptap/extension-heading').HeadingOptions, any> | import('@tiptap/core').Mark<import('..').ExtensionOptions & Partial<import('@tiptap/extension-highlight').HighlightOptions>, any> | import('@tiptap/core').Extension<import('..').ExtensionOptions, any> | import('@tiptap/core').Mark<import('..').ExtensionOptions & Partial<import('@tiptap/extension-link').LinkOptions>, any> | import('@tiptap/core').Node<import('..').ExtensionOptions & import('@tiptap/extension-table').TableOptions, any> | import('@tiptap/core').Extension<import('..').ExtensionOptions & Partial<import('@tiptap/extension-text-align').TextAlignOptions>, any> | import('@tiptap/core').Node<import('..').ExtensionOptions & Partial<ExtensionCodeBlockOptions> & Partial<import('./code-block').CodeBlockOptions>, any> | import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Node<import('..').ExtensionOptions & import('./columns/columns').ColumnsOptions, any> | import('@tiptap/core').Extension<any, import('./format-brush').FormatBrushStore> | import('@tiptap/core').Node<import('..').ExtensionOptions & Partial<import('@tiptap/extension-image').ImageOptions>, any> | import('@tiptap/core').Extension<{
|
|
46
|
+
names: Array<string>;
|
|
47
|
+
indentRange: number;
|
|
48
|
+
minIndentLevel: number;
|
|
49
|
+
maxIndentLevel: number;
|
|
50
|
+
defaultIndentLevel: number;
|
|
51
|
+
HTMLAttributes: Record<string, any>;
|
|
52
|
+
firstLineIndent: boolean;
|
|
53
|
+
} & import('..').ExtensionOptions, any> | import('@tiptap/core').Extension<import('./node-selected').NodeSelectedOptions, any> | import('@tiptap/core').Extension<{}, import('./sidebar-toggle').SidebarToggleStorage> | import('@tiptap/core').Extension<{}, import('./fullscreen').FullscreenStorage> | import('@tiptap/core').Extension<import('@tiptap/extensions').CharacterCountOptions, import('@tiptap/extensions').CharacterCountStorage> | import('@tiptap/core').Extension<import('@tiptap/extensions').DropcursorOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-hard-break').HardBreakOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-horizontal-rule').HorizontalRuleOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extensions').PlaceholderOptions, any>)[];
|
|
54
|
+
export { allExtensions, AUDIO_BUBBLE_MENU_KEY, CODE_BLOCK_BUBBLE_MENU_KEY, COLUMNS_BUBBLE_MENU_KEY, DETAILS_BUBBLE_MENU_KEY, ExtensionAudio, ExtensionBlockquote, ExtensionBold, ExtensionBulletList, CharacterCount as ExtensionCharacterCount, ExtensionClearFormat, ExtensionCode, ExtensionCodeBlock, ExtensionColor, ExtensionColumn, ExtensionColumns, ExtensionCommands, ExtensionDetails, ExtensionDocument, ExtensionDraggable, Dropcursor as ExtensionDropcursor, ExtensionFontSize, ExtensionFormatBrush, ExtensionGapcursor, ExtensionHardBreak, ExtensionHeading, ExtensionHighlight, ExtensionHistory, ExtensionHorizontalRule, ExtensionIframe, ExtensionImage, ExtensionIndent, ExtensionItalic, ExtensionLink, ExtensionListKeymap, ExtensionNodeSelected, ExtensionOrderedList, ExtensionParagraph, Placeholder as ExtensionPlaceholder, ExtensionRangeSelection, ExtensionSearchAndReplace, ExtensionStrike, ExtensionSubscript, ExtensionSuperscript, ExtensionTable, ExtensionTaskList, ExtensionText, ExtensionTextAlign, ExtensionTextStyle, ExtensionTrailingNode, ExtensionUnderline, ExtensionVideo, IFRAME_BUBBLE_MENU_KEY, IMAGE_BUBBLE_MENU_KEY, RangeSelection, TABLE_BUBBLE_MENU_KEY, TEXT_BUBBLE_MENU_KEY, VIDEO_BUBBLE_MENU_KEY, };
|
|
55
|
+
export type { ExtensionCodeBlockOptions };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Editor } from '../../tiptap/vue-3';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
isActive: ({ editor }: {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}) => boolean;
|
|
8
|
+
visible?: ({ editor }: {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
icon?: Component;
|
|
12
|
+
title?: string;
|
|
13
|
+
action?: ({ editor }: {
|
|
14
|
+
editor: Editor;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ListKeymapOptions } from '@tiptap/extension-list';
|
|
2
|
+
/**
|
|
3
|
+
* Optimize the listKeymap extension until the issue with @tiptap/extension-list is resolved.
|
|
4
|
+
* https://github.com/ueberdosis/tiptap/issues/4395
|
|
5
|
+
*/
|
|
6
|
+
declare const ExtensionListKeymap: import('@tiptap/core').Extension<ListKeymapOptions, any>;
|
|
7
|
+
export default ExtensionListKeymap;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EditorState, ResolvedPos, Dispatch } from '../../tiptap';
|
|
2
|
+
import { ExtensionOptions } from '../../types';
|
|
3
|
+
declare const Paragraph: import('@tiptap/core').Node<ExtensionOptions, any>;
|
|
4
|
+
export declare function deleteCurrentNodeAndSetSelection($from: ResolvedPos, beforePos: number, state: EditorState, dispatch: Dispatch): boolean;
|
|
5
|
+
export declare function handleDeletePreviousNode($from: ResolvedPos, beforePos: number, state: EditorState, dispatch: Dispatch): boolean;
|
|
6
|
+
export default Paragraph;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Extension, ParentConfig } from '../../tiptap';
|
|
2
|
+
import { default as RangeSelection } from './range-selection';
|
|
3
|
+
declare module "@tiptap/core" {
|
|
4
|
+
interface NodeConfig<Options, Storage> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether to allow displaying a fake selection state on the node.
|
|
7
|
+
*
|
|
8
|
+
* Typically, it is only necessary to display a fake selection state on child nodes,
|
|
9
|
+
* so the parent node can be set to false.
|
|
10
|
+
*
|
|
11
|
+
* default: true
|
|
12
|
+
*/
|
|
13
|
+
fakeSelection?: boolean | null | ((this: {
|
|
14
|
+
name: string;
|
|
15
|
+
options: Options;
|
|
16
|
+
storage: Storage;
|
|
17
|
+
parent: ParentConfig<NodeConfig<Options>>["fakeSelection"];
|
|
18
|
+
}) => boolean | null);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
declare const ExtensionRangeSelection: Extension<any, any>;
|
|
22
|
+
export { ExtensionRangeSelection, RangeSelection };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { EditorState, Node, ResolvedPos, Selection, Mappable } from '../../tiptap/pm';
|
|
2
|
+
/**
|
|
3
|
+
* The RangeSelection class represents a selection range within a document.
|
|
4
|
+
* The content can include text, paragraphs, block-level content, etc.
|
|
5
|
+
*
|
|
6
|
+
* It has a starting position and an ending position. When the given range includes block-level content,
|
|
7
|
+
* the RangeSelection will automatically expand to include the block-level content at the corresponding depth.
|
|
8
|
+
*
|
|
9
|
+
* The RangeSelection must not contain empty content.
|
|
10
|
+
*/
|
|
11
|
+
declare class RangeSelection extends Selection {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a RangeSelection between the specified positions.
|
|
14
|
+
*
|
|
15
|
+
* @param $anchor - The starting position of the selection.
|
|
16
|
+
* @param $head - The ending position of the selection.
|
|
17
|
+
*/
|
|
18
|
+
constructor($anchor: ResolvedPos, $head: ResolvedPos);
|
|
19
|
+
map(doc: Node, mapping: Mappable): Selection;
|
|
20
|
+
eq(other: Selection): boolean;
|
|
21
|
+
getBookmark(): RangeBookmark;
|
|
22
|
+
toJSON(): any;
|
|
23
|
+
/**
|
|
24
|
+
* Validates if the given positions can form a valid RangeSelection in the given state.
|
|
25
|
+
*
|
|
26
|
+
* @param state - The editor state.
|
|
27
|
+
* @param anchor - The starting position.
|
|
28
|
+
* @param head - The ending position.
|
|
29
|
+
* @returns True if the positions form a valid RangeSelection, otherwise false.
|
|
30
|
+
*/
|
|
31
|
+
static valid(state: EditorState, anchor: number, head: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a RangeSelection spanning the given positions.
|
|
34
|
+
*
|
|
35
|
+
* When the given range includes block-level content, if only a part is included,
|
|
36
|
+
* the selection will be expanded to encompass the block-level content at the corresponding depth.
|
|
37
|
+
*
|
|
38
|
+
* Expansion: If the selection includes all depth nodes of the current block-level content but not the entire last node,
|
|
39
|
+
* the selection will be expanded to include the node at that depth.
|
|
40
|
+
*
|
|
41
|
+
* @param $anchor - The starting position of the selection.
|
|
42
|
+
* @param $head - The ending position of the selection.
|
|
43
|
+
* @returns A new RangeSelection that spans the given positions.
|
|
44
|
+
*/
|
|
45
|
+
static between($anchor: ResolvedPos, $head: ResolvedPos): RangeSelection | null;
|
|
46
|
+
static fromJSON(doc: Node, json: any): RangeSelection;
|
|
47
|
+
static create(doc: Node, anchor: number, head: number): RangeSelection;
|
|
48
|
+
static allRange(doc: Node): RangeSelection;
|
|
49
|
+
}
|
|
50
|
+
declare class RangeBookmark {
|
|
51
|
+
readonly anchor: number;
|
|
52
|
+
readonly head: number;
|
|
53
|
+
constructor(anchor: number, head: number);
|
|
54
|
+
map(mapping: Mappable): RangeBookmark;
|
|
55
|
+
resolve(doc: Node): RangeSelection;
|
|
56
|
+
}
|
|
57
|
+
export declare function checkRangeSelection($anchor: ResolvedPos, $head: ResolvedPos): void;
|
|
58
|
+
export declare function rangeNodesBetween($anchor: ResolvedPos, $head: ResolvedPos): {
|
|
59
|
+
node: Node;
|
|
60
|
+
pos: number;
|
|
61
|
+
parent: Node | null;
|
|
62
|
+
index: number;
|
|
63
|
+
}[];
|
|
64
|
+
export default RangeSelection;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Editor } from '../../tiptap';
|
|
2
|
+
import { PluginKey } from '../../tiptap/pm';
|
|
3
|
+
import { PropType } from 'vue';
|
|
4
|
+
import { SearchAndReplacePluginState } from './SearchAndReplacePlugin';
|
|
5
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
6
|
+
editor: {
|
|
7
|
+
type: PropType<Editor>;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
pluginKey: {
|
|
11
|
+
type: PropType<PluginKey<SearchAndReplacePluginState>>;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
visible: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
19
|
+
editor: {
|
|
20
|
+
type: PropType<Editor>;
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
pluginKey: {
|
|
24
|
+
type: PropType<PluginKey<SearchAndReplacePluginState>>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
visible: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
}>> & Readonly<{}>, {
|
|
32
|
+
visible: boolean;
|
|
33
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
34
|
+
searchInput: HTMLInputElement;
|
|
35
|
+
}, any>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { PMNode } from '../../tiptap';
|
|
2
|
+
import { Decoration, EditorView, Plugin, PluginKey, Selection, Transaction } from '../../tiptap/pm';
|
|
3
|
+
import { Editor } from '../../tiptap/vue-3';
|
|
4
|
+
export interface SearchAndReplacePluginProps {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
searchResultClass?: string;
|
|
8
|
+
findSearchClass?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const searchAndReplacePluginKey: PluginKey<SearchAndReplacePluginState>;
|
|
11
|
+
export type SearchAndReplacePluginViewProps = SearchAndReplacePluginProps & {
|
|
12
|
+
view: EditorView;
|
|
13
|
+
};
|
|
14
|
+
export declare class SearchAndReplacePluginView {
|
|
15
|
+
editor: Editor;
|
|
16
|
+
view: EditorView;
|
|
17
|
+
containerElement: HTMLElement;
|
|
18
|
+
init: boolean;
|
|
19
|
+
constructor({ view, editor, element }: SearchAndReplacePluginViewProps);
|
|
20
|
+
update(): boolean;
|
|
21
|
+
destroy(): boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface TextNodesWithPosition {
|
|
24
|
+
text: string;
|
|
25
|
+
pos: number;
|
|
26
|
+
index: number;
|
|
27
|
+
}
|
|
28
|
+
export interface SearchResultWithPosition {
|
|
29
|
+
pos: number;
|
|
30
|
+
index: number;
|
|
31
|
+
from: number;
|
|
32
|
+
to: number;
|
|
33
|
+
}
|
|
34
|
+
export declare class SearchAndReplacePluginState {
|
|
35
|
+
private _findIndex;
|
|
36
|
+
editor: Editor;
|
|
37
|
+
enable: boolean;
|
|
38
|
+
findIndexFlag: boolean;
|
|
39
|
+
findCount: number;
|
|
40
|
+
searchTerm: string;
|
|
41
|
+
replaceTerm: string;
|
|
42
|
+
regex: boolean;
|
|
43
|
+
caseSensitive: boolean;
|
|
44
|
+
wholeWord: boolean;
|
|
45
|
+
results: SearchResultWithPosition[];
|
|
46
|
+
searchResultDecorations: Decoration[];
|
|
47
|
+
findIndexDecoration: Decoration | undefined;
|
|
48
|
+
constructor({ editor, enable, regex, caseSensitive, wholeWord, }: {
|
|
49
|
+
editor: Editor;
|
|
50
|
+
enable?: boolean;
|
|
51
|
+
regex?: boolean;
|
|
52
|
+
caseSensitive?: boolean;
|
|
53
|
+
wholeWord?: boolean;
|
|
54
|
+
});
|
|
55
|
+
get findIndex(): number;
|
|
56
|
+
set findIndex(newValue: number);
|
|
57
|
+
apply(tr: Transaction): SearchAndReplacePluginState;
|
|
58
|
+
scrollIntoFindIndexView(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Validate if findIndex is within the range
|
|
61
|
+
* If results.length === 0, take 0
|
|
62
|
+
* If less than or equal to -1, take results.length - 1
|
|
63
|
+
* If greater than results.length - 1, take 0
|
|
64
|
+
*
|
|
65
|
+
* @param index new findIndex
|
|
66
|
+
* @returns validated findIndex
|
|
67
|
+
*/
|
|
68
|
+
verifySetIndex(index: number): number;
|
|
69
|
+
/**
|
|
70
|
+
* Execute full-text search functionality.
|
|
71
|
+
*
|
|
72
|
+
* @param Transaction
|
|
73
|
+
* @returns
|
|
74
|
+
* @memberof SearchAndReplacePluginState
|
|
75
|
+
*/
|
|
76
|
+
processSearches({ doc, selection, }: Transaction): SearchAndReplacePluginState;
|
|
77
|
+
/**
|
|
78
|
+
* Highlight the current result based on findIndex.
|
|
79
|
+
*
|
|
80
|
+
* @memberof SearchAndReplacePluginState
|
|
81
|
+
*/
|
|
82
|
+
processFindIndexDecoration(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Generate highlighted results based on the 'results'.
|
|
85
|
+
*
|
|
86
|
+
* @memberof SearchAndReplacePluginState
|
|
87
|
+
*/
|
|
88
|
+
processResultDecorations(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Reset findIndex based on the current cursor position.
|
|
91
|
+
*
|
|
92
|
+
* @param selection Current cursor position.
|
|
93
|
+
*/
|
|
94
|
+
getNearestResultBySelection(selection: Selection): void;
|
|
95
|
+
/**
|
|
96
|
+
* Convert the entire text into flattened text with positions.
|
|
97
|
+
*
|
|
98
|
+
* @param doc The entire document
|
|
99
|
+
* @returns Flattened text with positions
|
|
100
|
+
*/
|
|
101
|
+
getFullText(doc: PMNode): TextNodesWithPosition[];
|
|
102
|
+
/**
|
|
103
|
+
* Get the regular expression object based on the current search term.
|
|
104
|
+
*
|
|
105
|
+
* @returns Regular expression object
|
|
106
|
+
*/
|
|
107
|
+
getRegex: () => RegExp;
|
|
108
|
+
}
|
|
109
|
+
export declare const SearchAndReplacePlugin: (options: SearchAndReplacePluginProps) => Plugin<SearchAndReplacePluginState>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Extension } from '../../tiptap/vue-3';
|
|
2
|
+
import { ExtensionOptions } from '../../types';
|
|
3
|
+
declare module '../../tiptap' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
searchAndReplace: {
|
|
6
|
+
/**
|
|
7
|
+
* @description Replace first instance of search result with given replace term.
|
|
8
|
+
*/
|
|
9
|
+
replace: () => ReturnType;
|
|
10
|
+
/**
|
|
11
|
+
* @description Replace all instances of search result with given replace term.
|
|
12
|
+
*/
|
|
13
|
+
replaceAll: () => ReturnType;
|
|
14
|
+
/**
|
|
15
|
+
* @description Find next instance of search result.
|
|
16
|
+
*/
|
|
17
|
+
findNext: () => ReturnType;
|
|
18
|
+
/**
|
|
19
|
+
* @description Find previous instance of search result.
|
|
20
|
+
*/
|
|
21
|
+
findPrevious: () => ReturnType;
|
|
22
|
+
/**
|
|
23
|
+
* @description Open search panel.
|
|
24
|
+
*/
|
|
25
|
+
openSearch: () => ReturnType;
|
|
26
|
+
/**
|
|
27
|
+
* @description Close search panel.
|
|
28
|
+
*/
|
|
29
|
+
closeSearch: () => ReturnType;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
declare const SearchAndReplace: Extension<ExtensionOptions, any>;
|
|
34
|
+
export default SearchAndReplace;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
declare module '../../tiptap' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
sidebarToggle: {
|
|
5
|
+
/**
|
|
6
|
+
* Toggle sidebar visibility
|
|
7
|
+
*/
|
|
8
|
+
toggleSidebar: () => ReturnType;
|
|
9
|
+
/**
|
|
10
|
+
* Set sidebar visibility
|
|
11
|
+
*/
|
|
12
|
+
setSidebarVisibility: (visible: boolean) => ReturnType;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
declare module "@tiptap/core" {
|
|
17
|
+
interface Storage {
|
|
18
|
+
sidebarToggle: SidebarToggleStorage;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export interface SidebarToggleStorage {
|
|
22
|
+
showSidebar: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const SidebarToggle: Extension<{}, SidebarToggleStorage>;
|
|
25
|
+
export default SidebarToggle;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PluginKey } from '../../tiptap/pm';
|
|
2
|
+
import { ExtensionOptions } from '../../types';
|
|
3
|
+
import { TableOptions } from '@tiptap/extension-table';
|
|
4
|
+
export declare const TABLE_BUBBLE_MENU_KEY: PluginKey<any>;
|
|
5
|
+
declare const Table: import('@tiptap/core').Node<ExtensionOptions & TableOptions, any>;
|
|
6
|
+
export default Table;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EditorState, Selection, Transaction, CellSelection, Node, TableMap } from '../../tiptap/pm';
|
|
2
|
+
export declare const selectTable: (tr: Transaction) => Transaction;
|
|
3
|
+
export declare const selectColumn: (index: number) => (tr: Transaction) => Transaction;
|
|
4
|
+
export declare const selectRow: (index: number) => (tr: Transaction) => Transaction;
|
|
5
|
+
export declare const getCellsInColumn: (columnIndex: number | number[]) => (selection: Selection) => {
|
|
6
|
+
pos: number;
|
|
7
|
+
start: number;
|
|
8
|
+
node: Node | null | undefined;
|
|
9
|
+
}[] | undefined;
|
|
10
|
+
export declare const getCellsInRow: (rowIndex: number | number[]) => (selection: Selection) => {
|
|
11
|
+
pos: number;
|
|
12
|
+
start: number;
|
|
13
|
+
node: Node | null | undefined;
|
|
14
|
+
}[] | undefined;
|
|
15
|
+
export declare const findTable: (selection: Selection) => {
|
|
16
|
+
pos: number;
|
|
17
|
+
start: number;
|
|
18
|
+
depth: number;
|
|
19
|
+
node: Node;
|
|
20
|
+
} | undefined;
|
|
21
|
+
export declare const isRectSelected: (rect: any) => (selection: CellSelection) => boolean;
|
|
22
|
+
export declare const isCellSelection: (selection: any) => selection is CellSelection;
|
|
23
|
+
export declare const isColumnSelected: (columnIndex: number) => (selection: any) => boolean;
|
|
24
|
+
export declare const isRowSelected: (rowIndex: number) => (selection: any) => boolean;
|
|
25
|
+
export declare const isTableSelected: (selection: any) => boolean;
|
|
26
|
+
export declare const hasTableBefore: (editorState: EditorState) => boolean;
|
|
27
|
+
export declare const findNextCell: (state: EditorState) => {
|
|
28
|
+
start: number;
|
|
29
|
+
node: Node | null;
|
|
30
|
+
} | undefined;
|
|
31
|
+
export declare const findPreviousCell: (state: EditorState) => {
|
|
32
|
+
start: number;
|
|
33
|
+
node: Node | null;
|
|
34
|
+
} | undefined;
|
|
35
|
+
export declare const findAdjacentCell: (dir: number) => (state: EditorState) => {
|
|
36
|
+
start: number;
|
|
37
|
+
node: Node | null;
|
|
38
|
+
} | undefined;
|
|
39
|
+
export declare const nextCell: (map: TableMap) => (pos: number, dir: number) => {
|
|
40
|
+
top: number;
|
|
41
|
+
left: number;
|
|
42
|
+
right: number;
|
|
43
|
+
bottom: number;
|
|
44
|
+
} | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Extension } from '../../tiptap/vue-3';
|
|
2
|
+
/**
|
|
3
|
+
* Extension based on:
|
|
4
|
+
* - https://github.com/ueberdosis/tiptap/tree/main/demos/src/Experiments/TrailingNode
|
|
5
|
+
* - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js
|
|
6
|
+
* - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts
|
|
7
|
+
*/
|
|
8
|
+
declare const TrailingNode: Extension<any, any>;
|
|
9
|
+
export default TrailingNode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Editor } from '../../tiptap';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
isActive: ({ editor }: {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}) => boolean;
|
|
8
|
+
visible?: ({ editor }: {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
icon?: Component;
|
|
12
|
+
title?: string;
|
|
13
|
+
action?: ({ editor }: {
|
|
14
|
+
editor: Editor;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Editor } from '../../tiptap';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
isActive?: ({ editor }: {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}) => boolean;
|
|
8
|
+
visible?: ({ editor }: {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
icon?: Component;
|
|
12
|
+
title?: string;
|
|
13
|
+
action?: ({ editor }: {
|
|
14
|
+
editor: Editor;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NodeViewProps } from '../../tiptap/vue-3';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<NodeViewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
3
|
+
inputRef: HTMLInputElement;
|
|
4
|
+
}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Node, PluginKey } from '../../tiptap';
|
|
2
|
+
import { ExtensionOptions } from '../../types';
|
|
3
|
+
declare module '../../tiptap' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
video: {
|
|
6
|
+
setVideo: (options: {
|
|
7
|
+
src: string;
|
|
8
|
+
}) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const VIDEO_BUBBLE_MENU_KEY: PluginKey<any>;
|
|
13
|
+
declare const Video: Node<ExtensionOptions, any>;
|
|
14
|
+
export default Video;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from 'vue';
|
|
2
|
+
declare const plugin: Plugin;
|
|
3
|
+
export default plugin;
|
|
4
|
+
export * from './components';
|
|
5
|
+
export * from './extensions';
|
|
6
|
+
export * from './tiptap';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export { i18n } from './locales';
|
|
9
|
+
export { deleteNode, deleteNodeByPos, generateAnchor, generateAnchorId, isAllowedUri, isEmpty, isListActive, } from './utils';
|