@ai-matrx/rich-editor 0.3.0 → 0.3.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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.2
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/rich-editor/v0.3.1..npm/rich-editor/v0.3.2 -- apps/shared/rich-editor`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.3.1
10
+ ### A block goes above only from the very start of its paragraph (G15, 2026-10-07)
11
+
12
+ - `blockSide` / `nearestSide` / `blockSideOfSelection` (`"nearest"`): a caret at offset 0 of a non-empty block → BEFORE it; anywhere else → AFTER. The 0.3.0 "first half → before" rule counted characters, so a right-click 89% along the first visual line of a wrapped paragraph put the block above it.
13
+
14
+ Consumer action: none; hosts already pass `"nearest"`.
15
+
3
16
  ## 0.3.0
4
17
  ### A block lands on the side of the click; a trailing space stays typed (G11B, 2026-10-07)
5
18
 
@@ -125,3 +138,4 @@ approval, host value, block insert, shortcuts), `in-place/{in-place-session,care
125
138
 
126
139
  - matrx-frontend: import `@ai-matrx/rich-editor/core/<module>` instead of `@/components/rich-editor/core/<module>`.
127
140
 
141
+
@@ -22,10 +22,10 @@ import { type BlockPlacement } from "./text-insertion.js";
22
22
  /** The top-level boundary a block goes to, relative to [from, to]. */
23
23
  export declare function blockInsertPosition(doc: PMNode, from: number, to: number, where: "before" | "after"): number;
24
24
  /**
25
- * The side of its block a selection is nearer to (`blockSide`): a collapsed
26
- * caret at the start or in the first half of a textblock → "before"; anything
27
- * else — the second half, the end, an empty block, a selected chip, ⌘A,
28
- * a position between blocks — → "after".
25
+ * The side of its block a selection belongs on (`blockSide`): a collapsed
26
+ * caret at the very start of a textblock → "before"; anything else — the
27
+ * middle, the end, an empty block, a selected chip, ⌘A, a position between
28
+ * blocks — → "after".
29
29
  */
30
30
  export declare function blockSideOfSelection(doc: PMNode, from: number, to: number): "before" | "after";
31
31
  /**
@@ -14,16 +14,17 @@ export declare function insertTextByRef(textareaRef: HTMLTextAreaElement | null,
14
14
  export declare function blockBoundary(text: string, from: number, to: number, where?: BlockPlacement): number;
15
15
  /**
16
16
  * Where a block goes relative to the caret's block: `before` it, `after` it, or
17
- * `nearest` — the side the click was closer to.
17
+ * `nearest` — before it from the very start of the block, after it otherwise.
18
18
  */
19
19
  export type BlockPlacement = "before" | "after" | "nearest";
20
20
  /**
21
- * 🚨 A BLOCK LANDS ON THE SIDE OF THE CLICK (G11B review, 2026-10-07: every
22
- * reference and button went AFTER its paragraph, even from a right-click at the
23
- * start of a line). A matrx fence is block-level, so it can never sit
24
- * mid-sentence — but a caret at the START of its block, or in its first half,
25
- * puts the block BEFORE that block; anywhere else (the middle, the second half,
26
- * the end, an empty block) puts it AFTER. `offset` is the caret's place inside
21
+ * 🚨 A BLOCK GOES ABOVE ONLY FROM THE VERY START OF ITS BLOCK. A matrx fence is
22
+ * block-level, so it never sits mid-sentence: a caret at offset 0 of a
23
+ * non-empty block (a right-click left of its first character lands there too)
24
+ * puts the block BEFORE it; anywhere else (the middle, the end, an empty block)
25
+ * puts it AFTER. The old "first half → before" rule measured characters, so a
26
+ * right-click at 89% along the first visual line of a wrapped paragraph put the
27
+ * block ABOVE it (G15 review, 2026-10-07). `offset` is the caret's place inside
27
28
  * its block, `length` the block's size. ONE rule for the visual editor, the
28
29
  * source view and every plain-text field.
29
30
  */
@@ -51,7 +51,7 @@ function blockBoundary(text, from, to, where = "after") {
51
51
  }
52
52
  function blockSide(offset, length) {
53
53
  if (length <= 0) return "after";
54
- return offset * 2 < length ? "before" : "after";
54
+ return offset <= 0 ? "before" : "after";
55
55
  }
56
56
  function nearestSide(text, from, to) {
57
57
  if (from !== to) return "after";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-editor",
3
- "version": "0.3.0",
3
+ "version": "0.3.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",
@@ -93,9 +93,9 @@
93
93
  "@ai-matrx/agents": "latest",
94
94
  "@ai-matrx/alchemy": "latest",
95
95
  "@ai-matrx/content-ir": "latest",
96
- "@ai-matrx/design-system": "latest",
97
96
  "@ai-matrx/kit": "latest",
98
97
  "@ai-matrx/print": "latest",
98
+ "@ai-matrx/design-system": "latest",
99
99
  "@ai-matrx/rich-content": "latest"
100
100
  },
101
101
  "peerDependencies": {