Merge branch 'main' into feature/node-views

This commit is contained in:
Philipp Kühn
2020-10-30 16:06:53 +01:00
36 changed files with 258 additions and 112 deletions

View File

@@ -1,10 +1,13 @@
<template>
<div>
<button @click="setName">
set username
Set Name
</button>
<button @click="changeName">
Random Name
</button>
<button @click="changeColor">
change color
Random Color
</button>
<div class="collaboration-status">
@@ -89,7 +92,16 @@ export default {
methods: {
setName() {
this.name = window.prompt('Name')
const name = window.prompt('Name')
if (name) {
this.name = name
return this.updateUser()
}
},
changeName() {
this.name = this.getRandomName()
this.updateUser()
},
@@ -108,28 +120,26 @@ export default {
},
getRandomColor() {
const colors = [
'#f03e3e',
'#d6336c',
'#ae3ec9',
'#7048e8',
'#4263eb',
'#1c7ed6',
'#1098ad',
'#0ca678',
'#37b24d',
'#74b816',
'#f59f00',
'#f76707',
]
return colors[Math.floor(Math.random() * colors.length)]
return this.getRandomElement([
'#616161',
'#A975FF',
'#FB5151',
'#fd9170',
'#FFCB6B',
'#68CEF8',
'#80cbc4',
'#9DEF8F',
])
},
getRandomName() {
const names = ['🙈', '🙉', '🙊', '💥', '💫', '💦', '💨', '🐵', '🐒', '🦍', '🦧', '🐶', '🐕', '🦮', '🐕‍🦺', '🐩', '🐺', '🦊', '🦝', '🐱', '🐈', '🦁', '🐯', '🐅', '🐆', '🐴', '🐎', '🦄', '🦓', '🦌', '🐮', '🐂', '🐃', '🐄', '🐷', '🐖', '🐗', '🐽', '🐏', '🐑', '🐐', '🐪', '🐫', '🦙', '🦒', '🐘', '🦏', '🦛', '🐭', '🐁', '🐀', '🐹', '🐰', '🐇', '🐿', '🦔', '🦇', '🐻', '🐨', '🐼', '🦥', '🦦', '🦨', '🦘', '🦡', '🐾', '🦃', '🐔', '🐓', '🐣', '🐤', '🐥', '🐦', '🐧', '🕊', '🦅', '🦆', '🦢', '🦉', '🦩', '🦚', '🦜', '🐸', '🐊', '🐢', '🦎', '🐍', '🐲', '🐉', '🦕', '🦖', '🐳', '🐋', '🐬', '🐟', '🐠', '🐡', '🦈', '🐙', '🐚', '🐌', '🦋', '🐛', '🐜', '🐝', '🐞', '🦗', '🕷', '🕸', '🦂', '🦟', '🦠']
return this.getRandomElement([
'Lea Thompson', 'Cyndi Lauper', 'Tom Cruise', 'Madonna', 'Jerry Hall', 'Joan Collins', 'Winona Ryder', 'Christina Applegate', 'Alyssa Milano', 'Molly Ringwald', 'Ally Sheedy', 'Debbie Harry', 'Olivia Newton-John', 'Elton John', 'Michael J. Fox', 'Axl Rose', 'Emilio Estevez', 'Ralph Macchio', 'Rob Lowe', 'Jennifer Grey', 'Mickey Rourke', 'John Cusack', 'Matthew Broderick', 'Justine Bateman', 'Lisa Bonet',
])
},
return names[Math.floor(Math.random() * names.length)]
getRandomElement(list) {
return list[Math.floor(Math.random() * list.length)]
},
updateState() {
@@ -151,7 +161,8 @@ export default {
}
</script>
<style lang="scss">
<style lang="scss" scoped>
/* A list of all available users */
.collaboration-users {
margin-top: 0.5rem;
@@ -165,6 +176,7 @@ export default {
}
}
/* Some information about the status */
.collaboration-status {
background: #eee;
color: #666;
@@ -183,7 +195,7 @@ export default {
}
}
/* This gives the remote user caret */
/* Give a remote user a caret */
.collaboration-cursor__caret {
position: relative;
margin-left: -1px;
@@ -194,7 +206,7 @@ export default {
pointer-events: none;
}
/* This renders the username above the caret */
/* Render the username above the caret */
.collaboration-cursor__label {
position: absolute;
top: -1.4em;

View File

@@ -7,6 +7,12 @@
<button class="button" @click="clearContent">
Clear Content
</button>
<button @click="editor.chain().focus().bold().run()" :class="{ 'is-active': editor.isActive('bold') }">
Bold
</button>
<button @click="editor.chain().focus().italic().run()" :class="{ 'is-active': editor.isActive('italic') }">
Italic
</button>
</div>
<editor-content :editor="editor" />
@@ -70,7 +76,7 @@ export default {
content: [
{
type: 'text',
text: 'This is some inserted text. 👋',
text: 'Its 19871. You cant turn on a radio, or go to a mall without hearing Olivia Newton-Johns hit song, Physical.',
},
],
}],
@@ -95,11 +101,14 @@ export default {
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.export {
padding: 1rem 0 0;
h3 {
margin: 0.5rem 0;
margin: 1rem 0 0.5rem;
}
pre {
border-radius: 5px;
color: #333;
@@ -109,7 +118,9 @@ export default {
display: block;
white-space: pre-wrap;
font-size: 0.8rem;
padding: 1rem;
padding: 0.75rem 1rem;
background-color:#e9ecef;
color: #495057;
}
}
</style>

View File

@@ -58,7 +58,7 @@ export default {
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.has-focus {
border-radius: 3px;
box-shadow: 0 0 0 3px #3ea4ffe6;

View File

@@ -52,7 +52,7 @@ export default {
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.checkbox {
margin-bottom: 1rem;

View File

@@ -61,8 +61,8 @@ export default {
}
</script>
<style lang="scss">
/* This gives the remote user caret */
<style lang="scss" scoped>
/* Give a remote user a caret */
.collaboration-cursor__caret {
position: relative;
margin-left: -1px;
@@ -73,7 +73,7 @@ export default {
pointer-events: none;
}
/* This renders the username above the caret */
/* Render the username above the caret */
.collaboration-cursor__label {
position: absolute;
top: -1.4em;

View File

@@ -18,7 +18,7 @@ export default {
mounted() {
this.editor = new Editor({
content: '<p>Hello, Im tiptap running in Vue.js! 👋</p>',
content: '<p>Hello, here is tiptap! 👋</p>',
extensions: defaultExtensions(),
})
},