@skillre/dsh-plugin-sticky-wall 0.9.6 → 0.9.8
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/lib/client.js +12 -8
- package/lib/markdown-parse.js +11 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -411,7 +411,7 @@ window.__ModuleLoader__.load({
|
|
|
411
411
|
while (index < raw.length) {
|
|
412
412
|
const char = raw[index];
|
|
413
413
|
if (char === " ") width += 1;
|
|
414
|
-
else if (char === " ") width += INDENT_WIDTH;
|
|
414
|
+
else if (char === " ") width += INDENT_WIDTH - width % INDENT_WIDTH;
|
|
415
415
|
else break;
|
|
416
416
|
index += 1;
|
|
417
417
|
}
|
|
@@ -426,7 +426,7 @@ window.__ModuleLoader__.load({
|
|
|
426
426
|
consumed += 1;
|
|
427
427
|
index += 1;
|
|
428
428
|
} else if (char === " ") {
|
|
429
|
-
consumed += INDENT_WIDTH;
|
|
429
|
+
consumed += INDENT_WIDTH - consumed % INDENT_WIDTH;
|
|
430
430
|
index += 1;
|
|
431
431
|
} else break;
|
|
432
432
|
}
|
|
@@ -1445,7 +1445,9 @@ window.__ModuleLoader__.load({
|
|
|
1445
1445
|
];
|
|
1446
1446
|
function columnsOf(prefix) {
|
|
1447
1447
|
let width = 0;
|
|
1448
|
-
for (const char of prefix)
|
|
1448
|
+
for (const char of prefix) {
|
|
1449
|
+
width += char === " " ? INDENT_WIDTH2 - width % INDENT_WIDTH2 : 1;
|
|
1450
|
+
}
|
|
1449
1451
|
return width;
|
|
1450
1452
|
}
|
|
1451
1453
|
var INDENT_STEP = INDENT_WIDTH2;
|
|
@@ -1455,12 +1457,13 @@ window.__ModuleLoader__.load({
|
|
|
1455
1457
|
const prefix = leadingSpace(line);
|
|
1456
1458
|
const body = line.slice(prefix.length);
|
|
1457
1459
|
const columns2 = columnsOf(prefix);
|
|
1460
|
+
const atLevel = (level2) => prefix.includes(" ") ? " ".repeat(level2) : " ".repeat(level2 * INDENT_STEP);
|
|
1458
1461
|
if (direction === 1) {
|
|
1459
1462
|
const level2 = Math.floor(columns2 / INDENT_STEP);
|
|
1460
|
-
return `${
|
|
1463
|
+
return `${atLevel(level2 + 1)}${body}`;
|
|
1461
1464
|
}
|
|
1462
1465
|
const level = Math.ceil(columns2 / INDENT_STEP);
|
|
1463
|
-
return `${
|
|
1466
|
+
return `${atLevel(Math.max(0, level - 1))}${body}`;
|
|
1464
1467
|
});
|
|
1465
1468
|
}
|
|
1466
1469
|
function fenceLines(lines) {
|
|
@@ -1547,7 +1550,8 @@ window.__ModuleLoader__.load({
|
|
|
1547
1550
|
if (itemBody.trim() === "") {
|
|
1548
1551
|
return dropMarkerLine(value, line.from, line.to);
|
|
1549
1552
|
}
|
|
1550
|
-
const
|
|
1553
|
+
const indent = leadingSpace(text);
|
|
1554
|
+
const nextMarker = todo !== null ? `${indent}${todo[2] ?? "-"} [ ] ` : bullet !== null ? `${indent}${bullet[2] ?? "-"} ` : `${indent}${Number(ordered?.[2] ?? "1") + 1}${ordered?.[3] ?? "."} `;
|
|
1551
1555
|
const insert = `
|
|
1552
1556
|
${nextMarker}`;
|
|
1553
1557
|
const caret = start + insert.length;
|
|
@@ -1880,7 +1884,7 @@ window.__ModuleLoader__.load({
|
|
|
1880
1884
|
.skw-ed-btn[data-style="italic"] { font-style: italic; }
|
|
1881
1885
|
.skw-ed-btn[data-style="strike"] { text-decoration: line-through; }
|
|
1882
1886
|
.skw-ed-btn[disabled] { opacity: .45; cursor: default; }
|
|
1883
|
-
.skw-ed-input { width: 100%; min-height: ${MIN_HEIGHT_PX}px; padding: 8px 10px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; line-height: 20px; resize: none; overflow-y: auto; overflow-x: hidden; }
|
|
1887
|
+
.skw-ed-input { width: 100%; min-height: ${MIN_HEIGHT_PX}px; padding: 8px 10px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; line-height: 20px; resize: none; overflow-y: auto; overflow-x: hidden; tab-size: ${INDENT_WIDTH2}; }
|
|
1884
1888
|
.skw-ed-input::placeholder { color: var(--dsw-alias-label-tertiary); }
|
|
1885
1889
|
.skw-ed-input:focus-visible { outline: none; border-color: var(--dsw-alias-brand-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent); }
|
|
1886
1890
|
.skw-ed-input:disabled { opacity: .7; }
|
|
@@ -2574,7 +2578,7 @@ window.__ModuleLoader__.load({
|
|
|
2574
2578
|
border: 1px solid color-mix(in srgb, var(--skw-md-ink, currentColor) 14%, transparent);
|
|
2575
2579
|
font-size: .92em; line-height: 1.45; max-height: 180px;
|
|
2576
2580
|
}
|
|
2577
|
-
.skw-md .skw-md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
|
|
2581
|
+
.skw-md .skw-md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 2; }
|
|
2578
2582
|
.skw-md .skw-md-code {
|
|
2579
2583
|
padding: .08em .34em; border-radius: 4px; font-size: .94em;
|
|
2580
2584
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
package/lib/markdown-parse.js
CHANGED
|
@@ -61,7 +61,15 @@ const QUOTE = /^>[ \t]?(.*)$/;
|
|
|
61
61
|
const TASK = /^\[([ xX])\][ \t]+([\s\S]*)$/;
|
|
62
62
|
/** A table divider cell: `---`, `:---`, `---:`, `:---:`. */
|
|
63
63
|
const TABLE_DIVIDER = /^\|?[ \t]*:?-{2,}:?[ \t]*(?:\|[ \t]*:?-{2,}:?[ \t]*)*\|?[ \t]*$/;
|
|
64
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Measure leading whitespace in columns and split the line.
|
|
66
|
+
*
|
|
67
|
+
* A tab advances to the next multiple of {@link INDENT_WIDTH}, which is the CSS
|
|
68
|
+
* `tab-size` the editor paints with (see `EDITOR_CSS` in
|
|
69
|
+
* `src/client/editor.tsx`). The nesting LEVEL is unchanged either way — a tab is
|
|
70
|
+
* still worth "about one level" — but this keeps `indent` an honest column count
|
|
71
|
+
* instead of drifting one column on a mixed `" \t"` prefix.
|
|
72
|
+
*/
|
|
65
73
|
function toLine(raw) {
|
|
66
74
|
let width = 0;
|
|
67
75
|
let index = 0;
|
|
@@ -70,7 +78,7 @@ function toLine(raw) {
|
|
|
70
78
|
if (char === ' ')
|
|
71
79
|
width += 1;
|
|
72
80
|
else if (char === '\t')
|
|
73
|
-
width += INDENT_WIDTH;
|
|
81
|
+
width += INDENT_WIDTH - (width % INDENT_WIDTH);
|
|
74
82
|
else
|
|
75
83
|
break;
|
|
76
84
|
index += 1;
|
|
@@ -88,7 +96,7 @@ function stripColumns(raw, width) {
|
|
|
88
96
|
index += 1;
|
|
89
97
|
}
|
|
90
98
|
else if (char === '\t') {
|
|
91
|
-
consumed += INDENT_WIDTH;
|
|
99
|
+
consumed += INDENT_WIDTH - (consumed % INDENT_WIDTH);
|
|
92
100
|
index += 1;
|
|
93
101
|
}
|
|
94
102
|
else
|