docs: add divider to collab demo, fix #252

This commit is contained in:
Philipp Kühn 2021-04-17 00:05:43 +02:00
parent 148380b70d
commit 94b0f4b1d9
2 changed files with 27 additions and 1 deletions

View File

@ -1,6 +1,9 @@
<template> <template>
<div> <div>
<menu-item v-for="(item, index) in items" :key="index" v-bind="item" /> <template v-for="(item, index) in items">
<div class="divider" v-if="item.type === 'divider'" :key="index" />
<menu-item v-else :key="index" v-bind="item" />
</template>
</div> </div>
</template> </template>
@ -52,6 +55,9 @@ export default {
action: () => this.editor.chain().focus().toggleHighlight().run(), action: () => this.editor.chain().focus().toggleHighlight().run(),
isActive: () => this.editor.isActive('highlight'), isActive: () => this.editor.isActive('highlight'),
}, },
{
type: 'divider',
},
{ {
icon: 'h-1', icon: 'h-1',
title: 'Heading 1', title: 'Heading 1',
@ -94,6 +100,9 @@ export default {
action: () => this.editor.chain().focus().toggleCodeBlock().run(), action: () => this.editor.chain().focus().toggleCodeBlock().run(),
isActive: () => this.editor.isActive('codeBlock'), isActive: () => this.editor.isActive('codeBlock'),
}, },
{
type: 'divider',
},
{ {
icon: 'double-quotes-l', icon: 'double-quotes-l',
title: 'Blockquote', title: 'Blockquote',
@ -105,6 +114,9 @@ export default {
title: 'Horizontal Rule', title: 'Horizontal Rule',
action: () => this.editor.chain().focus().setHorizontalRule().run(), action: () => this.editor.chain().focus().setHorizontalRule().run(),
}, },
{
type: 'divider',
},
{ {
icon: 'text-wrap', icon: 'text-wrap',
title: 'Hard Break', title: 'Hard Break',
@ -119,6 +131,9 @@ export default {
.unsetAllMarks() .unsetAllMarks()
.run(), .run(),
}, },
{
type: 'divider',
},
{ {
icon: 'arrow-go-back-line', icon: 'arrow-go-back-line',
title: 'Undo', title: 'Undo',
@ -134,3 +149,13 @@ export default {
}, },
} }
</script> </script>
<style lang="scss" scoped>
.divider {
width: 2px;
height: 1.5rem;
background-color: rgba($colorBlack, 0.1);
margin-left: 0.5rem;
margin-right: 0.75rem;
}
</style>

View File

@ -148,6 +148,7 @@ export default {
&__header { &__header {
display: flex; display: flex;
align-items: center;
flex: 0 0 auto; flex: 0 0 auto;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0.25rem; padding: 0.25rem;