@ai-matrx/rich-editor 0.2.7 → 0.2.9

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,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.9
4
+
5
+ - Outline "Copy link" shows ONE toast (AP-2): the words ("Link to … copied.") ride the kit copy instead
6
+ of a second toast after the kit's own "Text copied to clipboard!".
7
+
8
+ ### Consumer action
9
+
10
+ - None required.
11
+
12
+ ## 0.2.8
13
+
14
+ - 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.
15
+
16
+ ### Consumer action
17
+
18
+ - None required.
19
+
3
20
  ## 0.2.7
4
21
 
5
22
  - 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).
@@ -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
@@ -1,4 +1,3 @@
1
- import "./format-actions.js";
2
1
  export declare function isApplePlatform(): boolean;
3
2
  /** Run the chord's command on this element; true when the chord was a formatting command. */
4
3
  export declare function handleFormatChord(el: HTMLTextAreaElement, event: KeyboardEvent): boolean;
@@ -3,7 +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 "./format-actions.js";
6
+ import { ensureFormatActions } from "./format-actions.js";
7
7
  function isApplePlatform() {
8
8
  if (typeof navigator === "undefined") return false;
9
9
  const platform = navigator.userAgentData?.platform ?? navigator.platform ?? "";
@@ -19,6 +19,7 @@ function handleFormatChord(el, event) {
19
19
  function useTextareaFormatting(element, enabled = true) {
20
20
  useEffect(() => {
21
21
  if (!element || !enabled) return;
22
+ ensureFormatActions();
22
23
  const onKeyDown = (event) => {
23
24
  if (event.defaultPrevented || event.isComposing) return;
24
25
  handleFormatChord(element, event);
@@ -15,8 +15,7 @@ function OutlinePanel({
15
15
  const minLevel = Math.min(...entries.map((entry) => entry.level), 6);
16
16
  const copyLink = async (entry) => {
17
17
  const url = `${window.location.origin}${window.location.pathname}${window.location.search}#${entry.slug}`;
18
- if (!await copyText(url, void 0, "Copy failed \u2014 your browser blocked clipboard access.")) return;
19
- toast.success(`Link to \u201C${entry.text}\u201D copied.`);
18
+ if (!await copyText(url, `Link to \u201C${entry.text}\u201D copied.`, "Copy failed \u2014 your browser blocked clipboard access.")) return;
20
19
  };
21
20
  return /* @__PURE__ */ jsxs("nav", { "aria-label": "Outline", className: cn("flex h-full flex-col overflow-hidden", className), children: [
22
21
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-3 py-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
@@ -1,5 +1,4 @@
1
1
  import { type Ref } from "react";
2
- import "../format/format-actions.js";
3
2
  import type { EditorViewHandle } from "../visual/VisualEditor.js";
4
3
  import type { RichShellActions } from "../visual/visual-extensions.js";
5
4
  export interface SourceEditorProps {
@@ -29,7 +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 "../format/format-actions.js";
32
+ import { ensureFormatActions } from "../format/format-actions.js";
33
33
  import { useSelectionZone } from "@ai-matrx/rich-content/selection-toolbar/selection-zones";
34
34
  import { RICH_EDITOR_SHORTCUTS, TYPED_TRIGGERS } from "../core/shortcuts.js";
35
35
  import { variableNamesInText, variableSuggestions } from "../core/variables.js";
@@ -276,7 +276,11 @@ function SourceEditor({
276
276
  const [zoneElement, setZoneElement] = useState(null);
277
277
  const [formatTarget] = useState(() => sourceFormatTarget(() => view.current));
278
278
  useSelectionZone(zoneElement, { editable: !context.readOnly, host: markdownFormatHost(formatTarget) });
279
- 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]);
280
284
  useImperativeHandle(handleRef, () => ({
281
285
  focus: () => view.current?.focus(),
282
286
  formatTarget: () => formatTarget,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-editor",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
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/*": {
@@ -88,13 +90,13 @@
88
90
  "@tiptap/suggestion": "^3.31.3",
89
91
  "github-slugger": "^2.0.0",
90
92
  "lucide-react": "^1.48.0",
93
+ "@ai-matrx/agents": "latest",
94
+ "@ai-matrx/alchemy": "latest",
91
95
  "@ai-matrx/content-ir": "latest",
92
96
  "@ai-matrx/design-system": "latest",
93
97
  "@ai-matrx/print": "latest",
94
- "@ai-matrx/rich-content": "latest",
95
- "@ai-matrx/alchemy": "latest",
96
98
  "@ai-matrx/kit": "latest",
97
- "@ai-matrx/agents": "latest"
99
+ "@ai-matrx/rich-content": "latest"
98
100
  },
99
101
  "peerDependencies": {
100
102
  "react": ">=19.0.0",