@vscode/markdown-editor 0.0.2-19 → 0.0.2-20
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/index.d.ts +31 -4
- package/dist/index.js +277 -216
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/view/editor.css +146 -47
- package/src/view/themes/default.css +6 -1
- package/src/view/themes/github.css +7 -2
- package/src/view/themes/vscode-default.css +9 -2
- package/src/view/themes/vscode-github.css +9 -2
package/package.json
CHANGED
package/src/view/editor.css
CHANGED
|
@@ -273,15 +273,28 @@ pre.md-unhandled-scroll.md-code-block {
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
/*
|
|
276
|
-
* Glue
|
|
277
|
-
*
|
|
278
|
-
*
|
|
276
|
+
* Glue normally keeps its inline footprint when hidden so source padding and
|
|
277
|
+
* widget gutters stay identical between active and inactive states. Hidden
|
|
278
|
+
* table-cell glue is the exception below: leaving it in inline flow lets its
|
|
279
|
+
* invisible spaces wrap around long cell content.
|
|
279
280
|
*/
|
|
280
281
|
.md-glue-hidden {
|
|
281
282
|
display: inline;
|
|
282
283
|
visibility: hidden;
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
/*
|
|
287
|
+
* Inactive table pipes stay in the DOM/source tree, but leave layout and
|
|
288
|
+
* hit-testing entirely. Keeping an invisible rect either in the content flow or
|
|
289
|
+
* over the cell padding can create phantom lines or steal clicks from visible
|
|
290
|
+
* text. Hidden source offsets therefore collapse to the neighboring semantic
|
|
291
|
+
* seam, matching other display-none markers. Visible pipes retain the per-theme
|
|
292
|
+
* active/source layout.
|
|
293
|
+
*/
|
|
294
|
+
.md-table td>.md-glue-tableCellGlue.md-glue-hidden {
|
|
295
|
+
display: none;
|
|
296
|
+
}
|
|
297
|
+
|
|
285
298
|
/*
|
|
286
299
|
* Inter-block glue: the run of blank lines between two top-level blocks. It is
|
|
287
300
|
* mounted as the last inline child of the block that precedes it, so it sits at
|
|
@@ -318,15 +331,6 @@ pre.md-unhandled-scroll.md-code-block {
|
|
|
318
331
|
visibility: hidden;
|
|
319
332
|
}
|
|
320
333
|
|
|
321
|
-
/*
|
|
322
|
-
* Table cell-glue pipes (`| `) keep their inline footprint when hidden so the
|
|
323
|
-
* column widths stay identical active and inactive.
|
|
324
|
-
*/
|
|
325
|
-
.md-marker-tableCellGlue.md-marker-hidden {
|
|
326
|
-
display: inline;
|
|
327
|
-
visibility: hidden;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
334
|
/*
|
|
331
335
|
* The code-block fences (```lang / ```) each sit on their own source line. When
|
|
332
336
|
* hidden they keep their vertical footprint (visibility hidden, not display
|
|
@@ -361,6 +365,48 @@ pre.md-unhandled-scroll.md-code-block {
|
|
|
361
365
|
height: 16px;
|
|
362
366
|
}
|
|
363
367
|
|
|
368
|
+
/*
|
|
369
|
+
* A wide table scrolls horizontally inside its wrapper (the block box) instead
|
|
370
|
+
* of overflowing the page and scrolling the editor's fixed left gutter away.
|
|
371
|
+
* The wrapper is the scroll viewport the selection/caret clipping measures (see
|
|
372
|
+
* `BlockViewNode.scrollElement` / `blockViewportClip`); the inner `<table>`
|
|
373
|
+
* keeps `width: auto` (theme-defined) so it sizes to its content and overflows.
|
|
374
|
+
*
|
|
375
|
+
* `width: fit-content` keeps the wrapper hugging the table's intrinsic width, so
|
|
376
|
+
* a narrow table — and the active-block glow redirected onto the wrapper below —
|
|
377
|
+
* stays as wide as the table (unchanged from before this wrapper existed).
|
|
378
|
+
* `max-width: 100%` caps it at the content column, past which the table
|
|
379
|
+
* overflows and scrolls locally. This is the standard responsive-table pattern
|
|
380
|
+
* (cf. GitHub's own `width: max-content; max-width: 100%`).
|
|
381
|
+
*/
|
|
382
|
+
.md-table-wrapper {
|
|
383
|
+
overflow-x: auto;
|
|
384
|
+
width: fit-content;
|
|
385
|
+
max-width: 100%;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/*
|
|
389
|
+
* The active-block highlight is an *outset* glow (`box-shadow: 0 0 0 8px`).
|
|
390
|
+
* Making the wrapper a scroll box (`overflow-x: auto`, which also forces
|
|
391
|
+
* `overflow-y: auto`) clips descendant paint to its padding box, so the glow on
|
|
392
|
+
* the inner active `<table>` would be cut off (the table has no horizontal
|
|
393
|
+
* margin to give the shadow room). Render the generic active chrome on the
|
|
394
|
+
* wrapper instead — a scroll box's own shadow is never clipped by its own
|
|
395
|
+
* overflow, exactly like a code block carries the glow on its own scroller —
|
|
396
|
+
* and drop it from the table, which keeps `md-block-active` purely for the
|
|
397
|
+
* per-theme source-pipe styling.
|
|
398
|
+
*/
|
|
399
|
+
.md-table-wrapper:has(> .md-table.md-block-active) {
|
|
400
|
+
background: var(--md-block-active-background, #f8f8f8);
|
|
401
|
+
border-radius: 4px;
|
|
402
|
+
box-shadow: 0 0 0 8px var(--md-block-active-background, #f8f8f8);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.md-table.md-block-active {
|
|
406
|
+
background: none;
|
|
407
|
+
box-shadow: none;
|
|
408
|
+
}
|
|
409
|
+
|
|
364
410
|
.md-selection-layer {
|
|
365
411
|
position: absolute;
|
|
366
412
|
top: 0;
|
|
@@ -707,10 +753,10 @@ pre.md-unhandled-scroll.md-code-block {
|
|
|
707
753
|
* Edit / read-only lock toggle.
|
|
708
754
|
*
|
|
709
755
|
* The host is a zero-height sticky strip pinned to the top of the scroll
|
|
710
|
-
* viewport, so the
|
|
711
|
-
* Being height-0 it never participates in the document's vertical
|
|
712
|
-
* use local `--md-readonly-*` custom properties with literal
|
|
713
|
-
* base file stays theme-agnostic (themes may override them).
|
|
756
|
+
* viewport, so the control stays in the top-right corner as the document
|
|
757
|
+
* scrolls. Being height-0 it never participates in the document's vertical
|
|
758
|
+
* flow. Colors use local `--md-readonly-*` custom properties with literal
|
|
759
|
+
* fallbacks so this base file stays theme-agnostic (themes may override them).
|
|
714
760
|
*/
|
|
715
761
|
.md-readonly-toggle-host {
|
|
716
762
|
position: sticky;
|
|
@@ -725,23 +771,32 @@ pre.md-unhandled-scroll.md-code-block {
|
|
|
725
771
|
top: 4px;
|
|
726
772
|
right: 4px;
|
|
727
773
|
pointer-events: auto;
|
|
728
|
-
display: inline-
|
|
774
|
+
display: inline-grid;
|
|
775
|
+
grid-template-columns: repeat(2, 24px);
|
|
729
776
|
align-items: center;
|
|
730
|
-
|
|
731
|
-
|
|
777
|
+
justify-items: center;
|
|
778
|
+
gap: 2px;
|
|
779
|
+
box-sizing: border-box;
|
|
780
|
+
width: 58px;
|
|
781
|
+
height: 32px;
|
|
782
|
+
padding: 3px;
|
|
783
|
+
overflow: hidden;
|
|
784
|
+
direction: ltr;
|
|
785
|
+
appearance: none;
|
|
732
786
|
border-radius: 999px;
|
|
733
|
-
border: 1px solid var(--md-readonly-border, #
|
|
734
|
-
background: var(--md-readonly-background, #
|
|
735
|
-
color: var(--md-readonly-foreground, #
|
|
736
|
-
font:
|
|
737
|
-
|
|
787
|
+
border: 1px solid var(--md-readonly-border, #b8b8b8);
|
|
788
|
+
background: var(--md-readonly-background, #f3f3f3);
|
|
789
|
+
color: var(--md-readonly-foreground, #444444);
|
|
790
|
+
font-size: 16px;
|
|
791
|
+
line-height: 1;
|
|
738
792
|
cursor: pointer;
|
|
739
793
|
box-shadow: 0 0 12px rgba(0, 0, 0, 0.14);
|
|
740
|
-
transition: background-color 0.12s ease,
|
|
794
|
+
transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
|
|
741
795
|
}
|
|
742
796
|
|
|
743
797
|
.md-readonly-toggle:hover {
|
|
744
|
-
border-color: var(--md-readonly-border-hover, #
|
|
798
|
+
border-color: var(--md-readonly-border-hover, #8d8d8d);
|
|
799
|
+
background: var(--md-readonly-background-hover, #e9e9e9);
|
|
745
800
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
|
|
746
801
|
}
|
|
747
802
|
|
|
@@ -750,36 +805,80 @@ pre.md-unhandled-scroll.md-code-block {
|
|
|
750
805
|
outline-offset: 1px;
|
|
751
806
|
}
|
|
752
807
|
|
|
753
|
-
.md-readonly-toggle .md-readonly-toggle-
|
|
754
|
-
|
|
755
|
-
|
|
808
|
+
.md-readonly-toggle .md-readonly-toggle-indicator {
|
|
809
|
+
position: absolute;
|
|
810
|
+
top: 50%;
|
|
811
|
+
left: 3px;
|
|
812
|
+
width: 24px;
|
|
813
|
+
height: 24px;
|
|
814
|
+
border-radius: 50%;
|
|
815
|
+
background: var(--md-readonly-accent, #4c8bf5);
|
|
816
|
+
box-shadow: 0 0 3px rgba(0, 0, 0, 0.25);
|
|
817
|
+
transform: translate(26px, -50%);
|
|
818
|
+
transition: background-color 0.12s ease, transform 0.16s ease;
|
|
756
819
|
}
|
|
757
820
|
|
|
758
|
-
.md-readonly-toggle .md-readonly-toggle-
|
|
759
|
-
|
|
821
|
+
.md-readonly-toggle .md-readonly-toggle-icon {
|
|
822
|
+
position: relative;
|
|
823
|
+
z-index: 1;
|
|
824
|
+
display: block;
|
|
825
|
+
width: 16px;
|
|
826
|
+
height: 16px;
|
|
827
|
+
color: var(--md-readonly-foreground, #444444);
|
|
828
|
+
opacity: 0.62;
|
|
829
|
+
pointer-events: none;
|
|
830
|
+
transition: color 0.12s ease, opacity 0.12s ease;
|
|
760
831
|
}
|
|
761
832
|
|
|
762
|
-
|
|
763
|
-
.md-readonly-toggle .md-readonly-toggle-icon-locked {
|
|
764
|
-
|
|
833
|
+
.md-readonly-toggle:not(.md-readonly-toggle-locked) .md-readonly-toggle-icon-editing,
|
|
834
|
+
.md-readonly-toggle.md-readonly-toggle-locked .md-readonly-toggle-icon-locked {
|
|
835
|
+
color: var(--md-readonly-accent-foreground, #ffffff);
|
|
836
|
+
opacity: 1;
|
|
765
837
|
}
|
|
766
838
|
|
|
767
|
-
.md-readonly-toggle.md-readonly-toggle-locked .md-readonly-toggle-
|
|
768
|
-
|
|
839
|
+
.md-readonly-toggle.md-readonly-toggle-locked .md-readonly-toggle-indicator {
|
|
840
|
+
transform: translate(0, -50%);
|
|
769
841
|
}
|
|
770
842
|
|
|
771
|
-
|
|
772
|
-
|
|
843
|
+
@media (prefers-reduced-motion: reduce) {
|
|
844
|
+
.md-readonly-toggle,
|
|
845
|
+
.md-readonly-toggle .md-readonly-toggle-indicator,
|
|
846
|
+
.md-readonly-toggle .md-readonly-toggle-icon {
|
|
847
|
+
transition: none;
|
|
848
|
+
}
|
|
773
849
|
}
|
|
774
850
|
|
|
775
|
-
|
|
776
|
-
.md-readonly-toggle
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
851
|
+
@media (forced-colors: active) {
|
|
852
|
+
.md-readonly-toggle {
|
|
853
|
+
forced-color-adjust: none;
|
|
854
|
+
border-color: ButtonText;
|
|
855
|
+
background: ButtonFace;
|
|
856
|
+
color: ButtonText;
|
|
857
|
+
box-shadow: none;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.md-readonly-toggle:hover {
|
|
861
|
+
border-color: Highlight;
|
|
862
|
+
background: ButtonFace;
|
|
863
|
+
box-shadow: none;
|
|
864
|
+
}
|
|
781
865
|
|
|
782
|
-
.md-readonly-toggle
|
|
783
|
-
|
|
784
|
-
|
|
866
|
+
.md-readonly-toggle:focus-visible {
|
|
867
|
+
outline-color: Highlight;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
.md-readonly-toggle .md-readonly-toggle-indicator {
|
|
871
|
+
background: Highlight;
|
|
872
|
+
box-shadow: none;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
.md-readonly-toggle .md-readonly-toggle-icon {
|
|
876
|
+
color: ButtonText;
|
|
877
|
+
opacity: 1;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
.md-readonly-toggle:not(.md-readonly-toggle-locked) .md-readonly-toggle-icon-editing,
|
|
881
|
+
.md-readonly-toggle.md-readonly-toggle-locked .md-readonly-toggle-icon-locked {
|
|
882
|
+
color: HighlightText;
|
|
883
|
+
}
|
|
785
884
|
}
|
|
@@ -121,9 +121,14 @@
|
|
|
121
121
|
--md-list-indent-step: 24px;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
.md-theme-default .md-table-wrapper {
|
|
125
|
+
/* Block spacing lives on the wrapper (the scroll/BFC box) so it collapses
|
|
126
|
+
with siblings as before; the inner table has no margin of its own. */
|
|
127
|
+
margin: 0.5em 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
124
130
|
.md-theme-default .md-table {
|
|
125
131
|
border-collapse: collapse;
|
|
126
|
-
margin: 0.5em 0;
|
|
127
132
|
width: auto;
|
|
128
133
|
}
|
|
129
134
|
|
|
@@ -197,10 +197,15 @@
|
|
|
197
197
|
line-height: 1;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
.github-markdown-theme .md-table {
|
|
201
|
-
|
|
200
|
+
.github-markdown-theme .md-table-wrapper {
|
|
201
|
+
/* Block spacing lives on the wrapper (the scroll/BFC box) so it collapses
|
|
202
|
+
with siblings as before; the inner table has no margin of its own. */
|
|
202
203
|
margin-top: 0;
|
|
203
204
|
margin-bottom: 16px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.github-markdown-theme .md-table {
|
|
208
|
+
border-collapse: collapse;
|
|
204
209
|
width: auto;
|
|
205
210
|
}
|
|
206
211
|
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
* stays visible on dark color themes.
|
|
49
49
|
*/
|
|
50
50
|
--md-cursor-background: var(--vscode-editorCursor-foreground, #000);
|
|
51
|
+
--md-readonly-accent: var(--vscode-button-background, rgb(45, 92, 180));
|
|
52
|
+
--md-readonly-accent-foreground: var(--vscode-button-foreground, #fff);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
.md-theme-vscode-default .md-heading {
|
|
@@ -238,10 +240,15 @@
|
|
|
238
240
|
line-height: 1;
|
|
239
241
|
}
|
|
240
242
|
|
|
241
|
-
.md-theme-vscode-default .md-table {
|
|
242
|
-
|
|
243
|
+
.md-theme-vscode-default .md-table-wrapper {
|
|
244
|
+
/* Block spacing lives on the wrapper (the scroll/BFC box) so it collapses
|
|
245
|
+
with siblings as before; the inner table has no margin of its own. */
|
|
243
246
|
margin-top: 0;
|
|
244
247
|
margin-bottom: 16px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.md-theme-vscode-default .md-table {
|
|
251
|
+
border-collapse: collapse;
|
|
245
252
|
width: auto;
|
|
246
253
|
}
|
|
247
254
|
|
|
@@ -58,6 +58,8 @@
|
|
|
58
58
|
* stays visible on dark color themes.
|
|
59
59
|
*/
|
|
60
60
|
--md-cursor-background: var(--vscode-editorCursor-foreground, #000);
|
|
61
|
+
--md-readonly-accent: var(--vscode-button-background, rgb(45, 92, 180));
|
|
62
|
+
--md-readonly-accent-foreground: var(--vscode-button-foreground, #fff);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
.md-theme-vscode-github .md-heading {
|
|
@@ -240,10 +242,15 @@
|
|
|
240
242
|
line-height: 1;
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
.md-theme-vscode-github .md-table {
|
|
244
|
-
|
|
245
|
+
.md-theme-vscode-github .md-table-wrapper {
|
|
246
|
+
/* Block spacing lives on the wrapper (the scroll/BFC box) so it collapses
|
|
247
|
+
with siblings as before; the inner table has no margin of its own. */
|
|
245
248
|
margin-top: 0;
|
|
246
249
|
margin-bottom: 16px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.md-theme-vscode-github .md-table {
|
|
253
|
+
border-collapse: collapse;
|
|
247
254
|
width: auto;
|
|
248
255
|
}
|
|
249
256
|
|