@welshman/editor 0.2.2 → 0.2.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInline.d.ts","sourceRoot":"","sources":["../../../../src/extensions/CodeInline.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,IAAI,EAAY,MAAM,cAAc,CAAA;AACxE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA;AAMvD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEtC,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"CodeInline.d.ts","sourceRoot":"","sources":["../../../../src/extensions/CodeInline.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,IAAI,EAAY,MAAM,cAAc,CAAA;AACxE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA;AAMvD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEtC,eAAO,MAAM,UAAU,wBAqErB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputRule, mergeAttributes, Node, PasteRule } from "@tiptap/core";
|
|
2
|
-
const inputRegex = /(
|
|
3
|
-
const pasteRegex = /(
|
|
2
|
+
const inputRegex = /(^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/;
|
|
3
|
+
const pasteRegex = /(^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g;
|
|
4
4
|
export const CodeInline = Node.create({
|
|
5
5
|
name: "codeInline",
|
|
6
6
|
content: "text*",
|
|
@@ -43,9 +43,11 @@ export const CodeInline = Node.create({
|
|
|
43
43
|
new InputRule({
|
|
44
44
|
find: inputRegex,
|
|
45
45
|
handler: ({ state, range, match }) => {
|
|
46
|
-
const textNode = state.schema.text(match[
|
|
46
|
+
const textNode = state.schema.text(match[3]);
|
|
47
47
|
const codeNode = this.type.create(null, textNode);
|
|
48
|
-
|
|
48
|
+
// Preserve any leading space by adjusting the range start
|
|
49
|
+
const spaceAdjustment = match[1] === " " ? 1 : 0;
|
|
50
|
+
state.tr.replaceWith(range.from + spaceAdjustment, range.to, codeNode).insertText(" ");
|
|
49
51
|
},
|
|
50
52
|
}),
|
|
51
53
|
];
|
|
@@ -55,9 +57,11 @@ export const CodeInline = Node.create({
|
|
|
55
57
|
new PasteRule({
|
|
56
58
|
find: pasteRegex,
|
|
57
59
|
handler: ({ state, range, match }) => {
|
|
58
|
-
const textNode = state.schema.text(match[
|
|
60
|
+
const textNode = state.schema.text(match[3]);
|
|
59
61
|
const codeNode = this.type.create(null, textNode);
|
|
60
|
-
|
|
62
|
+
// Preserve any leading space by adjusting the range start
|
|
63
|
+
const spaceAdjustment = match[1] === " " ? 1 : 0;
|
|
64
|
+
state.tr.replaceWith(range.from + spaceAdjustment, range.to, codeNode).insertText(" ");
|
|
61
65
|
},
|
|
62
66
|
}),
|
|
63
67
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInline.js","sourceRoot":"","sources":["../../../../src/extensions/CodeInline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,cAAc,CAAA;AAGxE,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"CodeInline.js","sourceRoot":"","sources":["../../../../src/extensions/CodeInline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,cAAc,CAAA;AAGxE,MAAM,UAAU,GAAG,wCAAwC,CAAA;AAE3D,MAAM,UAAU,GAAG,wCAAwC,CAAA;AAI3D,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAc;IACjD,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,EAAE;IACT,KAAK,EAA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,CAAC,CAAA;gBACxF,CAAC;aACF,CAAC;SACH,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/extensions/breakorsubmit.ts","../src/extensions/codeinline.ts","../src/extensions/welshman.ts","../src/extensions/wordcount.ts","../src/extensions/index.ts","../src/nodeviews/bolt11nodeview.ts","../src/nodeviews/eventnodeview.ts","../src/nodeviews/medianodeview.ts","../src/nodeviews/mentionnodeview.ts","../src/nodeviews/index.ts","../src/plugins/tippysuggestion.ts","../src/plugins/index.ts"],"version":"5.8.
|
|
1
|
+
{"root":["../src/index.ts","../src/extensions/breakorsubmit.ts","../src/extensions/codeinline.ts","../src/extensions/welshman.ts","../src/extensions/wordcount.ts","../src/extensions/index.ts","../src/nodeviews/bolt11nodeview.ts","../src/nodeviews/eventnodeview.ts","../src/nodeviews/medianodeview.ts","../src/nodeviews/mentionnodeview.ts","../src/nodeviews/index.ts","../src/plugins/tippysuggestion.ts","../src/plugins/index.ts"],"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@welshman/editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"author": "hodlbod",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A batteries-included nostr editor.",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"@tiptap/pm": "^2.11.5",
|
|
35
35
|
"@tiptap/suggestion": "^2.11.5",
|
|
36
36
|
"nostr-editor": "^0.0.4-pre.17",
|
|
37
|
-
"nostr-tools": "^2.
|
|
37
|
+
"nostr-tools": "^2.7.2",
|
|
38
38
|
"tippy.js": "^6.3.7",
|
|
39
|
-
"@welshman/
|
|
40
|
-
"@welshman/
|
|
39
|
+
"@welshman/util": "0.2.2",
|
|
40
|
+
"@welshman/lib": "0.2.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"rimraf": "~6.0.0",
|