mrmd-editor 0.8.0 → 0.8.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mrmd-editor",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Markdown editor with realtime collaboration - the core editor package",
5
5
  "type": "module",
6
6
  "main": "dist/mrmd.cjs",
@@ -15,7 +15,8 @@
15
15
  "dev": "rollup -c --watch",
16
16
  "build": "rollup -c",
17
17
  "serve": "npx serve .",
18
- "test:node": "node -e \"const m = require('./dist/mrmd.cjs'); console.log('Loaded:', m.version, Object.keys(m))\""
18
+ "test:node": "node -e \"const m = require('./dist/mrmd.cjs'); console.log('Loaded:', m.version, Object.keys(m))\"",
19
+ "prepublishOnly": "npm run build"
19
20
  },
20
21
  "keywords": [
21
22
  "codemirror",
@@ -30,7 +31,8 @@
30
31
  "@rollup/plugin-node-resolve": "^15.2.3",
31
32
  "@rollup/plugin-terser": "^0.4.4",
32
33
  "puppeteer": "^24.34.0",
33
- "rollup": "^4.9.0"
34
+ "rollup": "^4.9.0",
35
+ "vite": "^8.0.0"
34
36
  },
35
37
  "dependencies": {
36
38
  "@codemirror/autocomplete": "^6.18.0",
@@ -49,8 +51,8 @@
49
51
  "@codemirror/lang-xml": "^6.1.0",
50
52
  "@codemirror/lang-yaml": "^6.1.2",
51
53
  "@codemirror/language": "^6.10.2",
52
- "@codemirror/lint": "^6.8.0",
53
54
  "@codemirror/legacy-modes": "^6.5.2",
55
+ "@codemirror/lint": "^6.8.0",
54
56
  "@codemirror/search": "^6.5.6",
55
57
  "@codemirror/state": "^6.4.1",
56
58
  "@codemirror/theme-one-dark": "^6.1.3",
@@ -684,7 +684,7 @@ class OutputWidget extends WidgetType {
684
684
  }
685
685
 
686
686
  ignoreEvent() {
687
- return false;
687
+ return true;
688
688
  }
689
689
  }
690
690
 
@@ -844,7 +844,7 @@ class HtmlOutputWidget extends WidgetType {
844
844
  }
845
845
 
846
846
  ignoreEvent() {
847
- return false;
847
+ return true;
848
848
  }
849
849
  }
850
850
 
@@ -1037,7 +1037,7 @@ class CssOutputWidget extends WidgetType {
1037
1037
  }
1038
1038
 
1039
1039
  ignoreEvent() {
1040
- return false;
1040
+ return true;
1041
1041
  }
1042
1042
  }
1043
1043
 
@@ -1128,7 +1128,7 @@ class ScrollableOutputWidget extends WidgetType {
1128
1128
  }
1129
1129
 
1130
1130
  ignoreEvent() {
1131
- return false;
1131
+ return true;
1132
1132
  }
1133
1133
  }
1134
1134
 
@@ -1229,7 +1229,7 @@ class JsonOutputWidget extends WidgetType {
1229
1229
  }
1230
1230
 
1231
1231
  ignoreEvent() {
1232
- return false;
1232
+ return true;
1233
1233
  }
1234
1234
  }
1235
1235
 
