@gt-editor/markdown-editor 0.1.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.
@@ -0,0 +1,153 @@
1
+ import { DecorationSet } from '@codemirror/view';
2
+ import { EditorView } from '@codemirror/view';
3
+ import { Extension } from '@codemirror/state';
4
+ import { foldEffect } from '@codemirror/language';
5
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
6
+ import { unfoldEffect } from '@codemirror/language';
7
+ import { ViewPlugin } from '@codemirror/view';
8
+ import { ViewUpdate } from '@codemirror/view';
9
+ import { WidgetType } from '@codemirror/view';
10
+
11
+ export declare class BulletWidget extends WidgetType {
12
+ private indent;
13
+ private hasChildren;
14
+ private view;
15
+ private markerStart;
16
+ private markerEnd;
17
+ constructor(indent: string, hasChildren: boolean | undefined, view: EditorView, markerStart: number, markerEnd: number);
18
+ eq(other: BulletWidget): boolean;
19
+ toDOM(): HTMLSpanElement;
20
+ ignoreEvent(): boolean;
21
+ }
22
+
23
+ declare interface ClipboardConfig {
24
+ onImagePaste?: (base64: string) => Promise<string | null>;
25
+ onGenerateTitle?: (text: string) => Promise<string>;
26
+ }
27
+
28
+ export declare const collapsibleFoldService: Extension;
29
+
30
+ export declare class CollapsibleHeaderWidget extends WidgetType {
31
+ private indent;
32
+ constructor(indent?: string);
33
+ toDOM(): HTMLSpanElement;
34
+ eq(other: CollapsibleHeaderWidget): boolean;
35
+ }
36
+
37
+ export declare function createClipboardKeymap(config?: ClipboardConfig): Extension;
38
+
39
+ export declare const createDarkTheme: (fontSize?: number, contentPaddingX?: number, contentPaddingY?: number) => Extension;
40
+
41
+ export declare function createImagePasteHandler(config: ImagePasteConfig): Extension;
42
+
43
+ export declare function createMarkdownSyntaxPlugin(config?: MarkdownSyntaxConfig): ViewPlugin<{
44
+ decorations: DecorationSet;
45
+ update(update: ViewUpdate): void;
46
+ buildDecorations(view: EditorView): DecorationSet;
47
+ }, undefined>;
48
+
49
+ export declare function createWrapSelectionHandler(): Extension;
50
+
51
+ export { foldEffect }
52
+
53
+ export declare interface FoldRange {
54
+ fromLine: number;
55
+ toLine: number;
56
+ }
57
+
58
+ export declare function hasFoldEffects(effects: readonly {
59
+ is: (type: any) => boolean;
60
+ }[]): boolean;
61
+
62
+ export declare class HiddenWidget extends WidgetType {
63
+ toDOM(): HTMLSpanElement;
64
+ }
65
+
66
+ export declare class HorizontalRuleWidget extends WidgetType {
67
+ toDOM(): HTMLDivElement;
68
+ }
69
+
70
+ export declare interface ImagePasteConfig {
71
+ onImagePaste?: (base64: string) => Promise<string | null>;
72
+ }
73
+
74
+ export declare class ImageWidget extends WidgetType {
75
+ readonly src: string;
76
+ readonly alt: string;
77
+ readonly width: number | null;
78
+ readonly resolveImageUrl?: ((src: string) => string) | undefined;
79
+ readonly isActive: boolean;
80
+ constructor(src: string, alt: string, width: number | null, resolveImageUrl?: ((src: string) => string) | undefined, isActive?: boolean);
81
+ eq(other: ImageWidget): boolean;
82
+ updateDOM(dom: HTMLElement): boolean;
83
+ toDOM(): HTMLDivElement;
84
+ ignoreEvent(): boolean;
85
+ }
86
+
87
+ declare interface IncludeOffset {
88
+ editorLine: number;
89
+ diskLines: number;
90
+ }
91
+
92
+ export declare function loadFoldState(foldStateKey: string | undefined, view: EditorView): void;
93
+
94
+ declare function MarkdownEditor({ content, onChange, fontSize, wordWrap, onImagePaste, resolveImageUrl, foldStateKey, onEditorView, initialScrollTop, resolveInclude, onOpenInclude, onBlur, showLineNumbers, compact, readOnly, contentPaddingX, contentPaddingY, includeOffsets, onGenerateTitle, emojiShortcuts }: MarkdownEditorProps): JSX_2.Element;
95
+ export { MarkdownEditor }
96
+ export default MarkdownEditor;
97
+
98
+ export declare interface MarkdownEditorProps {
99
+ /** Markdown content */
100
+ content: string;
101
+ /** Called when content changes */
102
+ onChange: (content: string) => void;
103
+ /** Font size in pixels (default: 14) */
104
+ fontSize?: number;
105
+ /** Enable word wrap (default: true) */
106
+ wordWrap?: boolean;
107
+ /** Called when user pastes an image. Should return the path to save or null to cancel */
108
+ onImagePaste?: (base64: string) => Promise<string | null>;
109
+ /** Transform image src before loading (e.g., add protocol) */
110
+ resolveImageUrl?: (src: string) => string;
111
+ /** Key for persisting fold state in localStorage. Set to undefined to disable */
112
+ foldStateKey?: string;
113
+ /** Callback to receive the EditorView instance */
114
+ onEditorView?: (view: EditorView | null) => void;
115
+ /** Initial scroll position */
116
+ initialScrollTop?: number;
117
+ /** Resolve include path to file content (for "Copy with includes" feature) */
118
+ resolveInclude?: (relativePath: string) => Promise<string>;
119
+ /** Called when user clicks "open file" on an include link */
120
+ onOpenInclude?: (relativePath: string) => void;
121
+ /** Called when editor loses focus (for auto-save) */
122
+ onBlur?: () => void;
123
+ /** Show line numbers gutter (default: true) */
124
+ showLineNumbers?: boolean;
125
+ /** Disable overscroll padding (default: false). Use for compact/sidebar editors */
126
+ compact?: boolean;
127
+ /** Read-only mode — not editable but widgets (collapsible, links) stay interactive (default: false) */
128
+ readOnly?: boolean;
129
+ /** Horizontal content padding in pixels (default: 16) */
130
+ contentPaddingX?: number;
131
+ /** Vertical content padding in pixels (default: 16) */
132
+ contentPaddingY?: number;
133
+ /** Line offsets for virtual line numbers (transclusion support) */
134
+ includeOffsets?: IncludeOffset[];
135
+ /** Called to generate AI title for Shift+Cmd+V paste */
136
+ onGenerateTitle?: (text: string) => Promise<string>;
137
+ /** Emoji shortcuts for context menu quick-insert */
138
+ emojiShortcuts?: {
139
+ emoji: string;
140
+ name: string;
141
+ description?: string;
142
+ }[];
143
+ }
144
+
145
+ export declare interface MarkdownSyntaxConfig {
146
+ resolveImageUrl?: (src: string) => string;
147
+ }
148
+
149
+ export declare function saveFoldState(foldStateKey: string | undefined, view: EditorView): void;
150
+
151
+ export { unfoldEffect }
152
+
153
+ export { }