@usememos/editor 26.10.8 → 26.10.10

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/style.css CHANGED
@@ -111,6 +111,15 @@
111
111
  margin: 8px 0;
112
112
  vertical-align: bottom;
113
113
  }
114
+ .mbe-root .mbe-image-block[data-align=left] {
115
+ text-align: left;
116
+ }
117
+ .mbe-root .mbe-image-block[data-align=center] {
118
+ text-align: center;
119
+ }
120
+ .mbe-root .mbe-image-block[data-align=right] {
121
+ text-align: right;
122
+ }
114
123
  .mbe-root .mbe-image-unavailable {
115
124
  display: inline-flex;
116
125
  align-items: center;
@@ -127,7 +136,7 @@
127
136
  }
128
137
  .mbe-root .mbe-image-selected {
129
138
  outline: 2px solid Highlight;
130
- outline-offset: 2px;
139
+ outline-offset: -2px;
131
140
  }
132
141
  .mbe-root.mbe-image-selection,
133
142
  .mbe-root.mbe-image-selection * {
@@ -260,7 +269,7 @@
260
269
  }
261
270
  .mbe-menu,
262
271
  .mbe-toolbar,
263
- .mbe-link-popover {
272
+ .mbe-input-popover {
264
273
  position: fixed;
265
274
  background: Canvas;
266
275
  color: CanvasText;
@@ -324,35 +333,92 @@
324
333
  padding: 6px 8px;
325
334
  }
326
335
  .mbe-toolbar {
336
+ box-sizing: border-box;
327
337
  display: flex;
328
338
  align-items: center;
329
339
  gap: 2px;
330
- padding: 3px;
340
+ padding: 4px;
341
+ overflow-x: auto;
342
+ scrollbar-width: none;
343
+ }
344
+ .mbe-toolbar::-webkit-scrollbar {
345
+ display: none;
331
346
  }
332
347
  .mbe-tool {
348
+ flex: none;
333
349
  font: inherit;
334
350
  color: inherit;
335
351
  background: none;
336
352
  border: none;
337
- padding: 4px 6px;
338
- min-width: 28px;
339
- min-height: 28px;
353
+ padding: 4px 7px;
354
+ min-width: 32px;
355
+ min-height: 32px;
340
356
  display: inline-flex;
341
357
  align-items: center;
342
358
  justify-content: center;
343
359
  cursor: pointer;
344
360
  }
361
+ .mbe-tool[hidden],
362
+ .mbe-tool-sep[hidden] {
363
+ display: none;
364
+ }
365
+ .mbe-tool .mbe-icon {
366
+ width: 18px;
367
+ height: 18px;
368
+ }
369
+ .mbe-tool-menu {
370
+ gap: 1px;
371
+ padding-inline: 7px 4px;
372
+ }
373
+ .mbe-tool-icon,
374
+ .mbe-tool-chevron {
375
+ display: inline-flex;
376
+ }
377
+ .mbe-tool .mbe-tool-chevron .mbe-icon {
378
+ width: 13px;
379
+ height: 13px;
380
+ }
345
381
  .mbe-tool.mbe-active {
346
382
  background: Highlight;
347
383
  color: HighlightText;
348
384
  }
349
385
  .mbe-tool-sep {
386
+ flex: none;
350
387
  width: 1px;
351
- align-self: stretch;
352
- margin: 3px 2px;
388
+ height: 18px;
389
+ margin: 0 3px;
353
390
  background: GrayText;
354
391
  }
355
- .mbe-link-popover {
392
+ .mbe-menu-check {
393
+ flex: none;
394
+ display: inline-flex;
395
+ margin-inline-start: auto;
396
+ }
397
+ .mbe-menu-submenu {
398
+ flex: none;
399
+ display: inline-flex;
400
+ margin-inline-start: auto;
401
+ }
402
+ .mbe-menu-submenu .mbe-icon {
403
+ width: 14px;
404
+ height: 14px;
405
+ }
406
+ .mbe-submenu {
407
+ min-width: 160px;
408
+ }
409
+ .mbe-menu-item[aria-expanded=true] {
410
+ background: Highlight;
411
+ color: HighlightText;
412
+ }
413
+ .mbe-tooltip {
414
+ position: fixed;
415
+ pointer-events: none;
416
+ white-space: nowrap;
417
+ padding: 4px 8px;
418
+ background: CanvasText;
419
+ color: Canvas;
420
+ }
421
+ .mbe-input-popover {
356
422
  display: flex;
357
423
  gap: 4px;
358
424
  padding: 4px;
@@ -361,7 +427,7 @@
361
427
  position: fixed;
362
428
  pointer-events: none;
363
429
  }
364
- .mbe-image-handle {
430
+ .mbe-resize-handle {
365
431
  position: absolute;
366
432
  top: 50%;
367
433
  width: 6px;
@@ -377,34 +443,34 @@
377
443
  border: 1px solid CanvasText;
378
444
  border-radius: 3px;
379
445
  }
380
- .mbe-image-handle::before {
446
+ .mbe-resize-handle::before {
381
447
  content: "";
382
448
  position: absolute;
383
449
  inset: -6px -8px;
384
450
  }
385
- .mbe-image-handle-left {
451
+ .mbe-resize-handle-left {
386
452
  left: 8px;
387
453
  }
388
- .mbe-image-handle-right {
454
+ .mbe-resize-handle-right {
389
455
  left: calc(100% - 8px);
390
456
  }
391
- .mbe-image-frame-small .mbe-image-handle-left {
457
+ .mbe-image-frame-small .mbe-resize-handle-left {
392
458
  left: 0;
393
459
  }
394
- .mbe-image-frame-small .mbe-image-handle-right {
460
+ .mbe-image-frame-small .mbe-resize-handle-right {
395
461
  left: 100%;
396
462
  }
397
463
  .mbe-image-resizing,
398
- .mbe-image-resizing .mbe-image-handle {
464
+ .mbe-image-resizing .mbe-resize-handle {
399
465
  cursor: ew-resize;
400
466
  }
401
- .mbe-link-input {
467
+ .mbe-popover-input {
402
468
  font: inherit;
403
469
  color: inherit;
404
470
  width: 260px;
405
471
  padding: 5px 8px;
406
472
  }
407
- .mbe-handle {
473
+ .mbe-block-handle {
408
474
  position: fixed;
409
475
  width: 20px;
410
476
  height: 22px;
@@ -673,7 +739,7 @@
673
739
  }
674
740
  .mbe-menu,
675
741
  .mbe-toolbar,
676
- .mbe-link-popover {
742
+ .mbe-input-popover {
677
743
  color: var(--mbe-text);
678
744
  background: var(--mbe-popup-bg);
679
745
  border: 1px solid var(--mbe-popup-border);
@@ -714,16 +780,23 @@
714
780
  font-size: 12px;
715
781
  color: var(--mbe-muted);
716
782
  }
783
+ .mbe-toolbar {
784
+ border-radius: calc(var(--mbe-radius) + 2px);
785
+ }
717
786
  .mbe-tool {
718
- border-radius: 6px;
787
+ border-radius: 7px;
719
788
  }
720
- .mbe-tool:hover {
789
+ .mbe-tool:hover,
790
+ .mbe-tool.mbe-open {
721
791
  background: var(--mbe-hover);
722
792
  }
723
793
  .mbe-tool.mbe-active {
724
794
  color: var(--mbe-accent);
725
795
  background: var(--mbe-hover);
726
796
  }
797
+ .mbe-tool-chevron {
798
+ color: var(--mbe-muted);
799
+ }
727
800
  .mbe-tool-bold {
728
801
  font-weight: 700;
729
802
  }
@@ -741,30 +814,64 @@
741
814
  .mbe-tool-sep {
742
815
  background: var(--mbe-popup-border);
743
816
  }
744
- .mbe-link-input {
817
+ .mbe-tooltip {
818
+ font-size: 12px;
819
+ border-radius: 6px;
820
+ color: var(--mbe-popup-bg);
821
+ background: var(--mbe-text);
822
+ }
823
+ .mbe-text-style-menu .mbe-menu-item,
824
+ .mbe-list-menu .mbe-menu-item {
825
+ min-height: 32px;
826
+ font-size: 14px;
827
+ line-height: 24px;
828
+ }
829
+ .mbe-menu-check {
830
+ color: var(--mbe-accent);
831
+ }
832
+ .mbe-menu-submenu {
833
+ color: var(--mbe-muted);
834
+ }
835
+ .mbe-menu-item[aria-expanded=true] {
836
+ background: var(--mbe-hover);
837
+ color: inherit;
838
+ }
839
+ .mbe-menu-heading1 {
840
+ font-size: 19px;
841
+ font-weight: 650;
842
+ }
843
+ .mbe-menu-heading2 {
844
+ font-size: 17px;
845
+ font-weight: 650;
846
+ }
847
+ .mbe-menu-heading3 {
848
+ font-size: 15px;
849
+ font-weight: 650;
850
+ }
851
+ .mbe-popover-input {
745
852
  border: 1px solid var(--mbe-popup-border);
746
853
  border-radius: 6px;
747
854
  background: transparent;
748
855
  outline: none;
749
856
  }
750
- .mbe-link-input:focus {
857
+ .mbe-popover-input:focus {
751
858
  border-color: var(--mbe-accent);
752
859
  }
753
- .mbe-image-handle {
860
+ .mbe-resize-handle {
754
861
  background: rgb(0 0 0 / 0.6);
755
862
  border-color: rgb(255 255 255 / 0.85);
756
863
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
757
864
  }
758
- .mbe-image-handle:hover,
759
- .mbe-image-resizing .mbe-image-handle {
865
+ .mbe-resize-handle:hover,
866
+ .mbe-image-resizing .mbe-resize-handle {
760
867
  background: var(--mbe-accent);
761
868
  }
762
- .mbe-handle {
869
+ .mbe-block-handle {
763
870
  border-radius: 4px;
764
871
  color: var(--mbe-muted);
765
872
  opacity: 0.7;
766
873
  }
767
- .mbe-handle:hover {
874
+ .mbe-block-handle:hover {
768
875
  background: var(--mbe-hover);
769
876
  opacity: 1;
770
877
  }
package/dist/theme.css CHANGED
@@ -190,7 +190,7 @@
190
190
  }
191
191
  .mbe-menu,
192
192
  .mbe-toolbar,
193
- .mbe-link-popover {
193
+ .mbe-input-popover {
194
194
  color: var(--mbe-text);
195
195
  background: var(--mbe-popup-bg);
196
196
  border: 1px solid var(--mbe-popup-border);
@@ -207,34 +207,53 @@
207
207
  .mbe-menu-loading { color: var(--mbe-muted); }
208
208
  .mbe-menu-detail { font-size: 12px; color: var(--mbe-muted); }
209
209
 
210
- .mbe-tool { border-radius: 6px; }
211
- .mbe-tool:hover { background: var(--mbe-hover); }
210
+ .mbe-toolbar { border-radius: calc(var(--mbe-radius) + 2px); }
211
+ .mbe-tool { border-radius: 7px; }
212
+ .mbe-tool:hover,
213
+ .mbe-tool.mbe-open { background: var(--mbe-hover); }
212
214
  .mbe-tool.mbe-active { color: var(--mbe-accent); background: var(--mbe-hover); }
215
+ .mbe-tool-chevron { color: var(--mbe-muted); }
213
216
  .mbe-tool-bold { font-weight: 700; }
214
217
  .mbe-tool-italic { font-style: italic; font-family: Georgia, serif; }
215
218
  .mbe-tool-strike { text-decoration: line-through; }
216
219
  .mbe-tool-code { font-family: var(--mbe-mono); font-size: 12px; }
217
220
  .mbe-tool-sep { background: var(--mbe-popup-border); }
221
+ .mbe-tooltip {
222
+ font-size: 12px;
223
+ border-radius: 6px;
224
+ color: var(--mbe-popup-bg);
225
+ background: var(--mbe-text);
226
+ }
227
+
228
+ /* The text style and list menus: roomier rows, and each style shown as itself. */
229
+ .mbe-text-style-menu .mbe-menu-item,
230
+ .mbe-list-menu .mbe-menu-item { min-height: 32px; font-size: 14px; line-height: 24px; }
231
+ .mbe-menu-check { color: var(--mbe-accent); }
232
+ .mbe-menu-submenu { color: var(--mbe-muted); }
233
+ .mbe-menu-item[aria-expanded="true"] { background: var(--mbe-hover); color: inherit; }
234
+ .mbe-menu-heading1 { font-size: 19px; font-weight: 650; }
235
+ .mbe-menu-heading2 { font-size: 17px; font-weight: 650; }
236
+ .mbe-menu-heading3 { font-size: 15px; font-weight: 650; }
218
237
 
219
- .mbe-link-input {
238
+ .mbe-popover-input {
220
239
  border: 1px solid var(--mbe-popup-border);
221
240
  border-radius: 6px;
222
241
  background: transparent;
223
242
  outline: none;
224
243
  }
225
- .mbe-link-input:focus { border-color: var(--mbe-accent); }
244
+ .mbe-popover-input:focus { border-color: var(--mbe-accent); }
226
245
 
227
- .mbe-image-handle {
246
+ .mbe-resize-handle {
228
247
  background: rgb(0 0 0 / 0.6);
229
248
  border-color: rgb(255 255 255 / 0.85);
230
249
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
231
250
  }
232
- .mbe-image-handle:hover,
233
- .mbe-image-resizing .mbe-image-handle { background: var(--mbe-accent); }
251
+ .mbe-resize-handle:hover,
252
+ .mbe-image-resizing .mbe-resize-handle { background: var(--mbe-accent); }
234
253
 
235
- .mbe-handle {
254
+ .mbe-block-handle {
236
255
  border-radius: 4px;
237
256
  color: var(--mbe-muted);
238
257
  opacity: 0.7;
239
258
  }
240
- .mbe-handle:hover { background: var(--mbe-hover); opacity: 1; }
259
+ .mbe-block-handle:hover { background: var(--mbe-hover); opacity: 1; }
@@ -1,4 +1,4 @@
1
- import { type Block, type EditorState, type HeadingLevel, type ImageAtom, type ListType, type Mark, type Position, type Selection, type TableBlock, type Align } from './model.js';
1
+ import { type Block, type EditorState, type HeadingLevel, type ImageAlign, type ImageAtom, type ListType, type Mark, type Position, type Selection, type TableBlock, type RawBlock, type TextBlock, type Align } from './model.js';
2
2
  import type { InlineSyntax } from './markdown/options.js';
3
3
  export type Command = (state: EditorState) => EditorState;
4
4
  /** A copy of a block with a new ID. */
@@ -17,10 +17,10 @@ export declare function deleteForward(state: EditorState): EditorState;
17
17
  export declare function insertText(state: EditorState, text: string): EditorState;
18
18
  /**
19
19
  * ArrowDown on the last line of the last block, or ArrowUp on the first line
20
- * of the first block, when that block is a code block, table or divider: adds
21
- * an empty paragraph past it, so the caret is never stuck. In a table that is
22
- * the last (or first) row. Lines are lines of text; a wrapped line counts as
23
- * one.
20
+ * of the first block, when that block is a code block, table or divider, or
21
+ * a selected image block: adds an empty paragraph past it, so the caret is
22
+ * never stuck. In a table that is the last (or first) row. Lines are lines of
23
+ * text; a wrapped line counts as one.
24
24
  */
25
25
  export declare function exitBlock(state: EditorState, dir: 1 | -1): EditorState;
26
26
  /** Shift+Enter: a hard line break. A newline in code; nothing in a table cell. */
@@ -47,12 +47,22 @@ export declare function selectedImage(state: EditorState): {
47
47
  pos: Position;
48
48
  image: ImageAtom;
49
49
  } | null;
50
+ /** The selected image when it is an image block's (see `isImageBlock`), else null. */
51
+ export declare function selectedImageBlock(state: EditorState): {
52
+ pos: Position;
53
+ image: ImageAtom;
54
+ } | null;
50
55
  /** Selects the image after `pos` as one unit. */
51
56
  export declare function selectImage(state: EditorState, pos: Position): EditorState;
52
- /** What `updateImage` changes. `null` removes a title or a size; a new width drops the height, so the image keeps its aspect ratio. */
57
+ /**
58
+ * What `updateImage` changes. `null` removes a title, an alignment or a size;
59
+ * a new width drops the height, so the image keeps its aspect ratio.
60
+ */
53
61
  export interface ImageChange {
54
62
  readonly alt?: string;
55
63
  readonly title?: string | null;
64
+ /** Shown on image blocks only (see `isImageBlock`). */
65
+ readonly align?: ImageAlign | null;
56
66
  readonly width?: number | null;
57
67
  }
58
68
  /** Changes the image after `pos` and selects it. */
@@ -79,9 +89,12 @@ export type BlockTypeSpec = {
79
89
  };
80
90
  /**
81
91
  * Changes the type of every text block touched by the selection. Text and IDs
82
- * are kept. Tables and dividers are inserted instead (see insertBlock).
92
+ * are kept. Tables and dividers are inserted instead (see insertBlock). Code
93
+ * is the exception: adjacent blocks become one code block, a line per block.
83
94
  */
84
95
  export declare function setBlockType(state: EditorState, spec: BlockTypeSpec): EditorState;
96
+ /** The blocks the selection touches whose type the block type commands change. */
97
+ export declare function convertibleBlocks(state: EditorState): Exclude<TextBlock, RawBlock>[];
85
98
  /**
86
99
  * Sets the type of the selected text blocks, or turns them back into
87
100
  * paragraphs when they all have that type already.
@@ -7,6 +7,7 @@ import type { Extension } from './extension.js';
7
7
  import { type SuggestionState } from './suggest/controller.js';
8
8
  import { type Widget, type WidgetRender } from './widgets.js';
9
9
  import { type Block, type EditorState, type HeadingLevel, type Position, type Selection } from './model.js';
10
+ import { type ToolbarItem } from './ui/toolbar.js';
10
11
  import { type ResolveUrl } from './view/dom.js';
11
12
  import { type Theme } from './theme.js';
12
13
  export interface EditorOptions {
@@ -65,8 +66,13 @@ export interface EditorOptions {
65
66
  labels?: Partial<Labels>;
66
67
  /** Replaces built-in icons, by the `labels` key of the same control. A string is shown as text; an element is cloned. */
67
68
  icons?: Icons;
68
- /** Shows the formatting toolbar on selection. Default true. */
69
- toolbar?: boolean;
69
+ /**
70
+ * Shows the formatting toolbar on selection. Default true. `items` picks
71
+ * its controls; they always appear in the built-in order.
72
+ */
73
+ toolbar?: boolean | {
74
+ items?: readonly ToolbarItem[];
75
+ };
70
76
  /**
71
77
  * The element menus, the toolbar and other popups are appended to.
72
78
  * Default: the nearest open `<dialog>` or `aria-modal` ancestor of
@@ -177,7 +183,8 @@ export interface EditorCommands {
177
183
  unsetLink(): boolean;
178
184
  /**
179
185
  * Changes the selected image (see `isActive('image')`): its alt text, its
180
- * title, or its width in CSS pixels. `null` removes the title or the width.
186
+ * title, its alignment (shown on image blocks), or its width in CSS pixels.
187
+ * `null` removes the title, the alignment or the width.
181
188
  */
182
189
  updateImage(attrs: cmd.ImageChange): boolean;
183
190
  /** Inserts plain text at the selection, or in place of `range` (for example a suggestion's range). */
@@ -228,6 +235,12 @@ export declare class Editor {
228
235
  private composition;
229
236
  /** When the last composition ended (Safari only): the next key may be the Enter that committed it. */
230
237
  private compositionEndedAt;
238
+ /**
239
+ * The last Markdown shortcut that typing applied: the state with the typed
240
+ * characters, and the state the shortcut made. Backspace right after it
241
+ * goes back to the typed characters.
242
+ */
243
+ private shortcut;
231
244
  /** Blocks the browser edited during a composition that ended, rendered again on the next frame. */
232
245
  private readonly unsettled;
233
246
  private settleFrame;
@@ -267,9 +280,10 @@ export declare class Editor {
267
280
  private readonly suggestions;
268
281
  private readonly blockMenu;
269
282
  private readonly toolbar;
270
- private readonly linkPopover;
271
- private readonly handle;
272
- private readonly imageControls;
283
+ /** The link popover, and the field for an image's alt text. */
284
+ private readonly inputPopover;
285
+ private readonly blockHandle;
286
+ private readonly resizeHandles;
273
287
  /** The selected image's element, which carries the selected class. */
274
288
  private selectedImageEl;
275
289
  private hintEl;
@@ -309,7 +323,7 @@ export declare class Editor {
309
323
  get isDestroyed(): boolean;
310
324
  /** True if `name` applies at the selection: a mark on the selected text, or the type of the block with the caret. */
311
325
  isActive(name: ActiveName, attrs?: Readonly<Record<string, unknown>>): boolean;
312
- /** Attributes of `name` at the selection: `src`, `alt`, `title`, `width` and `height` for a selected image, `href` for a link, `level` for a heading, `language` for a code block, `checked` for a task, `syntax` for a raw block. */
326
+ /** Attributes of `name` at the selection: `src`, `alt`, `title`, `align`, `width`, `height` and `block` (true for an image block) for a selected image, `href` for a link, `level` for a heading, `language` for a code block, `checked` for a task, `syntax` for a raw block. */
313
327
  getAttributes(name: ActiveName): Record<string, unknown>;
314
328
  getSelection(): Selection;
315
329
  /**
@@ -388,6 +402,8 @@ export declare class Editor {
388
402
  private toDom;
389
403
  private readDomSelection;
390
404
  private onSelectionChange;
405
+ /** The selection of an image block's image, when `sel` is a caret in that block. */
406
+ private imageBlockAt;
391
407
  /**
392
408
  * After the browser moved the caret from block `from` with ArrowDown
393
409
  * (`dir` 1) or ArrowUp to `to`: the position in the first block it passed
@@ -432,6 +448,13 @@ export declare class Editor {
432
448
  * column.
433
449
  */
434
450
  private blockPast;
451
+ /**
452
+ * An arrow key next to an image block: from the edge of the block before
453
+ * or after it, the selection of its image; from a selected image block, a
454
+ * caret in the next block that holds one, or the same selection when there
455
+ * is none. Null when no image block is involved.
456
+ */
457
+ private imageBlockStep;
435
458
  /**
436
459
  * ArrowUp or ArrowDown on the first or last line of a table cell: the
437
460
  * position in the cell above or below (same column), or past the table in
@@ -464,6 +487,12 @@ export declare class Editor {
464
487
  private browserApplies;
465
488
  /** Markdown shortcuts and suggestion menus that typing `text` triggers. */
466
489
  private afterTyping;
490
+ /**
491
+ * Backspace right after a Markdown shortcut, with no edit or caret move since,
492
+ * restores the characters that were typed: `**a**` stays text. It is its
493
+ * own undo step.
494
+ */
495
+ private undoShortcut;
467
496
  private onCompositionStart;
468
497
  private onCompositionEnd;
469
498
  private settleComposition;
@@ -505,7 +534,7 @@ export declare class Editor {
505
534
  private moveMenu;
506
535
  private onMouseDown;
507
536
  /**
508
- * A click in the empty space below a final code block, table or divider
537
+ * A click in the empty space below a final code block, table, divider or image block
509
538
  * adds a paragraph there. The browser would put the caret inside the
510
539
  * block, or in the block above a table.
511
540
  */
@@ -551,14 +580,24 @@ export declare class Editor {
551
580
  */
552
581
  private onBlockKey;
553
582
  private blockMenuSections;
583
+ /** The Align row of the block menu: a submenu of Left, Center and Right with the current one checked. */
584
+ private alignMenuItem;
554
585
  private closeBlockMenu;
555
- /** A press anywhere but the block menu or the block handle closes the menu, in the editor's text too. */
586
+ /**
587
+ * A press anywhere but the block menu or the block handle closes the block menu,
588
+ * in the editor's text too. The same goes for a toolbar menu and the toolbar.
589
+ */
556
590
  private onDocumentPointerDown;
557
591
  private updateUi;
558
592
  /** Marks the selected image's element, and hides the browser's selection highlight over it. */
559
593
  private paintSelectedImage;
560
594
  /** The selected image of `state` and its element, or null. */
561
595
  private imageTargetAt;
596
+ /**
597
+ * Opens the alt text field under the image after `pos`. Enter saves the text,
598
+ * Escape keeps the old one. Either way the image stays selected.
599
+ */
600
+ private editAltText;
562
601
  private syncActiveDescendant;
563
602
  private hideUi;
564
603
  /** Wraps an input event handler so the changes it makes keep the caret in view. */
@@ -15,7 +15,7 @@
15
15
  export type Icon = string | Element;
16
16
  /** One SVG child: a path's `d`, or a tag and its attributes. */
17
17
  type IconChild = string | readonly [tag: string, attrs: Readonly<Record<string, string>>];
18
- /** The built-in icons, by the `labels` key of the control that shows them. The comment names the Lucide icon. */
18
+ /** The built-in icons, by the `labels` key of the control that shows them (see IconName). The comment names the Lucide icon. */
19
19
  declare const ICONS: {
20
20
  /** `type` */
21
21
  text: string[];
@@ -87,12 +87,36 @@ declare const ICONS: {
87
87
  addColumnLeft: string[];
88
88
  /** `arrow-right` */
89
89
  addColumnRight: string[];
90
+ /** `text-align-start`, the table menu's Align row */
91
+ align: string[];
90
92
  /** `text-align-start` */
91
93
  alignLeft: string[];
92
94
  /** `text-align-center` */
93
95
  alignCenter: string[];
94
96
  /** `text-align-end` */
95
97
  alignRight: string[];
98
+ /** `align-start-vertical`, an image block's Align row and its Left item */
99
+ imageAlignLeft: (string | [string, {
100
+ width: string;
101
+ height: string;
102
+ x: string;
103
+ y: string;
104
+ rx: string;
105
+ }])[];
106
+ /** `align-center-vertical` */
107
+ imageAlignCenter: string[];
108
+ /** `align-end-vertical` */
109
+ imageAlignRight: (string | [string, {
110
+ width: string;
111
+ height: string;
112
+ x: string;
113
+ y: string;
114
+ rx: string;
115
+ }])[];
116
+ /** `rotate-ccw` */
117
+ resetImageSize: string[];
118
+ /** `text-cursor-input` */
119
+ altText: string[];
96
120
  /** `trash` */
97
121
  deleteRow: readonly IconChild[];
98
122
  /** `trash` */
@@ -124,6 +148,12 @@ declare const ICONS: {
124
148
  y1: string;
125
149
  y2: string;
126
150
  }])[];
151
+ /** `chevron-down`, after the icon of a toolbar button that opens a menu */
152
+ chevronDown: string[];
153
+ /** `check`, after the current item of a menu */
154
+ selected: string[];
155
+ /** `chevron-right`, at the end of a menu row that opens a submenu */
156
+ chevronRight: string[];
127
157
  /** `grip-vertical` */
128
158
  blockHandle: [string, {
129
159
  cx: string;
@@ -131,7 +161,12 @@ declare const ICONS: {
131
161
  r: string;
132
162
  }][];
133
163
  };
134
- /** Names of the built-in icons. Each is the `labels` key of the control that shows it. */
164
+ /**
165
+ * Names of the built-in icons. Each is the `labels` key of the control that
166
+ * shows it, except `chevronDown`, `chevronRight` and `selected`, which are
167
+ * parts of controls, and `imageAlignLeft`, `imageAlignCenter` and
168
+ * `imageAlignRight`, an image block's Align choices.
169
+ */
135
170
  export type IconName = keyof typeof ICONS;
136
171
  export type Icons = Partial<Record<IconName, Icon>>;
137
172
  /** Builds the built-in icon `name` as a new `<svg class="mbe-icon">`. */
@@ -1,5 +1,6 @@
1
1
  export { Editor, type ActiveName, type EditorCommands, type EditorEvents, type EditorOptions, type InsertMarkdownOptions, type InsertTarget, type PositionJSON, type RuntimeOptions, type SelectionJSON, type SuggestionApi, SLASH_ITEM_IDS, type SlashItemId, } from './editor.js';
2
2
  export { DEFAULT_LABELS, type Labels } from './labels.js';
3
+ export { TOOLBAR_ITEMS, type ToolbarItem } from './ui/toolbar.js';
3
4
  export type { Icon, IconName, Icons } from './icons.js';
4
5
  export * from './model.js';
5
6
  export * as commands from './commands.js';
@@ -26,6 +26,10 @@ export declare const DEFAULT_LABELS: {
26
26
  strike: string;
27
27
  inlineCode: string;
28
28
  link: string;
29
+ /** The formatting toolbar's menu of paragraph and heading styles. */
30
+ textStyle: string;
31
+ /** The formatting toolbar's menu of list types. */
32
+ list: string;
29
33
  linkPlaceholder: string;
30
34
  removeLink: string;
31
35
  slashHint: string;
@@ -45,16 +49,22 @@ export declare const DEFAULT_LABELS: {
45
49
  addColumnRight: string;
46
50
  deleteRow: string;
47
51
  deleteColumn: string;
52
+ /** The block menu row that opens the Align submenu, and the submenu's title. */
53
+ align: string;
48
54
  alignLeft: string;
49
55
  alignCenter: string;
50
56
  alignRight: string;
51
57
  tableSection: string;
52
- /** Shown in place of an image that did not load and has no alt text. */
53
- imageUnavailable: string;
54
- /** The button over a selected image that edits its alt text, and the field's name. */
58
+ /** The title of the block menu's section of image block actions. */
59
+ imageSection: string;
60
+ /** Removes an image's width, so it shows at its own size. */
61
+ resetImageSize: string;
62
+ /** Edits an image's alt text, and names the field that edits it. */
55
63
  altText: string;
56
64
  altTextPlaceholder: string;
57
- /** Accessible name of the handles that resize an image. */
65
+ /** Shown in place of an image that did not load and has no alt text. */
66
+ imageUnavailable: string;
67
+ /** Accessible name of an image's resize handles. */
58
68
  resizeImage: string;
59
69
  };
60
70
  export type Labels = typeof DEFAULT_LABELS;