mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-28 07:40:13 +08:00
docs: auto detect languages from demo main file
This commit is contained in:
parent
4ed025e210
commit
30fccac47c
@ -23,11 +23,6 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'vue',
|
||||
},
|
||||
|
||||
inline: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
@ -52,7 +47,7 @@ export default {
|
||||
|
||||
computed: {
|
||||
query() {
|
||||
return `mode=${this.mode}&inline=${this.inline}&highlight=${this.highlight}&showSource=${this.showSource}`
|
||||
return `inline=${this.inline}&highlight=${this.highlight}&showSource=${this.showSource}`
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -7,11 +7,6 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'vue',
|
||||
},
|
||||
|
||||
inline: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
@ -41,7 +36,6 @@ export default {
|
||||
props() {
|
||||
return {
|
||||
name: this.name,
|
||||
mode: this.mode,
|
||||
inline: this.inline,
|
||||
highlight: this.highlight,
|
||||
showSource: this.showSource,
|
||||
@ -49,14 +43,27 @@ export default {
|
||||
},
|
||||
|
||||
mainFile() {
|
||||
const file = this.files
|
||||
.find(item => item.path.endsWith('index.vue') || item.path.endsWith('index.jsx'))
|
||||
|
||||
if (!file) {
|
||||
if (!this.mainFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
return require(`~/demos/${file.path}`).default
|
||||
return require(`~/demos/${this.mainFilePath}`).default
|
||||
},
|
||||
|
||||
mainFilePath() {
|
||||
const file = this.files.find(item => item.path.endsWith('index.vue') || item.path.endsWith('index.jsx'))
|
||||
|
||||
if (file) {
|
||||
return file.path
|
||||
}
|
||||
},
|
||||
|
||||
mode() {
|
||||
if (this.mainFilePath?.endsWith('.jsx')) {
|
||||
return 'react'
|
||||
}
|
||||
|
||||
return 'vue'
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -7,4 +7,4 @@ The following guide describes how to integrate tiptap with your [Next.js](https:
|
||||
|
||||
TODO
|
||||
|
||||
<demo name="React" mode="react" />
|
||||
<demo name="React" />
|
||||
|
@ -7,4 +7,4 @@ The following guide describes how to integrate tiptap with your [React](https://
|
||||
|
||||
TODO
|
||||
|
||||
<demo name="React" mode="react" />
|
||||
<demo name="React" />
|
||||
|
Loading…
Reference in New Issue
Block a user