fix more linting errors

This commit is contained in:
Philipp Kühn
2020-09-24 00:29:05 +02:00
parent aefb4ca8e6
commit ac33eb483e
106 changed files with 310 additions and 274 deletions

View File

@@ -1,5 +1,5 @@
<template>
<pre>{{ this.html }}</pre>
<pre>{{ html }}</pre>
</template>
<script>
@@ -9,22 +9,21 @@ import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
export default {
data() {
return {
doc: {
'type': 'document',
'content': [{
'type': 'paragraph',
'attrs': {
'align': 'left'
type: 'document',
content: [{
type: 'paragraph',
attrs: {
align: 'left',
},
'content': [{
'type': 'text',
'text': 'Example Text'
}]
}]
}
content: [{
type: 'text',
text: 'Example Text',
}],
}],
},
}
},
@@ -35,8 +34,7 @@ export default {
Paragraph(),
Text(),
])
}
}
},
},
}
</script>
</script>

View File

@@ -83,7 +83,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: defaultExtensions(),
content: `
content: `
<h2>
Hi there,
</h2>
@@ -112,4 +112,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -88,4 +88,4 @@ export default {
}
</script>
<style lang="scss" src="./style.scss">
<style lang="scss" src="./style.scss">

View File

@@ -55,4 +55,4 @@ export default {
}
</script>
<style lang="scss" src="./style.scss">
<style lang="scss" src="./style.scss">

View File

@@ -28,7 +28,7 @@ export default {
mounted() {
this.editor = new Editor({
content: `
content: `
<h2>
History
</h2>
@@ -44,4 +44,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -20,7 +20,7 @@ export default {
mounted() {
this.editor = new Editor({
content: `
content: `
<p>
Start a new line and type <code>#</code> followed by a space to get a headline. Try <code>#</code>, <code>##</code>, <code>###</code>, <code>####</code>, <code>#####</code>, <code>######</code> for different levels.
</p>
@@ -39,4 +39,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -49,4 +49,4 @@ export default {
}
</script>
<style lang="scss" src="./style.scss">
<style lang="scss" src="./style.scss">

View File

@@ -41,4 +41,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -38,4 +38,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -46,6 +46,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -49,6 +49,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -48,6 +48,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -44,6 +44,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -59,6 +59,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -37,6 +37,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -52,6 +52,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -54,6 +54,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -46,6 +46,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -47,6 +47,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -46,6 +46,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -41,6 +41,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -68,6 +68,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -48,6 +48,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -37,6 +37,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -47,6 +47,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -37,6 +37,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -45,6 +45,6 @@ export default {
beforeDestroy() {
this.editor.destroy()
}
},
}
</script>
</script>

View File

@@ -27,4 +27,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -72,4 +72,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -27,4 +27,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>

View File

@@ -1,11 +1,15 @@
import React, { useState, useRef, useEffect, createContext, useContext } from 'react'
import {
useState, useRef, useEffect, createContext, useContext,
} from 'react'
import { Editor as Tiptap } from '@tiptap/core'
export const EditorContext = createContext({})
export const useEditor = () => useContext(EditorContext)
export const Editor = ({ value, onChange, children, ...props }) => {
export const Editor = ({
value, onChange, children, ...props
}) => {
const [editor, setEditor] = useState(null)
const editorRef = useRef(null)

View File

@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { useEditor, Editor } from './components/Editor'
import { useState } from 'react'
import extensions from '@tiptap/starter-kit'
import { useEditor, Editor } from './components/Editor'
// Menu bar example component
// useEditor only works for child components of <Editor />
@@ -24,39 +24,39 @@ const MenuBar = () => {
export default () => {
const [value, setValue] = useState({
'type': 'document',
'content': [
{
'type': 'paragraph',
'content': [
{
'type': 'text',
'text': 'rendered in '
},
{
'type': 'text',
'marks': [
{
'type': 'bold'
}
],
'text': 'react'
},
{
'type': 'text',
'text': '!'
}
]
}
]
})
type: 'document',
content: [
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'rendered in ',
},
{
type: 'text',
marks: [
{
type: 'bold',
},
],
text: 'react',
},
{
type: 'text',
text: '!',
},
],
},
],
})
return (
<>
<p>
<button onClick={() => alert(JSON.stringify(value))}>Alert state</button>
</p>
<hr style={{ margin: '0.85rem 0'}} />
<hr style={{ margin: '0.85rem 0' }} />
<Editor
value={value}
onChange={setValue}

View File

@@ -41,4 +41,4 @@ export default {
this.editor.destroy()
},
}
</script>
</script>