@powerduck/md-editor 0.10.8 → 0.10.9
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/dist/Editor.d.ts +11 -0
- package/dist/index.cjs +31 -29
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +4780 -2115
- package/dist/plugins/syntax-highlight.d.ts +4 -0
- package/package.json +2 -1
package/dist/Editor.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditorView } from '@codemirror/view';
|
|
2
2
|
import { type MentionOptions } from './plugins/mention.js';
|
|
3
3
|
import { type DocLinkOptions } from './plugins/doclink.js';
|
|
4
|
+
export type EditorTheme = 'light' | 'dark';
|
|
4
5
|
export interface CodeEditorOptions {
|
|
5
6
|
value: string;
|
|
6
7
|
onChange?: (value: string) => void;
|
|
@@ -13,16 +14,20 @@ export interface CodeEditorOptions {
|
|
|
13
14
|
mention?: MentionOptions;
|
|
14
15
|
/** Document link inserter configuration */
|
|
15
16
|
docLink?: DocLinkOptions;
|
|
17
|
+
/** Initial color theme for syntax highlighting. Defaults to 'light'. */
|
|
18
|
+
theme?: EditorTheme;
|
|
16
19
|
}
|
|
17
20
|
export declare class CodeEditor {
|
|
18
21
|
readonly view: EditorView;
|
|
19
22
|
private lineNumbersCompartment;
|
|
20
23
|
private customKeymapCompartment;
|
|
24
|
+
private highlightCompartment;
|
|
21
25
|
private onImageFile?;
|
|
22
26
|
private mention;
|
|
23
27
|
private docLink;
|
|
24
28
|
private blurTimeout;
|
|
25
29
|
private destroyed;
|
|
30
|
+
private theme;
|
|
26
31
|
constructor(container: HTMLElement, options: CodeEditorOptions);
|
|
27
32
|
private handlePaste;
|
|
28
33
|
private handleDrop;
|
|
@@ -37,6 +42,12 @@ export declare class CodeEditor {
|
|
|
37
42
|
getValue(): string;
|
|
38
43
|
setValue(value: string): void;
|
|
39
44
|
setLineNumbers(enabled: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Switch the syntax highlighting theme. Reconfigures only the highlight
|
|
47
|
+
* compartment — the document and view state are preserved, so this is
|
|
48
|
+
* effectively free on large documents.
|
|
49
|
+
*/
|
|
50
|
+
setTheme(theme: EditorTheme): void;
|
|
40
51
|
insertAtCursor(text: string): void;
|
|
41
52
|
/**
|
|
42
53
|
* Wrap the current selection with prefix and suffix. If nothing is
|