@doist/typist 1.1.0 → 1.1.2
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 +12 -0
- package/dist/utilities/can-insert-node-at.d.ts +1 -1
- package/dist/utilities/can-insert-node-at.d.ts.map +1 -1
- package/dist/utilities/can-insert-suggestion.d.ts +2 -2
- package/dist/utilities/can-insert-suggestion.d.ts.map +1 -1
- package/dist/utilities/can-insert-suggestion.js +3 -6
- package/package.json +32 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.1.2](https://github.com/Doist/typist/compare/v1.1.1...v1.1.2) (2023-03-06)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **deps:** update tiptap packages to v2.0.0-beta.220 ([#158](https://github.com/Doist/typist/issues/158)) ([c7fc3d8](https://github.com/Doist/typist/commit/c7fc3d8885e962bd33dc30172206309fbeb4eda4))
|
|
6
|
+
|
|
7
|
+
## [1.1.1](https://github.com/Doist/typist/compare/v1.1.0...v1.1.1) (2023-03-03)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- Invalid `hasCodeMarkBefore` check in `canInsertSuggestion` utility function ([#156](https://github.com/Doist/typist/issues/156)) ([21826c5](https://github.com/Doist/typist/commit/21826c58f763d020d3810fe373ab2524e0f0448e))
|
|
12
|
+
|
|
1
13
|
## [1.1.0](https://github.com/Doist/typist/compare/v1.0.19...v1.1.0) (2023-03-02)
|
|
2
14
|
|
|
3
15
|
### Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-insert-node-at.d.ts","sourceRoot":"","sources":["../../src/utilities/can-insert-node-at.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"can-insert-node-at.d.ts","sourceRoot":"","sources":["../../src/utilities/can-insert-node-at.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEjD;;;;GAIG;AACH,iBAAS,eAAe,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,KAAK,GACR,EAAE;IACC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;CACf,WAIA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
2
|
-
import { EditorState } from '@tiptap/pm/state';
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { EditorState } from '@tiptap/pm/state';
|
|
3
3
|
/**
|
|
4
4
|
* Check if a suggestion can be inserted within the current editor selection.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-insert-suggestion.d.ts","sourceRoot":"","sources":["../../src/utilities/can-insert-suggestion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"can-insert-suggestion.d.ts","sourceRoot":"","sources":["../../src/utilities/can-insert-suggestion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;GAIG;AACH,iBAAS,mBAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,WAoBrF;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -7,12 +7,9 @@ function canInsertSuggestion({ editor, state }) {
|
|
|
7
7
|
const { selection } = state;
|
|
8
8
|
const isInsideCodeMark = editor.isActive('code');
|
|
9
9
|
const isInsideCodeBlockNode = selection.$from.parent.type.name === 'codeBlock';
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const isComposingInlineCode = selection.$from.nodeBefore?.text
|
|
14
|
-
?.split(' ')
|
|
15
|
-
.some((word) => word.startsWith('`'));
|
|
10
|
+
const wordsBeforeSelection = (selection.$from.nodeBefore?.text ?? '').split(' ');
|
|
11
|
+
const hasCodeMarkBefore = (selection.$from.parent.cut(selection.$from.parentOffset - wordsBeforeSelection.slice(-1)[0].length - 1, selection.$from.parentOffset - 1).content.firstChild?.marks.length ?? 0) > 0;
|
|
12
|
+
const isComposingInlineCode = wordsBeforeSelection.some((word) => word.startsWith('`'));
|
|
16
13
|
return (!isInsideCodeMark && !isInsideCodeBlockNode && !hasCodeMarkBefore && !isComposingInlineCode);
|
|
17
14
|
}
|
|
18
15
|
export { canInsertSuggestion };
|
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": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://typist.doist.dev/",
|
|
7
7
|
"repository": "https://github.com/Doist/typist",
|
|
@@ -46,35 +46,35 @@
|
|
|
46
46
|
"validate:pre-push": "run-s test"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@tiptap/core": "2.0.0-beta.
|
|
50
|
-
"@tiptap/extension-blockquote": "2.0.0-beta.
|
|
51
|
-
"@tiptap/extension-bold": "2.0.0-beta.
|
|
52
|
-
"@tiptap/extension-bullet-list": "2.0.0-beta.
|
|
53
|
-
"@tiptap/extension-character-count": "2.0.0-beta.
|
|
54
|
-
"@tiptap/extension-code": "2.0.0-beta.
|
|
55
|
-
"@tiptap/extension-code-block": "2.0.0-beta.
|
|
56
|
-
"@tiptap/extension-document": "2.0.0-beta.
|
|
57
|
-
"@tiptap/extension-dropcursor": "2.0.0-beta.
|
|
58
|
-
"@tiptap/extension-gapcursor": "2.0.0-beta.
|
|
59
|
-
"@tiptap/extension-hard-break": "2.0.0-beta.
|
|
60
|
-
"@tiptap/extension-heading": "2.0.0-beta.
|
|
61
|
-
"@tiptap/extension-history": "2.0.0-beta.
|
|
62
|
-
"@tiptap/extension-horizontal-rule": "2.0.0-beta.
|
|
63
|
-
"@tiptap/extension-image": "2.0.0-beta.
|
|
64
|
-
"@tiptap/extension-italic": "2.0.0-beta.
|
|
65
|
-
"@tiptap/extension-link": "2.0.0-beta.
|
|
66
|
-
"@tiptap/extension-list-item": "2.0.0-beta.
|
|
67
|
-
"@tiptap/extension-ordered-list": "2.0.0-beta.
|
|
68
|
-
"@tiptap/extension-paragraph": "2.0.0-beta.
|
|
69
|
-
"@tiptap/extension-placeholder": "2.0.0-beta.
|
|
70
|
-
"@tiptap/extension-strike": "2.0.0-beta.
|
|
71
|
-
"@tiptap/extension-task-item": "2.0.0-beta.
|
|
72
|
-
"@tiptap/extension-task-list": "2.0.0-beta.
|
|
73
|
-
"@tiptap/extension-text": "2.0.0-beta.
|
|
74
|
-
"@tiptap/extension-typography": "2.0.0-beta.
|
|
75
|
-
"@tiptap/pm": "2.0.0-beta.
|
|
76
|
-
"@tiptap/react": "2.0.0-beta.
|
|
77
|
-
"@tiptap/suggestion": "2.0.0-beta.
|
|
49
|
+
"@tiptap/core": "2.0.0-beta.220",
|
|
50
|
+
"@tiptap/extension-blockquote": "2.0.0-beta.220",
|
|
51
|
+
"@tiptap/extension-bold": "2.0.0-beta.220",
|
|
52
|
+
"@tiptap/extension-bullet-list": "2.0.0-beta.220",
|
|
53
|
+
"@tiptap/extension-character-count": "2.0.0-beta.220",
|
|
54
|
+
"@tiptap/extension-code": "2.0.0-beta.220",
|
|
55
|
+
"@tiptap/extension-code-block": "2.0.0-beta.220",
|
|
56
|
+
"@tiptap/extension-document": "2.0.0-beta.220",
|
|
57
|
+
"@tiptap/extension-dropcursor": "2.0.0-beta.220",
|
|
58
|
+
"@tiptap/extension-gapcursor": "2.0.0-beta.220",
|
|
59
|
+
"@tiptap/extension-hard-break": "2.0.0-beta.220",
|
|
60
|
+
"@tiptap/extension-heading": "2.0.0-beta.220",
|
|
61
|
+
"@tiptap/extension-history": "2.0.0-beta.220",
|
|
62
|
+
"@tiptap/extension-horizontal-rule": "2.0.0-beta.220",
|
|
63
|
+
"@tiptap/extension-image": "2.0.0-beta.220",
|
|
64
|
+
"@tiptap/extension-italic": "2.0.0-beta.220",
|
|
65
|
+
"@tiptap/extension-link": "2.0.0-beta.220",
|
|
66
|
+
"@tiptap/extension-list-item": "2.0.0-beta.220",
|
|
67
|
+
"@tiptap/extension-ordered-list": "2.0.0-beta.220",
|
|
68
|
+
"@tiptap/extension-paragraph": "2.0.0-beta.220",
|
|
69
|
+
"@tiptap/extension-placeholder": "2.0.0-beta.220",
|
|
70
|
+
"@tiptap/extension-strike": "2.0.0-beta.220",
|
|
71
|
+
"@tiptap/extension-task-item": "2.0.0-beta.220",
|
|
72
|
+
"@tiptap/extension-task-list": "2.0.0-beta.220",
|
|
73
|
+
"@tiptap/extension-text": "2.0.0-beta.220",
|
|
74
|
+
"@tiptap/extension-typography": "2.0.0-beta.220",
|
|
75
|
+
"@tiptap/pm": "2.0.0-beta.220",
|
|
76
|
+
"@tiptap/react": "2.0.0-beta.220",
|
|
77
|
+
"@tiptap/suggestion": "2.0.0-beta.220",
|
|
78
78
|
"prosemirror-codemark": "0.4.2"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"classnames": "2.3.2",
|
|
106
106
|
"conventional-changelog-conventionalcommits": "5.0.0",
|
|
107
107
|
"emoji-regex": "10.2.1",
|
|
108
|
-
"eslint": "8.
|
|
108
|
+
"eslint": "8.35.0",
|
|
109
109
|
"eslint-formatter-codeframe": "7.32.1",
|
|
110
110
|
"eslint-import-resolver-typescript": "3.5.3",
|
|
111
111
|
"eslint-plugin-jest": "27.2.1",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"storybook-css-modules": "1.0.8",
|
|
131
131
|
"ts-jest": "29.0.5",
|
|
132
132
|
"ts-node": "10.9.1",
|
|
133
|
-
"type-fest": "3.6.
|
|
133
|
+
"type-fest": "3.6.1",
|
|
134
134
|
"typescript": "4.9.5",
|
|
135
135
|
"typescript-plugin-css-modules": "4.2.2"
|
|
136
136
|
},
|