@@ -1896,22 +1896,37 @@ export const outputWidgetStyles = `
1896
1896
  This approach works with CM6 viewport virtualization.
1897
1897
  ========================================================================== */
1898
1898
 
1899
- /* Fence lines (opening and closing) - hidden in viewing mode */
1899
+ /* Fence lines (opening and closing) - visually hidden in viewing mode.
1900
+ * Uses font-size:1px (not 0) so CodeMirror's posAtCoordsInline can
1901
+ * still find a child with a non-zero bounding rect. With font-size:0,
1902
+ * all text rects are zero-sized, point widgets are skipped, and CM
1903
+ * throws "Invalid child in posBefore". */
1900
1904
  .cm-output-fence-line {
1901
- font-size: 0 !important;
1905
+ font-size: 1px !important;
1902
1906
  line-height: 0 !important;
1903
1907
  height: 0 !important;
1904
1908
  overflow: hidden !important;
1905
1909
  padding: 0 !important;
1906
1910
  margin: 0 !important;
1911
+ color: transparent !important;
1907
1912
  }
1908
1913
 
1909
1914
  /* Rich output widgets (HTML/CSS/Mermaid->HTML) are mounted on the opening
1910
- * fence line. Keep that line unclipped so the inline widget can paint. */
1915
+ * fence line. Keep that line unclipped so the inline widget can paint.
1916
+ *
1917
+ * The text span children on this line must have non-zero bounding rects
1918
+ * so CodeMirror's posAtCoordsInline can find a measurable child.
1919
+ * Without this, clicking/hovering on the widget area crashes with
1920
+ * "Invalid child in posBefore" because CM skips point widgets during
1921
+ * coordinate mapping and finds no other child with height > 0. */
1922
+ /* Rich output widgets are mounted on the opening fence line.
1923
+ * The fence text stays at font-size:1px (inherited from .cm-output-fence-line)
1924
+ * so CodeMirror can measure it for position mapping.
1925
+ * The widget paints via overflow:visible beyond the line's layout height. */
1911
1926
  .cm-output-fence-rich-start {
1912
1927
  height: auto !important;
1913
1928
  overflow: visible !important;
1914
- line-height: 1 !important;
1929
+ line-height: 0 !important;
1915
1930
  }
1916
1931
 
1917
1932
  /* Hide CodeMirror's special character rendering (escape symbols) in output blocks */
@@ -2230,8 +2245,11 @@ export const outputWidgetStyles = `
2230
2245
  ========================================================================== */
2231
2246
 
2232
2247
  /* Hide content lines for rich output (HTML/CSS) */
2248
+ /* Hidden content lines for rich output (HTML/CSS/JSON).
2249
+ * Use clip-path instead of height:0 so CodeMirror can still
2250
+ * resolve positions (prevents "Invalid child in posBefore"). */
2233
2251
  .cm-rich-output-hidden {
2234
- font-size: 0 !important;
2252
+ font-size: 1px !important;
2235
2253
  line-height: 0 !important;
2236
2254
  height: 0 !important;
2237
2255
  overflow: hidden !important;
@@ -2250,6 +2268,8 @@ export const outputWidgetStyles = `
2250
2268
  border-radius: var(--widget-border-radius, 6px);
2251
2269
  overflow: hidden;
2252
2270
  border: 1px solid var(--widget-border, rgba(255, 255, 255, 0.1));
2271
+ line-height: normal; /* Override parent's collapsed line-height */
2272
+ font-size: var(--mrmd-ui-font-size, 13px);
2253
2273
  }
2254
2274
 
2255
2275
  .cm-html-output-widget::before {
@@ -2287,6 +2307,8 @@ export const outputWidgetStyles = `
2287
2307
  border-radius: var(--widget-border-radius, 6px);
2288
2308
  border: 1px solid var(--widget-border, rgba(255, 255, 255, 0.08));
2289
2309
  border-left: 2px solid var(--widget-accent-css, #64b5f6);
2310
+ line-height: normal; /* Override parent's collapsed line-height */
2311
+ font-size: var(--mrmd-ui-font-size, 13px);
2290
2312
  }
2291
2313
 
2292
2314
  .cm-css-header {
@@ -2412,6 +2434,8 @@ export const outputWidgetStyles = `
2412
2434
  border-left: 3px solid var(--widget-border-accent, rgba(100, 149, 237, 0.6));
2413
2435
  border-radius: var(--widget-border-radius, 6px);
2414
2436
  overflow: hidden;
2437
+ line-height: normal; /* Override parent's collapsed line-height */
2438
+ font-size: var(--mrmd-ui-font-size, 13px);
2415
2439
  }
2416
2440
 
2417
2441
  .cm-scroll-output-header {
@@ -2494,6 +2518,8 @@ export const outputWidgetStyles = `
2494
2518
  border-left: 3px solid var(--widget-accent-json, #8cc0ff);
2495
2519
  border-radius: var(--widget-border-radius, 6px);
2496
2520
  overflow: hidden;
2521
+ line-height: normal; /* Override parent's collapsed line-height */
2522
+ font-size: var(--mrmd-ui-font-size, 13px);
2497
2523
  }
2498
2524
 
2499
2525
  .cm-json-header {