@skillre/dsh-plugin-sticky-wall 0.9.5 → 0.9.6

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.
Files changed (2) hide show
  1. package/lib/client.js +8 -16
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -1448,27 +1448,19 @@ window.__ModuleLoader__.load({
1448
1448
  for (const char of prefix) width += char === " " ? INDENT_WIDTH2 : 1;
1449
1449
  return width;
1450
1450
  }
1451
- function indentUnitOf(value) {
1452
- let sawIndent = false;
1453
- for (const line of value.split("\n")) {
1454
- if (line.trim() === "") continue;
1455
- const columns2 = columnsOf(leadingSpace(line));
1456
- if (columns2 === 0) continue;
1457
- sawIndent = true;
1458
- if (columns2 % WIDE_INDENT_UNIT !== 0) return INDENT_WIDTH2;
1459
- }
1460
- return sawIndent ? WIDE_INDENT_UNIT : INDENT_WIDTH2;
1461
- }
1462
- var WIDE_INDENT_UNIT = 4;
1451
+ var INDENT_STEP = INDENT_WIDTH2;
1463
1452
  function indentSelection(value, start, end, direction) {
1464
- const unit2 = indentUnitOf(value);
1465
1453
  return rewriteLines(value, start, end, (line) => {
1466
1454
  if (line.trim() === "") return line;
1467
1455
  const prefix = leadingSpace(line);
1468
1456
  const body = line.slice(prefix.length);
1469
- if (direction === 1) return `${prefix}${" ".repeat(unit2)}${body}`;
1470
- const level = Math.floor(columnsOf(prefix) / unit2);
1471
- return `${" ".repeat(Math.max(0, level - 1) * unit2)}${body}`;
1457
+ const columns2 = columnsOf(prefix);
1458
+ if (direction === 1) {
1459
+ const level2 = Math.floor(columns2 / INDENT_STEP);
1460
+ return `${" ".repeat((level2 + 1) * INDENT_STEP)}${body}`;
1461
+ }
1462
+ const level = Math.ceil(columns2 / INDENT_STEP);
1463
+ return `${" ".repeat(Math.max(0, level - 1) * INDENT_STEP)}${body}`;
1472
1464
  });
1473
1465
  }
1474
1466
  function fenceLines(lines) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillre/dsh-plugin-sticky-wall",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "便签墙:DSH 侧栏的自由画布便签板,可拖动摆放、一键整理,正文按 Markdown 渲染",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",