@doist/typist 4.0.4 → 5.0.0
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/extensions/rich-text/rich-text-image.d.ts +1 -5
- package/dist/extensions/rich-text/rich-text-image.d.ts.map +1 -1
- package/dist/serializers/markdown/plugins/paragraph.d.ts +2 -1
- package/dist/serializers/markdown/plugins/paragraph.d.ts.map +1 -1
- package/dist/serializers/markdown/plugins/paragraph.js +8 -3
- package/package.json +18 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [5.0.0](https://github.com/Doist/typist/compare/v4.0.5...v5.0.0) (2024-03-20)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
- This option was unused and was not intended for
|
|
6
|
+
consumer use. However, its removal technically constitutes a breaking
|
|
7
|
+
change, so we have marked it accordingly.
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
- Remove unused `onImageNodeDelete` option ([#702](https://github.com/Doist/typist/issues/702)) ([ebd0678](https://github.com/Doist/typist/commit/ebd06784c14d00b748af7ad38bb030afcba41c35))
|
|
12
|
+
|
|
13
|
+
## [4.0.5](https://github.com/Doist/typist/compare/v4.0.4...v4.0.5) (2024-03-06)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- Prevent extra blank lines on list items ([#685](https://github.com/Doist/typist/issues/685)) ([b538ebe](https://github.com/Doist/typist/commit/b538ebef9a43d6b1af2f68efcdad445ec9e0cc17))
|
|
18
|
+
|
|
1
19
|
## [4.0.4](https://github.com/Doist/typist/compare/v4.0.3...v4.0.4) (2024-03-06)
|
|
2
20
|
|
|
3
21
|
### Bug Fixes
|
|
@@ -48,7 +48,7 @@ type RichTextImageOptions = {
|
|
|
48
48
|
*/
|
|
49
49
|
acceptedImageMimeTypes: string[];
|
|
50
50
|
/**
|
|
51
|
-
* Renders the image node inline (e.g., <p><img src="
|
|
51
|
+
* Renders the image node inline (e.g., <p><img src="doist.jpg"></p>). By default images are on
|
|
52
52
|
* the same level as paragraphs.
|
|
53
53
|
*/
|
|
54
54
|
inline: boolean;
|
|
@@ -64,10 +64,6 @@ type RichTextImageOptions = {
|
|
|
64
64
|
* The event handler that is fired when an image file is pasted.
|
|
65
65
|
*/
|
|
66
66
|
onImageFilePaste?: (file: File) => void;
|
|
67
|
-
/**
|
|
68
|
-
* The event handler that should be fired when an image node is deleted.
|
|
69
|
-
*/
|
|
70
|
-
onImageNodeDelete?: (attachmentId: string) => void;
|
|
71
67
|
};
|
|
72
68
|
/**
|
|
73
69
|
* Custom extension that extends the built-in `Image` extension to add support for image pasting,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-image.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-image.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD;;GAEG;AACH,KAAK,uBAAuB,GAAG;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE;QACP;;WAEG;QACH,YAAY,EAAE,MAAM,CAAA;QAEpB;;WAEG;QACH,cAAc,EAAE,OAAO,CAAA;QAEvB;;WAEG;QACH,cAAc,EAAE,MAAM,CAAA;KACzB,CAAA;CACJ,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAC7B,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,CAAA;AAEpD;;;GAGG;AACH,OAAO,QAAQ,cAAc,CAAC;IAC1B,UAAU,QAAQ,CAAC,UAAU;QACzB,aAAa,EAAE;YACX;;eAEG;YACH,WAAW,EAAE,CAAC,UAAU,EAAE,uBAAuB,KAAK,UAAU,CAAA;YAEhE;;eAEG;YACH,WAAW,EAAE,CACT,UAAU,EAAE,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uBAAuB,CAAC,GACxC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC,KACtD,UAAU,CAAA;SAClB,CAAA;KACJ;CACJ;AAED;;GAEG;AACH,KAAK,oBAAoB,GAAG;IACxB;;OAEG;IACH,sBAAsB,EAAE,MAAM,EAAE,CAAA;IAEhC;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAA;IAEf;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEtC;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;IAEtD;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED;;;GAGG;AACH,QAAA,MAAM,aAAa,yDAoHjB,CAAA;AAEF,OAAO,EAAE,aAAa,EAAE,CAAA;AAExB,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -2,7 +2,8 @@ import type { NodeType } from '@tiptap/pm/model';
|
|
|
2
2
|
import type Turndown from 'turndown';
|
|
3
3
|
/**
|
|
4
4
|
* A Turndown plugin which adds a custom rule for paragraphs. This custom rule is required to avoid
|
|
5
|
-
* adding unnecessary blank lines between paragraphs to plain-text documents
|
|
5
|
+
* adding unnecessary blank lines between paragraphs to plain-text documents, and to list items in
|
|
6
|
+
* rich-text documents.
|
|
6
7
|
*
|
|
7
8
|
* @param nodeType The node object that matches this rule.
|
|
8
9
|
* @param isPlainText Specifies if the schema represents a plain-text document.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../src/serializers/markdown/plugins/paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../src/serializers/markdown/plugins/paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC;;;;;;;GAOG;AACH,iBAAS,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,GAAG,QAAQ,CAAC,MAAM,CAe5E;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A Turndown plugin which adds a custom rule for paragraphs. This custom rule is required to avoid
|
|
3
|
-
* adding unnecessary blank lines between paragraphs to plain-text documents
|
|
3
|
+
* adding unnecessary blank lines between paragraphs to plain-text documents, and to list items in
|
|
4
|
+
* rich-text documents.
|
|
4
5
|
*
|
|
5
6
|
* @param nodeType The node object that matches this rule.
|
|
6
7
|
* @param isPlainText Specifies if the schema represents a plain-text document.
|
|
@@ -9,8 +10,12 @@ function paragraph(nodeType, isPlainText) {
|
|
|
9
10
|
return (turndown) => {
|
|
10
11
|
turndown.addRule(nodeType.name, {
|
|
11
12
|
filter: 'p',
|
|
12
|
-
replacement(content) {
|
|
13
|
-
|
|
13
|
+
replacement(content, node) {
|
|
14
|
+
const useSingleLineSpacing = isPlainText ||
|
|
15
|
+
// Paragraphs within list items should be wrapped with a single line feed to
|
|
16
|
+
// maintain proper list formatting in rich-text documents.
|
|
17
|
+
(!isPlainText && node.parentNode?.nodeName === 'LI');
|
|
18
|
+
return useSingleLineSpacing ? `\n${content}\n` : `\n\n${content}\n\n`;
|
|
14
19
|
},
|
|
15
20
|
});
|
|
16
21
|
};
|
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": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://typist.doist.dev/",
|
|
7
7
|
"repository": "https://github.com/Doist/typist",
|
|
@@ -83,24 +83,24 @@
|
|
|
83
83
|
"@doist/prettier-config": "4.0.0",
|
|
84
84
|
"@doist/reactist": "23.2.0",
|
|
85
85
|
"@mdx-js/react": "3.0.1",
|
|
86
|
-
"@rollup/rollup-linux-x64-gnu": "4.12.0",
|
|
87
86
|
"@semantic-release/changelog": "6.0.3",
|
|
88
87
|
"@semantic-release/exec": "6.0.3",
|
|
89
88
|
"@semantic-release/git": "10.0.1",
|
|
90
|
-
"@storybook/addon-a11y": "
|
|
91
|
-
"@storybook/addon-essentials": "
|
|
92
|
-
"@storybook/
|
|
89
|
+
"@storybook/addon-a11y": "8.0.0",
|
|
90
|
+
"@storybook/addon-essentials": "8.0.0",
|
|
91
|
+
"@storybook/blocks": "8.0.0",
|
|
93
92
|
"@storybook/csf": "0.1.2",
|
|
93
|
+
"@storybook/manager-api": "8.0.0",
|
|
94
94
|
"@storybook/mdx2-csf": "1.1.0",
|
|
95
|
-
"@storybook/react": "
|
|
96
|
-
"@storybook/react-vite": "
|
|
95
|
+
"@storybook/react": "8.0.0",
|
|
96
|
+
"@storybook/react-vite": "8.0.0",
|
|
97
97
|
"@testing-library/dom": "9.3.4",
|
|
98
98
|
"@testing-library/jest-dom": "6.4.2",
|
|
99
99
|
"@testing-library/react": "14.2.1",
|
|
100
100
|
"@types/hast": "3.0.4",
|
|
101
101
|
"@types/lodash-es": "4.17.12",
|
|
102
|
-
"@types/react": "18.2.
|
|
103
|
-
"@types/react-dom": "18.2.
|
|
102
|
+
"@types/react": "18.2.66",
|
|
103
|
+
"@types/react-dom": "18.2.22",
|
|
104
104
|
"@types/react-syntax-highlighter": "15.5.11",
|
|
105
105
|
"@types/turndown": "5.0.4",
|
|
106
106
|
"@types/unist": "3.0.2",
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
"eslint-plugin-simple-import-sort": "12.0.0",
|
|
116
116
|
"eslint-plugin-storybook": "0.8.0",
|
|
117
117
|
"eslint-plugin-unicorn": "51.0.1",
|
|
118
|
-
"eslint-plugin-vitest": "0.3.
|
|
119
|
-
"eslint-plugin-vitest-globals": "1.
|
|
118
|
+
"eslint-plugin-vitest": "0.3.26",
|
|
119
|
+
"eslint-plugin-vitest-globals": "1.5.0",
|
|
120
120
|
"github-markdown-css": "5.5.1",
|
|
121
121
|
"husky": "9.0.11",
|
|
122
122
|
"ignore-sync": "7.0.1",
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
"npm-run-all2": "6.1.2",
|
|
127
127
|
"prettier": "3.2.5",
|
|
128
128
|
"react": "18.2.0",
|
|
129
|
+
"react-docgen-typescript": "2.2.2",
|
|
129
130
|
"react-dom": "18.2.0",
|
|
130
131
|
"react-icons": "5.0.1",
|
|
131
132
|
"react-markdown": "9.0.1",
|
|
@@ -133,14 +134,14 @@
|
|
|
133
134
|
"rehype-raw": "7.0.0",
|
|
134
135
|
"remark-gfm": "4.0.0",
|
|
135
136
|
"rimraf": "5.0.5",
|
|
136
|
-
"semantic-release": "23.0.
|
|
137
|
-
"
|
|
138
|
-
"storybook": "7.6.17",
|
|
137
|
+
"semantic-release": "23.0.3",
|
|
138
|
+
"storybook": "8.0.0",
|
|
139
139
|
"storybook-css-modules": "1.0.8",
|
|
140
|
-
"
|
|
141
|
-
"
|
|
140
|
+
"tippy.js": "6.3.7",
|
|
141
|
+
"type-fest": "4.12.0",
|
|
142
|
+
"typescript": "5.4.2",
|
|
142
143
|
"typescript-plugin-css-modules": "5.1.0",
|
|
143
|
-
"vitest": "1.
|
|
144
|
+
"vitest": "1.4.0"
|
|
144
145
|
},
|
|
145
146
|
"peerDependencies": {
|
|
146
147
|
"@react-hookz/web": "^14.2.3 || >=15.x",
|