@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/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
+ }