@doist/typist 6.0.4 → 6.0.5
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
|
+
## [6.0.5](https://github.com/Doist/typist/compare/v6.0.4...v6.0.5) (2024-08-09)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **paste-markdown:** Escape backslashes before punctuation ([#866](https://github.com/Doist/typist/issues/866)) ([e7e83de](https://github.com/Doist/typist/commit/e7e83dec4f522ca14533f8ad0ffb81e8492664ff))
|
|
6
|
+
|
|
1
7
|
## [6.0.4](https://github.com/Doist/typist/compare/v6.0.3...v6.0.4) (2024-08-02)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paste-markdown.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/paste-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"paste-markdown.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/paste-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAkBxC;;;;;;GAMG;AACH,QAAA,MAAM,aAAa,qBA2GjB,CAAA;AAEF,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -4,6 +4,7 @@ import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
|
4
4
|
import * as linkify from 'linkifyjs';
|
|
5
5
|
import { ClipboardDataType } from '../../constants/common';
|
|
6
6
|
import { PASTE_MARKDOWN_EXTENSION_PRIORITY } from '../../constants/extension-priorities';
|
|
7
|
+
import { REGEX_PUNCTUATION } from '../../constants/regular-expressions';
|
|
7
8
|
/**
|
|
8
9
|
* The `PasteMarkdown` extension adds the ability to paste Markdown as HTML into the editor,
|
|
9
10
|
* providing full rich-text support to the pasted content. The pasting behavior was inspired from
|
|
@@ -71,9 +72,13 @@ const PasteMarkdown = Extension.create({
|
|
|
71
72
|
clipboardContainsHTMLFromVSCodeOtherThanTextOrMarkdown) {
|
|
72
73
|
return false;
|
|
73
74
|
}
|
|
75
|
+
// Escape all backslash characters that precede any punctuation marks, to
|
|
76
|
+
// prevent the backslash itself from being interpreted as an escape sequence
|
|
77
|
+
// for the subsequent character.
|
|
78
|
+
const escapedTextContent = textContent.replace(new RegExp(`(\\\\${REGEX_PUNCTUATION.source})`, 'g'), '\\$1');
|
|
74
79
|
// Send the clipboard text through the HTML serializer to convert potential
|
|
75
80
|
// Markdown into HTML, and then insert it into the editor
|
|
76
|
-
editor.commands.insertMarkdownContent(
|
|
81
|
+
editor.commands.insertMarkdownContent(escapedTextContent);
|
|
77
82
|
// Suppress the default handling behaviour
|
|
78
83
|
return true;
|
|
79
84
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/serializers/markdown/markdown.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;GAEG;AACH,KAAK,4BAA4B,GAAG;IAChC;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACtC,CAAA;AASD;;GAEG;AACH,QAAA,MAAM,kBAAkB,MAAM,CAAA;AA8C9B;;;;;;;;;;;;GAYG;AACH,iBAAS,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,4BAA4B,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/serializers/markdown/markdown.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;GAEG;AACH,KAAK,4BAA4B,GAAG;IAChC;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACtC,CAAA;AASD;;GAEG;AACH,QAAA,MAAM,kBAAkB,MAAM,CAAA;AA8C9B;;;;;;;;;;;;GAYG;AACH,iBAAS,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,4BAA4B,CAgG9E;AAOD;;;;;;GAMG;AACH,iBAAS,6BAA6B,CAAC,MAAM,EAAE,MAAM,gCAQpD;AAED,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,CAAA;AAEtF,YAAY,EAAE,4BAA4B,EAAE,CAAA"}
|
|
@@ -79,11 +79,10 @@ function createMarkdownSerializer(schema) {
|
|
|
79
79
|
else {
|
|
80
80
|
turndown.escape = (str) => {
|
|
81
81
|
return (str
|
|
82
|
-
// Escape all backslash characters that
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
// could be double escaping some backslash characters.
|
|
82
|
+
// Escape all backslash characters that precede any punctuation marks, to
|
|
83
|
+
// prevent the backslash itself from being interpreted as an escape sequence
|
|
84
|
+
// for the subsequent character. It's important to apply this rule first to
|
|
85
|
+
// avoid double escaping.
|
|
87
86
|
.replace(new RegExp(`(\\\\${REGEX_PUNCTUATION.source})`, 'g'), '\\$1')
|
|
88
87
|
// Although the CommonMark specification allows for bulleted or ordered lists
|
|
89
88
|
// inside other bulleted or ordered lists (i.e. `- 1. - 1. Item`), the markup
|
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": "6.0.
|
|
4
|
+
"version": "6.0.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://typist.doist.dev/",
|
|
7
7
|
"repository": "https://github.com/Doist/typist",
|
|
@@ -86,14 +86,14 @@
|
|
|
86
86
|
"@semantic-release/changelog": "6.0.3",
|
|
87
87
|
"@semantic-release/exec": "6.0.3",
|
|
88
88
|
"@semantic-release/git": "10.0.1",
|
|
89
|
-
"@storybook/addon-a11y": "8.2.
|
|
90
|
-
"@storybook/addon-essentials": "8.2.
|
|
91
|
-
"@storybook/blocks": "8.2.
|
|
89
|
+
"@storybook/addon-a11y": "8.2.7",
|
|
90
|
+
"@storybook/addon-essentials": "8.2.7",
|
|
91
|
+
"@storybook/blocks": "8.2.7",
|
|
92
92
|
"@storybook/csf": "0.1.11",
|
|
93
|
-
"@storybook/manager-api": "8.2.
|
|
93
|
+
"@storybook/manager-api": "8.2.7",
|
|
94
94
|
"@storybook/mdx2-csf": "1.1.0",
|
|
95
|
-
"@storybook/react": "8.2.
|
|
96
|
-
"@storybook/react-vite": "8.2.
|
|
95
|
+
"@storybook/react": "8.2.7",
|
|
96
|
+
"@storybook/react-vite": "8.2.7",
|
|
97
97
|
"@testing-library/dom": "10.4.0",
|
|
98
98
|
"@testing-library/jest-dom": "6.4.8",
|
|
99
99
|
"@testing-library/react": "16.0.0",
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
"eslint-plugin-vitest": "0.4.1",
|
|
119
119
|
"eslint-plugin-vitest-globals": "1.5.0",
|
|
120
120
|
"github-markdown-css": "5.6.1",
|
|
121
|
-
"husky": "9.1.
|
|
121
|
+
"husky": "9.1.4",
|
|
122
122
|
"ignore-sync": "7.0.1",
|
|
123
123
|
"is-ci": "3.0.1",
|
|
124
124
|
"jsdom": "24.1.1",
|
|
125
|
-
"lint-staged": "15.2.
|
|
125
|
+
"lint-staged": "15.2.8",
|
|
126
126
|
"npm-run-all2": "6.2.2",
|
|
127
127
|
"prettier": "3.2.5",
|
|
128
128
|
"react": "18.3.1",
|
|
@@ -134,13 +134,13 @@
|
|
|
134
134
|
"remark-gfm": "4.0.0",
|
|
135
135
|
"rimraf": "6.0.1",
|
|
136
136
|
"semantic-release": "24.0.0",
|
|
137
|
-
"storybook": "8.2.
|
|
137
|
+
"storybook": "8.2.7",
|
|
138
138
|
"storybook-css-modules": "1.0.8",
|
|
139
139
|
"tippy.js": "6.3.7",
|
|
140
140
|
"type-fest": "4.23.0",
|
|
141
141
|
"typescript": "5.5.4",
|
|
142
142
|
"typescript-plugin-css-modules": "5.1.0",
|
|
143
|
-
"vitest": "2.0.
|
|
143
|
+
"vitest": "2.0.5"
|
|
144
144
|
},
|
|
145
145
|
"peerDependencies": {
|
|
146
146
|
"emoji-regex": "^10.2.1",
|