move extensions to own package

This commit is contained in:
Philipp Kühn
2018-08-23 22:08:19 +02:00
parent 2ef23d3003
commit e2176f00fd
32 changed files with 420 additions and 65 deletions

View File

@@ -1,4 +1,4 @@
import { Node } from 'tiptap-models'
import { Node } from 'tiptap'
export default class IframeNode extends Node {

View File

@@ -19,6 +19,21 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
import Iframe from './Iframe.js'
export default {
@@ -28,7 +43,23 @@ export default {
},
data() {
return {
extensions: [new Iframe()],
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
// custom extension
new Iframe(),
],
}
},
methods: {

View File

@@ -1,6 +1,6 @@
<template>
<div>
<editor class="editor" @update="onUpdate">
<editor class="editor" :extensions="extensions" @update="onUpdate">
<div class="menubar is-hidden" :class="{ 'is-focused': focused }" slot="menubar" slot-scope="{ nodes, marks, focused }">
<div v-if="nodes && marks">
@@ -104,12 +104,46 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
export default {
components: {
Editor,
Icon,
},
data() {
return {
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
],
}
},
methods: {
onUpdate(state) {
// console.log(state.doc.toJSON())

View File

@@ -1,6 +1,6 @@
<template>
<div>
<editor class="editor" @update="onUpdate">
<editor class="editor" :extensions="extensions" @update="onUpdate">
<div class="menububble" slot="menububble" slot-scope="{ marks, focus }">
<template v-if="marks">
@@ -39,6 +39,21 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
export default {
components: {
@@ -47,6 +62,21 @@ export default {
},
data() {
return {
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
],
linkUrl: null,
linkMenuIsActive: false,
}

View File

@@ -1,6 +1,6 @@
<template>
<div>
<editor class="editor" @update="onUpdate">
<editor class="editor" :extensions="extensions" @update="onUpdate">
<div class="editor__content" slot="content" slot-scope="props">
<h2>
@@ -21,12 +21,46 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
export default {
components: {
Editor,
Icon,
},
data() {
return {
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
],
}
},
methods: {
onUpdate(state) {
// console.log(state.doc.toJSON())

View File

@@ -1,6 +1,6 @@
<template>
<div>
<editor class="editor" @update="onUpdate">
<editor class="editor" :extensions="extensions" @update="onUpdate">
<div class="menubar" slot="menubar" slot-scope="{ nodes, marks }">
<div v-if="nodes && marks">
@@ -118,12 +118,46 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
export default {
components: {
Editor,
Icon,
},
data() {
return {
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
],
}
},
methods: {
onUpdate(state) {
// console.log(state.doc.toJSON())

View File

@@ -1,6 +1,6 @@
<template>
<div>
<editor class="editor" @update="onUpdate">
<editor class="editor" :extensions="extensions" @update="onUpdate">
<div class="menububble" slot="menububble" slot-scope="{ marks, focus }">
<template v-if="marks">
@@ -48,6 +48,21 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
export default {
components: {
@@ -56,8 +71,21 @@ export default {
},
data() {
return {
linkUrl: null,
linkMenuIsActive: false,
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
],
}
},
methods: {

View File

@@ -1,6 +1,6 @@
<template>
<div>
<editor :editable="false" class="editor" @update="onUpdate">
<editor :editable="false" :extensions="extensions" class="editor" @update="onUpdate">
<div class="editor__content" slot="content" slot-scope="props">
<h2>
@@ -18,12 +18,46 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
export default {
components: {
Editor,
Icon,
},
data() {
return {
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
],
}
},
methods: {
onUpdate(state) {
// console.log(state.doc.toJSON())

View File

@@ -1,6 +1,6 @@
<template>
<div>
<editor :editable="true" class="editor" @update="onUpdate">
<editor :extensions="extensions" class="editor" @update="onUpdate">
<div class="menubar" slot="menubar" slot-scope="{ nodes, marks }">
<div v-if="nodes && marks">
@@ -67,12 +67,46 @@
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
} from 'tiptap-extensions'
export default {
components: {
Editor,
Icon,
},
data() {
return {
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
new Heading(),
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
],
}
},
methods: {
onUpdate(state) {
// console.log(state.doc.toJSON())