@k2b/editor 0.3.0 → 0.3.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": "@k2b/editor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Configurable Markdown editor for SolidJS: editor, toolbar, bubble menu, and slash menu on one shared state.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@codemirror/state": "6.7.1",
|
|
70
70
|
"@codemirror/view": "6.43.7",
|
|
71
71
|
"@k2b/stdlib": "0.30.0",
|
|
72
|
-
"@k2b/ui": "0.
|
|
72
|
+
"@k2b/ui": "0.40.0",
|
|
73
73
|
"@lezer/common": "1.5.3",
|
|
74
74
|
"@lezer/highlight": "1.2.4",
|
|
75
75
|
"@lezer/markdown": "1.7.2",
|
|
@@ -339,12 +339,17 @@ export const remoteCursors = (ytext: Y.Text, awareness: Awareness): Extension =>
|
|
|
339
339
|
const base = view.scrollDOM.getBoundingClientRect();
|
|
340
340
|
const edge = view.contentDOM.getBoundingClientRect();
|
|
341
341
|
const padding = parseFloat(getComputedStyle(view.contentDOM).paddingLeft);
|
|
342
|
+
// A rendered block hides the source the other person edits, so no line of it shows the caret's place: the
|
|
343
|
+
// caret runs along the whole block, which a line-high caret at its top would misstate.
|
|
344
|
+
// The block as drawn, which a widget may offset from the line the editor gives it.
|
|
345
|
+
const box = view.coordsAtPos(block.from, 1);
|
|
346
|
+
if (!box) return [];
|
|
342
347
|
const rect = new RectangleMarker(
|
|
343
|
-
"cm-remoteCaret",
|
|
348
|
+
"cm-remoteCaret cm-remoteCaret-block",
|
|
344
349
|
edge.left + padding - base.left + view.scrollDOM.scrollLeft,
|
|
345
|
-
|
|
350
|
+
box.top - base.top + view.scrollDOM.scrollTop,
|
|
346
351
|
null,
|
|
347
|
-
|
|
352
|
+
box.bottom - box.top,
|
|
348
353
|
);
|
|
349
354
|
return [new RemoteCaretMarker(rect, color, name, idle)];
|
|
350
355
|
}
|
|
@@ -251,7 +251,7 @@ class QueryBlockWidget extends WidgetType {
|
|
|
251
251
|
if (this.placeholder) return this.placeholder.estimatedHeight;
|
|
252
252
|
if (this.chart) return 66 + (this.chart.subtitle ? 44 : 28) + 8 + (this.chart.kind === "stat" ? 160 : 288);
|
|
253
253
|
// Query tables have 14px / 21px text, 16px cell padding and row dividers;
|
|
254
|
-
// controls, widget padding/border and table spacing add 65px.
|
|
254
|
+
// controls, widget padding/border and table spacing add 65px, the space around the frame 16px.
|
|
255
255
|
// The truncated count paragraph inherits 16px / 1.6 text (25.6px) in
|
|
256
256
|
// `.cm-query-block-preview.notebook-book-content` and 1rem block margins
|
|
257
257
|
// from app.css. Its top margin collapses with the table's bottom margin,
|
|
@@ -263,7 +263,7 @@ class QueryBlockWidget extends WidgetType {
|
|
|
263
263
|
: this.html?.includes('class="notebook-query-pager"')
|
|
264
264
|
? 36
|
|
265
265
|
: 0;
|
|
266
|
-
return rows ? rows * 38 +
|
|
266
|
+
return rows ? rows * 38 + 81 + countHeight : 136;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
|
|
@@ -82,8 +82,12 @@ export const namedBlocksExtension = (): Extension => {
|
|
|
82
82
|
stateField,
|
|
83
83
|
blockWidgetLineNavigationExtension(stateField, (value) => value.atomicDecorations),
|
|
84
84
|
EditorView.theme({
|
|
85
|
+
// A block of the editor, measured without margins: an inline label would sit in a taller line box than the
|
|
86
|
+
// editor measures, and every line after it would drift from where the editor places it.
|
|
85
87
|
".cm-named-block-handle": {
|
|
88
|
+
display: "flex",
|
|
86
89
|
margin: "0 !important",
|
|
90
|
+
padding: "0.35rem 0 0.15rem",
|
|
87
91
|
},
|
|
88
92
|
}),
|
|
89
93
|
];
|
package/src/styles.css
CHANGED
|
@@ -269,13 +269,21 @@
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
/* A rendered block in the editor, and the box the note's server preview reserves for a chart in its place.
|
|
272
|
+
/* A rendered block in the editor, and the box the note's server preview reserves for a chart in its place. The editor
|
|
273
|
+
measures blocks without margins, so the space above and below the frame is the block's own padding and the frame is
|
|
274
|
+
drawn inside it; a margin would move every line after the block away from where the editor places it. */
|
|
273
275
|
.cm-query-block-widget {
|
|
276
|
+
position: relative;
|
|
274
277
|
display: block;
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
padding: calc(1rem + 1px) calc(0.5rem + 1px);
|
|
279
|
+
}
|
|
280
|
+
.cm-query-block-widget::before {
|
|
281
|
+
content: "";
|
|
282
|
+
position: absolute;
|
|
283
|
+
inset: 0.5rem 0;
|
|
277
284
|
border: 1px solid var(--ui-border);
|
|
278
285
|
border-radius: var(--k2b-radius-control);
|
|
286
|
+
pointer-events: none;
|
|
279
287
|
}
|
|
280
288
|
.cm-query-block-preview.notebook-book-content {
|
|
281
289
|
max-width: none;
|