Merge branch 'main' of github.com:ueberdosis/tiptap

This commit is contained in:
Dominik Biedebach 2022-12-16 12:07:23 +01:00
commit 10861a27d8
4 changed files with 15 additions and 7 deletions

View File

@ -5,6 +5,7 @@
"scripts": {
"start": "vite --host",
"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"
},
"dependencies": {

View File

@ -15,10 +15,10 @@ import React, {
} from 'react'
import * as Y from 'yjs'
import { variables } from '../../../variables'
import MenuBar from './MenuBar'
const colors = ['#958DF1', '#F98181', '#FBBC88', '#FAF594', '#70CFF8', '#94FADB', '#B9F18D']
const rooms = ['rooms.70', 'rooms.71', 'rooms.72']
const names = [
'Lea Thompson',
'Cyndi Lauper',
@ -49,7 +49,11 @@ const names = [
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 getRandomName = () => getRandomElement(names)

View File

@ -32,6 +32,7 @@ import StarterKit from '@tiptap/starter-kit'
import { Editor, EditorContent } from '@tiptap/vue-3'
import * as Y from 'yjs'
import { variables } from '../../../variables'
import MenuBar from './MenuBar.vue'
const getRandomElement = list => {
@ -39,11 +40,9 @@ const getRandomElement = list => {
}
const getRandomRoom = () => {
return getRandomElement([
'rooms.70',
'rooms.71',
'rooms.72',
])
const roomNumbers = variables.collabRooms?.trim()?.split(',') ?? [10, 11, 12]
return getRandomElement(roomNumbers.map(number => `rooms.${number}`))
}
export default {

4
demos/src/variables.js Normal file
View 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,
}