@k2b/editor 0.14.0 → 0.15.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
|
+
"version": "0.15.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": [
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"@codemirror/search": "6.7.2",
|
|
71
71
|
"@codemirror/state": "6.7.6",
|
|
72
72
|
"@codemirror/view": "6.43.15",
|
|
73
|
-
"@k2b/stdlib": "0.36.
|
|
74
|
-
"@k2b/ui": "0.
|
|
73
|
+
"@k2b/stdlib": "0.36.1",
|
|
74
|
+
"@k2b/ui": "0.66.0",
|
|
75
75
|
"@lezer/common": "1.5.5",
|
|
76
76
|
"@lezer/highlight": "1.2.5",
|
|
77
77
|
"@lezer/markdown": "1.8.1",
|
|
@@ -314,14 +314,14 @@ class QueryBlockWidget extends WidgetType {
|
|
|
314
314
|
if (this.chart) return 34 + (this.chart.subtitle ? 44 : 28) + 8 + (this.chart.kind === "stat" ? 160 : 288);
|
|
315
315
|
// Query tables have 14px / 21px text, 16px cell padding and row dividers;
|
|
316
316
|
// the 28px source switch, widget padding/border and table spacing add 69px, the space around the frame 16px.
|
|
317
|
-
// The truncated count paragraph inherits
|
|
317
|
+
// The truncated count paragraph inherits 16px / 1.6 text (25.6px) in
|
|
318
318
|
// `.cm-query-block-preview.notebook-book-content` and 1rem block margins
|
|
319
319
|
// from app.css. Its top margin collapses with the table's bottom margin,
|
|
320
|
-
// so it adds one line plus one 16px margin:
|
|
320
|
+
// so it adds one line plus one 16px margin: 41.6px.
|
|
321
321
|
const rows = this.snapshot.failed ? 0 : (this.html?.match(/<tr(?:\s|>)/g)?.length ?? 0);
|
|
322
322
|
// The page buttons of a paged query add a 28px row and its 8px top margin.
|
|
323
323
|
const countHeight = this.html?.includes('<p class="notebook-book-empty">')
|
|
324
|
-
?
|
|
324
|
+
? 41.6
|
|
325
325
|
: this.html?.includes('class="notebook-query-pager"')
|
|
326
326
|
? 36
|
|
327
327
|
: 0;
|
|
@@ -86,11 +86,10 @@ class InfoBlockWidget extends WidgetType {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
override get estimatedHeight() {
|
|
89
|
-
// At
|
|
90
|
-
//
|
|
91
|
-
// text and adds no height. A wrapped line measures taller; CodeMirror corrects the height once the notice renders.
|
|
89
|
+
// At 16px / 26px, count each title and unwrapped body line, plus 32px padding, 2px border and a 4px title gap.
|
|
90
|
+
// The icon sits beside the text and adds no height. A wrapped line measures taller; CodeMirror corrects the height once the notice renders.
|
|
92
91
|
const lines = this.blockData.content.split("\n").length + (this.blockData.title ? 1 : 0);
|
|
93
|
-
return lines *
|
|
92
|
+
return lines * 26 + 34 + (this.blockData.title ? 4 : 0);
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
@@ -148,15 +147,10 @@ export const infoBlocksExtension = (locale: string): Extension => {
|
|
|
148
147
|
margin: "0 !important",
|
|
149
148
|
lineHeight: "1",
|
|
150
149
|
},
|
|
151
|
-
// Notices read at the note's text size
|
|
152
|
-
// inside a 1 px edge, the title on the text's first line) here, so `estimatedHeight` holds for every host.
|
|
150
|
+
// Notices read at the note's text size, as in the Book.
|
|
153
151
|
".cm-notice-card-widget .k2b-notice-card": {
|
|
154
152
|
fontSize: "inherit",
|
|
155
|
-
lineHeight: "
|
|
156
|
-
paddingBlock: "7px",
|
|
157
|
-
},
|
|
158
|
-
".cm-notice-card-widget .k2b-notice-card__title + .k2b-notice-card__body": {
|
|
159
|
-
marginTop: "0",
|
|
153
|
+
lineHeight: "1.625",
|
|
160
154
|
},
|
|
161
155
|
});
|
|
162
156
|
|
package/src/markdown/tables.ts
CHANGED
|
@@ -600,10 +600,10 @@ export const tablesExtension = (presentation: PrettyTableOptions = {}): Extensio
|
|
|
600
600
|
marginBottom: "0 !important",
|
|
601
601
|
overflowX: "auto",
|
|
602
602
|
},
|
|
603
|
-
// The Book's table type:
|
|
603
|
+
// The Book's table type: a step below the text.
|
|
604
604
|
".cm-table-widget .md-table": {
|
|
605
605
|
wordBreak: "normal",
|
|
606
|
-
fontSize: "
|
|
606
|
+
fontSize: "0.875em",
|
|
607
607
|
lineHeight: "1.5",
|
|
608
608
|
},
|
|
609
609
|
});
|
package/src/markdown/theme.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type CreateThemeOptions, createTheme } from "@uiw/codemirror-themes";
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Layout / chrome styles — shared between rich and raw modes. Deliberately
|
|
7
|
-
* font-free so each mode can pick its own type system (rich =
|
|
7
|
+
* font-free so each mode can pick its own type system (rich = 16px sans
|
|
8
8
|
* with code-mark mono override, raw = 14px mono).
|
|
9
9
|
*/
|
|
10
10
|
const baseEditorCSS = EditorView.theme({
|
|
@@ -64,16 +64,15 @@ const baseEditorCSS = EditorView.theme({
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* Rich-mode type: prose in Sans at the Book's size and line height
|
|
68
|
-
*
|
|
69
|
-
* lines while writing and reading; code in Mono.
|
|
67
|
+
* Rich-mode type: prose in Sans at the Book's size and line height, so a
|
|
68
|
+
* paragraph breaks into the same lines while writing and reading; code in Mono.
|
|
70
69
|
*
|
|
71
70
|
* `.cm-md-code` is applied per-range by `codeFontExtension` against the
|
|
72
71
|
* markdown syntax tree (FencedCode / InlineCode / CodeBlock nodes).
|
|
73
72
|
*/
|
|
74
73
|
const richFontCSS = EditorView.theme({
|
|
75
|
-
"&": { fontFamily: "var(--font-sans)", fontSize: "
|
|
76
|
-
".cm-scroller": { lineHeight: "
|
|
74
|
+
"&": { fontFamily: "var(--font-sans)", fontSize: "16px" },
|
|
75
|
+
".cm-scroller": { lineHeight: "1.6" },
|
|
77
76
|
".cm-line": { fontFamily: "var(--font-sans)" },
|
|
78
77
|
// The Book's code sizes (`.notebook-book-content pre` and inline `code`).
|
|
79
78
|
".cm-md-code": { fontFamily: "var(--font-mono)", fontSize: "0.9em" },
|
|
@@ -105,14 +104,15 @@ const darkText = "var(--color-zinc-100)";
|
|
|
105
104
|
|
|
106
105
|
/**
|
|
107
106
|
* The heading scale of the Book (`.notebook-book-content` in the app's
|
|
108
|
-
* stylesheet)
|
|
109
|
-
*
|
|
110
|
-
* and italic keep the text color in both themes; only code is highlighted.
|
|
107
|
+
* stylesheet). Headings, bold and italic keep the text color in both themes;
|
|
108
|
+
* only code is highlighted.
|
|
111
109
|
*/
|
|
112
110
|
const headingStyles: CreateThemeOptions["styles"] = [
|
|
113
|
-
{ tag: t.heading1, fontSize: "
|
|
114
|
-
{ tag: t.heading2, fontSize: "
|
|
115
|
-
{ tag:
|
|
111
|
+
{ tag: t.heading1, fontSize: "1.875em", fontWeight: "650", lineHeight: "1.25" },
|
|
112
|
+
{ tag: t.heading2, fontSize: "1.5em", fontWeight: "650", lineHeight: "1.3" },
|
|
113
|
+
{ tag: t.heading3, fontSize: "1.25em", fontWeight: "650", lineHeight: "1.4" },
|
|
114
|
+
{ tag: t.heading4, fontSize: "1.125em", fontWeight: "650" },
|
|
115
|
+
{ tag: [t.heading5, t.heading6], fontSize: "1em", fontWeight: "650" },
|
|
116
116
|
];
|
|
117
117
|
|
|
118
118
|
const customLightStyle: CreateThemeOptions["styles"] = [
|