@vscode/markdown-editor 0.0.2-51 → 0.0.2-53

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,65 @@
1
+ /**
2
+ * Canonical editor command catalog. Standalone keyboard handling and host
3
+ * integrations derive their command registration and default keybindings from
4
+ * this list.
5
+ */
6
+ export declare const commands: readonly EditorCommandDefinition[];
7
+
8
+ export declare type CursorKeyboardAction = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'visualLineStart' | 'visualLineEnd' | 'logicalLineStart' | 'logicalLineEnd' | 'documentStart' | 'documentEnd';
9
+
10
+ export declare type EditKeyboardAction = 'deleteLeft' | 'deleteRight' | 'deleteWordLeft' | 'deleteWordRight' | 'deleteLineLeft' | 'deleteLineRight';
11
+
12
+ export declare interface EditorCommandDefinition {
13
+ readonly id: `markdown.editor.${string}`;
14
+ readonly title: string;
15
+ readonly action: EditorKeyboardAction;
16
+ readonly keybindings: readonly EditorCommandKeybinding[];
17
+ /**
18
+ * Local commands must execute synchronously in the webview instead of being
19
+ * forwarded through the VS Code keybinding service.
20
+ */
21
+ readonly routing?: 'host' | 'local';
22
+ }
23
+
24
+ export declare interface EditorCommandKeybinding {
25
+ readonly key: string;
26
+ readonly modifiers?: KeyboardModifiers;
27
+ readonly platforms?: readonly KeyboardPlatform[];
28
+ }
29
+
30
+ export declare type EditorKeyboardAction = {
31
+ readonly kind: 'cursor';
32
+ readonly command: CursorKeyboardAction;
33
+ readonly extend: boolean;
34
+ } | {
35
+ readonly kind: 'edit';
36
+ readonly command: EditKeyboardAction;
37
+ } | {
38
+ readonly kind: 'history';
39
+ readonly command: HistoryKeyboardAction;
40
+ } | {
41
+ readonly kind: 'tab';
42
+ readonly command: TabKeyboardAction;
43
+ } | {
44
+ readonly kind: 'toggleTabFocus';
45
+ } | {
46
+ readonly kind: 'selectAll';
47
+ } | {
48
+ readonly kind: 'enter';
49
+ readonly command: 'smartEnter' | 'insertParagraph' | 'insertHardLineBreak';
50
+ };
51
+
52
+ export declare type HistoryKeyboardAction = 'undo' | 'redo';
53
+
54
+ export declare interface KeyboardModifiers {
55
+ readonly shift?: boolean;
56
+ readonly alt?: boolean;
57
+ readonly ctrl?: boolean;
58
+ readonly meta?: boolean;
59
+ }
60
+
61
+ export declare type KeyboardPlatform = 'macos' | 'windows' | 'linux';
62
+
63
+ export declare type TabKeyboardAction = 'insert' | 'outdent';
64
+
65
+ export { }
@@ -0,0 +1,159 @@
1
+ const r = ["macos"], i = ["windows", "linux"], o = (n, u = !1) => ({
2
+ kind: "cursor",
3
+ command: n,
4
+ extend: u
5
+ }), d = (n) => ({ kind: "edit", command: n }), l = (n) => ({ kind: "history", command: n }), s = (n) => ({ kind: "tab", command: n }), c = (n) => ({
6
+ kind: "enter",
7
+ command: n
8
+ }), t = (n, u, a) => ({ key: n, modifiers: u, platforms: a }), e = (n, u, a, m, w = "host") => ({ id: n, title: u, action: a, keybindings: m, routing: w }), L = [
9
+ e("markdown.editor.cursorLeft", "Move Cursor Left", o("left"), [
10
+ t("b", { ctrl: !0 }, r),
11
+ t("ArrowLeft")
12
+ ]),
13
+ e("markdown.editor.cursorRight", "Move Cursor Right", o("right"), [
14
+ t("f", { ctrl: !0 }, r),
15
+ t("ArrowRight")
16
+ ]),
17
+ e("markdown.editor.cursorUp", "Move Cursor Up", o("up"), [
18
+ t("p", { ctrl: !0 }, r),
19
+ t("ArrowUp")
20
+ ]),
21
+ e("markdown.editor.cursorDown", "Move Cursor Down", o("down"), [
22
+ t("n", { ctrl: !0 }, r),
23
+ t("ArrowDown")
24
+ ]),
25
+ e("markdown.editor.cursorLeftSelect", "Select Left", o("left", !0), [
26
+ t("ArrowLeft", { shift: !0 })
27
+ ]),
28
+ e("markdown.editor.cursorRightSelect", "Select Right", o("right", !0), [
29
+ t("ArrowRight", { shift: !0 })
30
+ ]),
31
+ e("markdown.editor.cursorUpSelect", "Select Up", o("up", !0), [
32
+ t("ArrowUp", { shift: !0 })
33
+ ]),
34
+ e("markdown.editor.cursorDownSelect", "Select Down", o("down", !0), [
35
+ t("ArrowDown", { shift: !0 })
36
+ ]),
37
+ e("markdown.editor.cursorWordLeft", "Move Cursor Word Left", o("wordLeft"), [
38
+ t("ArrowLeft", { alt: !0 }, r),
39
+ t("ArrowLeft", { ctrl: !0 }, i)
40
+ ]),
41
+ e("markdown.editor.cursorWordRight", "Move Cursor Word Right", o("wordRight"), [
42
+ t("ArrowRight", { alt: !0 }, r),
43
+ t("ArrowRight", { ctrl: !0 }, i)
44
+ ]),
45
+ e("markdown.editor.cursorWordLeftSelect", "Select Word Left", o("wordLeft", !0), [
46
+ t("ArrowLeft", { alt: !0, shift: !0 }, r),
47
+ t("ArrowLeft", { ctrl: !0, shift: !0 }, i)
48
+ ]),
49
+ e("markdown.editor.cursorWordRightSelect", "Select Word Right", o("wordRight", !0), [
50
+ t("ArrowRight", { alt: !0, shift: !0 }, r),
51
+ t("ArrowRight", { ctrl: !0, shift: !0 }, i)
52
+ ]),
53
+ e("markdown.editor.cursorVisualLineStart", "Move Cursor to Visual Line Start", o("visualLineStart"), [
54
+ t("ArrowLeft", { meta: !0 }, r),
55
+ t("Home")
56
+ ]),
57
+ e("markdown.editor.cursorVisualLineEnd", "Move Cursor to Visual Line End", o("visualLineEnd"), [
58
+ t("ArrowRight", { meta: !0 }, r),
59
+ t("End")
60
+ ]),
61
+ e("markdown.editor.cursorVisualLineStartSelect", "Select to Visual Line Start", o("visualLineStart", !0), [
62
+ t("ArrowLeft", { meta: !0, shift: !0 }, r),
63
+ t("Home", { shift: !0 })
64
+ ]),
65
+ e("markdown.editor.cursorVisualLineEndSelect", "Select to Visual Line End", o("visualLineEnd", !0), [
66
+ t("ArrowRight", { meta: !0, shift: !0 }, r),
67
+ t("End", { shift: !0 })
68
+ ]),
69
+ e("markdown.editor.cursorLogicalLineStart", "Move Cursor to Logical Line Start", o("logicalLineStart"), [
70
+ t("a", { ctrl: !0 }, r)
71
+ ]),
72
+ e("markdown.editor.cursorLogicalLineEnd", "Move Cursor to Logical Line End", o("logicalLineEnd"), [
73
+ t("e", { ctrl: !0 }, r)
74
+ ]),
75
+ e("markdown.editor.cursorLogicalLineStartSelect", "Select to Logical Line Start", o("logicalLineStart", !0), [
76
+ t("a", { ctrl: !0, shift: !0 }, r)
77
+ ]),
78
+ e("markdown.editor.cursorLogicalLineEndSelect", "Select to Logical Line End", o("logicalLineEnd", !0), [
79
+ t("e", { ctrl: !0, shift: !0 }, r)
80
+ ]),
81
+ e("markdown.editor.cursorDocumentStart", "Move Cursor to Document Start", o("documentStart"), [
82
+ t("ArrowUp", { meta: !0 }, r),
83
+ t("Home", { ctrl: !0 }, i)
84
+ ]),
85
+ e("markdown.editor.cursorDocumentEnd", "Move Cursor to Document End", o("documentEnd"), [
86
+ t("ArrowDown", { meta: !0 }, r),
87
+ t("End", { ctrl: !0 }, i)
88
+ ]),
89
+ e("markdown.editor.cursorDocumentStartSelect", "Select to Document Start", o("documentStart", !0), [
90
+ t("ArrowUp", { meta: !0, shift: !0 }, r),
91
+ t("Home", { ctrl: !0, shift: !0 }, i)
92
+ ]),
93
+ e("markdown.editor.cursorDocumentEndSelect", "Select to Document End", o("documentEnd", !0), [
94
+ t("ArrowDown", { meta: !0, shift: !0 }, r),
95
+ t("End", { ctrl: !0, shift: !0 }, i)
96
+ ]),
97
+ e("markdown.editor.selectAll", "Select All", { kind: "selectAll" }, [
98
+ t("a", { meta: !0 }, r),
99
+ t("a", { ctrl: !0 }, i)
100
+ ]),
101
+ e("markdown.editor.deleteLeft", "Delete Left", d("deleteLeft"), [
102
+ t("h", { ctrl: !0 }, r),
103
+ t("Backspace", { ctrl: !0 }, r),
104
+ t("Backspace"),
105
+ t("Backspace", { shift: !0 })
106
+ ]),
107
+ e("markdown.editor.deleteRight", "Delete Right", d("deleteRight"), [
108
+ t("d", { ctrl: !0 }, r),
109
+ t("Delete", { ctrl: !0 }, r),
110
+ t("Delete")
111
+ ]),
112
+ e("markdown.editor.deleteWordLeft", "Delete Word Left", d("deleteWordLeft"), [
113
+ t("Backspace", { alt: !0 }, r),
114
+ t("Backspace", { ctrl: !0 }, i)
115
+ ]),
116
+ e("markdown.editor.deleteWordRight", "Delete Word Right", d("deleteWordRight"), [
117
+ t("Delete", { alt: !0 }, r),
118
+ t("Delete", { ctrl: !0 }, i)
119
+ ]),
120
+ e("markdown.editor.deleteLineLeft", "Delete All Left", d("deleteLineLeft"), [
121
+ t("Backspace", { meta: !0 }, r)
122
+ ]),
123
+ e("markdown.editor.deleteLineRight", "Delete All Right", d("deleteLineRight"), [
124
+ t("Delete", { meta: !0 }, r),
125
+ t("k", { ctrl: !0 }, r)
126
+ ]),
127
+ e("markdown.editor.undo", "Undo", l("undo"), [
128
+ t("z", { meta: !0 }, r),
129
+ t("z", { ctrl: !0 }, i)
130
+ ]),
131
+ e("markdown.editor.redo", "Redo", l("redo"), [
132
+ t("z", { meta: !0, shift: !0 }, r),
133
+ t("z", { ctrl: !0, shift: !0 }, i),
134
+ t("y", { ctrl: !0 }, i)
135
+ ]),
136
+ e("markdown.editor.insertTab", "Insert Tab", s("insert"), [
137
+ t("Tab")
138
+ ], "local"),
139
+ e("markdown.editor.outdent", "Outdent", s("outdent"), [
140
+ t("Tab", { shift: !0 })
141
+ ], "local"),
142
+ e("markdown.editor.toggleTabFocus", "Toggle Tab Key Moves Focus", { kind: "toggleTabFocus" }, [
143
+ t("m", { ctrl: !0 })
144
+ ], "local"),
145
+ e("markdown.editor.smartEnter", "Insert Paragraph", c("smartEnter"), [
146
+ t("Enter")
147
+ ]),
148
+ e("markdown.editor.insertHardLineBreak", "Insert Hard Line Break", c("insertHardLineBreak"), [
149
+ t("Enter", { shift: !0 })
150
+ ]),
151
+ e("markdown.editor.insertParagraph", "Insert Paragraph Without Continuing Markup", c("insertParagraph"), [
152
+ t("Enter", { meta: !0 }, r),
153
+ t("Enter", { ctrl: !0 })
154
+ ])
155
+ ];
156
+ export {
157
+ L as commands
158
+ };
159
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sources":["../src/editorCommands.ts"],"sourcesContent":["export type KeyboardPlatform = 'macos' | 'windows' | 'linux';\n\nexport type CursorKeyboardAction =\n\t| 'left'\n\t| 'right'\n\t| 'up'\n\t| 'down'\n\t| 'wordLeft'\n\t| 'wordRight'\n\t| 'visualLineStart'\n\t| 'visualLineEnd'\n\t| 'logicalLineStart'\n\t| 'logicalLineEnd'\n\t| 'documentStart'\n\t| 'documentEnd';\n\nexport type EditKeyboardAction =\n\t| 'deleteLeft'\n\t| 'deleteRight'\n\t| 'deleteWordLeft'\n\t| 'deleteWordRight'\n\t| 'deleteLineLeft'\n\t| 'deleteLineRight';\n\nexport type HistoryKeyboardAction = 'undo' | 'redo';\nexport type TabKeyboardAction = 'insert' | 'outdent';\n\nexport type EditorKeyboardAction =\n\t| { readonly kind: 'cursor'; readonly command: CursorKeyboardAction; readonly extend: boolean }\n\t| { readonly kind: 'edit'; readonly command: EditKeyboardAction }\n\t| { readonly kind: 'history'; readonly command: HistoryKeyboardAction }\n\t| { readonly kind: 'tab'; readonly command: TabKeyboardAction }\n\t| { readonly kind: 'toggleTabFocus' }\n\t| { readonly kind: 'selectAll' }\n\t| { readonly kind: 'enter'; readonly command: 'smartEnter' | 'insertParagraph' | 'insertHardLineBreak' };\n\nexport interface KeyboardModifiers {\n\treadonly shift?: boolean;\n\treadonly alt?: boolean;\n\treadonly ctrl?: boolean;\n\treadonly meta?: boolean;\n}\n\nexport interface EditorCommandKeybinding {\n\treadonly key: string;\n\treadonly modifiers?: KeyboardModifiers;\n\treadonly platforms?: readonly KeyboardPlatform[];\n}\n\nexport interface EditorCommandDefinition {\n\treadonly id: `markdown.editor.${string}`;\n\treadonly title: string;\n\treadonly action: EditorKeyboardAction;\n\treadonly keybindings: readonly EditorCommandKeybinding[];\n\t/**\n\t * Local commands must execute synchronously in the webview instead of being\n\t * forwarded through the VS Code keybinding service.\n\t */\n\treadonly routing?: 'host' | 'local';\n}\n\nconst MACOS = ['macos'] as const;\nconst NON_MACOS = ['windows', 'linux'] as const;\n\nconst cursor = (command: CursorKeyboardAction, extend = false): EditorKeyboardAction => ({\n\tkind: 'cursor',\n\tcommand,\n\textend,\n});\nconst edit = (command: EditKeyboardAction): EditorKeyboardAction => ({ kind: 'edit', command });\nconst history = (command: HistoryKeyboardAction): EditorKeyboardAction => ({ kind: 'history', command });\nconst tab = (command: TabKeyboardAction): EditorKeyboardAction => ({ kind: 'tab', command });\nconst enter = (command: 'smartEnter' | 'insertParagraph' | 'insertHardLineBreak'): EditorKeyboardAction => ({\n\tkind: 'enter',\n\tcommand,\n});\nconst binding = (\n\tkey: string,\n\tmodifiers?: KeyboardModifiers,\n\tplatforms?: readonly KeyboardPlatform[],\n): EditorCommandKeybinding => ({ key, modifiers, platforms });\nconst command = (\n\tid: EditorCommandDefinition['id'],\n\ttitle: string,\n\taction: EditorKeyboardAction,\n\tkeybindings: readonly EditorCommandKeybinding[],\n\trouting: EditorCommandDefinition['routing'] = 'host',\n): EditorCommandDefinition => ({ id, title, action, keybindings, routing });\n\n/**\n * Canonical editor command catalog. Standalone keyboard handling and host\n * integrations derive their command registration and default keybindings from\n * this list.\n */\nexport const commands: readonly EditorCommandDefinition[] = [\n\tcommand('markdown.editor.cursorLeft', 'Move Cursor Left', cursor('left'), [\n\t\tbinding('b', { ctrl: true }, MACOS),\n\t\tbinding('ArrowLeft'),\n\t]),\n\tcommand('markdown.editor.cursorRight', 'Move Cursor Right', cursor('right'), [\n\t\tbinding('f', { ctrl: true }, MACOS),\n\t\tbinding('ArrowRight'),\n\t]),\n\tcommand('markdown.editor.cursorUp', 'Move Cursor Up', cursor('up'), [\n\t\tbinding('p', { ctrl: true }, MACOS),\n\t\tbinding('ArrowUp'),\n\t]),\n\tcommand('markdown.editor.cursorDown', 'Move Cursor Down', cursor('down'), [\n\t\tbinding('n', { ctrl: true }, MACOS),\n\t\tbinding('ArrowDown'),\n\t]),\n\tcommand('markdown.editor.cursorLeftSelect', 'Select Left', cursor('left', true), [\n\t\tbinding('ArrowLeft', { shift: true }),\n\t]),\n\tcommand('markdown.editor.cursorRightSelect', 'Select Right', cursor('right', true), [\n\t\tbinding('ArrowRight', { shift: true }),\n\t]),\n\tcommand('markdown.editor.cursorUpSelect', 'Select Up', cursor('up', true), [\n\t\tbinding('ArrowUp', { shift: true }),\n\t]),\n\tcommand('markdown.editor.cursorDownSelect', 'Select Down', cursor('down', true), [\n\t\tbinding('ArrowDown', { shift: true }),\n\t]),\n\tcommand('markdown.editor.cursorWordLeft', 'Move Cursor Word Left', cursor('wordLeft'), [\n\t\tbinding('ArrowLeft', { alt: true }, MACOS),\n\t\tbinding('ArrowLeft', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.cursorWordRight', 'Move Cursor Word Right', cursor('wordRight'), [\n\t\tbinding('ArrowRight', { alt: true }, MACOS),\n\t\tbinding('ArrowRight', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.cursorWordLeftSelect', 'Select Word Left', cursor('wordLeft', true), [\n\t\tbinding('ArrowLeft', { alt: true, shift: true }, MACOS),\n\t\tbinding('ArrowLeft', { ctrl: true, shift: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.cursorWordRightSelect', 'Select Word Right', cursor('wordRight', true), [\n\t\tbinding('ArrowRight', { alt: true, shift: true }, MACOS),\n\t\tbinding('ArrowRight', { ctrl: true, shift: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.cursorVisualLineStart', 'Move Cursor to Visual Line Start', cursor('visualLineStart'), [\n\t\tbinding('ArrowLeft', { meta: true }, MACOS),\n\t\tbinding('Home'),\n\t]),\n\tcommand('markdown.editor.cursorVisualLineEnd', 'Move Cursor to Visual Line End', cursor('visualLineEnd'), [\n\t\tbinding('ArrowRight', { meta: true }, MACOS),\n\t\tbinding('End'),\n\t]),\n\tcommand('markdown.editor.cursorVisualLineStartSelect', 'Select to Visual Line Start', cursor('visualLineStart', true), [\n\t\tbinding('ArrowLeft', { meta: true, shift: true }, MACOS),\n\t\tbinding('Home', { shift: true }),\n\t]),\n\tcommand('markdown.editor.cursorVisualLineEndSelect', 'Select to Visual Line End', cursor('visualLineEnd', true), [\n\t\tbinding('ArrowRight', { meta: true, shift: true }, MACOS),\n\t\tbinding('End', { shift: true }),\n\t]),\n\tcommand('markdown.editor.cursorLogicalLineStart', 'Move Cursor to Logical Line Start', cursor('logicalLineStart'), [\n\t\tbinding('a', { ctrl: true }, MACOS),\n\t]),\n\tcommand('markdown.editor.cursorLogicalLineEnd', 'Move Cursor to Logical Line End', cursor('logicalLineEnd'), [\n\t\tbinding('e', { ctrl: true }, MACOS),\n\t]),\n\tcommand('markdown.editor.cursorLogicalLineStartSelect', 'Select to Logical Line Start', cursor('logicalLineStart', true), [\n\t\tbinding('a', { ctrl: true, shift: true }, MACOS),\n\t]),\n\tcommand('markdown.editor.cursorLogicalLineEndSelect', 'Select to Logical Line End', cursor('logicalLineEnd', true), [\n\t\tbinding('e', { ctrl: true, shift: true }, MACOS),\n\t]),\n\tcommand('markdown.editor.cursorDocumentStart', 'Move Cursor to Document Start', cursor('documentStart'), [\n\t\tbinding('ArrowUp', { meta: true }, MACOS),\n\t\tbinding('Home', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.cursorDocumentEnd', 'Move Cursor to Document End', cursor('documentEnd'), [\n\t\tbinding('ArrowDown', { meta: true }, MACOS),\n\t\tbinding('End', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.cursorDocumentStartSelect', 'Select to Document Start', cursor('documentStart', true), [\n\t\tbinding('ArrowUp', { meta: true, shift: true }, MACOS),\n\t\tbinding('Home', { ctrl: true, shift: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.cursorDocumentEndSelect', 'Select to Document End', cursor('documentEnd', true), [\n\t\tbinding('ArrowDown', { meta: true, shift: true }, MACOS),\n\t\tbinding('End', { ctrl: true, shift: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.selectAll', 'Select All', { kind: 'selectAll' }, [\n\t\tbinding('a', { meta: true }, MACOS),\n\t\tbinding('a', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.deleteLeft', 'Delete Left', edit('deleteLeft'), [\n\t\tbinding('h', { ctrl: true }, MACOS),\n\t\tbinding('Backspace', { ctrl: true }, MACOS),\n\t\tbinding('Backspace'),\n\t\tbinding('Backspace', { shift: true }),\n\t]),\n\tcommand('markdown.editor.deleteRight', 'Delete Right', edit('deleteRight'), [\n\t\tbinding('d', { ctrl: true }, MACOS),\n\t\tbinding('Delete', { ctrl: true }, MACOS),\n\t\tbinding('Delete'),\n\t]),\n\tcommand('markdown.editor.deleteWordLeft', 'Delete Word Left', edit('deleteWordLeft'), [\n\t\tbinding('Backspace', { alt: true }, MACOS),\n\t\tbinding('Backspace', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.deleteWordRight', 'Delete Word Right', edit('deleteWordRight'), [\n\t\tbinding('Delete', { alt: true }, MACOS),\n\t\tbinding('Delete', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.deleteLineLeft', 'Delete All Left', edit('deleteLineLeft'), [\n\t\tbinding('Backspace', { meta: true }, MACOS),\n\t]),\n\tcommand('markdown.editor.deleteLineRight', 'Delete All Right', edit('deleteLineRight'), [\n\t\tbinding('Delete', { meta: true }, MACOS),\n\t\tbinding('k', { ctrl: true }, MACOS),\n\t]),\n\tcommand('markdown.editor.undo', 'Undo', history('undo'), [\n\t\tbinding('z', { meta: true }, MACOS),\n\t\tbinding('z', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.redo', 'Redo', history('redo'), [\n\t\tbinding('z', { meta: true, shift: true }, MACOS),\n\t\tbinding('z', { ctrl: true, shift: true }, NON_MACOS),\n\t\tbinding('y', { ctrl: true }, NON_MACOS),\n\t]),\n\tcommand('markdown.editor.insertTab', 'Insert Tab', tab('insert'), [\n\t\tbinding('Tab'),\n\t], 'local'),\n\tcommand('markdown.editor.outdent', 'Outdent', tab('outdent'), [\n\t\tbinding('Tab', { shift: true }),\n\t], 'local'),\n\tcommand('markdown.editor.toggleTabFocus', 'Toggle Tab Key Moves Focus', { kind: 'toggleTabFocus' }, [\n\t\tbinding('m', { ctrl: true }),\n\t], 'local'),\n\tcommand('markdown.editor.smartEnter', 'Insert Paragraph', enter('smartEnter'), [\n\t\tbinding('Enter'),\n\t]),\n\tcommand('markdown.editor.insertHardLineBreak', 'Insert Hard Line Break', enter('insertHardLineBreak'), [\n\t\tbinding('Enter', { shift: true }),\n\t]),\n\tcommand('markdown.editor.insertParagraph', 'Insert Paragraph Without Continuing Markup', enter('insertParagraph'), [\n\t\tbinding('Enter', { meta: true }, MACOS),\n\t\tbinding('Enter', { ctrl: true }),\n\t]),\n];\n"],"names":["MACOS","NON_MACOS","cursor","command","extend","edit","history","tab","enter","binding","key","modifiers","platforms","id","title","action","keybindings","routing","commands"],"mappings":"AA6DA,MAAMA,IAAQ,CAAC,OAAO,GAChBC,IAAY,CAAC,WAAW,OAAO,GAE/BC,IAAS,CAACC,GAA+BC,IAAS,QAAiC;AAAA,EACxF,MAAM;AAAA,EACN,SAAAD;AAAAA,EACA,QAAAC;AACD,IACMC,IAAO,CAACF,OAAuD,EAAE,MAAM,QAAQ,SAAAA,MAC/EG,IAAU,CAACH,OAA0D,EAAE,MAAM,WAAW,SAAAA,MACxFI,IAAM,CAACJ,OAAsD,EAAE,MAAM,OAAO,SAAAA,MAC5EK,IAAQ,CAACL,OAA6F;AAAA,EAC3G,MAAM;AAAA,EACN,SAAAA;AACD,IACMM,IAAU,CACfC,GACAC,GACAC,OAC8B,EAAE,KAAAF,GAAK,WAAAC,GAAW,WAAAC,MAC3CT,IAAU,CACfU,GACAC,GACAC,GACAC,GACAC,IAA8C,YAChB,EAAE,IAAAJ,GAAI,OAAAC,GAAO,QAAAC,GAAQ,aAAAC,GAAa,SAAA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Q,kCAAkC,8BAA8B,EAAE,MAAM,oBAAoB;AAAA,IACnGM,EAAQ,KAAK,EAAE,MAAM,IAAM;AAAA,EAAA,GACzB,OAAO;AAAA,EACVN,EAAQ,8BAA8B,oBAAoBK,EAAM,YAAY,GAAG;AAAA,IAC9EC,EAAQ,OAAO;AAAA,EAAA,CACf;AAAA,EACDN,EAAQ,uCAAuC,0BAA0BK,EAAM,qBAAqB,GAAG;AAAA,IACtGC,EAAQ,SAAS,EAAE,OAAO,IAAM;AAAA,EAAA,CAChC;AAAA,EACDN,EAAQ,mCAAmC,8CAA8CK,EAAM,iBAAiB,GAAG;AAAA,IAClHC,EAAQ,SAAS,EAAE,MAAM,GAAA,GAAQT,CAAK;AAAA,IACtCS,EAAQ,SAAS,EAAE,MAAM,IAAM;AAAA,EAAA,CAC/B;AACF;"}
package/dist/index.d.ts CHANGED
@@ -248,6 +248,10 @@ export declare interface BlockViewOptions {
248
248
  * falls back to the default rendering. EXPERIMENTAL.
249
249
  */
250
250
  readonly embeddedCodeEditorFactory?: IEmbeddedCodeEditorFactory;
251
+ /** Current read-only state forwarded to embedded code editors. */
252
+ readonly embeddedCodeEditorReadOnly?: boolean;
253
+ /** Identity used to invalidate previously created embedded editors. */
254
+ readonly embeddedCodeEditorFactoryVersion?: unknown;
251
255
  /**
252
256
  * Called when an {@link IEmbeddedCodeEditor} edits its content. `contentEdit`
253
257
  * is in the block's *content* coordinates; the host translates it to a
@@ -337,10 +341,18 @@ export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData>
337
341
  * manually (a node reused as `previous` is never {@link dispose}d).
338
342
  */
339
343
  private _embeddedEditor;
344
+ private readonly _embeddedEditorFactoryVersion;
340
345
  constructor(data: CodeBlockViewData, options: BlockViewOptions | undefined, previous: ViewNode | undefined);
341
346
  dispose(): void;
342
347
  }
343
348
 
349
+ /**
350
+ * Canonical editor command catalog. Standalone keyboard handling and host
351
+ * integrations derive their command registration and default keybindings from
352
+ * this list.
353
+ */
354
+ export declare const commands: readonly EditorCommandDefinition[];
355
+
344
356
  /** A persistent comment anchored to a source range. */
345
357
  declare interface Comment_2 {
346
358
  readonly id: string;
@@ -868,7 +880,7 @@ export declare type EditCommand = (ctx: CursorCommandContext) => {
868
880
 
869
881
  export declare type EditKeyboardAction = 'deleteLeft' | 'deleteRight' | 'deleteWordLeft' | 'deleteWordRight' | 'deleteLineLeft' | 'deleteLineRight';
870
882
 
871
- declare interface EditorCommandDefinition {
883
+ export declare interface EditorCommandDefinition {
872
884
  readonly id: `markdown.editor.${string}`;
873
885
  readonly title: string;
874
886
  readonly action: EditorKeyboardAction;
@@ -880,7 +892,7 @@ declare interface EditorCommandDefinition {
880
892
  readonly routing?: 'host' | 'local';
881
893
  }
882
894
 
883
- declare interface EditorCommandKeybinding {
895
+ export declare interface EditorCommandKeybinding {
884
896
  readonly key: string;
885
897
  readonly modifiers?: KeyboardModifiers;
886
898
  readonly platforms?: readonly KeyboardPlatform[];
@@ -1235,8 +1247,11 @@ export declare class EditorView extends Disposable {
1235
1247
  * (those go through the measured-layout model).
1236
1248
  */
1237
1249
  private readonly _document;
1250
+ private readonly _embeddedCodeEditorFactoryVersion;
1238
1251
  /** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
1239
1252
  get documentViewNode(): IObservable<DocumentViewNode | undefined>;
1253
+ /** Re-resolves embedded code editors while preserving the surrounding editor view. */
1254
+ refreshEmbeddedCodeEditors(): void;
1240
1255
  /**
1241
1256
  * Last frame's view-data overlay, threaded back into
1242
1257
  * {@link buildDocumentViewData} so any subtree whose ast and selection flags
@@ -1778,7 +1793,7 @@ declare class HeadingViewData {
1778
1793
 
1779
1794
  export declare function hiddenCursorRanges(doc: DocumentAstNode, markerVisibleBlocks: ReadonlySet<BlockAstNode>, cursor: number): readonly OffsetRange[];
1780
1795
 
1781
- declare type HistoryKeyboardAction = 'undo' | 'redo';
1796
+ export declare type HistoryKeyboardAction = 'undo' | 'redo';
1782
1797
 
1783
1798
  /**
1784
1799
  * The editor operations a clipboard strategy drives. The strategy never
@@ -1855,6 +1870,8 @@ declare interface IEmbeddedCodeEditor {
1855
1870
  * is how edits the editor itself originated are prevented from echoing back.
1856
1871
  */
1857
1872
  setContent(content: string): void;
1873
+ /** Update whether the embedded editor may change its content. */
1874
+ setReadOnly?(readOnly: boolean): void;
1858
1875
  /**
1859
1876
  * Optional synchronous height (px) to reserve for `content` *before* the
1860
1877
  * editor has laid out. Return `undefined` to let the editor size itself
@@ -2807,7 +2824,7 @@ declare class StrongViewData {
2807
2824
  constructor(ast: StrongAstNode, content: readonly AnyViewData[]);
2808
2825
  }
2809
2826
 
2810
- declare type TabKeyboardAction = 'insert' | 'outdent';
2827
+ export declare type TabKeyboardAction = 'insert' | 'outdent';
2811
2828
 
2812
2829
  export declare class TableAstNode extends BlockAstNodeBase {
2813
2830
  readonly content: readonly (TableRowAstNode | GlueAstNode)[];