improve new extensions

This commit is contained in:
Philipp Kühn
2020-11-16 09:43:17 +01:00
parent 034ee139a3
commit c87f49c1fe
50 changed files with 296 additions and 377 deletions

View File

@@ -27,9 +27,9 @@ export default {
mounted() {
this.html = generateHTML(this.json, [
Document(),
Paragraph(),
Text(),
Document,
Paragraph,
Text,
])
},
}

View File

@@ -135,11 +135,11 @@ export default {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
Collaboration({
Collaboration.set({
provider: this.provider,
type: this.type,
}),
CollaborationCursor({
CollaborationCursor.set({
provider: this.provider,
name: this.name,
color: this.color,

View File

@@ -61,16 +61,16 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Heading({
Document,
Paragraph,
Text,
Heading.set({
level: [1, 2, 3],
}),
Bold(),
Italic(),
TextAlign(),
HardBreak(),
Bold,
Italic,
TextAlign,
HardBreak,
],
content: `
<h3>Girls Just Want to Have Fun (Cyndi Lauper)</h2>

View File

@@ -32,10 +32,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Link(),
Document,
Paragraph,
Text,
Link,
],
content: `
<p>

View File

@@ -37,7 +37,7 @@ export default {
`,
extensions: [
...defaultExtensions(),
Highlight(),
Highlight,
],
})
},

View File

@@ -22,9 +22,9 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Document,
Paragraph,
Text,
],
content: `
<p>

View File

@@ -35,11 +35,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
CustomDocument(),
Paragraph(),
Text(),
TaskList(),
CustomTaskItem(),
CustomDocument,
Paragraph,
Text,
TaskList,
CustomTaskItem,
],
content: `
<ul data-type="taskList">

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: [
Document(),
Paragraph(),
Text(),
Bold(),
Document,
Paragraph,
Text,
Bold,
],
})
},

View File

@@ -37,10 +37,10 @@ export default {
// <p>Example Text</p>
// `,
extensions: [
Document(),
Paragraph(),
Text(),
Collaboration({
Document,
Paragraph,
Text,
Collaboration.set({
provider: this.provider,
type: this.type,
}),

View File

@@ -38,14 +38,14 @@ export default {
// <p>Example Text</p>
// `,
extensions: [
Document(),
Paragraph(),
Text(),
Collaboration({
Document,
Paragraph,
Text,
Collaboration.set({
provider: this.provider,
type: this.type,
}),
CollaborationCursor({
CollaborationCursor.set({
provider: this.provider,
name: 'Cyndi Lauper',
color: '#f783ac',

View File

@@ -26,11 +26,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Image(),
Dropcursor(),
Document,
Paragraph,
Text,
Image,
Dropcursor,
],
content: `
<p>Try to drag around the image. While you drag, the editor should show a decoration under your cursor. The so called dropcursor.</p>

View File

@@ -28,16 +28,16 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Focus({
Document,
Paragraph,
Text,
Focus.set({
className: 'has-focus',
nested: true,
}),
Code(),
BulletList(),
ListItem(),
Code,
BulletList,
ListItem,
],
autoFocus: true,
content: `

View File

@@ -46,11 +46,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
TextStyle(),
FontFamily(),
Document,
Paragraph,
Text,
TextStyle,
FontFamily,
],
content: `
<p><span style="font-family: Inter">Did you know that Inter is a really nice font for interfaces?</span></p>

View File

@@ -26,11 +26,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Image(),
Gapcursor(),
Document,
Paragraph,
Text,
Image,
Gapcursor,
],
content: `
<p>Try to set the cursor behind the image with your arrow keys! You should see big blinking cursor right from the image. This is the gapcursor.</p>

View File

@@ -33,10 +33,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
History(),
Document,
Paragraph,
Text,
History,
],
content: `
<p>

View File

@@ -42,11 +42,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Heading(),
TextAlign(),
Document,
Paragraph,
Text,
Heading,
TextAlign,
],
content: `
<h2>Heading</h2>

View File

@@ -25,10 +25,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Typography(),
Document,
Paragraph,
Text,
Typography,
],
content: `
<p>“I have been suffering from Typomania all my life, a sickness that is incurable but not lethal.”</p>

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 headless. You can easily add custom nodes as Vue components.</p>',
extensions: [
Document(),
Paragraph(),
Text(),
CodeBlock(),
History(),
Bold(),
Italic(),
Code(),
Heading(),
Document,
Paragraph,
Text,
CodeBlock,
History,
Bold,
Italic,
Code,
Heading,
],
})
},

View File

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

View File

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

View File

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

View File

@@ -32,10 +32,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Link(),
Document,
Paragraph,
Text,
Link,
],
content: `
<p>

View File

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

View File

@@ -26,10 +26,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
TextStyle(),
Document,
Paragraph,
Text,
TextStyle,
],
content: `
<p><span>This has a &lt;span&gt; tag without a style attribute, so its thrown away.</span></p>

View File

@@ -30,10 +30,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Underline(),
Document,
Paragraph,
Text,
Underline,
],
content: `
<p>There is no underline here.</p>

View File

@@ -30,10 +30,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Blockquote(),
Document,
Paragraph,
Text,
Blockquote,
],
content: `
<blockquote>

View File

@@ -31,11 +31,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
BulletList(),
ListItem(),
Document,
Paragraph,
Text,
BulletList,
ListItem,
],
content: `
<ul>

View File

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

View File

@@ -25,9 +25,9 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
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>

View File

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

View File

@@ -36,10 +36,10 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Heading({
Document,
Paragraph,
Text,
Heading.set({
levels: [1, 2, 3],
}),
],

View File

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

View File

@@ -38,11 +38,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Image(),
Dropcursor(),
Document,
Paragraph,
Text,
Image,
Dropcursor,
],
content: `
<p>This is a basic example of implementing images. Drag to re-order.</p>

View File

@@ -35,12 +35,12 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
BulletList(),
OrderedList(),
ListItem(),
Document,
Paragraph,
Text,
BulletList,
OrderedList,
ListItem,
],
content: `
<p>

View File

@@ -31,11 +31,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
OrderedList(),
ListItem(),
Document,
Paragraph,
Text,
OrderedList,
ListItem,
],
content: `
<ol>

View File

@@ -25,9 +25,9 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
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>

View File

@@ -27,11 +27,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
TaskList(),
TaskItem(),
Document,
Paragraph,
Text,
TaskList,
TaskItem,
],
content: `
<ul data-type="task_list">

View File

@@ -31,11 +31,11 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
TaskList(),
TaskItem(),
Document,
Paragraph,
Text,
TaskList,
TaskItem,
],
content: `
<ul data-type="task_list">

View File

@@ -25,9 +25,9 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
Document,
Paragraph,
Text,
],
content: `
<p>The Text extension is required, at least if you want to have text in your text editor and thats very likely.</p>