Merge branch 'main' of https://github.com/ueberdosis/tiptap-next into main
This commit is contained in:
@@ -59,7 +59,7 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentUser: {
|
currentUser: JSON.parse(localStorage.getItem('currentUser')) || {
|
||||||
name: this.getRandomName(),
|
name: this.getRandomName(),
|
||||||
color: this.getRandomColor(),
|
color: this.getRandomColor(),
|
||||||
},
|
},
|
||||||
@@ -97,11 +97,15 @@ export default {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
localStorage.setItem('currentUser', JSON.stringify(this.currentUser))
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
setName() {
|
setName() {
|
||||||
const name = window.prompt('Name')
|
const name = window.prompt('Name')
|
||||||
|
.trim()
|
||||||
|
.substring(0, 32)
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
return this.updateCurrentUser({
|
return this.updateCurrentUser({
|
||||||
@@ -113,6 +117,8 @@ export default {
|
|||||||
updateCurrentUser(attributes) {
|
updateCurrentUser(attributes) {
|
||||||
this.currentUser = { ...this.currentUser, ...attributes }
|
this.currentUser = { ...this.currentUser, ...attributes }
|
||||||
this.editor.chain().focus().user(this.currentUser).run()
|
this.editor.chain().focus().user(this.currentUser).run()
|
||||||
|
|
||||||
|
localStorage.setItem('currentUser', JSON.stringify(this.currentUser))
|
||||||
},
|
},
|
||||||
|
|
||||||
getRandomColor() {
|
getRandomColor() {
|
||||||
|
|||||||
Reference in New Issue
Block a user