Skip to content

Commit

Permalink
Merge branch 'develop' into fix/can-clearNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
guanriyue authored Oct 21, 2024
2 parents 7a6516c + ae711ab commit 072ef6d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/calm-carpets-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tiptap/extension-italic": patch
"@tiptap/extension-bold": patch
---

Add parse rules that reset bold & italic marks
5 changes: 5 additions & 0 deletions .changeset/lemon-onions-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tiptap/extension-mention": patch
---

Increase mention extension priority to allow mentions to be inserted in lists using the Enter key
8 changes: 4 additions & 4 deletions demos/src/Examples/Transition/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ context('/src/Examples/Transition/Vue/', () => {
it('should not have an active tiptap instance but a button', () => {
cy.get('.tiptap').should('not.exist')

cy.get('button').should('exist')
cy.get('#toggle-editor').should('exist')
})

it('clicking the button should show the editor', () => {
cy.get('button').click()
cy.get('#toggle-editor').click()

cy.get('.tiptap').should('exist')
cy.get('.tiptap').should('be.visible')
})

it('clicking the button again should hide the editor', () => {
cy.get('button').click()
cy.get('#toggle-editor').click()

cy.get('.tiptap').should('exist')
cy.get('.tiptap').should('be.visible')

cy.get('button').click()
cy.get('#toggle-editor').click()

cy.get('.tiptap').should('not.exist')
})
Expand Down
7 changes: 6 additions & 1 deletion demos/src/Examples/Transition/Vue/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ const showEditor = ref(false)

<template>
<div>
<button type="button" @click="showEditor = !showEditor" style="margin-bottom: 1rem;">
<button
type="button"
@click="showEditor = !showEditor"
style="margin-bottom: 1rem;"
id="toggle-editor"
>
{{ showEditor ? 'Hide editor' : 'Show editor' }}
</button>

Expand Down
4 changes: 4 additions & 0 deletions packages/extension-bold/src/bold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export const Bold = Mark.create<BoldOptions>({
tag: 'b',
getAttrs: node => (node as HTMLElement).style.fontWeight !== 'normal' && null,
},
{
style: 'font-weight=400',
clearMark: mark => mark.type.name === this.name,
},
{
style: 'font-weight',
getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value as string) && null,
Expand Down
4 changes: 4 additions & 0 deletions packages/extension-italic/src/italic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export const Italic = Mark.create<ItalicOptions>({
tag: 'i',
getAttrs: node => (node as HTMLElement).style.fontStyle !== 'normal' && null,
},
{
style: 'font-style=normal',
clearMark: mark => mark.type.name === this.name,
},
{
style: 'font-style=italic',
},
Expand Down
2 changes: 2 additions & 0 deletions packages/extension-mention/src/mention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export const MentionPluginKey = new PluginKey('mention')
export const Mention = Node.create<MentionOptions>({
name: 'mention',

priority: 101,

addOptions() {
return {
HTMLAttributes: {},
Expand Down

0 comments on commit 072ef6d

Please sign in to comment.