-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add overrides to typography extension
- Loading branch information
Showing
9 changed files
with
211 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
25 changes: 25 additions & 0 deletions
25
demos/src/Extensions/TypographyWithOverrides/React/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Document from '@tiptap/extension-document' | ||
import Paragraph from '@tiptap/extension-paragraph' | ||
import Text from '@tiptap/extension-text' | ||
import Typography from '@tiptap/extension-typography' | ||
import { EditorContent, useEditor } from '@tiptap/react' | ||
import React from 'react' | ||
|
||
export default () => { | ||
const editor = useEditor({ | ||
extensions: [ | ||
Document, | ||
Paragraph, | ||
Text, | ||
Typography.configure({ | ||
rightArrow: '=====>', | ||
}), | ||
], | ||
content: ` | ||
<p>“I have been suffering from Typomania all my life, a sickness that is incurable but not lethal.”</p> | ||
<p>— Erik Spiekermann, December 2008</p> | ||
`, | ||
}) | ||
|
||
return <EditorContent editor={editor} /> | ||
} |
15 changes: 15 additions & 0 deletions
15
demos/src/Extensions/TypographyWithOverrides/React/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
context('/src/Extensions/TypographyWithOverrides/React/', () => { | ||
before(() => { | ||
cy.visit('/src/Extensions/TypographyWithOverrides/React/') | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.get('.tiptap').then(([{ editor }]) => { | ||
editor.commands.clearContent() | ||
}) | ||
}) | ||
|
||
it('should use correct override for rightArrow', () => { | ||
cy.get('.tiptap').type('-> Hello!').should('contain', '=====> Hello!') | ||
}) | ||
}) |
Empty file.
15 changes: 15 additions & 0 deletions
15
demos/src/Extensions/TypographyWithOverrides/Vue/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
context('/src/Extensions/TypographyWithOverrides/Vue/', () => { | ||
before(() => { | ||
cy.visit('/src/Extensions/TypographyWithOverrides/Vue/') | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.get('.tiptap').then(([{ editor }]) => { | ||
editor.commands.clearContent() | ||
}) | ||
}) | ||
|
||
it('should use correct override for rightArrow', () => { | ||
cy.get('.tiptap').type('-> Hello!').should('contain', '=====> Hello!') | ||
}) | ||
}) |
44 changes: 44 additions & 0 deletions
44
demos/src/Extensions/TypographyWithOverrides/Vue/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<editor-content :editor="editor" /> | ||
</template> | ||
|
||
<script> | ||
import Document from '@tiptap/extension-document' | ||
import Paragraph from '@tiptap/extension-paragraph' | ||
import Text from '@tiptap/extension-text' | ||
import Typography from '@tiptap/extension-typography' | ||
import { Editor, EditorContent } from '@tiptap/vue-3' | ||
export default { | ||
components: { | ||
EditorContent, | ||
}, | ||
data() { | ||
return { | ||
editor: null, | ||
} | ||
}, | ||
mounted() { | ||
this.editor = new Editor({ | ||
extensions: [ | ||
Document, | ||
Paragraph, | ||
Text, | ||
Typography.configure({ | ||
rightArrow: '=====>', | ||
}), | ||
], | ||
content: ` | ||
<p>“I have been suffering from Typomania all my life, a sickness that is incurable but not lethal.”</p> | ||
<p>— Erik Spiekermann, December 2008</p> | ||
`, | ||
}) | ||
}, | ||
beforeUnmount() { | ||
this.editor.destroy() | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.