@grandaniel/vue-markdown-editor 1.0.0-dev.bd10ecb
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 +15 -0
- package/README.md +29 -0
- package/dist/components/MarkdownEditor/Composable/HeadlineTypeMap.d.ts +8 -0
- package/dist/components/MarkdownEditor/Composable/useMarkdownEditor.d.ts +26 -0
- package/dist/components/MarkdownEditor/Composable/useMarkdownProcessor.d.ts +28 -0
- package/dist/components/MarkdownEditor/Composable/useReflectiveState.d.ts +20 -0
- package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorContextMenu.vue.d.ts +17 -0
- package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorContextMenuBlockItem.vue.d.ts +17 -0
- package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorContextMenuInlineItem.vue.d.ts +20 -0
- package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorImageContextMenu.vue.d.ts +11 -0
- package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorTextSelectionContextMenu.vue.d.ts +20 -0
- package/dist/components/MarkdownEditor/Factory/MarkdownNodeFactory.d.ts +14 -0
- package/dist/components/MarkdownEditor/MarkdownComponentRegistry.d.ts +15 -0
- package/dist/components/MarkdownEditor/MarkdownEditor.vue.d.ts +42 -0
- package/dist/components/MarkdownEditor/MarkdownEditorModal.vue.d.ts +23 -0
- package/dist/components/MarkdownEditor/MarkdownEditorModule.vue.d.ts +45 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleHeadline1.vue.d.ts +19 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleHeadline2.vue.d.ts +19 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleHeadline3.vue.d.ts +19 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleImage.vue.d.ts +14 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleImageState.d.ts +6 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleList.vue.d.ts +3 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleListState.d.ts +5 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleParagraph.vue.d.ts +19 -0
- package/dist/components/MarkdownEditor/Modules/MarkdownModuleTextState.d.ts +4 -0
- package/dist/components/MarkdownEditor/TipTap/SingleLineExtension.d.ts +4 -0
- package/dist/components/MarkdownEditor/Types/MarkdownAstNode.d.ts +14 -0
- package/dist/components/MarkdownEditor/Types/MarkdownAstNodeType.d.ts +11 -0
- package/dist/components/MarkdownEditor/Types/TextishEmits.d.ts +12 -0
- package/dist/components/MarkdownEditor/index.d.ts +5 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/vue-markdown-editor.css +2 -0
- package/dist/vue-markdown-editor.mjs +20524 -0
- package/package.json +91 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 danielgran
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @grandaniel/vue-markdown-editor
|
|
2
|
+
|
|
3
|
+
Vue 3 markdown editor component library.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @grandaniel/vue-markdown-editor
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { ref } from "vue";
|
|
16
|
+
import { MarkdownEditor, useMarkdownEditor } from "@grandaniel/vue-markdown-editor";
|
|
17
|
+
import "@grandaniel/vue-markdown-editor/dist/vue-markdown-editor.css";
|
|
18
|
+
|
|
19
|
+
const editor = useMarkdownEditor("# Hello\n\nStart writing...");
|
|
20
|
+
const focusedNode = ref(null);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<MarkdownEditor
|
|
25
|
+
:editor="editor"
|
|
26
|
+
v-model:focused-node="focusedNode"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import MarkdownNodeType from "../Types/MarkdownAstNodeType";
|
|
2
|
+
export interface HeadlineTypeEntry {
|
|
3
|
+
prefix: string;
|
|
4
|
+
type: MarkdownNodeType;
|
|
5
|
+
depth: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const HEADLINE_TYPE_MAP: HeadlineTypeEntry[];
|
|
8
|
+
export declare function detectHeadlineTypeFromContent(content: string, cursorPosition: number): MarkdownNodeType | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare function useMarkdownEditor(initialContent?: string): {
|
|
2
|
+
markdownContent: import("vue").Ref<string, string>;
|
|
3
|
+
markdownNodes: import("vue").Ref<{
|
|
4
|
+
id: symbol;
|
|
5
|
+
type: import("..").MarkdownAstNodeType;
|
|
6
|
+
componentState: object;
|
|
7
|
+
editingState: {
|
|
8
|
+
cursorPosition: number;
|
|
9
|
+
};
|
|
10
|
+
}[], import("..").MarkdownAstNode<object>[] | {
|
|
11
|
+
id: symbol;
|
|
12
|
+
type: import("..").MarkdownAstNodeType;
|
|
13
|
+
componentState: object;
|
|
14
|
+
editingState: {
|
|
15
|
+
cursorPosition: number;
|
|
16
|
+
};
|
|
17
|
+
}[]>;
|
|
18
|
+
deleteNode: (nodeIndex: number) => void;
|
|
19
|
+
addBlankNode: (nodeIndex: number) => number;
|
|
20
|
+
replaceNodeType: (node: import("..").MarkdownAstNode, newType: import("..").MarkdownAstNodeType) => {
|
|
21
|
+
newNode: import("..").MarkdownAstNode;
|
|
22
|
+
index: number;
|
|
23
|
+
} | null;
|
|
24
|
+
moveNode: (fromIndex: number, toIndex: number) => void;
|
|
25
|
+
};
|
|
26
|
+
export type MarkdownEditorInstance = ReturnType<typeof useMarkdownEditor>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ModelRef } from "vue";
|
|
2
|
+
import type { MarkdownAstNode } from "../Types/MarkdownAstNode";
|
|
3
|
+
import MarkdownNodeType from "../Types/MarkdownAstNodeType";
|
|
4
|
+
declare function useMarkdownProcessor(modelValue: ModelRef<string | undefined>): {
|
|
5
|
+
markdownNodes: import("vue").Ref<{
|
|
6
|
+
id: symbol;
|
|
7
|
+
type: MarkdownNodeType;
|
|
8
|
+
componentState: object;
|
|
9
|
+
editingState: {
|
|
10
|
+
cursorPosition: number;
|
|
11
|
+
};
|
|
12
|
+
}[], MarkdownAstNode<object>[] | {
|
|
13
|
+
id: symbol;
|
|
14
|
+
type: MarkdownNodeType;
|
|
15
|
+
componentState: object;
|
|
16
|
+
editingState: {
|
|
17
|
+
cursorPosition: number;
|
|
18
|
+
};
|
|
19
|
+
}[]>;
|
|
20
|
+
deleteNode: (nodeIndex: number) => void;
|
|
21
|
+
addBlankNode: (nodeIndex: number) => number;
|
|
22
|
+
replaceNodeType: (node: MarkdownAstNode, newType: MarkdownNodeType) => {
|
|
23
|
+
newNode: MarkdownAstNode;
|
|
24
|
+
index: number;
|
|
25
|
+
} | null;
|
|
26
|
+
moveNode: (fromIndex: number, toIndex: number) => void;
|
|
27
|
+
};
|
|
28
|
+
export default useMarkdownProcessor;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EditorContent, EditorEvents } from "@tiptap/vue-3";
|
|
2
|
+
import { type ModelRef, type Ref } from "vue";
|
|
3
|
+
import type MarkdownModuleTextState from "../Modules/MarkdownModuleTextState";
|
|
4
|
+
import type { TextishEmitFunction } from "../Types/TextishEmits";
|
|
5
|
+
declare function markdownToHtml(markdown: string): string;
|
|
6
|
+
declare function useReflectiveState<T extends MarkdownModuleTextState>(options: {
|
|
7
|
+
modelRef: ModelRef<T>;
|
|
8
|
+
emit: TextishEmitFunction;
|
|
9
|
+
editorRef?: Ref<InstanceType<typeof EditorContent> | undefined>;
|
|
10
|
+
containingHtmlElementRef?: Ref<HTMLElement | undefined>;
|
|
11
|
+
}): {
|
|
12
|
+
handleTipTapUpdateEvent: (event: EditorEvents["update"]) => Promise<void>;
|
|
13
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
14
|
+
editorContent: Ref<string, string>;
|
|
15
|
+
expose: {
|
|
16
|
+
focus: () => void;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export { markdownToHtml };
|
|
20
|
+
export default useReflectiveState;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: 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>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorContextMenuBlockItem.vue.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
click: () => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
|
+
onClick?: (() => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorContextMenuInlineItem.vue.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
active?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_1: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_1) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
click: () => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
onClick?: (() => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
17
|
+
new (): {
|
|
18
|
+
$slots: S;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"edit-attributes": () => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
|
+
"onEdit-attributes"?: (() => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
package/dist/components/MarkdownEditor/ContextMenu/MarkdownEditorTextSelectionContextMenu.vue.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
isActive: {
|
|
5
|
+
bold: boolean;
|
|
6
|
+
italic: boolean;
|
|
7
|
+
underline: boolean;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"toggle-bold": () => any;
|
|
12
|
+
"toggle-italic": () => any;
|
|
13
|
+
"toggle-underline": () => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onToggle-bold"?: (() => any) | undefined;
|
|
16
|
+
"onToggle-italic"?: (() => any) | undefined;
|
|
17
|
+
"onToggle-underline"?: (() => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type MarkdownModuleImageState from "../Modules/MarkdownModuleImageState";
|
|
2
|
+
import type MarkdownModuleListState from "../Modules/MarkdownModuleListState";
|
|
3
|
+
import MarkdownModuleTextState from "../Modules/MarkdownModuleTextState";
|
|
4
|
+
import { MarkdownAstNode } from "../Types/MarkdownAstNode";
|
|
5
|
+
import { type TextishNodeType } from "../Types/MarkdownAstNodeType";
|
|
6
|
+
declare class MarkdownNodeFactory {
|
|
7
|
+
private createNode;
|
|
8
|
+
createTextNode(type: TextishNodeType, text: string): MarkdownAstNode<MarkdownModuleTextState>;
|
|
9
|
+
createImageNode(src: string, alt: string, caption?: string): MarkdownAstNode<MarkdownModuleImageState>;
|
|
10
|
+
createListNode(items: string[]): MarkdownAstNode<MarkdownModuleListState>;
|
|
11
|
+
createBlankParagraph(): MarkdownAstNode<MarkdownModuleTextState>;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: MarkdownNodeFactory;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Component } from "vue";
|
|
2
|
+
import MarkdownModuleImageState from "./Modules/MarkdownModuleImageState";
|
|
3
|
+
import MarkdownModuleListState from "./Modules/MarkdownModuleListState";
|
|
4
|
+
import MarkdownModuleTextState from "./Modules/MarkdownModuleTextState";
|
|
5
|
+
import type { MarkdownAstNode } from "./Types/MarkdownAstNode";
|
|
6
|
+
import MarkdownNodeType from "./Types/MarkdownAstNodeType";
|
|
7
|
+
type MarkdownComponentRegistryEntry = {
|
|
8
|
+
component: Component;
|
|
9
|
+
stateType: typeof MarkdownModuleTextState | typeof MarkdownModuleImageState | typeof MarkdownModuleListState;
|
|
10
|
+
};
|
|
11
|
+
declare const registry: Record<MarkdownNodeType, MarkdownComponentRegistryEntry>;
|
|
12
|
+
export declare function isTextNodeState(state: MarkdownAstNode): state is MarkdownAstNode & {
|
|
13
|
+
componentState: MarkdownModuleTextState;
|
|
14
|
+
};
|
|
15
|
+
export default registry;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type PropType } from "vue";
|
|
2
|
+
import type { MarkdownEditorInstance } from "./Composable/useMarkdownEditor";
|
|
3
|
+
import type { MarkdownAstNode } from "./Types/MarkdownAstNode";
|
|
4
|
+
declare var __VLS_15: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
'after-controls'?: (props: typeof __VLS_15) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
|
+
editor: {
|
|
10
|
+
type: PropType<MarkdownEditorInstance>;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
focusedNode: {
|
|
14
|
+
type: PropType<MarkdownAstNode | null>;
|
|
15
|
+
required: false;
|
|
16
|
+
default: null;
|
|
17
|
+
};
|
|
18
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
+
"update:focused-node": (value: MarkdownAstNode<object> | null) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
editor: {
|
|
22
|
+
type: PropType<MarkdownEditorInstance>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
focusedNode: {
|
|
26
|
+
type: PropType<MarkdownAstNode | null>;
|
|
27
|
+
required: false;
|
|
28
|
+
default: null;
|
|
29
|
+
};
|
|
30
|
+
}>> & Readonly<{
|
|
31
|
+
"onUpdate:focused-node"?: ((value: MarkdownAstNode<object> | null) => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
focusedNode: MarkdownAstNode<object> | null;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
36
|
+
declare const _default: typeof __VLS_export;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
39
|
+
new (): {
|
|
40
|
+
$slots: S;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
show: boolean;
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_7: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_7) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
close: () => any;
|
|
11
|
+
confirm: () => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onClose?: (() => any) | undefined;
|
|
14
|
+
onConfirm?: (() => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type PropType } from "vue";
|
|
2
|
+
import type { MarkdownAstNode } from "./Types/MarkdownAstNode";
|
|
3
|
+
declare var __VLS_1: {}, __VLS_15: {};
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
'focus-controls'?: (props: typeof __VLS_1) => any;
|
|
6
|
+
} & {
|
|
7
|
+
'after-controls'?: (props: typeof __VLS_15) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
+
node: {
|
|
11
|
+
type: PropType<MarkdownAstNode>;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
focused: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:cursor-position": (args_0: number) => any;
|
|
20
|
+
"change-type": (args_0: MarkdownAstNode<object>, args_1: number) => any;
|
|
21
|
+
focus: () => any;
|
|
22
|
+
"update:node": (args_0: Record<string, unknown>) => any;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
node: {
|
|
25
|
+
type: PropType<MarkdownAstNode>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
focused: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
}>> & Readonly<{
|
|
33
|
+
"onUpdate:cursor-position"?: ((args_0: number) => any) | undefined;
|
|
34
|
+
"onChange-type"?: ((args_0: MarkdownAstNode<object>, args_1: number) => any) | undefined;
|
|
35
|
+
onFocus?: (() => any) | undefined;
|
|
36
|
+
"onUpdate:node"?: ((args_0: Record<string, unknown>) => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
39
|
+
declare const _default: typeof __VLS_export;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type MarkdownModuleTextState from "./MarkdownModuleTextState";
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: MarkdownModuleTextState;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:model-value": (componentState: MarkdownModuleTextState) => any;
|
|
9
|
+
"update:cursor-position": (cursorPosition: number) => any;
|
|
10
|
+
"change-type": (newType: import("..").MarkdownAstNodeType) => any;
|
|
11
|
+
"update:modelValue": (value: MarkdownModuleTextState) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
13
|
+
"onUpdate:model-value"?: ((componentState: MarkdownModuleTextState) => any) | undefined;
|
|
14
|
+
"onUpdate:cursor-position"?: ((cursorPosition: number) => any) | undefined;
|
|
15
|
+
"onChange-type"?: ((newType: import("..").MarkdownAstNodeType) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: MarkdownModuleTextState) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type MarkdownModuleTextState from "./MarkdownModuleTextState";
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: MarkdownModuleTextState;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:model-value": (componentState: MarkdownModuleTextState) => any;
|
|
9
|
+
"update:cursor-position": (cursorPosition: number) => any;
|
|
10
|
+
"change-type": (newType: import("..").MarkdownAstNodeType) => any;
|
|
11
|
+
"update:modelValue": (value: MarkdownModuleTextState) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
13
|
+
"onUpdate:model-value"?: ((componentState: MarkdownModuleTextState) => any) | undefined;
|
|
14
|
+
"onUpdate:cursor-position"?: ((cursorPosition: number) => any) | undefined;
|
|
15
|
+
"onChange-type"?: ((newType: import("..").MarkdownAstNodeType) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: MarkdownModuleTextState) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type MarkdownModuleTextState from "./MarkdownModuleTextState";
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: MarkdownModuleTextState;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:model-value": (componentState: MarkdownModuleTextState) => any;
|
|
9
|
+
"update:cursor-position": (cursorPosition: number) => any;
|
|
10
|
+
"change-type": (newType: import("..").MarkdownAstNodeType) => any;
|
|
11
|
+
"update:modelValue": (value: MarkdownModuleTextState) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
13
|
+
"onUpdate:model-value"?: ((componentState: MarkdownModuleTextState) => any) | undefined;
|
|
14
|
+
"onUpdate:cursor-position"?: ((cursorPosition: number) => any) | undefined;
|
|
15
|
+
"onChange-type"?: ((newType: import("..").MarkdownAstNodeType) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: MarkdownModuleTextState) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type MarkdownModuleImageState from "./MarkdownModuleImageState";
|
|
2
|
+
declare function focus(): void;
|
|
3
|
+
type __VLS_ModelProps = {
|
|
4
|
+
modelValue: MarkdownModuleImageState;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {
|
|
7
|
+
focus: typeof focus;
|
|
8
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (value: MarkdownModuleImageState) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: MarkdownModuleImageState) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type MarkdownModuleTextState from "./MarkdownModuleTextState";
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: MarkdownModuleTextState;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:model-value": (componentState: MarkdownModuleTextState) => any;
|
|
9
|
+
"update:cursor-position": (cursorPosition: number) => any;
|
|
10
|
+
"change-type": (newType: import("..").MarkdownAstNodeType) => any;
|
|
11
|
+
"update:modelValue": (value: MarkdownModuleTextState) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
13
|
+
"onUpdate:model-value"?: ((componentState: MarkdownModuleTextState) => any) | undefined;
|
|
14
|
+
"onUpdate:cursor-position"?: ((cursorPosition: number) => any) | undefined;
|
|
15
|
+
"onChange-type"?: ((newType: import("..").MarkdownAstNodeType) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: MarkdownModuleTextState) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type MarkdownModuleImageState from "../Modules/MarkdownModuleImageState";
|
|
2
|
+
import type MarkdownModuleTextState from "../Modules/MarkdownModuleTextState";
|
|
3
|
+
import type MarkdownNodeType from "./MarkdownAstNodeType";
|
|
4
|
+
export declare class MarkdownAstNode<TState extends object = object> {
|
|
5
|
+
id: symbol;
|
|
6
|
+
type: MarkdownNodeType;
|
|
7
|
+
componentState: TState;
|
|
8
|
+
editingState: {
|
|
9
|
+
cursorPosition: number;
|
|
10
|
+
};
|
|
11
|
+
constructor(value: Omit<MarkdownAstNode<TState>, "id">);
|
|
12
|
+
}
|
|
13
|
+
export type TextNode = MarkdownAstNode<MarkdownModuleTextState>;
|
|
14
|
+
export type ImageNode = MarkdownAstNode<MarkdownModuleImageState>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare enum MarkdownNodeType {
|
|
2
|
+
PARAGRAPH = 0,
|
|
3
|
+
HEADLINE1 = 1,
|
|
4
|
+
HEADLINE2 = 2,
|
|
5
|
+
HEADLINE3 = 3,
|
|
6
|
+
IMAGE = 4,
|
|
7
|
+
LIST = 5
|
|
8
|
+
}
|
|
9
|
+
export type TextishNodeType = MarkdownNodeType.PARAGRAPH | MarkdownNodeType.LIST | MarkdownNodeType.HEADLINE1 | MarkdownNodeType.HEADLINE2 | MarkdownNodeType.HEADLINE3;
|
|
10
|
+
export declare function isTextNodeType(type: MarkdownNodeType): type is TextishNodeType;
|
|
11
|
+
export default MarkdownNodeType;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type MarkdownModuleTextState from "../Modules/MarkdownModuleTextState";
|
|
2
|
+
import type MarkdownAstNodeType from "./MarkdownAstNodeType";
|
|
3
|
+
export interface TextishEmits {
|
|
4
|
+
"update:model-value": [componentState: MarkdownModuleTextState];
|
|
5
|
+
"update:cursor-position": [cursorPosition: number];
|
|
6
|
+
"change-type": [newType: MarkdownAstNodeType];
|
|
7
|
+
}
|
|
8
|
+
export interface TextishEmitFunction {
|
|
9
|
+
(event: "update:model-value", value: MarkdownModuleTextState): void;
|
|
10
|
+
(event: "update:cursor-position", value: number): void;
|
|
11
|
+
(event: "change-type", value: MarkdownAstNodeType): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as MarkdownEditor } from './MarkdownEditor.vue';
|
|
2
|
+
export { useMarkdownEditor, type MarkdownEditorInstance } from "./Composable/useMarkdownEditor";
|
|
3
|
+
export { isTextNodeState } from "./MarkdownComponentRegistry";
|
|
4
|
+
export { MarkdownAstNode, type ImageNode, type TextNode } from "./Types/MarkdownAstNode";
|
|
5
|
+
export { default as MarkdownAstNodeType, isTextNodeType, type TextishNodeType } from "./Types/MarkdownAstNodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MarkdownEditor/';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
[data-v-aa7529af],[data-v-0d04047d]{background:0 0;border:none;outline:none}.markdown-editor-modal-overlay[data-v-3e773d7f]{z-index:9999;background:#00000080;justify-content:center;align-items:center;padding:1rem;display:flex;position:fixed;inset:0}.markdown-editor-modal[data-v-3e773d7f]{background:#fff;border-radius:.75rem;flex-direction:column;width:100%;max-width:32rem;max-height:90vh;display:flex;box-shadow:0 20px 25px -5px #0000001a,0 10px 10px -5px #0000000a}.markdown-editor-modal-header[data-v-3e773d7f]{border-bottom:1px solid #e5e7eb;justify-content:space-between;align-items:center;padding:1.25rem 1.5rem;display:flex}.markdown-editor-modal-title[data-v-3e773d7f]{color:#111827;margin:0;font-size:1.125rem;font-weight:600}.markdown-editor-modal-close[data-v-3e773d7f]{color:#6b7280;cursor:pointer;background:0 0;border:none;border-radius:.375rem;justify-content:center;align-items:center;width:2rem;height:2rem;padding:0;font-size:1.75rem;line-height:1;transition:all .15s;display:flex}.markdown-editor-modal-close[data-v-3e773d7f]:hover{color:#111827;background:#f3f4f6}.markdown-editor-modal-body[data-v-3e773d7f]{flex:1;padding:1.5rem;overflow-y:auto}.markdown-editor-modal-footer[data-v-3e773d7f]{border-top:1px solid #e5e7eb;justify-content:flex-end;gap:.75rem;padding:1.25rem 1.5rem;display:flex}.markdown-editor-modal-button[data-v-3e773d7f]{cursor:pointer;border:none;border-radius:.5rem;padding:.625rem 1.25rem;font-size:.875rem;font-weight:500;transition:all .15s}.markdown-editor-modal-button[data-v-3e773d7f]:active{transform:scale(.98)}.markdown-editor-modal-button-secondary[data-v-3e773d7f]{color:#374151;background:#f3f4f6}.markdown-editor-modal-button-secondary[data-v-3e773d7f]:hover{background:#e5e7eb}.markdown-editor-modal-button-primary[data-v-3e773d7f]{color:#fff;background:#3b82f6}.markdown-editor-modal-button-primary[data-v-3e773d7f]:hover{background:#2563eb}.markdown-module-image[data-v-a762fc53]{cursor:pointer;text-align:center;position:relative}.markdown-module-image img[data-v-a762fc53]{max-width:100%;height:auto}.markdown-module-image span[data-v-a762fc53]{color:#6b7280;margin-top:.25rem;font-size:.875rem;display:block}.markdown-module-image-form[data-v-a762fc53]{flex-direction:column;gap:1.25rem;display:flex}.markdown-module-image-form-field[data-v-a762fc53]{flex-direction:column;gap:.5rem;display:flex}.markdown-module-image-form-field label[data-v-a762fc53]{color:#374151;font-size:.875rem;font-weight:500}.markdown-module-image-form-field input[data-v-a762fc53]{color:#111827;background:#fff;border:1px solid #d1d5db;border-radius:.5rem;padding:.625rem .875rem;font-size:.875rem;transition:all .15s}.markdown-module-image-form-field input[data-v-a762fc53]:focus{border-color:#3b82f6;outline:none;box-shadow:0 0 0 3px #3b82f61a}.markdown-module-image-form-field input[data-v-a762fc53]::placeholder{color:#9ca3af}[data-v-a762fc53]{background:0 0;border:none;outline:none}.markdown-editor-module[data-v-611f8edd]{flex-direction:row;gap:1rem;display:flex}.markdown-editor-module[data-v-611f8edd] .tiptap{outline:none}.markdown-editor-module .markdown-editor-module-content[data-v-611f8edd]{outline:none;width:100%}.markdown-editor-module .drag-handle[data-v-611f8edd]{cursor:grab;-webkit-user-select:none;user-select:none;opacity:.5;padding:0 .25rem;font-size:1rem}.markdown-editor-module .drag-handle[data-v-611f8edd]:active{cursor:grabbing}.markdown-editor-module .markdown-editor-module-controls[data-v-611f8edd]{flex-direction:row;align-items:center;gap:.25rem;width:6rem;display:flex}.markdown-editor-module .markdown-editor-module-content-focused[data-v-611f8edd]{background-color:#9e95950d}p{margin:.5rem 0}strong,b{font-weight:700}em,i{font-style:italic}code{color:green;background:#7f7f7f26;border-radius:3px;padding:.1em .3em;font-family:monospace;font-size:.9em}h1{margin:0;font-size:2em}h2{margin:0;font-size:1.5em}h3{margin:0;font-size:1.17em}
|
|
2
|
+
/*$vite$:1*/
|