Merge branch 'main' into feature/generate-html-from-json-document

# Conflicts:
#	packages/core/src/ExtensionManager.ts
This commit is contained in:
Philipp Kühn
2020-09-09 20:50:53 +02:00
59 changed files with 929 additions and 785 deletions

View File

@@ -9,12 +9,7 @@ import { Editor, EditorContent } from '@tiptap/vue-starter-kit'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import History from '@tiptap/extension-history'
import Bold from '@tiptap/extension-bold'
import Italic from '@tiptap/extension-italic'
import Code from '@tiptap/extension-code'
import CodeBlock from '@tiptap/extension-codeblock'
import Heading from '@tiptap/extension-heading'
import Focus from '@tiptap/extension-focus'
export default {
@@ -31,16 +26,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
new Document(),
new History(),
new Paragraph(),
new Text(),
new Bold(),
new Italic(),
new Code(),
new CodeBlock(),
new Heading(),
new Focus({
Document(),
Paragraph(),
Text(),
Code(),
Focus({
className: 'has-focus',
nested: true,
}),
@@ -48,16 +38,12 @@ export default {
autoFocus: true,
content: `
<p>
With the focus extension you can add custom classes to focused nodes. Default options:
The focus extension adds custom classes to focused nodes. By default, itll add a <code>has-focus</code> class, even to nested nodes:
</p>
<pre><code>{\n className: 'has-focus',\n nested: true,\n}</code></pre>
<pre><code>{ className: 'has-focus', nested: true }</code></pre>
<ul>
<li>
When set <code>nested</code> to <code>true</code> also nested elements like this list item will be captured.
</li>
<li>
Otherwise only the wrapping list will get this class.
</li>
<li>With <code>nested: true</code> nested elements like this list item will be focused.</li>
<li>Otherwise the whole list will get the focus class, even if only a single list item is selected.</li>
</ul>
`,
})

View File

@@ -24,9 +24,9 @@ export default {
this.editor = new Editor({
content: '<p>This is a radically reduced version of tiptap for minimalisits. It has only support for a document, paragraphs and text, thats it.</p>',
extensions: [
new Document(),
new Paragraph(),
new Text(),
Document(),
Paragraph(),
Text(),
],
})

View File

@@ -26,10 +26,10 @@ export default {
this.editor = new Editor({
content: '<p>Im running tiptap with Vue.js. This demo is interactive, try to edit the text.</p>',
extensions: [
new Document(),
new Paragraph(),
new Text(),
new Bold(),
Document(),
Paragraph(),
Text(),
Bold(),
],
})
},

View File

@@ -30,10 +30,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
new Document(),
new Paragraph(),
new Text(),
new Bold(),
Document(),
Paragraph(),
Text(),
Bold(),
],
content: `
<p>This isnt bold.</p>

View File

@@ -30,10 +30,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
new Document(),
new Paragraph(),
new Text(),
new Code(),
Document(),
Paragraph(),
Text(),
Code(),
],
content: `
<p>This isnt code.</p>

View File

@@ -0,0 +1,5 @@
context('/api/extensions/document', () => {
beforeEach(() => {
cy.visit('/api/extensions/document')
})
})

View File

@@ -0,0 +1,44 @@
<template>
<div v-if="editor">
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor } from '@tiptap/core'
import { EditorContent } from '@tiptap/vue'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
],
content: `
<p>The Document extension is required. Though, you can write your own implementation, e. g. to give it custom name.</p>
`,
})
window.editor = this.editor
},
beforeDestroy() {
this.editor.destroy()
}
}
</script>

View File

@@ -33,10 +33,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
new Document(),
new Paragraph(),
new Text(),
new History(),
Document(),
Paragraph(),
Text(),
History(),
],
content: `
<p>Edit this text and press undo to test this extension.</p>

View File

@@ -30,10 +30,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
new Document(),
new Paragraph(),
new Text(),
new Italic(),
Document(),
Paragraph(),
Text(),
Italic(),
],
content: `
<p>This isnt italic.</p>

View File

@@ -0,0 +1,5 @@
context('/api/extensions/paragraph', () => {
beforeEach(() => {
cy.visit('/api/extensions/paragraph')
})
})

View File

@@ -0,0 +1,44 @@
<template>
<div v-if="editor">
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor } from '@tiptap/core'
import { EditorContent } from '@tiptap/vue'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
],
content: `
<p>The Paragraph extension is not required, but its very likely you want to use it. Its needed to write paragraphs of text. 🤓</p>
`,
})
window.editor = this.editor
},
beforeDestroy() {
this.editor.destroy()
}
}
</script>

View File

@@ -55,15 +55,15 @@ export default {
this.editor = new Editor({
content: '<h2>Hey there!</h2><p>This editor is based on Prosemirror, fully extendable and renderless. You can easily add custom nodes as Vue components.</p>',
extensions: [
new Document(),
new Paragraph(),
new Text(),
new CodeBlock(),
new History(),
new Bold(),
new Italic(),
new Code(),
new Heading(),
Document(),
Paragraph(),
Text(),
CodeBlock(),
History(),
Bold(),
Italic(),
Code(),
Heading(),
],
})
},