@k2b/editor 0.9.0 → 0.11.0
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 +3 -3
- package/src/BubbleMenu.tsx +11 -4
- package/src/Toolbar.tsx +25 -12
- package/src/chart-locale.ts +1 -1
- package/src/chart-schema.ts +178 -27
- package/src/charts.ts +225 -83
- package/src/collab/remote-cursors.ts +10 -2
- package/src/markdown/_lib/changed-blocks.ts +66 -0
- package/src/markdown/_lib/cursor-zone-field.ts +61 -5
- package/src/markdown/_lib/list-structure.ts +6 -1
- package/src/markdown/_lib/math-syntax.ts +5 -2
- package/src/markdown/block-previews.tsx +16 -9
- package/src/markdown/data-blocks.ts +13 -5
- package/src/markdown/images.ts +2 -1
- package/src/markdown/info-blocks.ts +4 -2
- package/src/markdown/katex.ts +11 -13
- package/src/markdown/lib/chart-blocks.ts +129 -16
- package/src/markdown/lib/query-blocks.ts +1 -0
- package/src/markdown/ligatures.ts +54 -45
- package/src/markdown/links.ts +2 -2
- package/src/markdown/lists.ts +53 -8
- package/src/markdown/markup.ts +110 -340
- package/src/markdown/mermaid.ts +4 -2
- package/src/markdown/named-blocks.ts +4 -2
- package/src/markdown/notebook-charts.tsx +10 -3
- package/src/markdown/tables.ts +15 -7
- package/src/slash-menu.ts +8 -0
- package/src/styles.css +8 -0
package/src/slash-menu.ts
CHANGED
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
type CompletionSource,
|
|
7
7
|
pickedCompletion,
|
|
8
8
|
} from "@codemirror/autocomplete";
|
|
9
|
+
import { syntaxTree } from "@codemirror/language";
|
|
9
10
|
import type { Extension } from "@codemirror/state";
|
|
10
11
|
import { type EditorView, ViewPlugin } from "@codemirror/view";
|
|
11
12
|
import { fuzzy } from "@k2b/stdlib";
|
|
12
13
|
import type { EditorAction } from "./editor-state";
|
|
14
|
+
import { isInsideFencedCode } from "./markdown/editor-scope";
|
|
13
15
|
import { caretIntoTableCell, tableCellCompletions } from "./table-cells";
|
|
14
16
|
|
|
15
17
|
/** One entry of the slash menu: an editor action reached by typing `/` and its name. */
|
|
@@ -120,6 +122,12 @@ export const slashCompletionSource = (actions: SlashAction[]) => {
|
|
|
120
122
|
const line = context.state.doc.lineAt(context.pos);
|
|
121
123
|
const match = trigger.exec(line.text.slice(0, context.pos - line.from));
|
|
122
124
|
if (!match) return null;
|
|
125
|
+
if (isInsideFencedCode(context)) return null;
|
|
126
|
+
for (let node = syntaxTree(context.state).resolveInner(context.pos, -1); ; ) {
|
|
127
|
+
if (node.name === "InlineCode") return null;
|
|
128
|
+
if (!node.parent) break;
|
|
129
|
+
node = node.parent;
|
|
130
|
+
}
|
|
123
131
|
const typed = match[2] ?? "";
|
|
124
132
|
const from = line.from + match.index + (match[1] ?? "").length;
|
|
125
133
|
const enabled = actions.filter((action) => action.isEnabled?.(context.state) !== false);
|
package/src/styles.css
CHANGED
|
@@ -427,3 +427,11 @@
|
|
|
427
427
|
flex: none;
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
+
|
|
431
|
+
/* Calendar placeholders, drawings and tables share a width-derived content box. */
|
|
432
|
+
.k2b-ui .notebook-book-chart[data-calendar] .notebook-book-chart__viewport {
|
|
433
|
+
height: var(--notebook-chart-height);
|
|
434
|
+
}
|
|
435
|
+
.k2b-ui .notebook-book-chart[data-calendar] .k2b-chart__svg {
|
|
436
|
+
height: auto;
|
|
437
|
+
}
|