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

@@ -23,7 +23,7 @@
</div>
<div class="demo__meta">
<div class="demo__name">
Demo/{{ this.name }}
Demo/{{ name }}
</div>
<a class="demo__link" :href="githubUrl" target="_blank">
Edit on GitHub
@@ -31,7 +31,7 @@
</div>
</template>
<div v-else class="demo__error">
Could not find a demo called {{ this.name }}.
Could not find a demo called {{ name }}.
</div>
</div>
</template>
@@ -66,7 +66,7 @@ export default {
hideSourceCode: {
type: Boolean,
default: false,
}
},
},
data() {
@@ -106,7 +106,7 @@ export default {
},
mounted() {
this.files = collect(require.context(`~/demos/`, true, /.+\..+$/).keys())
this.files = collect(require.context('~/demos/', true, /.+\..+$/).keys())
.filter(path => path.startsWith(`./${this.name}`))
.map(path => path.replace('./', ''))
.map(path => {
@@ -120,13 +120,13 @@ export default {
highlight: this.syntax[extension] || extension,
}
})
.filter((item) => {
.filter(item => {
return ['vue', 'jsx', 'scss'].includes(item.extension)
})
.sortBy(item => item.path.split('/').length)
.toArray()
}
},
}
</script>
<style lang="scss" src="./style.scss" scoped />
<style lang="scss" src="./style.scss" scoped />

View File

@@ -51,8 +51,8 @@ export default {
previousPage() {
return this.items[this.currentIndex - 1]
},
}
},
}
</script>
<style lang="scss" src="./style.scss" scoped></style>
<style lang="scss" src="./style.scss" scoped></style>

View File

@@ -34,11 +34,11 @@ export default {
methods: {
highlightCode() {
Prism.highlightAllUnder(this.$el)
}
},
},
mounted() {
this.highlightCode()
},
}
</script>
</script>

View File

@@ -10,7 +10,7 @@ export default {
props: {
component: {
required: true,
}
},
},
mounted() {
@@ -21,4 +21,4 @@ export default {
ReactDOM.unmountComponentAtNode(this.$el)
},
}
</script>
</script>

View File

@@ -8,18 +8,18 @@ import { outdent } from '@mvasilkov/outdent'
export default {
data() {
return {
formattedCode: null
formattedCode: null,
}
},
methods: {
updateCode() {
const text = this.$slots.default[0].text
const { text } = this.$slots.default[0]
if (text) {
this.formattedCode = outdent(text)
}
}
},
},
beforeUpdate() {
@@ -30,4 +30,4 @@ export default {
this.updateCode()
},
}
</script>
</script>

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>

View File

@@ -6,7 +6,7 @@
{{ $static.metadata.siteName }}
</g-link>
<div>
<input class="search" type="search" placeholder="Search" />
<input class="search" type="search" placeholder="Search">
<a href="https://github.com/sponsors/ueberdosis">
Sponsor
</a>
@@ -58,9 +58,9 @@
</nav>
</div>
<main class="app__main">
<slot/>
<slot />
<p>
<br />
<br>
<a :href="editLink" target="_blank">
<span>Edit this page on GitHub</span>
</a>
@@ -103,11 +103,11 @@ export default {
},
computed: {
currentPath () {
currentPath() {
return this.$route.matched[0].path
},
editLink () {
const currentPath = this.currentPath
editLink() {
const { currentPath } = this
const filePath = currentPath === '' ? '/introduction' : currentPath
return `https://github.com/ueberdosis/tiptap-next/blob/main/docs/src/docPages${filePath}.md`
@@ -116,13 +116,14 @@ export default {
methods: {
initSearch() {
// eslint-disable-next-line
docsearch({
apiKey: '1abe7fb0f0dac150d0e963d2eda930fe',
indexName: 'ueberdosis_tiptap',
inputSelector: '.search',
debug: false,
})
}
},
},
mounted() {
@@ -134,4 +135,4 @@ export default {
<style lang="scss" src="./fonts.scss"></style>
<style lang="scss" src="./base.scss"></style>
<style lang="scss" src="./prism.scss"></style>
<style lang="scss" src="./style.scss" scoped></style>
<style lang="scss" src="./style.scss" scoped></style>

View File

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

View File

@@ -6,4 +6,4 @@
</Layout>
</template>
<style lang="scss" src="./style.scss" scoped></style>
<style lang="scss" src="./style.scss" scoped></style>