@doist/typist 7.0.5 → 7.0.6
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,3 +1,9 @@
|
|
|
1
|
+
## [7.0.6](https://github.com/Doist/typist/compare/v7.0.5...v7.0.6) (2025-01-07)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **rich-text-code:** Retore original Tiptap input/paste rules ([#999](https://github.com/Doist/typist/issues/999)) ([6673d83](https://github.com/Doist/typist/commit/6673d83e1e6985cfcd68e5f836518f7edee8d444))
|
|
6
|
+
|
|
1
7
|
## [7.0.5](https://github.com/Doist/typist/compare/v7.0.4...v7.0.5) (2025-01-07)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-code.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rich-text-code.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-code.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD;;GAEG;AACH,KAAK,mBAAmB,GAAG,WAAW,CAAA;AActC;;;;;;;GAOG;AACH,QAAA,MAAM,YAAY,+CAmBhB,CAAA;AAEF,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB,YAAY,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { markInputRule, markPasteRule } from '@tiptap/core';
|
|
1
2
|
import { Code } from '@tiptap/extension-code';
|
|
2
3
|
import { CODE_EXTENSION_PRIORITY } from '../../constants/extension-priorities';
|
|
4
|
+
/**
|
|
5
|
+
* The original input regex for Markdown inline code (i.e. `<code>code</code>`) to prevent the issue
|
|
6
|
+
* introduced in this PR: https://github.com/ueberdosis/tiptap/pull/4468#issuecomment-2575093998
|
|
7
|
+
*/
|
|
8
|
+
const inputRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/;
|
|
9
|
+
/**
|
|
10
|
+
* The original paste regex for Markdown inline code (i.e. `<code>code</code>`) to prevent the issue
|
|
11
|
+
* introduced in this PR: https://github.com/ueberdosis/tiptap/pull/4468#issuecomment-2575093998
|
|
12
|
+
*/
|
|
13
|
+
const pasteRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g;
|
|
3
14
|
/**
|
|
4
15
|
* Custom extension that extends the built-in `Code` extension to allow all marks (e.g., Bold,
|
|
5
16
|
* Italic, and Strikethrough) to coexist with the `Code` mark (as opposed to disallowing all any
|
|
@@ -11,5 +22,21 @@ import { CODE_EXTENSION_PRIORITY } from '../../constants/extension-priorities';
|
|
|
11
22
|
const RichTextCode = Code.extend({
|
|
12
23
|
priority: CODE_EXTENSION_PRIORITY,
|
|
13
24
|
excludes: Code.name,
|
|
25
|
+
addInputRules() {
|
|
26
|
+
return [
|
|
27
|
+
markInputRule({
|
|
28
|
+
find: inputRegex,
|
|
29
|
+
type: this.type,
|
|
30
|
+
}),
|
|
31
|
+
];
|
|
32
|
+
},
|
|
33
|
+
addPasteRules() {
|
|
34
|
+
return [
|
|
35
|
+
markPasteRule({
|
|
36
|
+
find: pasteRegex,
|
|
37
|
+
type: this.type,
|
|
38
|
+
}),
|
|
39
|
+
];
|
|
40
|
+
},
|
|
14
41
|
});
|
|
15
42
|
export { RichTextCode };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/typist",
|
|
3
3
|
"description": "The mighty Tiptap-based rich-text editor React component that powers Doist products.",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://typist.doist.dev/",
|
|
7
7
|
"repository": "https://github.com/Doist/typist",
|