@ai-matrx/rich-editor 0.2.6 → 0.2.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.8
4
+
5
+ - The REAL root cause of "no Bold in notes Split's selection toolbar": the package declares `sideEffects: ["**/*.css"]`, so 0.2.7's bare `import "./format-actions"` was tree-shaken out of the app bundle (the module was present in the tarball and the jest run, absent in the browser). Textarea and Source hosts now call `ensureFormatActions()` (a used binding keeps the module and its provider declaration), and `format-actions` is listed in `sideEffects` as well.
6
+
7
+ ### Consumer action
8
+
9
+ - None required.
10
+
11
+ ## 0.2.7
12
+
13
+ - Root cause of "no Bold in notes Split's selection toolbar" (2026-10-07): the format provider was declared only by `visual/format-actions`, which only the Visual editor imports, so a page mounting just a textarea (`useTextareaFormatting`) or the Source view had no provider at all. Both now import `format/format-actions` themselves (module identity was fine: one copy of each module in the app bundle).
14
+
15
+ ### Consumer action
16
+
17
+ - None required.
18
+
3
19
  ## 0.2.6
4
20
 
5
21
  - Source view: where the toolbar row cannot hold the format buttons AND the tools (an in-place editor in a chat column, under 980px), the tools fold into the one "More tools" menu — nothing scrolls off the row (2026-10-07: Outline, Focus and Shortcuts had slid out of view).
@@ -7,4 +7,10 @@ export declare function registerVisualFormatResolver(resolver: VisualResolver):
7
7
  export declare function formatTargetOf(target: ClickTarget): FormatTarget | null;
8
8
  /** The formatting provider (declared on import; the toolbar root imports this module). */
9
9
  export declare const formatProvider: ActionProvider;
10
+ /**
11
+ * A host that only mounts a plain-text editor calls this so a bundler keeps THIS module: the package
12
+ * declares `sideEffects: ["**\/*.css"]`, so a bare `import "./format-actions.js"` is dropped from an app
13
+ * bundle and the selection toolbar never learns the format buttons (0.2.7 shipped exactly that).
14
+ */
15
+ export declare function ensureFormatActions(): void;
10
16
  export {};
@@ -72,7 +72,10 @@ const formatProvider = {
72
72
  actions: (target) => formatTargetOf(target) ? placeSelectionActions(ACTIONS, target) : []
73
73
  };
74
74
  declareSelectionProvider(formatProvider);
75
+ function ensureFormatActions() {
76
+ }
75
77
  export {
78
+ ensureFormatActions,
76
79
  formatProvider,
77
80
  formatTargetOf,
78
81
  registerVisualFormatResolver
@@ -3,6 +3,7 @@ import { useEffect } from "react";
3
3
  import { useSelectionZone } from "@ai-matrx/rich-content/selection-toolbar/selection-zones";
4
4
  import { formatCommandForKey, keyNameOf } from "../core/markdown-format.js";
5
5
  import { markdownFormatHost, registerFormatElement, textareaFormatTarget } from "./format-target.js";
6
+ import { ensureFormatActions } from "./format-actions.js";
6
7
  function isApplePlatform() {
7
8
  if (typeof navigator === "undefined") return false;
8
9
  const platform = navigator.userAgentData?.platform ?? navigator.platform ?? "";
@@ -18,6 +19,7 @@ function handleFormatChord(el, event) {
18
19
  function useTextareaFormatting(element, enabled = true) {
19
20
  useEffect(() => {
20
21
  if (!element || !enabled) return;
22
+ ensureFormatActions();
21
23
  const onKeyDown = (event) => {
22
24
  if (event.defaultPrevented || event.isComposing) return;
23
25
  handleFormatChord(element, event);
@@ -29,6 +29,7 @@ import { continueMarkupOnEnter, makeLink, setLinePrefix, toggleWrap } from "../c
29
29
  import { markdownSourceLanguage } from "./markdown-language.js";
30
30
  import { formatMarkdown } from "../core/markdown-format.js";
31
31
  import { markdownFormatHost, registerFormatElement, textFormatTarget } from "../format/format-target.js";
32
+ import { ensureFormatActions } from "../format/format-actions.js";
32
33
  import { useSelectionZone } from "@ai-matrx/rich-content/selection-toolbar/selection-zones";
33
34
  import { RICH_EDITOR_SHORTCUTS, TYPED_TRIGGERS } from "../core/shortcuts.js";
34
35
  import { variableNamesInText, variableSuggestions } from "../core/variables.js";
@@ -275,7 +276,11 @@ function SourceEditor({
275
276
  const [zoneElement, setZoneElement] = useState(null);
276
277
  const [formatTarget] = useState(() => sourceFormatTarget(() => view.current));
277
278
  useSelectionZone(zoneElement, { editable: !context.readOnly, host: markdownFormatHost(formatTarget) });
278
- useEffect(() => zoneElement ? registerFormatElement(zoneElement, formatTarget) : void 0, [zoneElement, formatTarget]);
279
+ useEffect(() => {
280
+ if (!zoneElement) return void 0;
281
+ ensureFormatActions();
282
+ return registerFormatElement(zoneElement, formatTarget);
283
+ }, [zoneElement, formatTarget]);
279
284
  useImperativeHandle(handleRef, () => ({
280
285
  focus: () => view.current?.focus(),
281
286
  formatTarget: () => formatTarget,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-editor",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "The AI Matrx editor: Visual (Tiptap), Source (CodeMirror), Preview, the markdown formatting command layer, and edit-in-place — over @ai-matrx/rich-content. Consumers that only render never install it.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,7 +20,9 @@
20
20
  "CHANGELOG.md"
21
21
  ],
22
22
  "sideEffects": [
23
- "**/*.css"
23
+ "**/*.css",
24
+ "./dist/format/format-actions.js",
25
+ "./src/format/format-actions.ts"
24
26
  ],
25
27
  "exports": {
26
28
  "./core/*": {