@ai-matrx/rich-editor 0.1.1 → 0.1.3
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 +18 -0
- package/dist/core/markdown-format.js +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
### Unreleased
|
|
5
|
+
|
|
6
|
+
### Shared fence parsing
|
|
7
|
+
|
|
8
|
+
- Code-block formatting uses Content IR's canonical fence opener. Invalid
|
|
9
|
+
backtick info is not mistaken for a block that should be unwrapped.
|
|
10
|
+
|
|
11
|
+
### Consumer action
|
|
12
|
+
|
|
13
|
+
- None required. Formatting commands and selection contracts are unchanged.
|
|
14
|
+
|
|
15
|
+
## 0.1.2
|
|
16
|
+
|
|
17
|
+
The packed-tarball canary now uses the public source-edit helper and proves both resulting markdown
|
|
18
|
+
and selection positions for bold and heading formatting.
|
|
19
|
+
|
|
3
20
|
## 0.1.1
|
|
4
21
|
|
|
5
22
|
The npm-install canary applies the returned changes (it read the result object as text); package contents unchanged.
|
|
@@ -17,3 +34,4 @@ approval, host value, block insert, shortcuts), `in-place/{in-place-session,care
|
|
|
17
34
|
### Consumer action
|
|
18
35
|
|
|
19
36
|
- matrx-frontend: import `@ai-matrx/rich-editor/core/<module>` instead of `@/components/rich-editor/core/<module>`.
|
|
37
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fenceOpenerOf } from "@ai-matrx/content-ir/source";
|
|
1
2
|
const FORMAT_COMMAND_IDS = [
|
|
2
3
|
"bold",
|
|
3
4
|
"italic",
|
|
@@ -217,12 +218,11 @@ function quoteCommand(text, from, to) {
|
|
|
217
218
|
const head = from === to ? anchor : mapPos(to, ordered, 1);
|
|
218
219
|
return { changes: ordered, anchor, head };
|
|
219
220
|
}
|
|
220
|
-
const FENCE = /^ {0,3}(`{3,}|~{3,})/;
|
|
221
221
|
function codeBlockCommand(text, from, to) {
|
|
222
222
|
const lines = linesTouched(text, from, to);
|
|
223
223
|
const first = lines[0];
|
|
224
224
|
const last = lines[lines.length - 1];
|
|
225
|
-
if (lines.length >= 2 &&
|
|
225
|
+
if (lines.length >= 2 && fenceOpenerOf(first.text) && fenceOpenerOf(last.text)) {
|
|
226
226
|
const changes2 = [
|
|
227
227
|
{ from: first.start, to: Math.min(first.end + 1, text.length), insert: "" },
|
|
228
228
|
{ from: last.start - 1, to: last.end, insert: "" }
|
|
@@ -236,7 +236,7 @@ function codeBlockCommand(text, from, to) {
|
|
|
236
236
|
const nextStart = last.end + 1;
|
|
237
237
|
const nextBreak = text.indexOf("\n", nextStart);
|
|
238
238
|
const nextLine = nextStart <= text.length ? text.slice(nextStart, nextBreak === -1 ? text.length : nextBreak) : "";
|
|
239
|
-
if (prevEnd >= 0 &&
|
|
239
|
+
if (prevEnd >= 0 && fenceOpenerOf(prevLine) && nextStart <= text.length && fenceOpenerOf(nextLine) && nextLine.trim().replace(/[`~]/g, "") === "") {
|
|
240
240
|
const nextEnd = nextBreak === -1 ? text.length : nextBreak;
|
|
241
241
|
const changes2 = [
|
|
242
242
|
{ from: prevStart, to: first.start, insert: "" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/rich-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
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",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"@tiptap/pm": "^3.31.3",
|
|
56
56
|
"github-slugger": "^2.0.0",
|
|
57
57
|
"@ai-matrx/content-ir": "latest",
|
|
58
|
-
"@ai-matrx/
|
|
59
|
-
"@ai-matrx/
|
|
58
|
+
"@ai-matrx/rich-content": "latest",
|
|
59
|
+
"@ai-matrx/print": "latest"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"react": ">=19.0.0",
|