Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update tiptap packages to v2.1.6 #398

Merged
merged 5 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
472 changes: 244 additions & 228 deletions package-lock.json

Large diffs are not rendered by default.

59 changes: 30 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,36 @@
"validate:pre-push": "run-s test"
},
"dependencies": {
"@tiptap/core": "2.0.4",
"@tiptap/extension-blockquote": "2.0.4",
"@tiptap/extension-bold": "2.0.4",
"@tiptap/extension-bullet-list": "2.0.4",
"@tiptap/extension-character-count": "2.0.4",
"@tiptap/extension-code": "2.0.4",
"@tiptap/extension-code-block": "2.0.4",
"@tiptap/extension-document": "2.0.4",
"@tiptap/extension-dropcursor": "2.0.4",
"@tiptap/extension-gapcursor": "2.0.4",
"@tiptap/extension-hard-break": "2.0.4",
"@tiptap/extension-heading": "2.0.4",
"@tiptap/extension-history": "2.0.4",
"@tiptap/extension-horizontal-rule": "2.0.4",
"@tiptap/extension-image": "2.0.4",
"@tiptap/extension-italic": "2.0.4",
"@tiptap/extension-link": "2.0.4",
"@tiptap/extension-list-item": "2.0.4",
"@tiptap/extension-ordered-list": "2.0.4",
"@tiptap/extension-paragraph": "2.0.4",
"@tiptap/extension-placeholder": "2.0.4",
"@tiptap/extension-strike": "2.0.4",
"@tiptap/extension-task-item": "2.0.4",
"@tiptap/extension-task-list": "2.0.4",
"@tiptap/extension-text": "2.0.4",
"@tiptap/extension-typography": "2.0.4",
"@tiptap/pm": "2.0.4",
"@tiptap/react": "2.0.4",
"@tiptap/suggestion": "2.0.4",
"@tiptap/core": "2.1.6",
"@tiptap/extension-blockquote": "2.1.6",
"@tiptap/extension-bold": "2.1.6",
"@tiptap/extension-bullet-list": "2.1.6",
"@tiptap/extension-character-count": "2.1.6",
"@tiptap/extension-code": "2.1.6",
"@tiptap/extension-code-block": "2.1.6",
"@tiptap/extension-document": "2.1.6",
"@tiptap/extension-dropcursor": "2.1.6",
"@tiptap/extension-gapcursor": "2.1.6",
"@tiptap/extension-hard-break": "2.1.6",
"@tiptap/extension-heading": "2.1.6",
"@tiptap/extension-history": "2.1.6",
"@tiptap/extension-horizontal-rule": "2.1.6",
"@tiptap/extension-image": "2.1.6",
"@tiptap/extension-italic": "2.1.6",
"@tiptap/extension-link": "2.1.6",
"@tiptap/extension-list-item": "2.1.6",
"@tiptap/extension-list-keymap": "2.1.6",
"@tiptap/extension-ordered-list": "2.1.6",
"@tiptap/extension-paragraph": "2.1.6",
"@tiptap/extension-placeholder": "2.1.6",
"@tiptap/extension-strike": "2.1.6",
"@tiptap/extension-task-item": "2.1.6",
"@tiptap/extension-task-list": "2.1.6",
"@tiptap/extension-text": "2.1.6",
"@tiptap/extension-typography": "2.1.6",
"@tiptap/pm": "2.1.6",
"@tiptap/react": "2.1.6",
"@tiptap/suggestion": "2.1.6",
"prosemirror-codemark": "0.4.2"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/components/typist-editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ describe('<TypistEditor />', () => {
test('validate HTML attributes defined by Tiptap/ProseMirror', () => {
renderPlainTextEditor()

expect(screen.getByRole('textbox')).toHaveAttribute('class', 'ProseMirror')
expect(screen.getByRole('textbox')).toHaveClass('tiptap')
expect(screen.getByRole('textbox')).toHaveClass('ProseMirror')
expect(screen.getByRole('textbox')).toHaveAttribute('contenteditable', 'true')
expect(screen.getByRole('textbox')).toHaveAttribute('tabindex', '0')
expect(screen.getByRole('textbox')).toHaveAttribute('translate', 'no')
Expand Down Expand Up @@ -142,7 +143,8 @@ describe('<TypistEditor />', () => {
test('validate HTML attributes defined by Tiptap/ProseMirror', () => {
renderRichTextEditor()

expect(screen.getByRole('textbox')).toHaveAttribute('class', 'ProseMirror')
expect(screen.getByRole('textbox')).toHaveClass('tiptap')
expect(screen.getByRole('textbox')).toHaveClass('ProseMirror')
expect(screen.getByRole('textbox')).toHaveAttribute('contenteditable', 'true')
expect(screen.getByRole('textbox')).toHaveAttribute('tabindex', '0')
expect(screen.getByRole('textbox')).toHaveAttribute('translate', 'no')
Expand Down
38 changes: 0 additions & 38 deletions src/extensions/rich-text/rich-text-horizontal-rule.ts

This file was deleted.

26 changes: 18 additions & 8 deletions src/extensions/rich-text/rich-text-kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import { Gapcursor } from '@tiptap/extension-gapcursor'
import { HardBreak } from '@tiptap/extension-hard-break'
import { Heading } from '@tiptap/extension-heading'
import { History } from '@tiptap/extension-history'
import { HorizontalRule } from '@tiptap/extension-horizontal-rule'
import { Italic } from '@tiptap/extension-italic'
import { ListItem } from '@tiptap/extension-list-item'
import { ListKeymap } from '@tiptap/extension-list-keymap'
import { OrderedList } from '@tiptap/extension-ordered-list'
import { Paragraph } from '@tiptap/extension-paragraph'
import { Strike } from '@tiptap/extension-strike'
import { Text } from '@tiptap/extension-text'
import { Typography } from '@tiptap/extension-typography'

Expand All @@ -27,9 +28,9 @@ import { PasteEmojis } from './paste-emojis'
import { PasteMarkdown } from './paste-markdown'
import { RichTextCode } from './rich-text-code'
import { RichTextDocument } from './rich-text-document'
import { RichTextHorizontalRule } from './rich-text-horizontal-rule'
import { RichTextImage } from './rich-text-image'
import { RichTextLink } from './rich-text-link'
import { RichTextStrikethrough, RichTextStrikethroughOptions } from './rich-text-strikethrough'

import type { Extensions } from '@tiptap/core'
import type { BlockquoteOptions } from '@tiptap/extension-blockquote'
Expand All @@ -41,13 +42,13 @@ import type { DropcursorOptions } from '@tiptap/extension-dropcursor'
import type { HardBreakOptions } from '@tiptap/extension-hard-break'
import type { HeadingOptions } from '@tiptap/extension-heading'
import type { HistoryOptions } from '@tiptap/extension-history'
import type { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule'
import type { ItalicOptions } from '@tiptap/extension-italic'
import type { ListItemOptions } from '@tiptap/extension-list-item'
import type { ListKeymapOptions } from '@tiptap/extension-list-keymap'
import type { OrderedListOptions } from '@tiptap/extension-ordered-list'
import type { ParagraphOptions } from '@tiptap/extension-paragraph'
import type { StrikeOptions } from '@tiptap/extension-strike'
import type { RichTextDocumentOptions } from './rich-text-document'
import type { RichTextHorizontalRuleOptions } from './rich-text-horizontal-rule'
import type { RichTextImageOptions } from './rich-text-image'
import type { RichTextLinkOptions } from './rich-text-link'

Expand Down Expand Up @@ -113,7 +114,7 @@ type RichTextKitOptions = {
/**
* Set options for the `HorizontalRule` extension, or `false` to disable.
*/
horizontalRule: Partial<RichTextHorizontalRuleOptions> | false
horizontalRule: Partial<HorizontalRuleOptions> | false

/**
* Set options for the `Image` extension, or `false` to disable.
Expand All @@ -135,6 +136,11 @@ type RichTextKitOptions = {
*/
listItem: Partial<ListItemOptions> | false

/**
* Set options for the `ListKeymap` extension, or `false` to disable.
*/
listKeymap: Partial<ListKeymapOptions> | false

/**
* Set options for the `OrderedList` extension, or `false` to disable.
*/
Expand Down Expand Up @@ -168,7 +174,7 @@ type RichTextKitOptions = {
/**
* Set options for the `Strike` extension, or `false` to disable.
*/
strike: Partial<StrikeOptions> | false
strike: Partial<RichTextStrikethroughOptions> | false

/**
* Set to `false` to disable the `Text` extension.
Expand Down Expand Up @@ -276,7 +282,7 @@ const RichTextKit = Extension.create<RichTextKitOptions>({
}

if (this.options.horizontalRule !== false) {
extensions.push(RichTextHorizontalRule.configure(this.options?.horizontalRule))
extensions.push(HorizontalRule.configure(this.options?.horizontalRule))
}

if (this.options.image !== false) {
Expand All @@ -299,6 +305,10 @@ const RichTextKit = Extension.create<RichTextKitOptions>({
extensions.push(ListItem.configure(this.options?.listItem))
}

if (this.options.listKeymap !== false) {
extensions.push(ListKeymap)
}

if (this.options.orderedList !== false) {
extensions.push(OrderedList.configure(this.options?.orderedList))
}
Expand All @@ -308,7 +318,7 @@ const RichTextKit = Extension.create<RichTextKitOptions>({
}

if (this.options.strike !== false) {
extensions.push(Strike.configure(this.options?.strike))
extensions.push(RichTextStrikethrough.configure(this.options?.strike))
}

if (this.options.text !== false) {
Expand Down
18 changes: 18 additions & 0 deletions src/extensions/rich-text/rich-text-strikethrough.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Strike } from '@tiptap/extension-strike'

import type { StrikeOptions } from '@tiptap/extension-strike'

/**
* Custom extension that extends the built-in `Strike` extension to overwrite the default keyboard.
*/
const RichTextStrikethrough = Strike.extend({
addKeyboardShortcuts() {
return {
'Mod-Shift-x': () => this.editor.commands.toggleStrike(),
}
},
})

export { RichTextStrikethrough }

export type { StrikeOptions as RichTextStrikethroughOptions }