fix more linting errors
This commit is contained in:
@@ -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 />
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -34,11 +34,11 @@ export default {
|
||||
methods: {
|
||||
highlightCode() {
|
||||
Prism.highlightAllUnder(this.$el)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.highlightCode()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
props: {
|
||||
component: {
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@@ -21,4 +21,4 @@ export default {
|
||||
ReactDOM.unmountComponentAtNode(this.$el)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -88,4 +88,4 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="./style.scss">
|
||||
<style lang="scss" src="./style.scss">
|
||||
|
||||
@@ -55,4 +55,4 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="./style.scss">
|
||||
<style lang="scss" src="./style.scss">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -49,4 +49,4 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="./style.scss">
|
||||
<style lang="scss" src="./style.scss">
|
||||
|
||||
@@ -41,4 +41,4 @@ export default {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -38,4 +38,4 @@ export default {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -46,6 +46,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -49,6 +49,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -48,6 +48,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -44,6 +44,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -59,6 +59,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -37,6 +37,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -52,6 +52,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -54,6 +54,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -46,6 +46,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -47,6 +47,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -46,6 +46,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -41,6 +41,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -68,6 +68,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -48,6 +48,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -37,6 +37,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -47,6 +47,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -37,6 +37,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -45,6 +45,6 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -27,4 +27,4 @@ export default {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -72,4 +72,4 @@ export default {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -27,4 +27,4 @@ export default {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -41,4 +41,4 @@ export default {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -35,4 +35,4 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="./style.scss" scoped></style>
|
||||
<style lang="scss" src="./style.scss" scoped></style>
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
</Layout>
|
||||
</template>
|
||||
|
||||
<style lang="scss" src="./style.scss" scoped></style>
|
||||
<style lang="scss" src="./style.scss" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user