remove text align example

This commit is contained in:
Philipp Kühn
2018-11-08 22:35:52 +01:00
parent 6e38c5abac
commit 1728a247ea
4 changed files with 0 additions and 137 deletions

View File

@@ -1,34 +0,0 @@
import { setBlockType } from 'tiptap-commands'
import { Node } from 'tiptap'
export default class Paragraph extends Node {
get name() {
return 'paragraph'
}
get schema() {
return {
attrs: {
textAlign: {
default: 'left',
},
},
content: 'inline*',
group: 'block',
draggable: false,
parseDOM: [{
tag: 'p',
getAttrs: node => ({
textAlign: node.style.textAlign,
}),
}],
toDOM: node => ['p', { style: `text-align: ${node.attrs.textAlign}` }, 0],
}
}
commands({ type }) {
return attrs => setBlockType(type, attrs)
}
}

View File

@@ -1,93 +0,0 @@
<template>
<div class="editor">
<menu-bar :editor="editor">
<div class="menubar" slot-scope="{ commands, isActive }">
<button
class="menubar__button"
:class="{ 'is-active': isActive('paragraph', { textAlign: 'left' }) }"
@click="commands.paragraph({ textAlign: 'left' })"
>
<icon name="align-left" />
</button>
<button
class="menubar__button"
:class="{ 'is-active': isActive('paragraph', { textAlign: 'center' }) }"
@click="commands.paragraph({ textAlign: 'center' })"
>
<icon name="align-center" />
</button>
<button
class="menubar__button"
:class="{ 'is-active': isActive('paragraph', { textAlign: 'right' }) }"
@click="commands.paragraph({ textAlign: 'right' })"
>
<icon name="align-right" />
</button>
</div>
</menu-bar>
<editor-content class="editor__content" :editor="editor" />
</div>
</template>
<script>
import Icon from 'Components/Icon'
import { Editor, EditorContent, MenuBar } from 'tiptap'
import {
HardBreak,
Code,
} from 'tiptap-extensions'
import ParagraphAlignment from './Paragraph.js'
export default {
components: {
EditorContent,
MenuBar,
Icon,
},
data() {
return {
editor: new Editor({
extensions: [
new HardBreak(),
new Code(),
new ParagraphAlignment(),
],
content: `
<p style="text-align: left">
Maybe you want to implement text alignment. If so, you're able to overwrite the default <code>ParagraphNode</code>. You can define some classes oder inline styles in your schema to achive that.
</p>
<p style="text-align: right">
Have fun! 🙌
</p>
`,
}),
}
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>
<style lang="scss">
.text-align {
&--left {
text-align: left;
}
&--center {
text-align: center;
}
&--right {
text-align: right;
}
}
</style>

View File

@@ -15,9 +15,6 @@
<router-link class="subnavigation__link" to="/images"> <router-link class="subnavigation__link" to="/images">
Images Images
</router-link> </router-link>
<router-link class="subnavigation__link" to="/text-align">
Text Align
</router-link>
<router-link class="subnavigation__link" to="/hiding-menu-bar"> <router-link class="subnavigation__link" to="/hiding-menu-bar">
Hiding Menu Bar Hiding Menu Bar
</router-link> </router-link>

View File

@@ -47,13 +47,6 @@ const routes = [
githubUrl: 'https://github.com/heyscrumpy/tiptap/tree/master/examples/Components/Routes/Images', githubUrl: 'https://github.com/heyscrumpy/tiptap/tree/master/examples/Components/Routes/Images',
}, },
}, },
{
path: '/text-align',
component: () => import('Components/Routes/TextAlign'),
meta: {
githubUrl: 'https://github.com/heyscrumpy/tiptap/tree/master/examples/Components/Routes/TextAlign',
},
},
{ {
path: '/hiding-menu-bar', path: '/hiding-menu-bar',
component: () => import('Components/Routes/HidingMenuBar'), component: () => import('Components/Routes/HidingMenuBar'),