add table commands, add tableRole to the schema, add buttons to the example

This commit is contained in:
Hans Pagel
2021-01-21 00:16:45 +01:00
parent cfe0898fdd
commit fde2b1572d
7 changed files with 163 additions and 11 deletions

View File

@@ -1,5 +1,44 @@
<template>
<div v-if="editor">
<button disabled>
createTable
</button>
<button @click="editor.chain().focus().addColumnBefore().run()">
addColumnBefore
</button>
<button @click="editor.chain().focus().addColumnAfter().run()">
addColumnAfter
</button>
<button @click="editor.chain().focus().deleteColumn().run()">
deleteColumn
</button>
<button @click="editor.chain().focus().addRowBefore().run()">
addRowBefore
</button>
<button @click="editor.chain().focus().addRowAfter().run()">
addRowAfter
</button>
<button @click="editor.chain().focus().deleteRow().run()">
deleteRow
</button>
<button @click="editor.chain().focus().deleteTable().run()">
deleteTable
</button>
<button @click="editor.chain().focus().mergeCells().run()">
mergeCells
</button>
<button @click="editor.chain().focus().splitCell().run()">
splitCell
</button>
<button @click="editor.chain().focus().toggleHeaderColumn().run()">
toggleHeaderColumn
</button>
<button @click="editor.chain().focus().toggleHeaderRow().run()">
toggleHeaderRow
</button>
<button @click="editor.chain().focus().toggleHeaderCell().run()">
toggleHeaderCell
</button>
<editor-content :editor="editor" />
</div>
</template>
@@ -57,8 +96,10 @@ export default {
}
</script>
<style>
table, tr, td {
border: 3px solid red;
<style lang="scss">
.ProseMirror {
table, tr, td {
border: 3px solid red;
}
}
</style>