mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
fix(typography): require spaces after divisions to not break date formats (#4696)
This commit is contained in:
parent
e66160d774
commit
f6d7e00a74
@ -9,6 +9,15 @@ context('/src/Extensions/Typography/React/', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('should keep dates as they are', () => {
|
||||
cy.get('.tiptap').type('1/4/2024').should('contain', '1/4/2024')
|
||||
})
|
||||
|
||||
it('should make a fraction only with spaces afterwards', () => {
|
||||
cy.get('.tiptap').type('1/4').should('contain', '1/4')
|
||||
cy.get('.tiptap').type('{selectall}{backspace}1/4 ').should('contain', '¼')
|
||||
})
|
||||
|
||||
it('should make an em dash from two dashes', () => {
|
||||
cy.get('.tiptap').type('-- emDash').should('contain', '— emDash')
|
||||
})
|
||||
|
@ -86,7 +86,7 @@ export const registeredTrademark = (override?: string) => textInputRule({
|
||||
})
|
||||
|
||||
export const oneHalf = (override?: string) => textInputRule({
|
||||
find: /(?:^|\s)(1\/2)$/,
|
||||
find: /(?:^|\s)(1\/2)\s$/,
|
||||
replace: override ?? '½',
|
||||
})
|
||||
|
||||
@ -126,12 +126,12 @@ export const superscriptThree = (override?: string) => textInputRule({
|
||||
})
|
||||
|
||||
export const oneQuarter = (override?: string) => textInputRule({
|
||||
find: /(?:^|\s)(1\/4)$/,
|
||||
find: /(?:^|\s)(1\/4)\s$/,
|
||||
replace: override ?? '¼',
|
||||
})
|
||||
|
||||
export const threeQuarters = (override?: string) => textInputRule({
|
||||
find: /(?:^|\s)(3\/4)$/,
|
||||
find: /(?:^|\s)(3\/4)\s$/,
|
||||
replace: override ?? '¾',
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user