@ai-matrx/rich-editor 0.5.0 → 0.5.2

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.2
4
+ ### A typed link keeps the space after it (2026-10-08)
5
+
6
+ - The address-to-link rule no longer swallows the space that completed it under Tiptap ≤ 3.31.3 (what apps resolve today): it inserts the typed whitespace itself unless Tiptap (≥ 3.31.4) already put it in the document. Live in notes Write, `https://maps.example.com/alton and` stored `altonand`. The image and checklist rules work under both. Guard: `typing-and-table-menu.test.ts` › "under Tiptap ≤ 3.31.3" (`TYPING_RULES` is exported for it).
7
+
8
+ Consumer action: none.
9
+
10
+ ## 0.5.1
11
+ ### The toolbar measures its layout width (2026-10-08)
12
+
13
+ - `FormatButtons` folds by the row's layout width (`clientWidth`), not its painted box: in a dialog that opens with a scale animation it measured a shrunken rect and kept only Bold and Italic.
14
+
15
+ Consumer action: none.
16
+
3
17
  ## 0.5.0
4
18
  ### Write behaves like a notes app (2026-10-08)
5
19
 
@@ -1,4 +1,4 @@
1
- import { Extension } from "@tiptap/core";
1
+ import { Extension, InputRule } from "@tiptap/core";
2
2
  /** `[ ] ` / `[] ` / `[x] ` typed at the very start of a line. */
3
3
  export declare const TASK_TYPED: RegExp;
4
4
  /** An address followed by the whitespace that ends it. */
@@ -8,4 +8,5 @@ export declare const IMAGE_TYPED: RegExp;
8
8
  /** Trailing punctuation is sentence, not address (GFM's extended-autolink rule). */
9
9
  export declare function trimUrl(url: string): string;
10
10
  /** The typed-markdown conversions (header). Image first: its URL must never be autolinked. */
11
+ export declare const TYPING_RULES: readonly InputRule[];
11
12
  export declare const MarkdownTypingRules: Extension<any, any>;
@@ -17,6 +17,10 @@ function listItemDepth($from) {
17
17
  }
18
18
  return -1;
19
19
  }
20
+ function typedWhitespaceInDoc(doc, range) {
21
+ if (range.to <= range.from) return false;
22
+ return /\s$/.test(doc.textBetween(range.to - 1, range.to, "\n", "\uFFFC"));
23
+ }
20
24
  const taskRule = new InputRule({
21
25
  find: TASK_TYPED,
22
26
  handler: ({ state, range, match }) => {
@@ -77,20 +81,23 @@ const urlRule = new InputRule({
77
81
  const href = /^www\./i.test(url) ? `https://${url}` : url;
78
82
  const { tr } = state;
79
83
  tr.addMark(start, end, link.create({ href, mdForm: "bare", mdTailHref: href, mdText: url }));
84
+ if (!typedWhitespaceInDoc(state.doc, range)) tr.insertText(match[2] ?? " ", range.to);
80
85
  tr.removeStoredMark(link);
81
86
  return void 0;
82
87
  }
83
88
  });
89
+ const TYPING_RULES = [taskRule, imageRule, urlRule];
84
90
  const MarkdownTypingRules = Extension.create({
85
91
  name: "richEditorTypingRules",
86
92
  addInputRules() {
87
- return [taskRule, imageRule, urlRule];
93
+ return [...TYPING_RULES];
88
94
  }
89
95
  });
90
96
  export {
91
97
  IMAGE_TYPED,
92
98
  MarkdownTypingRules,
93
99
  TASK_TYPED,
100
+ TYPING_RULES,
94
101
  URL_TYPED,
95
102
  trimUrl
96
103
  };
@@ -133,7 +133,7 @@ function FormatButtons({ resolve, disabled = false, className, size = "sm", vari
133
133
  React.useEffect(() => {
134
134
  const el = rootRef.current;
135
135
  if (!el || typeof ResizeObserver === "undefined") return void 0;
136
- const ro = new ResizeObserver(() => setWidth(el.getBoundingClientRect().width));
136
+ const ro = new ResizeObserver(() => setWidth(el.clientWidth || el.getBoundingClientRect().width));
137
137
  ro.observe(el);
138
138
  return () => ro.disconnect();
139
139
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-editor",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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",
@@ -90,8 +90,8 @@
90
90
  "@tiptap/suggestion": "^3.31.3",
91
91
  "github-slugger": "^2.0.0",
92
92
  "lucide-react": "^1.48.0",
93
- "@ai-matrx/alchemy": "latest",
94
93
  "@ai-matrx/agents": "latest",
94
+ "@ai-matrx/alchemy": "latest",
95
95
  "@ai-matrx/content-ir": "latest",
96
96
  "@ai-matrx/design-system": "latest",
97
97
  "@ai-matrx/kit": "latest",