@meowdown/core 0.83.3 → 0.84.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 +1 -1
- package/dist/class-names.d.ts +189 -0
- package/dist/class-names.js +190 -0
- package/dist/index.d.ts +93 -3
- package/dist/index.js +269 -97
- package/dist/style.css +177 -3
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ the current block to that level (or back to a paragraph).
|
|
|
60
60
|
| `Mod-Alt-5` | Heading 5 | `##### heading` |
|
|
61
61
|
| `Mod-Alt-6` | Heading 6 | `###### heading` |
|
|
62
62
|
| `Mod-.` | Fold or unfold a bullet | |
|
|
63
|
-
| `Mod-/` | Open the code block menu
|
|
63
|
+
| `Mod-/` | Open the code block or embed menu | |
|
|
64
64
|
| `Shift-Enter` | Insert a line break | |
|
|
65
65
|
| `Mod-Enter` | Follow the link under the caret, or cycle a checkbox task | `- [ ]` / `- [x]` |
|
|
66
66
|
| `Mod-Shift-Enter` | Cycle a circle checkbox task | `+ [ ]` / `+ [x]` |
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The root of the editable document, and of a `MarkdownView`.
|
|
3
|
+
*/
|
|
4
|
+
export declare const CONTENT_CLASS = "meowdown-content";
|
|
5
|
+
/**
|
|
6
|
+
* The `mdMark` mark: a run of Markdown syntax characters.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SYNTAX_MARK_CLASS = "md-mark";
|
|
9
|
+
/**
|
|
10
|
+
* The `mdImage` mark.
|
|
11
|
+
*/
|
|
12
|
+
export declare const IMAGE_MARK_CLASS = "md-image";
|
|
13
|
+
/**
|
|
14
|
+
* The `mdLinkText` mark, and a rendered link in a `MarkdownView`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LINK_TEXT_MARK_CLASS = "md-link";
|
|
17
|
+
/**
|
|
18
|
+
* The `mdLinkUri` mark.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LINK_URI_MARK_CLASS = "md-link-uri";
|
|
21
|
+
/**
|
|
22
|
+
* The `mdLinkTitle` mark.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LINK_TITLE_MARK_CLASS = "md-link-title";
|
|
25
|
+
/**
|
|
26
|
+
* The `mdTag` mark.
|
|
27
|
+
*/
|
|
28
|
+
export declare const TAG_MARK_CLASS = "md-tag";
|
|
29
|
+
/**
|
|
30
|
+
* The `mdWikilink` mark.
|
|
31
|
+
*/
|
|
32
|
+
export declare const WIKILINK_MARK_CLASS = "md-wikilink";
|
|
33
|
+
/**
|
|
34
|
+
* The `mdFile` mark.
|
|
35
|
+
*/
|
|
36
|
+
export declare const FILE_MARK_CLASS = "md-file";
|
|
37
|
+
/**
|
|
38
|
+
* The `mdMath` mark.
|
|
39
|
+
*/
|
|
40
|
+
export declare const MATH_MARK_CLASS = "md-math";
|
|
41
|
+
/**
|
|
42
|
+
* The `mdPack` mark.
|
|
43
|
+
*/
|
|
44
|
+
export declare const PACK_MARK_CLASS = "md-pack";
|
|
45
|
+
/**
|
|
46
|
+
* A decoration that reveals the hidden Markdown syntax in its range.
|
|
47
|
+
*/
|
|
48
|
+
export declare const SHOW_CLASS = "show";
|
|
49
|
+
/**
|
|
50
|
+
* A decoration on the source range of a selected atom.
|
|
51
|
+
*/
|
|
52
|
+
export declare const ATOM_SELECTED_CLASS = "md-atom-selected";
|
|
53
|
+
/**
|
|
54
|
+
* A decoration on the range of a pending replacement.
|
|
55
|
+
*/
|
|
56
|
+
export declare const PENDING_REPLACEMENT_CLASS = "md-pending-replacement";
|
|
57
|
+
/**
|
|
58
|
+
* The layer that holds the virtual caret.
|
|
59
|
+
*/
|
|
60
|
+
export declare const VIRTUAL_CARET_LAYER_CLASS = "md-virtual-caret-layer";
|
|
61
|
+
/**
|
|
62
|
+
* The virtual caret.
|
|
63
|
+
*/
|
|
64
|
+
export declare const VIRTUAL_CARET_CLASS = "md-virtual-caret";
|
|
65
|
+
/**
|
|
66
|
+
* The root of an atom mark view: an image, file, or wiki link.
|
|
67
|
+
*/
|
|
68
|
+
export declare const ATOM_VIEW_CLASS = "md-atom-view";
|
|
69
|
+
/**
|
|
70
|
+
* The hidden holder of an atom mark view's Markdown source.
|
|
71
|
+
*/
|
|
72
|
+
export declare const ATOM_VIEW_CONTENT_CLASS = "md-atom-view-content";
|
|
73
|
+
/**
|
|
74
|
+
* The rendered, non-editable part of an atom mark view.
|
|
75
|
+
*/
|
|
76
|
+
export declare const ATOM_VIEW_PREVIEW_CLASS = "md-atom-view-preview";
|
|
77
|
+
/**
|
|
78
|
+
* The root of an image mark view, which also renders X post and YouTube cards.
|
|
79
|
+
*/
|
|
80
|
+
export declare const IMAGE_VIEW_CLASS = "md-image-view";
|
|
81
|
+
/**
|
|
82
|
+
* The hidden holder of an image's Markdown source.
|
|
83
|
+
*/
|
|
84
|
+
export declare const IMAGE_VIEW_CONTENT_CLASS = "md-image-view-content";
|
|
85
|
+
/**
|
|
86
|
+
* The rendered image or card.
|
|
87
|
+
*/
|
|
88
|
+
export declare const IMAGE_VIEW_PREVIEW_CLASS = "md-image-view-preview";
|
|
89
|
+
/**
|
|
90
|
+
* The drag handle that resizes an image or YouTube card.
|
|
91
|
+
*/
|
|
92
|
+
export declare const IMAGE_RESIZE_HANDLE_CLASS = "md-image-resize-handle";
|
|
93
|
+
/**
|
|
94
|
+
* The resizable box around an image.
|
|
95
|
+
*/
|
|
96
|
+
export declare const IMAGE_RESIZABLE_CLASS = "md-image-resizable";
|
|
97
|
+
/**
|
|
98
|
+
* The resizable box around a YouTube card.
|
|
99
|
+
*/
|
|
100
|
+
export declare const EMBED_RESIZABLE_CLASS = "md-embed-resizable";
|
|
101
|
+
/**
|
|
102
|
+
* The root of a file mark view.
|
|
103
|
+
*/
|
|
104
|
+
export declare const FILE_VIEW_CLASS = "md-file-view";
|
|
105
|
+
/**
|
|
106
|
+
* The hidden holder of a file's Markdown source.
|
|
107
|
+
*/
|
|
108
|
+
export declare const FILE_VIEW_CONTENT_CLASS = "md-file-view-content";
|
|
109
|
+
/**
|
|
110
|
+
* The rendered file pill.
|
|
111
|
+
*/
|
|
112
|
+
export declare const FILE_VIEW_PREVIEW_CLASS = "md-file-view-preview";
|
|
113
|
+
/**
|
|
114
|
+
* The icon of a file pill.
|
|
115
|
+
*/
|
|
116
|
+
export declare const FILE_VIEW_ICON_CLASS = "md-file-view-icon";
|
|
117
|
+
/**
|
|
118
|
+
* The name of a file pill.
|
|
119
|
+
*/
|
|
120
|
+
export declare const FILE_VIEW_NAME_CLASS = "md-file-view-name";
|
|
121
|
+
/**
|
|
122
|
+
* The size of a file pill.
|
|
123
|
+
*/
|
|
124
|
+
export declare const FILE_VIEW_SIZE_CLASS = "md-file-view-size";
|
|
125
|
+
/**
|
|
126
|
+
* The root of a wiki link mark view.
|
|
127
|
+
*/
|
|
128
|
+
export declare const WIKILINK_VIEW_CLASS = "md-wikilink-view";
|
|
129
|
+
/**
|
|
130
|
+
* The hidden holder of a wiki link's Markdown source.
|
|
131
|
+
*/
|
|
132
|
+
export declare const WIKILINK_VIEW_CONTENT_CLASS = "md-wikilink-view-content";
|
|
133
|
+
/**
|
|
134
|
+
* The rendered wiki link.
|
|
135
|
+
*/
|
|
136
|
+
export declare const WIKILINK_VIEW_PREVIEW_CLASS = "md-wikilink-view-preview";
|
|
137
|
+
/**
|
|
138
|
+
* The label of a rendered wiki link.
|
|
139
|
+
*/
|
|
140
|
+
export declare const WIKILINK_VIEW_LABEL_CLASS = "md-wikilink-view-label";
|
|
141
|
+
/**
|
|
142
|
+
* The root of a math mark view.
|
|
143
|
+
*/
|
|
144
|
+
export declare const MATH_VIEW_CLASS = "md-math-view";
|
|
145
|
+
/**
|
|
146
|
+
* The Markdown source of a math formula.
|
|
147
|
+
*/
|
|
148
|
+
export declare const MATH_VIEW_CONTENT_CLASS = "md-math-view-content";
|
|
149
|
+
/**
|
|
150
|
+
* The rendered math formula.
|
|
151
|
+
*/
|
|
152
|
+
export declare const MATH_VIEW_PREVIEW_CLASS = "md-math-view-preview";
|
|
153
|
+
/**
|
|
154
|
+
* The class of the menu button that an image, X post, or YouTube card shows
|
|
155
|
+
* in the editor.
|
|
156
|
+
*/
|
|
157
|
+
export declare const EMBED_MENU_BUTTON_CLASS = "md-embed-menu-button";
|
|
158
|
+
/**
|
|
159
|
+
* A small square button holding one icon.
|
|
160
|
+
*/
|
|
161
|
+
export declare const ICON_BUTTON_CLASS = "meowdown-icon-button";
|
|
162
|
+
/**
|
|
163
|
+
* A Lucide icon drawn in `currentColor`. Pair it with {@link getIconClass}.
|
|
164
|
+
*/
|
|
165
|
+
export declare const ICON_CLASS = "meowdown-icon";
|
|
166
|
+
/**
|
|
167
|
+
* The Lucide icons that the core stylesheet ships.
|
|
168
|
+
*/
|
|
169
|
+
export type IconName = 'braces' | 'check' | 'chevrons-up-down' | 'copy' | 'earth' | 'ellipsis' | 'grip-horizontal' | 'grip-vertical' | 'link-2' | 'pencil' | 'sparkles' | 'trash-2' | 'unlink';
|
|
170
|
+
/**
|
|
171
|
+
* The class that picks the icon `name`, used together with {@link ICON_CLASS}.
|
|
172
|
+
*/
|
|
173
|
+
export declare function getIconClass(name: IconName): string;
|
|
174
|
+
/**
|
|
175
|
+
* The positioner of a floating action menu.
|
|
176
|
+
*/
|
|
177
|
+
export declare const MENU_POSITIONER_CLASS = "meowdown-menu-positioner";
|
|
178
|
+
/**
|
|
179
|
+
* The popup of a floating action menu.
|
|
180
|
+
*/
|
|
181
|
+
export declare const MENU_POPUP_CLASS = "meowdown-menu-popup";
|
|
182
|
+
/**
|
|
183
|
+
* A row of a floating menu.
|
|
184
|
+
*/
|
|
185
|
+
export declare const MENU_ITEM_CLASS = "meowdown-menu-item";
|
|
186
|
+
/**
|
|
187
|
+
* The check mark of the chosen row in a pick list.
|
|
188
|
+
*/
|
|
189
|
+
export declare const MENU_ITEM_INDICATOR_CLASS = "meowdown-menu-item-indicator";
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// src/class-names.ts
|
|
2
|
+
/**
|
|
3
|
+
* The root of the editable document, and of a `MarkdownView`.
|
|
4
|
+
*/
|
|
5
|
+
const CONTENT_CLASS = "meowdown-content";
|
|
6
|
+
/**
|
|
7
|
+
* The `mdMark` mark: a run of Markdown syntax characters.
|
|
8
|
+
*/
|
|
9
|
+
const SYNTAX_MARK_CLASS = "md-mark";
|
|
10
|
+
/**
|
|
11
|
+
* The `mdImage` mark.
|
|
12
|
+
*/
|
|
13
|
+
const IMAGE_MARK_CLASS = "md-image";
|
|
14
|
+
/**
|
|
15
|
+
* The `mdLinkText` mark, and a rendered link in a `MarkdownView`.
|
|
16
|
+
*/
|
|
17
|
+
const LINK_TEXT_MARK_CLASS = "md-link";
|
|
18
|
+
/**
|
|
19
|
+
* The `mdLinkUri` mark.
|
|
20
|
+
*/
|
|
21
|
+
const LINK_URI_MARK_CLASS = "md-link-uri";
|
|
22
|
+
/**
|
|
23
|
+
* The `mdLinkTitle` mark.
|
|
24
|
+
*/
|
|
25
|
+
const LINK_TITLE_MARK_CLASS = "md-link-title";
|
|
26
|
+
/**
|
|
27
|
+
* The `mdTag` mark.
|
|
28
|
+
*/
|
|
29
|
+
const TAG_MARK_CLASS = "md-tag";
|
|
30
|
+
/**
|
|
31
|
+
* The `mdWikilink` mark.
|
|
32
|
+
*/
|
|
33
|
+
const WIKILINK_MARK_CLASS = "md-wikilink";
|
|
34
|
+
/**
|
|
35
|
+
* The `mdFile` mark.
|
|
36
|
+
*/
|
|
37
|
+
const FILE_MARK_CLASS = "md-file";
|
|
38
|
+
/**
|
|
39
|
+
* The `mdMath` mark.
|
|
40
|
+
*/
|
|
41
|
+
const MATH_MARK_CLASS = "md-math";
|
|
42
|
+
/**
|
|
43
|
+
* The `mdPack` mark.
|
|
44
|
+
*/
|
|
45
|
+
const PACK_MARK_CLASS = "md-pack";
|
|
46
|
+
/**
|
|
47
|
+
* A decoration that reveals the hidden Markdown syntax in its range.
|
|
48
|
+
*/
|
|
49
|
+
const SHOW_CLASS = "show";
|
|
50
|
+
/**
|
|
51
|
+
* A decoration on the source range of a selected atom.
|
|
52
|
+
*/
|
|
53
|
+
const ATOM_SELECTED_CLASS = "md-atom-selected";
|
|
54
|
+
/**
|
|
55
|
+
* A decoration on the range of a pending replacement.
|
|
56
|
+
*/
|
|
57
|
+
const PENDING_REPLACEMENT_CLASS = "md-pending-replacement";
|
|
58
|
+
/**
|
|
59
|
+
* The layer that holds the virtual caret.
|
|
60
|
+
*/
|
|
61
|
+
const VIRTUAL_CARET_LAYER_CLASS = "md-virtual-caret-layer";
|
|
62
|
+
/**
|
|
63
|
+
* The virtual caret.
|
|
64
|
+
*/
|
|
65
|
+
const VIRTUAL_CARET_CLASS = "md-virtual-caret";
|
|
66
|
+
/**
|
|
67
|
+
* The root of an atom mark view: an image, file, or wiki link.
|
|
68
|
+
*/
|
|
69
|
+
const ATOM_VIEW_CLASS = "md-atom-view";
|
|
70
|
+
/**
|
|
71
|
+
* The hidden holder of an atom mark view's Markdown source.
|
|
72
|
+
*/
|
|
73
|
+
const ATOM_VIEW_CONTENT_CLASS = "md-atom-view-content";
|
|
74
|
+
/**
|
|
75
|
+
* The rendered, non-editable part of an atom mark view.
|
|
76
|
+
*/
|
|
77
|
+
const ATOM_VIEW_PREVIEW_CLASS = "md-atom-view-preview";
|
|
78
|
+
/**
|
|
79
|
+
* The root of an image mark view, which also renders X post and YouTube cards.
|
|
80
|
+
*/
|
|
81
|
+
const IMAGE_VIEW_CLASS = "md-image-view";
|
|
82
|
+
/**
|
|
83
|
+
* The hidden holder of an image's Markdown source.
|
|
84
|
+
*/
|
|
85
|
+
const IMAGE_VIEW_CONTENT_CLASS = "md-image-view-content";
|
|
86
|
+
/**
|
|
87
|
+
* The rendered image or card.
|
|
88
|
+
*/
|
|
89
|
+
const IMAGE_VIEW_PREVIEW_CLASS = "md-image-view-preview";
|
|
90
|
+
/**
|
|
91
|
+
* The drag handle that resizes an image or YouTube card.
|
|
92
|
+
*/
|
|
93
|
+
const IMAGE_RESIZE_HANDLE_CLASS = "md-image-resize-handle";
|
|
94
|
+
/**
|
|
95
|
+
* The resizable box around an image.
|
|
96
|
+
*/
|
|
97
|
+
const IMAGE_RESIZABLE_CLASS = "md-image-resizable";
|
|
98
|
+
/**
|
|
99
|
+
* The resizable box around a YouTube card.
|
|
100
|
+
*/
|
|
101
|
+
const EMBED_RESIZABLE_CLASS = "md-embed-resizable";
|
|
102
|
+
/**
|
|
103
|
+
* The root of a file mark view.
|
|
104
|
+
*/
|
|
105
|
+
const FILE_VIEW_CLASS = "md-file-view";
|
|
106
|
+
/**
|
|
107
|
+
* The hidden holder of a file's Markdown source.
|
|
108
|
+
*/
|
|
109
|
+
const FILE_VIEW_CONTENT_CLASS = "md-file-view-content";
|
|
110
|
+
/**
|
|
111
|
+
* The rendered file pill.
|
|
112
|
+
*/
|
|
113
|
+
const FILE_VIEW_PREVIEW_CLASS = "md-file-view-preview";
|
|
114
|
+
/**
|
|
115
|
+
* The icon of a file pill.
|
|
116
|
+
*/
|
|
117
|
+
const FILE_VIEW_ICON_CLASS = "md-file-view-icon";
|
|
118
|
+
/**
|
|
119
|
+
* The name of a file pill.
|
|
120
|
+
*/
|
|
121
|
+
const FILE_VIEW_NAME_CLASS = "md-file-view-name";
|
|
122
|
+
/**
|
|
123
|
+
* The size of a file pill.
|
|
124
|
+
*/
|
|
125
|
+
const FILE_VIEW_SIZE_CLASS = "md-file-view-size";
|
|
126
|
+
/**
|
|
127
|
+
* The root of a wiki link mark view.
|
|
128
|
+
*/
|
|
129
|
+
const WIKILINK_VIEW_CLASS = "md-wikilink-view";
|
|
130
|
+
/**
|
|
131
|
+
* The hidden holder of a wiki link's Markdown source.
|
|
132
|
+
*/
|
|
133
|
+
const WIKILINK_VIEW_CONTENT_CLASS = "md-wikilink-view-content";
|
|
134
|
+
/**
|
|
135
|
+
* The rendered wiki link.
|
|
136
|
+
*/
|
|
137
|
+
const WIKILINK_VIEW_PREVIEW_CLASS = "md-wikilink-view-preview";
|
|
138
|
+
/**
|
|
139
|
+
* The label of a rendered wiki link.
|
|
140
|
+
*/
|
|
141
|
+
const WIKILINK_VIEW_LABEL_CLASS = "md-wikilink-view-label";
|
|
142
|
+
/**
|
|
143
|
+
* The root of a math mark view.
|
|
144
|
+
*/
|
|
145
|
+
const MATH_VIEW_CLASS = "md-math-view";
|
|
146
|
+
/**
|
|
147
|
+
* The Markdown source of a math formula.
|
|
148
|
+
*/
|
|
149
|
+
const MATH_VIEW_CONTENT_CLASS = "md-math-view-content";
|
|
150
|
+
/**
|
|
151
|
+
* The rendered math formula.
|
|
152
|
+
*/
|
|
153
|
+
const MATH_VIEW_PREVIEW_CLASS = "md-math-view-preview";
|
|
154
|
+
/**
|
|
155
|
+
* The class of the menu button that an image, X post, or YouTube card shows
|
|
156
|
+
* in the editor.
|
|
157
|
+
*/
|
|
158
|
+
const EMBED_MENU_BUTTON_CLASS = "md-embed-menu-button";
|
|
159
|
+
/**
|
|
160
|
+
* A small square button holding one icon.
|
|
161
|
+
*/
|
|
162
|
+
const ICON_BUTTON_CLASS = "meowdown-icon-button";
|
|
163
|
+
/**
|
|
164
|
+
* A Lucide icon drawn in `currentColor`. Pair it with {@link getIconClass}.
|
|
165
|
+
*/
|
|
166
|
+
const ICON_CLASS = "meowdown-icon";
|
|
167
|
+
/**
|
|
168
|
+
* The class that picks the icon `name`, used together with {@link ICON_CLASS}.
|
|
169
|
+
*/
|
|
170
|
+
function getIconClass(name) {
|
|
171
|
+
return `${ICON_CLASS}-${name}`;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The positioner of a floating action menu.
|
|
175
|
+
*/
|
|
176
|
+
const MENU_POSITIONER_CLASS = "meowdown-menu-positioner";
|
|
177
|
+
/**
|
|
178
|
+
* The popup of a floating action menu.
|
|
179
|
+
*/
|
|
180
|
+
const MENU_POPUP_CLASS = "meowdown-menu-popup";
|
|
181
|
+
/**
|
|
182
|
+
* A row of a floating menu.
|
|
183
|
+
*/
|
|
184
|
+
const MENU_ITEM_CLASS = "meowdown-menu-item";
|
|
185
|
+
/**
|
|
186
|
+
* The check mark of the chosen row in a pick list.
|
|
187
|
+
*/
|
|
188
|
+
const MENU_ITEM_INDICATOR_CLASS = "meowdown-menu-item-indicator";
|
|
189
|
+
|
|
190
|
+
export { ATOM_SELECTED_CLASS, ATOM_VIEW_CLASS, ATOM_VIEW_CONTENT_CLASS, ATOM_VIEW_PREVIEW_CLASS, CONTENT_CLASS, EMBED_MENU_BUTTON_CLASS, EMBED_RESIZABLE_CLASS, FILE_MARK_CLASS, FILE_VIEW_CLASS, FILE_VIEW_CONTENT_CLASS, FILE_VIEW_ICON_CLASS, FILE_VIEW_NAME_CLASS, FILE_VIEW_PREVIEW_CLASS, FILE_VIEW_SIZE_CLASS, ICON_BUTTON_CLASS, ICON_CLASS, IMAGE_MARK_CLASS, IMAGE_RESIZABLE_CLASS, IMAGE_RESIZE_HANDLE_CLASS, IMAGE_VIEW_CLASS, IMAGE_VIEW_CONTENT_CLASS, IMAGE_VIEW_PREVIEW_CLASS, LINK_TEXT_MARK_CLASS, LINK_TITLE_MARK_CLASS, LINK_URI_MARK_CLASS, MATH_MARK_CLASS, MATH_VIEW_CLASS, MATH_VIEW_CONTENT_CLASS, MATH_VIEW_PREVIEW_CLASS, MENU_ITEM_CLASS, MENU_ITEM_INDICATOR_CLASS, MENU_POPUP_CLASS, MENU_POSITIONER_CLASS, PACK_MARK_CLASS, PENDING_REPLACEMENT_CLASS, SHOW_CLASS, SYNTAX_MARK_CLASS, TAG_MARK_CLASS, VIRTUAL_CARET_CLASS, VIRTUAL_CARET_LAYER_CLASS, WIKILINK_MARK_CLASS, WIKILINK_VIEW_CLASS, WIKILINK_VIEW_CONTENT_CLASS, WIKILINK_VIEW_LABEL_CLASS, WIKILINK_VIEW_PREVIEW_CLASS, getIconClass };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { Editor, Extension, ExtractMarkBuilders, ExtractNodeBuilders, PlainExten
|
|
|
2
2
|
import { CodeBlockAttrs, CodeBlockAttrs as CodeBlockAttrs$1, defineCodeBlockPreviewPlugin, isCodeBlockPreviewHiddenDecoration } from "@prosekit/extensions/code-block";
|
|
3
3
|
import { PlaceholderOptions, PlaceholderOptions as PlaceholderOptions$1, definePlaceholder } from "@prosekit/extensions/placeholder";
|
|
4
4
|
import { SearchStatus, SearchStatusHandler, defineSearchStatusHandler, getSearchStatus } from "@prosekit/extensions/search";
|
|
5
|
+
import { EmbedKind } from "@meowdown/markdown";
|
|
5
6
|
import { Command, EditorState, PluginKey } from "@prosekit/pm/state";
|
|
6
7
|
import { EditorView } from "@prosekit/pm/view";
|
|
7
|
-
import { EditorNode, Mark, ProseMirrorNode } from "@prosekit/pm/model";
|
|
8
|
+
import { EditorNode, Mark, ProseMirrorNode, ResolvedPos } from "@prosekit/pm/model";
|
|
8
9
|
import { ListAttrs } from "@prosekit/extensions/list";
|
|
9
10
|
import { HorizontalRuleCommandsExtension, HorizontalRuleSpecExtension } from "@prosekit/extensions/horizontal-rule";
|
|
10
11
|
import { Resolver, XPostMediaClickEvent } from "@meowdown/embed/x";
|
|
@@ -580,6 +581,37 @@ type FileClickHandler = (payload: FileClickPayload) => void;
|
|
|
580
581
|
* click does (e.g. open the file in the OS default app).
|
|
581
582
|
*/
|
|
582
583
|
export declare function defineFileClickHandler(getOnClick?: (state: EditorState) => FileClickHandler | undefined): PlainExtension;
|
|
584
|
+
/**
|
|
585
|
+
* An image, X post card, or YouTube card in the document. Its `` or
|
|
586
|
+
* `![[target]]` source, including any trailing magic comment, spans `from` to
|
|
587
|
+
* `to`.
|
|
588
|
+
*/
|
|
589
|
+
interface ImageHit {
|
|
590
|
+
from: number;
|
|
591
|
+
to: number;
|
|
592
|
+
/**
|
|
593
|
+
* The kind of card that `src` renders, or `image` for a plain image.
|
|
594
|
+
*/
|
|
595
|
+
kind: EmbedKind | 'image';
|
|
596
|
+
/**
|
|
597
|
+
* The image or post URL: the Markdown destination, or the resolved target
|
|
598
|
+
* of a `![[target]]` embed.
|
|
599
|
+
*/
|
|
600
|
+
src: string;
|
|
601
|
+
/**
|
|
602
|
+
* The alt text, or for a `![[target]]` embed, its display text or file name.
|
|
603
|
+
*/
|
|
604
|
+
alt: string;
|
|
605
|
+
/**
|
|
606
|
+
* `wikiEmbed` for a `![[target]]` source, otherwise `null`.
|
|
607
|
+
*/
|
|
608
|
+
syntax: 'wikiEmbed' | null;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* An {@link ImageHit} seen as what the menu acts on, which is just as often an
|
|
612
|
+
* X post or YouTube card as a plain image.
|
|
613
|
+
*/
|
|
614
|
+
type EmbedHit = ImageHit;
|
|
583
615
|
/**
|
|
584
616
|
* Payload for {@link ImageClickHandler}.
|
|
585
617
|
*/
|
|
@@ -1364,6 +1396,28 @@ export declare const codeBlockLanguages: ReadonlyArray<LanguageItem>;
|
|
|
1364
1396
|
*/
|
|
1365
1397
|
export declare function getEditorConfig(state: EditorState): Readonly<EditorConfig>;
|
|
1366
1398
|
export declare function updateEditorConfig(editor: Pick<Editor, 'state' | 'view' | 'mounted' | 'updateState'>, patch: Partial<EditorConfig>): void;
|
|
1399
|
+
/**
|
|
1400
|
+
* Replace the X post or YouTube card at `pos` with an ordinary link and put
|
|
1401
|
+
* the caret after it. A card without alt text becomes its bare URL, which
|
|
1402
|
+
* renders as an autolink; otherwise the `` source loses its
|
|
1403
|
+
* `!`. The trailing magic comment (size and saved snapshot) is dropped. Images
|
|
1404
|
+
* and `![[target]]` embeds are not converted.
|
|
1405
|
+
*/
|
|
1406
|
+
export declare function convertEmbedToLink(pos: number): Command;
|
|
1407
|
+
/**
|
|
1408
|
+
* Delete the image or card at `pos`, with its source and magic comment, and
|
|
1409
|
+
* put the caret where it was.
|
|
1410
|
+
*/
|
|
1411
|
+
export declare function deleteEmbed(pos: number): Command;
|
|
1412
|
+
/**
|
|
1413
|
+
* Receives a request to open the menu of `embed`, anchored to `button`.
|
|
1414
|
+
*/
|
|
1415
|
+
type EmbedMenuOpenHandler = (embed: EmbedHit, button: HTMLElement) => void;
|
|
1416
|
+
/**
|
|
1417
|
+
* Call `onOpen` when the user clicks the menu button of an image, X post card,
|
|
1418
|
+
* or YouTube card, or presses `Mod-/` with one selected.
|
|
1419
|
+
*/
|
|
1420
|
+
export declare function defineEmbedMenuHandler(onOpen: EmbedMenuOpenHandler): PlainExtension;
|
|
1367
1421
|
/**
|
|
1368
1422
|
* Auto-embed a pasted tweet or YouTube link. When the clipboard holds exactly
|
|
1369
1423
|
* one such URL, the link is rewritten to ``, which the image pipeline
|
|
@@ -1389,7 +1443,7 @@ export declare const EDITOR_KEY_BINDINGS: {
|
|
|
1389
1443
|
readonly 'Mod-Alt-5': "Heading 5";
|
|
1390
1444
|
readonly 'Mod-Alt-6': "Heading 6";
|
|
1391
1445
|
readonly 'Mod-.': "Fold or unfold a bullet";
|
|
1392
|
-
readonly 'Mod-/': "Open the code block menu";
|
|
1446
|
+
readonly 'Mod-/': "Open the code block or embed menu";
|
|
1393
1447
|
readonly 'Shift-Enter': "Insert a line break, or leave a code block from its end";
|
|
1394
1448
|
readonly 'Mod-Enter': "Follow the link under the caret, or cycle a checkbox task";
|
|
1395
1449
|
readonly 'Mod-Shift-Enter': "Cycle a circle checkbox task";
|
|
@@ -1404,6 +1458,42 @@ export declare const EDITOR_KEY_BINDINGS: {
|
|
|
1404
1458
|
readonly 'Mod-Shift-ArrowDown': "Select to the document end";
|
|
1405
1459
|
readonly Escape: "Collapse the selection";
|
|
1406
1460
|
};
|
|
1461
|
+
/** @internal */
|
|
1462
|
+
export declare function selectText(anchor: number, head?: number): Command;
|
|
1463
|
+
/** @internal */
|
|
1464
|
+
export declare function selectTextBetween($anchor: ResolvedPos, $head: ResolvedPos, bias?: number): Command;
|
|
1465
|
+
/** @internal */
|
|
1466
|
+
export declare function insertMarkdown(markdown: string): Command;
|
|
1467
|
+
/**
|
|
1468
|
+
* Inserts menu trigger text (`/`, `[[`, `@`, `#`) at the cursor and opens the
|
|
1469
|
+
* matching autocomplete menu in the same transaction. The menus normally only
|
|
1470
|
+
* open while the user is typing, so a host inserting the trigger itself (e.g.
|
|
1471
|
+
* from a toolbar button) must go through this command instead of a plain
|
|
1472
|
+
* `insertText`. When a non-space character sits right before the caret, a
|
|
1473
|
+
* space is inserted first so the trigger can match, like a user would type
|
|
1474
|
+
* it. In a code block, where no menu can open, the command does nothing.
|
|
1475
|
+
*
|
|
1476
|
+
* @internal
|
|
1477
|
+
*/
|
|
1478
|
+
export declare function insertTrigger(text: string): Command;
|
|
1479
|
+
/**
|
|
1480
|
+
* Turns the current block into plain text, peeling one layer per call: a
|
|
1481
|
+
* non-paragraph textblock becomes a paragraph, then a paragraph in a list
|
|
1482
|
+
* loses its marker, then a paragraph in a blockquote lifts out of it.
|
|
1483
|
+
*
|
|
1484
|
+
* @internal
|
|
1485
|
+
*/
|
|
1486
|
+
export declare function turnIntoText(): Command;
|
|
1487
|
+
/** @internal */
|
|
1488
|
+
export declare function scrollIntoView(): Command;
|
|
1489
|
+
/**
|
|
1490
|
+
* Deletes the block at `pos` and puts the caret where it was. A block that is
|
|
1491
|
+
* the only child of its parent gives way to an empty default block (usually a
|
|
1492
|
+
* paragraph), since the parent cannot be left empty.
|
|
1493
|
+
*
|
|
1494
|
+
* @internal
|
|
1495
|
+
*/
|
|
1496
|
+
export declare function deleteBlock(pos: number): Command;
|
|
1407
1497
|
interface MarkHoverHit<Payload> {
|
|
1408
1498
|
payload: Payload;
|
|
1409
1499
|
element: HTMLElement;
|
|
@@ -1592,4 +1682,4 @@ export declare function paragraphMarkdownToDoc(markdown: string, nodes?: TypedNo
|
|
|
1592
1682
|
* Flatten textblocks into one paragraph's source content.
|
|
1593
1683
|
*/
|
|
1594
1684
|
export declare function docToParagraphMarkdown(doc: ProseMirrorNode): string;
|
|
1595
|
-
export { type AcceptPendingReplacementOptions, type CodeBlockAttrs, type CodeBlockFenceStyle, type CodeToken, type DocToMarkdownOptions, type EditorConfig, type EditorExtension, type EditorExtensionOptions, type ExitBoundaryHandler, type ExitBoundaryOptions, type FileClickHandler, type FileClickPayload, type FileInfo, type FileInfoResolver, type FileLinkOptions, type FileLinkPayload, type FileLinkResolver, type FilePasteHandler, type FilePasteOptions, type FileSaveErrorHandler, type FileViewOptions, type FollowLinkHandlers, type ImageClickHandler, type ImageClickPayload, type ImageOptions, type ImageUrlResolver, type InlineMarkContext, type InlineMarkOptions, type KaTeXRender, type LanguageItem, type LinkAttrs, type LinkClickHandler, type LinkClickPayload, type LinkCopyHandler, type LinkCopyPayload, type LinkEditHandler, type LinkEditOptions, type LinkHoverHandler, type LinkHoverOptions, type LinkPreview, type LinkPreviewResolver, type LinkUnit, type ListMarker, type MarkChunk, type MarkMode, type MarkName, type MarkdownToDocOptions, type MdFileAttrs, type MdImageAttrs, type MdLinkTextAttrs, type MdMathAttrs, type MdWikilinkAttrs, type MeowdownCodeBlockAttrs, type MeowdownHTMLCommentAttrs, type MeowdownListAttrs, type MeowdownTableCellAttrs, type NodeName, type ParsedWikiEmbed, type PendingReplacement, type PendingReplacementEvent, type PendingReplacementHandler, type PendingReplacementMode, type PendingReplacementOutcome, type PlaceholderOptions, type PositionRange, type PostEmbedSnapshot, Priority, type ReferenceDefinition, type ReferenceDefinitionIndex, type ReferenceDefinitions, type SearchStatus, type SearchStatusHandler, type StartPendingReplacementOptions, type TableColumnAlign, type TagClickHandler, type TagClickPayload, type TypedEditor, type TypedMarkBuilders, type VirtualElement, type WikiEmbedOptions, type WikiEmbedResolution, type WikiEmbedResolver, type WikilinkClickHandler, type WikilinkClickPayload, type WikilinkHoverHandler, type WikilinkHoverHit, type WikilinkOptions, type WikilinkPayload, type WikilinkResolution, type WikilinkResolver, type XPostMediaClickHandler, type XPostResolver, type YouTubeVideoClickHandler, type YouTubeVideoResolver, defineCodeBlockPreviewPlugin, definePlaceholder, defineSearchStatusHandler, getSearchStatus, isCodeBlockPreviewHiddenDecoration, withPriority };
|
|
1685
|
+
export { type AcceptPendingReplacementOptions, type CodeBlockAttrs, type CodeBlockFenceStyle, type CodeToken, type DocToMarkdownOptions, type EditorConfig, type EditorExtension, type EditorExtensionOptions, type EmbedHit, type EmbedMenuOpenHandler, type ExitBoundaryHandler, type ExitBoundaryOptions, type FileClickHandler, type FileClickPayload, type FileInfo, type FileInfoResolver, type FileLinkOptions, type FileLinkPayload, type FileLinkResolver, type FilePasteHandler, type FilePasteOptions, type FileSaveErrorHandler, type FileViewOptions, type FollowLinkHandlers, type ImageClickHandler, type ImageClickPayload, type ImageOptions, type ImageUrlResolver, type InlineMarkContext, type InlineMarkOptions, type KaTeXRender, type LanguageItem, type LinkAttrs, type LinkClickHandler, type LinkClickPayload, type LinkCopyHandler, type LinkCopyPayload, type LinkEditHandler, type LinkEditOptions, type LinkHoverHandler, type LinkHoverOptions, type LinkPreview, type LinkPreviewResolver, type LinkUnit, type ListMarker, type MarkChunk, type MarkMode, type MarkName, type MarkdownToDocOptions, type MdFileAttrs, type MdImageAttrs, type MdLinkTextAttrs, type MdMathAttrs, type MdWikilinkAttrs, type MeowdownCodeBlockAttrs, type MeowdownHTMLCommentAttrs, type MeowdownListAttrs, type MeowdownTableCellAttrs, type NodeName, type ParsedWikiEmbed, type PendingReplacement, type PendingReplacementEvent, type PendingReplacementHandler, type PendingReplacementMode, type PendingReplacementOutcome, type PlaceholderOptions, type PositionRange, type PostEmbedSnapshot, Priority, type ReferenceDefinition, type ReferenceDefinitionIndex, type ReferenceDefinitions, type SearchStatus, type SearchStatusHandler, type StartPendingReplacementOptions, type TableColumnAlign, type TagClickHandler, type TagClickPayload, type TypedEditor, type TypedMarkBuilders, type VirtualElement, type WikiEmbedOptions, type WikiEmbedResolution, type WikiEmbedResolver, type WikilinkClickHandler, type WikilinkClickPayload, type WikilinkHoverHandler, type WikilinkHoverHit, type WikilinkOptions, type WikilinkPayload, type WikilinkResolution, type WikilinkResolver, type XPostMediaClickHandler, type XPostResolver, type YouTubeVideoClickHandler, type YouTubeVideoResolver, defineCodeBlockPreviewPlugin, definePlaceholder, defineSearchStatusHandler, getSearchStatus, isCodeBlockPreviewHiddenDecoration, withPriority };
|