@nerd-bible/wordgard 0.3.3
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 +22 -0
- package/README.md +24 -0
- package/dist/collab.d.ts +105 -0
- package/dist/collab.js +218 -0
- package/dist/command.d.ts +796 -0
- package/dist/command.js +1451 -0
- package/dist/doc.d.ts +2210 -0
- package/dist/doc.js +3814 -0
- package/dist/editor.d.ts +1920 -0
- package/dist/editor.js +7154 -0
- package/dist/history.d.ts +90 -0
- package/dist/history.js +278 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/phrases.d.ts +90 -0
- package/dist/phrases.js +141 -0
- package/dist/schema.d.ts +579 -0
- package/dist/schema.js +1341 -0
- package/dist/state.d.ts +1388 -0
- package/dist/state.js +2024 -0
- package/dist/table.d.ts +215 -0
- package/dist/table.js +1302 -0
- package/dist/types.d.ts +196 -0
- package/dist/types.js +288 -0
- package/package.json +52 -0
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
import { GardState } from 'wordgard/state';
|
|
2
|
+
import { Menu, Command } from 'wordgard/command';
|
|
3
|
+
import { KeyBinding, InputRule, Wordgard } from 'wordgard/editor';
|
|
4
|
+
import { PhraseSet } from 'wordgard/phrases';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
{@link Doc Schema element} that provides the outer document plot
|
|
8
|
+
type for a document with block content.
|
|
9
|
+
*/
|
|
10
|
+
declare function blockDoc(): GardState.Extension;
|
|
11
|
+
/**
|
|
12
|
+
Outer document {@link InlineDoc schema element} for a document
|
|
13
|
+
that contains only inline content.
|
|
14
|
+
*/
|
|
15
|
+
declare function inlineDoc(): GardState.Extension;
|
|
16
|
+
/**
|
|
17
|
+
The basic {@link Paragraph paragraph} schema element, with a
|
|
18
|
+
{@link paragraph.button menu button} and {@link
|
|
19
|
+
paragraph.keyBinding key binding} to switch to it.
|
|
20
|
+
*/
|
|
21
|
+
declare function paragraph(): GardState.Extension;
|
|
22
|
+
declare namespace paragraph {
|
|
23
|
+
/**
|
|
24
|
+
Binds `Ctrl-Shift-0` to switching the selected textblocks to
|
|
25
|
+
regular paragraphs.
|
|
26
|
+
*/
|
|
27
|
+
const keyBinding: KeyBinding;
|
|
28
|
+
/**
|
|
29
|
+
Button in the {@link Menu.Submenu.textblockStyle
|
|
30
|
+
`textblockStyle`} menu that makes the selected textblocks
|
|
31
|
+
paragraphs.
|
|
32
|
+
*/
|
|
33
|
+
const button: Menu.Button;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
Support for heading blocks. Includes the {@link Heading schema
|
|
37
|
+
element}, some {@link heading.keyBindings key bindings}, menu
|
|
38
|
+
buttons, and an {@link heading.createOnHash input rule} to
|
|
39
|
+
switch to this block type.
|
|
40
|
+
*/
|
|
41
|
+
declare function heading(): GardState.Extension;
|
|
42
|
+
declare namespace heading {
|
|
43
|
+
/**
|
|
44
|
+
Binds `Ctrl-Shift-1` through `Ctrl-Shift-6` to make the selected
|
|
45
|
+
textblocks headings of the given level.
|
|
46
|
+
*/
|
|
47
|
+
const keyBindings: KeyBinding[];
|
|
48
|
+
/**
|
|
49
|
+
Button for the {@link Menu.Submenu.textblockStyle textblock
|
|
50
|
+
style} menu that switches to a level 1 heading.
|
|
51
|
+
*/
|
|
52
|
+
const button1: Menu.Button;
|
|
53
|
+
/**
|
|
54
|
+
Menu button that switches to a level 2 heading.
|
|
55
|
+
*/
|
|
56
|
+
const button2: Menu.Button;
|
|
57
|
+
/**
|
|
58
|
+
Menu button that switches to a level 3 heading.
|
|
59
|
+
*/
|
|
60
|
+
const button3: Menu.Button;
|
|
61
|
+
/**
|
|
62
|
+
Input rule that will switch to a heading when one to six hash
|
|
63
|
+
characters, followed by a space, are typed at the start of a
|
|
64
|
+
textblock, using the number of hash characters to determine the
|
|
65
|
+
heading level.
|
|
66
|
+
*/
|
|
67
|
+
const createOnHash: InputRule;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
Extensions that add support for text alignment—the {@link
|
|
71
|
+
Alignment} mark, a set of {@link alignment.keyBindings key
|
|
72
|
+
bindings}, and a {@link alignment.button menu button}.
|
|
73
|
+
*/
|
|
74
|
+
declare function alignment(): GardState.Extension;
|
|
75
|
+
declare namespace alignment {
|
|
76
|
+
/**
|
|
77
|
+
Bind `Mod-Shift-l` to left-align, `Mod-Shift-r` to right-align,
|
|
78
|
+
and `Mod-Shift-e` to center.
|
|
79
|
+
*/
|
|
80
|
+
const keyBindings: KeyBinding[];
|
|
81
|
+
/**
|
|
82
|
+
A button that sets text alignments to start.
|
|
83
|
+
*/
|
|
84
|
+
const buttonStart: Menu.Button;
|
|
85
|
+
/**
|
|
86
|
+
A button that sets text alignment to end.
|
|
87
|
+
*/
|
|
88
|
+
const buttonEnd: Menu.Button;
|
|
89
|
+
/**
|
|
90
|
+
Menu button that sets text alignment to center.
|
|
91
|
+
*/
|
|
92
|
+
const buttonCenter: Menu.Button;
|
|
93
|
+
/**
|
|
94
|
+
A button that pops up a submenu for alignment choice. Includes
|
|
95
|
+
{@link alignment.buttonStart}, {@link alignment.buttonEnd}, and
|
|
96
|
+
{@link alignment.buttonCenter} as default content, so if you
|
|
97
|
+
include this you don't have to explicitly include those.
|
|
98
|
+
*/
|
|
99
|
+
const button: Menu.Submenu;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
Add support for selecting a text direction per textblock. Includes
|
|
103
|
+
the {@link Direction} mark, the {@link direction.textblockDir |
|
|
104
|
+
extension} to make the editor interpret that, and a {@link
|
|
105
|
+
direction.button menu button}.
|
|
106
|
+
*/
|
|
107
|
+
declare function direction(): GardState.Extension;
|
|
108
|
+
declare namespace direction {
|
|
109
|
+
/**
|
|
110
|
+
This extension makes the editor state understand the effect the
|
|
111
|
+
{@link Direction} mark has on text direction, so that cursor
|
|
112
|
+
motion and such behaves correctly in blocks that have it.
|
|
113
|
+
*/
|
|
114
|
+
const textblockDir: GardState.Extension;
|
|
115
|
+
/**
|
|
116
|
+
Menu button to choose a left-to-right text direction.
|
|
117
|
+
*/
|
|
118
|
+
const buttonLTR: Menu.Button;
|
|
119
|
+
/**
|
|
120
|
+
Button to choose a right-to-left text direction.
|
|
121
|
+
*/
|
|
122
|
+
const buttonRTL: Menu.Button;
|
|
123
|
+
/**
|
|
124
|
+
Button that enables automatic text direction, where the content
|
|
125
|
+
of the textblock determines direction.
|
|
126
|
+
*/
|
|
127
|
+
const buttonAuto: Menu.Button;
|
|
128
|
+
/**
|
|
129
|
+
Menu button for choosing text direction. Includes {@link
|
|
130
|
+
direction.buttonLTR `buttonLTR`}, {@link direction.buttonRTL
|
|
131
|
+
`buttonRTL`}, and {@link direction buttonAuto `buttonAuto`} as
|
|
132
|
+
default content.
|
|
133
|
+
*/
|
|
134
|
+
const button: Menu.Submenu;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
Support for blockquotes. Adds the {@link Blockquote schema
|
|
138
|
+
element}, a {@link blockquote.button menu button}, an {@link
|
|
139
|
+
blockquote.createOnGT input rule}, and a {@link blockquote.theme
|
|
140
|
+
default style}.
|
|
141
|
+
*/
|
|
142
|
+
declare function blockquote(): GardState.Extension;
|
|
143
|
+
declare namespace blockquote {
|
|
144
|
+
/**
|
|
145
|
+
Menu button that toggles a blockquote wrapper.
|
|
146
|
+
*/
|
|
147
|
+
const button: Menu.Button;
|
|
148
|
+
/**
|
|
149
|
+
Input rule that wraps the current block in a blockquote when you
|
|
150
|
+
type a greater-than sign followed by a space at its start.
|
|
151
|
+
*/
|
|
152
|
+
const createOnGT: InputRule;
|
|
153
|
+
/**
|
|
154
|
+
Simple style that shows a border next to blockquotes to make
|
|
155
|
+
them easy to see.
|
|
156
|
+
*/
|
|
157
|
+
const theme: GardState.Extension;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
Support extension for horizontal rules. Provides the {@link
|
|
161
|
+
HorizontalRule schema element} and an {@link
|
|
162
|
+
horizontalRule.createOnDashes input rule}.
|
|
163
|
+
*/
|
|
164
|
+
declare function horizontalRule(): GardState.Extension;
|
|
165
|
+
declare namespace horizontalRule {
|
|
166
|
+
/**
|
|
167
|
+
Input rule that will create a horizontal rule if you type three
|
|
168
|
+
dashes into an empty textblock.
|
|
169
|
+
*/
|
|
170
|
+
const createOnDashes: InputRule;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
Enable support for bullet lists. Includes the schema elements, the {@link
|
|
175
|
+
bulletList.toggleButton menu button}, and the {@link
|
|
176
|
+
bulletList.createOnDash input rule}.
|
|
177
|
+
*/
|
|
178
|
+
declare function bulletList(config?: {
|
|
179
|
+
/**
|
|
180
|
+
By defaults, list items contain {@link doc.Node.Group.Content
|
|
181
|
+
block content}. Set this to false to allow only inline content.
|
|
182
|
+
*/
|
|
183
|
+
blockItems?: boolean;
|
|
184
|
+
}): GardState.Extension[];
|
|
185
|
+
declare namespace bulletList {
|
|
186
|
+
/**
|
|
187
|
+
This rule wraps the current textblock in a bullet list when the
|
|
188
|
+
user starts it by typing an optional space, a dash, and then another
|
|
189
|
+
space.
|
|
190
|
+
*/
|
|
191
|
+
const createOnDash: InputRule;
|
|
192
|
+
/**
|
|
193
|
+
A menu button that toggles bullet list wrapping for the selection.
|
|
194
|
+
*/
|
|
195
|
+
const toggleButton: Menu.Button;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
Returns extensions that enable ordered list support, including the
|
|
199
|
+
schema elements, {@link orderedList.toggleButton menu button},
|
|
200
|
+
and {@link orderedList.createOnNumber input rule}.
|
|
201
|
+
*/
|
|
202
|
+
declare function orderedList(config?: {
|
|
203
|
+
blockItems?: boolean;
|
|
204
|
+
}): GardState.Extension[];
|
|
205
|
+
declare namespace orderedList {
|
|
206
|
+
/**
|
|
207
|
+
An input rule that, when the user starts a textblock with an
|
|
208
|
+
optional space, a number, a period, and a space, wraps the block
|
|
209
|
+
in an ordered list.
|
|
210
|
+
*/
|
|
211
|
+
const createOnNumber: InputRule;
|
|
212
|
+
/**
|
|
213
|
+
A menu button that toggles an ordered list wrapper for the
|
|
214
|
+
selected textblocks.
|
|
215
|
+
*/
|
|
216
|
+
const toggleButton: Menu.Button;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
Extensions to add support for code blocks. Includes the {@link
|
|
221
|
+
CodeBlock schema element}, a {@link codeBlock.keyBinding key
|
|
222
|
+
binding}, a {@link codeBlock.button menu button}, and an {@link
|
|
223
|
+
codeBlock.createOnBackticks input rule}.
|
|
224
|
+
*/
|
|
225
|
+
declare function codeBlock(): GardState.Extension;
|
|
226
|
+
declare namespace codeBlock {
|
|
227
|
+
/**
|
|
228
|
+
Binds `Ctrl-Shift-\` to switch the selected textblocks to a code
|
|
229
|
+
block.
|
|
230
|
+
*/
|
|
231
|
+
const keyBinding: KeyBinding;
|
|
232
|
+
/**
|
|
233
|
+
Button for the {@link Menu.Submenu.textblockStyle textblock
|
|
234
|
+
style} menu that switches to a code block.
|
|
235
|
+
*/
|
|
236
|
+
const button: Menu.Button;
|
|
237
|
+
/**
|
|
238
|
+
Enter command handler that, when activated at the end of a
|
|
239
|
+
textblock containing three backticks and an optional
|
|
240
|
+
language, converts the block into a code block.
|
|
241
|
+
*/
|
|
242
|
+
const createOnBackticks: GardState.Extension;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
Returns an extension that enables {@link LineBreak line breaks}.
|
|
247
|
+
*/
|
|
248
|
+
declare function lineBreak(): GardState.Extension;
|
|
249
|
+
/**
|
|
250
|
+
Enable the {@link strong}, {@link emphasis}, and {@link link}
|
|
251
|
+
marks.
|
|
252
|
+
*/
|
|
253
|
+
declare function basicMarks(): GardState.Extension;
|
|
254
|
+
/**
|
|
255
|
+
Enable {@link strong}, {@link emphasis}, {@link code}, {@link
|
|
256
|
+
link}, {@link underline}, {@link strikethrough}, {@link
|
|
257
|
+
superscript}, {@link color}, and {@link backgroundColor}.
|
|
258
|
+
*/
|
|
259
|
+
declare function inlineMarks(): GardState.Extension;
|
|
260
|
+
/**
|
|
261
|
+
Add the elements of a simple rich text schema: {@link blockDoc},
|
|
262
|
+
{@link basicMarks}, {@link paragraph}, {@link heading}, and {@link
|
|
263
|
+
lineBreak}.
|
|
264
|
+
*/
|
|
265
|
+
declare function basicSchema(): GardState.Extension;
|
|
266
|
+
/**
|
|
267
|
+
Add the extensions for a simple schema where the document is a
|
|
268
|
+
single textblock: {@link inlineDoc}, {@link basicMarks}, {@link
|
|
269
|
+
image}, and {@link lineBreak}.
|
|
270
|
+
*/
|
|
271
|
+
declare function inlineSchema(): GardState.Extension;
|
|
272
|
+
/**
|
|
273
|
+
Returns an extension with all the schema elements included in this
|
|
274
|
+
module, in a {@link blockDoc block document}. Note that new
|
|
275
|
+
elements may appear in this schema as new versions of the library
|
|
276
|
+
add new features.
|
|
277
|
+
*/
|
|
278
|
+
declare function fullSchema(): GardState.Extension;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
Extension that enables strong emphasis support. Includes the
|
|
282
|
+
{@link Strong schema element}, {@link strong.keyBinding key
|
|
283
|
+
binding}, and {@link strong.button menu button}.
|
|
284
|
+
*/
|
|
285
|
+
declare function strong(): GardState.Extension;
|
|
286
|
+
declare namespace strong {
|
|
287
|
+
/**
|
|
288
|
+
Binds `Mod-b` to toggle strong emphasis.
|
|
289
|
+
*/
|
|
290
|
+
const keyBinding: KeyBinding;
|
|
291
|
+
/**
|
|
292
|
+
A menu button that toggles strong emphasis.
|
|
293
|
+
*/
|
|
294
|
+
const button: Menu.Button;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
Returns extensions for the emphasis mark—the {@link Emphasis
|
|
298
|
+
schema element}, a {@link emphasis.keyBinding key binding}, and
|
|
299
|
+
a {@link emphasis.button menu button}.
|
|
300
|
+
*/
|
|
301
|
+
declare function emphasis(): GardState.Extension;
|
|
302
|
+
declare namespace emphasis {
|
|
303
|
+
/**
|
|
304
|
+
Binds `Mod-i` to toggle emphasis.
|
|
305
|
+
*/
|
|
306
|
+
const keyBinding: KeyBinding;
|
|
307
|
+
/**
|
|
308
|
+
Menu button that toggles emphasis.
|
|
309
|
+
*/
|
|
310
|
+
const button: Menu.Button;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
Returns extensions that enable the code font mark. Includes the
|
|
314
|
+
{@link Code schema element}, a {@link code.keyBinding key
|
|
315
|
+
binding}, and a {@link code.button menu button}.
|
|
316
|
+
*/
|
|
317
|
+
declare function code(): GardState.Extension;
|
|
318
|
+
declare namespace code {
|
|
319
|
+
/**
|
|
320
|
+
Binds `` Mod-` `` to toggle the code font mark.
|
|
321
|
+
*/
|
|
322
|
+
const keyBinding: KeyBinding;
|
|
323
|
+
/**
|
|
324
|
+
Menu button for toggling code font.
|
|
325
|
+
*/
|
|
326
|
+
const button: Menu.Button;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
Returns an extension bundle for the underline mark, including the
|
|
330
|
+
{@link Underline schema element}, a {@link underline.keyBinding
|
|
331
|
+
key bindding}, and a {@link underline.button menu button}.
|
|
332
|
+
*/
|
|
333
|
+
declare function underline(): GardState.Extension;
|
|
334
|
+
declare namespace underline {
|
|
335
|
+
/**
|
|
336
|
+
Binds `Mod-u` to toggle the underline mark.
|
|
337
|
+
*/
|
|
338
|
+
const keyBinding: KeyBinding;
|
|
339
|
+
/**
|
|
340
|
+
Menu button for toggling underline.
|
|
341
|
+
*/
|
|
342
|
+
const button: Menu.Button;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
Extensions to support a strikethrough mark—the {@link
|
|
346
|
+
Strikethrough schema element}, a {@link strikethrough.keyBinding
|
|
347
|
+
key binding}, and a {@link strikethrough.button menu button}.
|
|
348
|
+
*/
|
|
349
|
+
declare function strikethrough(): GardState.Extension;
|
|
350
|
+
declare namespace strikethrough {
|
|
351
|
+
/**
|
|
352
|
+
Binds `Mod-/` to toggle strikethrough.
|
|
353
|
+
*/
|
|
354
|
+
const keyBinding: KeyBinding;
|
|
355
|
+
/**
|
|
356
|
+
Menu button that toggles the strikethrough mark.
|
|
357
|
+
*/
|
|
358
|
+
const button: Menu.Button;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
Add support for a superscript mark. Includes the {@link
|
|
362
|
+
Superscript schema element}, a {@link superscript.keyBinding
|
|
363
|
+
key binding}, and a {@link superscript.button menu button}.
|
|
364
|
+
*/
|
|
365
|
+
declare function superscript(): GardState.Extension;
|
|
366
|
+
declare namespace superscript {
|
|
367
|
+
/**
|
|
368
|
+
Binds `Mod-.` to toggle superscript.
|
|
369
|
+
*/
|
|
370
|
+
const keyBinding: KeyBinding;
|
|
371
|
+
/**
|
|
372
|
+
Menu button for toggling superscript.
|
|
373
|
+
*/
|
|
374
|
+
const button: Menu.Button;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
Support for a subscript mark. Includes the {@link Subscript
|
|
378
|
+
schema element}, a {@link subscript.keyBinding key binding}, and
|
|
379
|
+
a {@link subscript.button menu button}.
|
|
380
|
+
*/
|
|
381
|
+
declare function subscript(): GardState.Extension;
|
|
382
|
+
declare namespace subscript {
|
|
383
|
+
/**
|
|
384
|
+
Binds `Mod-,` to toggle the subscript mark.
|
|
385
|
+
*/
|
|
386
|
+
const keyBinding: KeyBinding;
|
|
387
|
+
/**
|
|
388
|
+
Menu button for toggling subscript.
|
|
389
|
+
*/
|
|
390
|
+
const button: Menu.Button;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
User interface component that shows a grid of colors and allows
|
|
395
|
+
the user to pick one, for use in a menu.
|
|
396
|
+
*/
|
|
397
|
+
declare class ColorPicker {
|
|
398
|
+
dom: HTMLElement;
|
|
399
|
+
private width;
|
|
400
|
+
private selPos;
|
|
401
|
+
private options;
|
|
402
|
+
private constructor();
|
|
403
|
+
/**
|
|
404
|
+
Construct the color picker. `finish` will be called when a color
|
|
405
|
+
is selected.
|
|
406
|
+
*/
|
|
407
|
+
static create(wg: Wordgard, finish: (color: string) => void): ColorPicker;
|
|
408
|
+
private move;
|
|
409
|
+
}
|
|
410
|
+
declare namespace ColorPicker {
|
|
411
|
+
/**
|
|
412
|
+
The type used for color options.
|
|
413
|
+
*/
|
|
414
|
+
type Option = {
|
|
415
|
+
/**
|
|
416
|
+
Reference to a phrase giving the name of the color.
|
|
417
|
+
*/
|
|
418
|
+
name: PhraseSet.Ref;
|
|
419
|
+
/**
|
|
420
|
+
An optional second phrase to show after the name.
|
|
421
|
+
*/
|
|
422
|
+
detail?: PhraseSet.Ref;
|
|
423
|
+
/**
|
|
424
|
+
The color as a CSS color string, or the empty string to
|
|
425
|
+
indicate that this option clears the color.
|
|
426
|
+
*/
|
|
427
|
+
value: string;
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
Facet used to configure the width (in color widgets) of the
|
|
431
|
+
color picker. Defaults to 10.
|
|
432
|
+
*/
|
|
433
|
+
const width: GardState.Facet<number, number>;
|
|
434
|
+
/**
|
|
435
|
+
Facet used to configure color picker options. The default is a
|
|
436
|
+
collection of 80 colors, starting with an empty one for clearing
|
|
437
|
+
color.
|
|
438
|
+
*/
|
|
439
|
+
const options: GardState.Facet<readonly Option[], readonly Option[]>;
|
|
440
|
+
/**
|
|
441
|
+
Base theme for the color picker.
|
|
442
|
+
*/
|
|
443
|
+
const theme: GardState.Extension;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
Adds support for a text color mark. Includes the {@link Color
|
|
447
|
+
schema element}, the {@link color.button menu button}, and the
|
|
448
|
+
{@link ColorPicker.theme color picker styles}.
|
|
449
|
+
*/
|
|
450
|
+
declare function color(): GardState.Extension;
|
|
451
|
+
declare namespace color {
|
|
452
|
+
/**
|
|
453
|
+
A button that shows a color picker to change the text color.
|
|
454
|
+
*/
|
|
455
|
+
const button: Menu.Submenu;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
Adds support for a background color mark. Includes the {@link
|
|
459
|
+
BackgroundColor schema element}, the {@link
|
|
460
|
+
backgroundColor.button menu button}, and the {@link
|
|
461
|
+
ColorPicker.theme color picker styles}.
|
|
462
|
+
*/
|
|
463
|
+
declare function backgroundColor(): GardState.Extension;
|
|
464
|
+
declare namespace backgroundColor {
|
|
465
|
+
/**
|
|
466
|
+
A button that expands a submenu with a color picker that can be
|
|
467
|
+
used to change the text background color.
|
|
468
|
+
*/
|
|
469
|
+
const button: Menu.Submenu;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
Extensions for a link mark—the {@link Link schema element}, a
|
|
474
|
+
{@link link.keyBinding key binding}, a {@link link.button menu
|
|
475
|
+
button}, the {@link link.tooltip link tooltip}, and the {@link
|
|
476
|
+
link.pasteOver paste-link handler}.
|
|
477
|
+
*/
|
|
478
|
+
declare function link(): GardState.Extension;
|
|
479
|
+
declare namespace link {
|
|
480
|
+
/**
|
|
481
|
+
Binds `Mod-k` to toggle the link mark.
|
|
482
|
+
*/
|
|
483
|
+
const keyBinding: KeyBinding;
|
|
484
|
+
/**
|
|
485
|
+
Menu button that will remove the link mark from the selection if
|
|
486
|
+
present, or prompt for a target and make the current selection a
|
|
487
|
+
link.
|
|
488
|
+
*/
|
|
489
|
+
const button: Menu.Button;
|
|
490
|
+
/**
|
|
491
|
+
Extension that displays a tooltip with the link target below the
|
|
492
|
+
cursor when that is in a link.
|
|
493
|
+
*/
|
|
494
|
+
const tooltip: GardState.Extension;
|
|
495
|
+
/**
|
|
496
|
+
Registers a paste handler that, when a URI is pasted over a
|
|
497
|
+
selection, will add a link to the selection instead of replacing
|
|
498
|
+
it with the pasted text.
|
|
499
|
+
*/
|
|
500
|
+
const pasteOver: GardState.Extension;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
Support for block figures. Adds the same support extensions as
|
|
505
|
+
{@link image}, but includes the {@link Figure} schema element instead.
|
|
506
|
+
*/
|
|
507
|
+
declare function figure(conf?: {
|
|
508
|
+
/**
|
|
509
|
+
When enabled, also support {@link CaptionedFigure captioned figures}.
|
|
510
|
+
*/
|
|
511
|
+
captioned?: boolean;
|
|
512
|
+
}): GardState.Extension;
|
|
513
|
+
/**
|
|
514
|
+
Add resizing functionality for images and figures. Includes the
|
|
515
|
+
{@link ImageSize} mark, the {@link imageResizing.dragHandle drag
|
|
516
|
+
handle}, and {@link imageResizing.keyBindings key bindings}.
|
|
517
|
+
*/
|
|
518
|
+
declare function imageResizing(): GardState.Extension;
|
|
519
|
+
declare namespace imageResizing {
|
|
520
|
+
/**
|
|
521
|
+
Returns a command that resizes the currently selected image or
|
|
522
|
+
figure. When `relative` is fale, `by` indicates a pixel amount,
|
|
523
|
+
which can be positive or negative. When it is true, `by` is a
|
|
524
|
+
scaling factor, which should be between 0 and 1 to shrink the
|
|
525
|
+
image, and greater than1 to grow it.
|
|
526
|
+
*/
|
|
527
|
+
const resizeCommand: (by: number, relative?: boolean) => Command;
|
|
528
|
+
/**
|
|
529
|
+
Binds `Ctrl-Alt-l` (`Ctrl-Cmd-l` on Mac) to grow an image by
|
|
530
|
+
10%, and `Ctrl-Alt-k` (`Ctrl-Cmd-k` on Mac) to shrink it by 10%.
|
|
531
|
+
*/
|
|
532
|
+
const keyBindings: KeyBinding[];
|
|
533
|
+
/**
|
|
534
|
+
Extension that displays a drag handle when the user hovers over
|
|
535
|
+
an image or figure, which can be dragged to adjust the element's
|
|
536
|
+
width.
|
|
537
|
+
*/
|
|
538
|
+
const dragHandle: GardState.Extension;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
Returns extensions that add support for inline images. That
|
|
542
|
+
includes the {@link Image schema element}, the {@link ImageAlt
|
|
543
|
+
alt text mark}, the {@link image.button menu button}, a {@link
|
|
544
|
+
image.keyBinding key binding}, and a {@link image.dropHandler
|
|
545
|
+
drop handler for image files}.
|
|
546
|
+
*/
|
|
547
|
+
declare function image(): GardState.Extension;
|
|
548
|
+
declare namespace image {
|
|
549
|
+
/**
|
|
550
|
+
Binds `Ctrl-Alt-i` to open the image insert/update dialog.
|
|
551
|
+
*/
|
|
552
|
+
const keyBinding: KeyBinding;
|
|
553
|
+
/**
|
|
554
|
+
A menu button that opens a dialog to insert an image or figure,
|
|
555
|
+
or to adjust the currently selected image or figure.
|
|
556
|
+
*/
|
|
557
|
+
const button: Menu.Button;
|
|
558
|
+
/**
|
|
559
|
+
A custom drop handler that checks whether an image file is being
|
|
560
|
+
dropped. When an {@link image.uploader uploader} has been
|
|
561
|
+
defined, it will feed the file to that, and insert an image with
|
|
562
|
+
the resulting URI when it finishes.
|
|
563
|
+
*/
|
|
564
|
+
const dropHandler: GardState.Extension;
|
|
565
|
+
/**
|
|
566
|
+
The command that opens the image dialog.
|
|
567
|
+
*/
|
|
568
|
+
const insert: Command;
|
|
569
|
+
/**
|
|
570
|
+
A facet that you can use to register a handler for image
|
|
571
|
+
uploads. Your function will be passed a file object, an editor
|
|
572
|
+
instance, and a function that it can call to indicate progress,
|
|
573
|
+
and should return a promise that resolves to a URI for the
|
|
574
|
+
uploaded image.
|
|
575
|
+
*/
|
|
576
|
+
const uploader: GardState.Facet<(file: File, wg: Wordgard, progress: (percent: number) => void) => Promise<string>, readonly ((file: File, wg: Wordgard, progress: (percent: number) => void) => Promise<string>)[]>;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export { ColorPicker, alignment, backgroundColor, basicMarks, basicSchema, blockDoc, blockquote, bulletList, code, codeBlock, color, direction, emphasis, figure, fullSchema, heading, horizontalRule, image, imageResizing, inlineDoc, inlineMarks, inlineSchema, lineBreak, link, orderedList, paragraph, strikethrough, strong, subscript, superscript, underline };
|