mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 11:49:02 +08:00
Merge branch 'main' of github.com:ueberdosis/tiptap
This commit is contained in:
commit
10861a27d8
@ -5,6 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite --host",
|
"start": "vite --host",
|
||||||
"build": "npm run ts && vite build",
|
"build": "npm run ts && vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
"ts": "tsc --project tsconfig.base.json --noEmit && tsc --project tsconfig.react.json --noEmit && tsc --project tsconfig.vue-2.json --noEmit && tsc --project tsconfig.vue-3.json --noEmit"
|
"ts": "tsc --project tsconfig.base.json --noEmit && tsc --project tsconfig.react.json --noEmit && tsc --project tsconfig.vue-2.json --noEmit && tsc --project tsconfig.vue-3.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -15,10 +15,10 @@ import React, {
|
|||||||
} from 'react'
|
} from 'react'
|
||||||
import * as Y from 'yjs'
|
import * as Y from 'yjs'
|
||||||
|
|
||||||
|
import { variables } from '../../../variables'
|
||||||
import MenuBar from './MenuBar'
|
import MenuBar from './MenuBar'
|
||||||
|
|
||||||
const colors = ['#958DF1', '#F98181', '#FBBC88', '#FAF594', '#70CFF8', '#94FADB', '#B9F18D']
|
const colors = ['#958DF1', '#F98181', '#FBBC88', '#FAF594', '#70CFF8', '#94FADB', '#B9F18D']
|
||||||
const rooms = ['rooms.70', 'rooms.71', 'rooms.72']
|
|
||||||
const names = [
|
const names = [
|
||||||
'Lea Thompson',
|
'Lea Thompson',
|
||||||
'Cyndi Lauper',
|
'Cyndi Lauper',
|
||||||
@ -49,7 +49,11 @@ const names = [
|
|||||||
|
|
||||||
const getRandomElement = list => list[Math.floor(Math.random() * list.length)]
|
const getRandomElement = list => list[Math.floor(Math.random() * list.length)]
|
||||||
|
|
||||||
const getRandomRoom = () => getRandomElement(rooms)
|
const getRandomRoom = () => {
|
||||||
|
const roomNumbers = variables.collabRooms?.trim()?.split(',') ?? [10, 11, 12]
|
||||||
|
|
||||||
|
return getRandomElement(roomNumbers.map(number => `rooms.${number}`))
|
||||||
|
}
|
||||||
const getRandomColor = () => getRandomElement(colors)
|
const getRandomColor = () => getRandomElement(colors)
|
||||||
const getRandomName = () => getRandomElement(names)
|
const getRandomName = () => getRandomElement(names)
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import StarterKit from '@tiptap/starter-kit'
|
|||||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||||
import * as Y from 'yjs'
|
import * as Y from 'yjs'
|
||||||
|
|
||||||
|
import { variables } from '../../../variables'
|
||||||
import MenuBar from './MenuBar.vue'
|
import MenuBar from './MenuBar.vue'
|
||||||
|
|
||||||
const getRandomElement = list => {
|
const getRandomElement = list => {
|
||||||
@ -39,11 +40,9 @@ const getRandomElement = list => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getRandomRoom = () => {
|
const getRandomRoom = () => {
|
||||||
return getRandomElement([
|
const roomNumbers = variables.collabRooms?.trim()?.split(',') ?? [10, 11, 12]
|
||||||
'rooms.70',
|
|
||||||
'rooms.71',
|
return getRandomElement(roomNumbers.map(number => `rooms.${number}`))
|
||||||
'rooms.72',
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
4
demos/src/variables.js
Normal file
4
demos/src/variables.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// This is a workaround as vite failes to resolves the environment variables
|
||||||
|
export const variables = {
|
||||||
|
collabRooms: import.meta.env.VITE_COLLAB_ROOMS,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user