@usememos/editor 26.10.16 → 26.10.18
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 +4 -4
- package/dist/base.css +20 -10
- package/dist/index.js +348 -188
- package/dist/index.js.map +4 -4
- package/dist/style.css +27 -14
- package/dist/theme.css +4 -1
- package/dist/types/editor.d.ts +2 -6
- package/dist/types/labels.d.ts +5 -1
- package/dist/types/ui/imageToolbar.d.ts +28 -0
- package/dist/types/ui/resizeHandles.d.ts +2 -0
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -221,6 +221,9 @@
|
|
|
221
221
|
margin: 8px 0;
|
|
222
222
|
vertical-align: bottom;
|
|
223
223
|
}
|
|
224
|
+
.mbe-root .mbe-image-block .mbe-image {
|
|
225
|
+
margin: 0;
|
|
226
|
+
}
|
|
224
227
|
.mbe-root .mbe-image-block[data-align=left] {
|
|
225
228
|
text-align: left;
|
|
226
229
|
}
|
|
@@ -428,6 +431,7 @@
|
|
|
428
431
|
}
|
|
429
432
|
.mbe-menu,
|
|
430
433
|
.mbe-toolbar,
|
|
434
|
+
.mbe-image-toolbar,
|
|
431
435
|
.mbe-link-card,
|
|
432
436
|
.mbe-input-popover {
|
|
433
437
|
position: fixed;
|
|
@@ -496,7 +500,8 @@
|
|
|
496
500
|
.mbe-menu-loading {
|
|
497
501
|
padding: 6px 8px;
|
|
498
502
|
}
|
|
499
|
-
.mbe-toolbar
|
|
503
|
+
.mbe-toolbar,
|
|
504
|
+
.mbe-image-toolbar {
|
|
500
505
|
box-sizing: border-box;
|
|
501
506
|
display: flex;
|
|
502
507
|
align-items: center;
|
|
@@ -505,7 +510,8 @@
|
|
|
505
510
|
overflow-x: auto;
|
|
506
511
|
scrollbar-width: none;
|
|
507
512
|
}
|
|
508
|
-
.mbe-toolbar::-webkit-scrollbar
|
|
513
|
+
.mbe-toolbar::-webkit-scrollbar,
|
|
514
|
+
.mbe-image-toolbar::-webkit-scrollbar {
|
|
509
515
|
display: none;
|
|
510
516
|
}
|
|
511
517
|
.mbe-tool {
|
|
@@ -514,9 +520,9 @@
|
|
|
514
520
|
color: inherit;
|
|
515
521
|
background: none;
|
|
516
522
|
border: none;
|
|
517
|
-
padding:
|
|
518
|
-
min-width:
|
|
519
|
-
min-height:
|
|
523
|
+
padding: 2px 6px;
|
|
524
|
+
min-width: 28px;
|
|
525
|
+
min-height: 28px;
|
|
520
526
|
display: inline-flex;
|
|
521
527
|
align-items: center;
|
|
522
528
|
justify-content: center;
|
|
@@ -527,20 +533,20 @@
|
|
|
527
533
|
display: none;
|
|
528
534
|
}
|
|
529
535
|
.mbe-tool .mbe-icon {
|
|
530
|
-
width:
|
|
531
|
-
height:
|
|
536
|
+
width: 16px;
|
|
537
|
+
height: 16px;
|
|
532
538
|
}
|
|
533
539
|
.mbe-tool-menu {
|
|
534
540
|
gap: 1px;
|
|
535
|
-
padding-inline:
|
|
541
|
+
padding-inline: 6px 3px;
|
|
536
542
|
}
|
|
537
543
|
.mbe-tool-icon,
|
|
538
544
|
.mbe-tool-chevron {
|
|
539
545
|
display: inline-flex;
|
|
540
546
|
}
|
|
541
547
|
.mbe-tool .mbe-tool-chevron .mbe-icon {
|
|
542
|
-
width:
|
|
543
|
-
height:
|
|
548
|
+
width: 12px;
|
|
549
|
+
height: 12px;
|
|
544
550
|
}
|
|
545
551
|
.mbe-tool.mbe-active {
|
|
546
552
|
background: Highlight;
|
|
@@ -549,8 +555,8 @@
|
|
|
549
555
|
.mbe-tool-sep {
|
|
550
556
|
flex: none;
|
|
551
557
|
width: 1px;
|
|
552
|
-
height:
|
|
553
|
-
margin: 0
|
|
558
|
+
height: 16px;
|
|
559
|
+
margin: 0 2px;
|
|
554
560
|
background: GrayText;
|
|
555
561
|
}
|
|
556
562
|
.mbe-menu-check {
|
|
@@ -652,8 +658,10 @@
|
|
|
652
658
|
.mbe-popover-input {
|
|
653
659
|
font: inherit;
|
|
654
660
|
color: inherit;
|
|
661
|
+
box-sizing: border-box;
|
|
662
|
+
height: 28px;
|
|
655
663
|
width: 260px;
|
|
656
|
-
padding:
|
|
664
|
+
padding: 0 8px;
|
|
657
665
|
}
|
|
658
666
|
.mbe-block-handle {
|
|
659
667
|
position: fixed;
|
|
@@ -1053,6 +1061,7 @@
|
|
|
1053
1061
|
}
|
|
1054
1062
|
.mbe-menu,
|
|
1055
1063
|
.mbe-toolbar,
|
|
1064
|
+
.mbe-image-toolbar,
|
|
1056
1065
|
.mbe-link-card,
|
|
1057
1066
|
.mbe-input-popover {
|
|
1058
1067
|
color: var(--mbe-text);
|
|
@@ -1096,9 +1105,13 @@
|
|
|
1096
1105
|
color: var(--mbe-muted);
|
|
1097
1106
|
}
|
|
1098
1107
|
.mbe-toolbar,
|
|
1108
|
+
.mbe-image-toolbar,
|
|
1099
1109
|
.mbe-link-card {
|
|
1100
1110
|
border-radius: calc(var(--mbe-radius) + 2px);
|
|
1101
1111
|
}
|
|
1112
|
+
.mbe-tool-delete:hover {
|
|
1113
|
+
color: var(--mbe-danger);
|
|
1114
|
+
}
|
|
1102
1115
|
.mbe-link-card-url {
|
|
1103
1116
|
font-size: 13px;
|
|
1104
1117
|
color: var(--mbe-link);
|
|
@@ -1108,7 +1121,7 @@
|
|
|
1108
1121
|
text-decoration: underline;
|
|
1109
1122
|
}
|
|
1110
1123
|
.mbe-tool {
|
|
1111
|
-
border-radius:
|
|
1124
|
+
border-radius: 6px;
|
|
1112
1125
|
}
|
|
1113
1126
|
.mbe-tool:hover,
|
|
1114
1127
|
.mbe-tool.mbe-open {
|
package/dist/theme.css
CHANGED
|
@@ -258,6 +258,7 @@
|
|
|
258
258
|
}
|
|
259
259
|
.mbe-menu,
|
|
260
260
|
.mbe-toolbar,
|
|
261
|
+
.mbe-image-toolbar,
|
|
261
262
|
.mbe-link-card,
|
|
262
263
|
.mbe-input-popover {
|
|
263
264
|
color: var(--mbe-text);
|
|
@@ -277,10 +278,12 @@
|
|
|
277
278
|
.mbe-menu-detail { font-size: 12px; color: var(--mbe-muted); }
|
|
278
279
|
|
|
279
280
|
.mbe-toolbar,
|
|
281
|
+
.mbe-image-toolbar,
|
|
280
282
|
.mbe-link-card { border-radius: calc(var(--mbe-radius) + 2px); }
|
|
283
|
+
.mbe-tool-delete:hover { color: var(--mbe-danger); }
|
|
281
284
|
.mbe-link-card-url { font-size: 13px; color: var(--mbe-link); text-decoration: none; }
|
|
282
285
|
.mbe-link-card-url:hover { text-decoration: underline; }
|
|
283
|
-
.mbe-tool { border-radius:
|
|
286
|
+
.mbe-tool { border-radius: 6px; }
|
|
284
287
|
.mbe-tool:hover,
|
|
285
288
|
.mbe-tool.mbe-open { background: var(--mbe-hover); }
|
|
286
289
|
.mbe-tool.mbe-active { color: var(--mbe-accent); background: var(--mbe-hover); }
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -297,7 +297,7 @@ export declare class Editor {
|
|
|
297
297
|
private focused;
|
|
298
298
|
/** A mouse button is down in the editor. Rendered views keep their state until it is released, so a drag is not disturbed. */
|
|
299
299
|
private pointerDown;
|
|
300
|
-
/** The selection the formatting toolbar was closed for with Escape. It stays closed until the selection changes. */
|
|
300
|
+
/** The selection the formatting or image toolbar was closed for with Escape. It stays closed until the selection changes. */
|
|
301
301
|
private toolbarClosedFor;
|
|
302
302
|
/** Handling a key press, typed text, a paste or a drop: changes then scroll the caret into view. */
|
|
303
303
|
private typing;
|
|
@@ -311,6 +311,7 @@ export declare class Editor {
|
|
|
311
311
|
private readonly suggestions;
|
|
312
312
|
private readonly blockMenu;
|
|
313
313
|
private readonly toolbar;
|
|
314
|
+
private readonly imageToolbar;
|
|
314
315
|
/** The link popover, and the field for an image's alt text. */
|
|
315
316
|
private readonly inputPopover;
|
|
316
317
|
private readonly blockHandle;
|
|
@@ -682,11 +683,6 @@ export declare class Editor {
|
|
|
682
683
|
private paintSelectedImage;
|
|
683
684
|
/** The selected image of `state` and its element, or null. */
|
|
684
685
|
private imageTargetAt;
|
|
685
|
-
/**
|
|
686
|
-
* Opens the alt text field under the image after `pos`. Enter saves the text,
|
|
687
|
-
* Escape keeps the old one. Either way the image stays selected.
|
|
688
|
-
*/
|
|
689
|
-
private editAltText;
|
|
690
686
|
private syncActiveDescendant;
|
|
691
687
|
private hideUi;
|
|
692
688
|
/** Wraps an input event handler so the changes it makes keep the caret in view. */
|
package/dist/types/labels.d.ts
CHANGED
|
@@ -76,8 +76,12 @@ export declare const DEFAULT_LABELS: {
|
|
|
76
76
|
alignCenter: string;
|
|
77
77
|
alignRight: string;
|
|
78
78
|
tableSection: string;
|
|
79
|
-
/** The title of the block menu's section of image block actions. */
|
|
79
|
+
/** The title of the block menu's section of image block actions, and the accessible name of the image toolbar. */
|
|
80
80
|
imageSection: string;
|
|
81
|
+
/** The image toolbar's alignment buttons, for image blocks. */
|
|
82
|
+
imageAlignLeft: string;
|
|
83
|
+
imageAlignCenter: string;
|
|
84
|
+
imageAlignRight: string;
|
|
81
85
|
/** Removes an image's width, so it shows at its own size. */
|
|
82
86
|
resetImageSize: string;
|
|
83
87
|
/** Edits an image's alt text, and names the field that edits it. */
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Editor } from '../editor.js';
|
|
2
|
+
import type { ImageAlign } from '../model.js';
|
|
3
|
+
import { type ImageTarget } from './resizeHandles.js';
|
|
4
|
+
export declare class ImageToolbar {
|
|
5
|
+
private readonly editor;
|
|
6
|
+
private readonly popup;
|
|
7
|
+
private readonly alignButtons;
|
|
8
|
+
private readonly alignSep;
|
|
9
|
+
private readonly resetButton;
|
|
10
|
+
private target;
|
|
11
|
+
constructor(editor: Editor, actions: {
|
|
12
|
+
align: (target: ImageTarget, align: ImageAlign) => void;
|
|
13
|
+
altText: (target: ImageTarget) => void;
|
|
14
|
+
resetSize: (target: ImageTarget) => void;
|
|
15
|
+
remove: (target: ImageTarget) => void;
|
|
16
|
+
});
|
|
17
|
+
get isOpen(): boolean;
|
|
18
|
+
/** True if `node` is in the toolbar. */
|
|
19
|
+
contains(node: Node): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Shows the toolbar over `target`, the selected image, with the alignment
|
|
22
|
+
* buttons only for an image block (`block`). Over the part of the image its
|
|
23
|
+
* scrolling container shows, so it stays by the image in a short composer.
|
|
24
|
+
*/
|
|
25
|
+
show(target: ImageTarget, block: boolean): void;
|
|
26
|
+
hide(): void;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
@@ -16,6 +16,8 @@ export declare class ResizeHandles {
|
|
|
16
16
|
constructor(editor: Editor);
|
|
17
17
|
/** True when `node` is the frame or one of its resize handles. */
|
|
18
18
|
contains(node: Node): boolean;
|
|
19
|
+
/** True while a handle is being dragged. */
|
|
20
|
+
get isDragging(): boolean;
|
|
19
21
|
/** Shows the handles for the selected image, or for none. */
|
|
20
22
|
update(selected: ImageTarget | null): void;
|
|
21
23
|
/** Moves the resize handles to where their image is now, after scrolling. */
|