@doist/typist 1.3.2 → 1.4.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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [1.4.0](https://github.com/Doist/typist/compare/v1.3.2...v1.4.0) (2023-06-20)
2
+
3
+ ### Features
4
+
5
+ - Allow all marks to coexist with the Code mark ([#309](https://github.com/Doist/typist/issues/309)) ([ac06735](https://github.com/Doist/typist/commit/ac067352d97f6c7987ae94a47855654cfbf1dda6))
6
+
1
7
  ## [1.3.2](https://github.com/Doist/typist/compare/v1.3.1...v1.3.2) (2023-06-19)
2
8
 
3
9
  ### Bug Fixes
@@ -28,5 +28,11 @@ declare const VIEW_EVENT_HANDLERS_PRIORITY = 105;
28
28
  * precedence over the `Bold` extension keyboard shortcut.
29
29
  */
30
30
  declare const BLOCKQUOTE_EXTENSION_PRIORITY = 101;
31
- export { BLOCKQUOTE_EXTENSION_PRIORITY, PASTE_EXTENSION_PRIORITY, SMART_MARKDOWN_TYPING_PRIORITY, SUGGESTION_EXTENSION_PRIORITY, VIEW_EVENT_HANDLERS_PRIORITY, };
31
+ /**
32
+ * Priority for the `RichTextCode` extension. This needs to be lower than the default for most
33
+ * built-in and official extensions (i.e. `100`), so that other marks wrap the `Code` mark, and not
34
+ * the other way around (i.e. prevents `<code><em>code</em></code>` from happening).
35
+ */
36
+ declare const CODE_EXTENSION_PRIORITY = 99;
37
+ export { BLOCKQUOTE_EXTENSION_PRIORITY, CODE_EXTENSION_PRIORITY, PASTE_EXTENSION_PRIORITY, SMART_MARKDOWN_TYPING_PRIORITY, SUGGESTION_EXTENSION_PRIORITY, VIEW_EVENT_HANDLERS_PRIORITY, };
32
38
  //# sourceMappingURL=extension-priorities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension-priorities.d.ts","sourceRoot":"","sources":["../../src/constants/extension-priorities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,6BAA6B,OAAO,CAAA;AAE1C;;;;GAIG;AACH,QAAA,MAAM,8BAA8B,MAAM,CAAA;AAE1C;;;;GAIG;AACH,QAAA,MAAM,wBAAwB,MAAM,CAAA;AAEpC;;;;GAIG;AACH,QAAA,MAAM,4BAA4B,MAAM,CAAA;AAExC;;;;GAIG;AACH,QAAA,MAAM,6BAA6B,MAAM,CAAA;AAEzC,OAAO,EACH,6BAA6B,EAC7B,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,EAC7B,4BAA4B,GAC/B,CAAA"}
1
+ {"version":3,"file":"extension-priorities.d.ts","sourceRoot":"","sources":["../../src/constants/extension-priorities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,6BAA6B,OAAO,CAAA;AAE1C;;;;GAIG;AACH,QAAA,MAAM,8BAA8B,MAAM,CAAA;AAE1C;;;;GAIG;AACH,QAAA,MAAM,wBAAwB,MAAM,CAAA;AAEpC;;;;GAIG;AACH,QAAA,MAAM,4BAA4B,MAAM,CAAA;AAExC;;;;GAIG;AACH,QAAA,MAAM,6BAA6B,MAAM,CAAA;AAEzC;;;;GAIG;AACH,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAElC,OAAO,EACH,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,EAC7B,4BAA4B,GAC/B,CAAA"}
@@ -28,4 +28,10 @@ const VIEW_EVENT_HANDLERS_PRIORITY = 105;
28
28
  * precedence over the `Bold` extension keyboard shortcut.
29
29
  */
30
30
  const BLOCKQUOTE_EXTENSION_PRIORITY = 101;
31
- export { BLOCKQUOTE_EXTENSION_PRIORITY, PASTE_EXTENSION_PRIORITY, SMART_MARKDOWN_TYPING_PRIORITY, SUGGESTION_EXTENSION_PRIORITY, VIEW_EVENT_HANDLERS_PRIORITY, };
31
+ /**
32
+ * Priority for the `RichTextCode` extension. This needs to be lower than the default for most
33
+ * built-in and official extensions (i.e. `100`), so that other marks wrap the `Code` mark, and not
34
+ * the other way around (i.e. prevents `<code><em>code</em></code>` from happening).
35
+ */
36
+ const CODE_EXTENSION_PRIORITY = 99;
37
+ export { BLOCKQUOTE_EXTENSION_PRIORITY, CODE_EXTENSION_PRIORITY, PASTE_EXTENSION_PRIORITY, SMART_MARKDOWN_TYPING_PRIORITY, SUGGESTION_EXTENSION_PRIORITY, VIEW_EVENT_HANDLERS_PRIORITY, };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Custom extension that extends the built-in `Code` extension to allow all marks (e.g., Bold,
3
+ * Italic, and Strikethrough) to coexist with the `Code` mark (as opposed to disallowing all any
4
+ * other mark by default).
5
+ *
6
+ * @see https://tiptap.dev/api/schema#excludes
7
+ * @see https://prosemirror.net/docs/ref/#model.MarkSpec.excludes
8
+ */
9
+ declare const RichTextCode: import("@tiptap/core").Mark<import("@tiptap/extension-code").CodeOptions, any>;
10
+ export { RichTextCode };
11
+ //# sourceMappingURL=rich-text-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-text-code.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-code.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,QAAA,MAAM,YAAY,gFAGhB,CAAA;AAEF,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { Code } from '@tiptap/extension-code';
2
+ import { CODE_EXTENSION_PRIORITY } from '../../constants/extension-priorities';
3
+ /**
4
+ * Custom extension that extends the built-in `Code` extension to allow all marks (e.g., Bold,
5
+ * Italic, and Strikethrough) to coexist with the `Code` mark (as opposed to disallowing all any
6
+ * other mark by default).
7
+ *
8
+ * @see https://tiptap.dev/api/schema#excludes
9
+ * @see https://prosemirror.net/docs/ref/#model.MarkSpec.excludes
10
+ */
11
+ const RichTextCode = Code.extend({
12
+ priority: CODE_EXTENSION_PRIORITY,
13
+ excludes: Code.name,
14
+ });
15
+ export { RichTextCode };
@@ -2,7 +2,6 @@ import { Extension } from '@tiptap/core';
2
2
  import { Blockquote } from '@tiptap/extension-blockquote';
3
3
  import { Bold } from '@tiptap/extension-bold';
4
4
  import { BulletList } from '@tiptap/extension-bullet-list';
5
- import { Code } from '@tiptap/extension-code';
6
5
  import { CodeBlock } from '@tiptap/extension-code-block';
7
6
  import { Dropcursor } from '@tiptap/extension-dropcursor';
8
7
  import { Gapcursor } from '@tiptap/extension-gapcursor';
@@ -24,6 +23,7 @@ import { BoldAndItalics } from './bold-and-italics';
24
23
  import { CurvenoteCodemark } from './curvenote-codemark';
25
24
  import { PasteEmojis } from './paste-emojis';
26
25
  import { PasteMarkdown } from './paste-markdown';
26
+ import { RichTextCode } from './rich-text-code';
27
27
  import { RichTextDocument } from './rich-text-document';
28
28
  import { RichTextHorizontalRule } from './rich-text-horizontal-rule';
29
29
  import { RichTextImage } from './rich-text-image';
@@ -49,7 +49,7 @@ const RichTextKit = Extension.create({
49
49
  extensions.push(BulletList.configure(this.options?.bulletList));
50
50
  }
51
51
  if (this.options.code !== false) {
52
- extensions.push(Code.configure(this.options?.code),
52
+ extensions.push(RichTextCode.configure(this.options?.code),
53
53
  // Enhances the Code extension capabilities with additional features
54
54
  CurvenoteCodemark);
55
55
  }
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.3.2",
4
+ "version": "1.4.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://typist.doist.dev/",
7
7
  "repository": "https://github.com/Doist/typist",
@@ -92,7 +92,7 @@
92
92
  "@storybook/mdx2-csf": "1.1.0",
93
93
  "@storybook/react": "7.0.20",
94
94
  "@storybook/react-vite": "7.0.20",
95
- "@testing-library/dom": "9.3.0",
95
+ "@testing-library/dom": "9.3.1",
96
96
  "@testing-library/jest-dom": "5.16.5",
97
97
  "@testing-library/react": "14.0.0",
98
98
  "@types/hast": "2.3.4",
@@ -130,7 +130,7 @@
130
130
  "semantic-release": "21.0.5",
131
131
  "storybook": "7.0.20",
132
132
  "storybook-css-modules": "1.0.8",
133
- "type-fest": "3.11.1",
133
+ "type-fest": "3.12.0",
134
134
  "typescript": "5.1.3",
135
135
  "typescript-plugin-css-modules": "5.0.1",
136
136
  "vitest": "0.32.0"