Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(table): Fix readonly detection in vue components
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Jun 3, 2024
commit bb458c5acd9609c9b247ee4f821636c3288a9a03
13 changes: 12 additions & 1 deletion src/nodes/Table/TableCellView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<NodeViewWrapper data-text-el="table-cell" as="td" :style="textAlign">
<div class="container">
<NodeViewContent class="content" />
<NcActions v-if="editor.isEditable"
<NcActions v-if="isEditable"
data-text-table-actions="row">
<NcActionButton data-text-table-action="add-row-before"
close-after-click
Expand Down Expand Up @@ -81,11 +81,22 @@ export default {
required: true,
},
},
data() {
return {
isEditable: false,
}
},
computed: {
textAlign() {
return { 'text-align': this.node.attrs.textAlign }
},
},
beforeMount() {
this.isEditable = this.editor.isEditable
this.editor.on('update', ({ editor }) => {
this.isEditable = editor.isEditable
})
},
methods: {
deleteRow() {
this.editor.chain()
Expand Down
13 changes: 12 additions & 1 deletion src/nodes/Table/TableHeaderView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<NodeViewWrapper data-text-el="table-header" as="th" :style="textAlign">
<div>
<NodeViewContent class="content" />
<NcActions v-if="editor.isEditable"
<NcActions v-if="isEditable"
ref="menu"
data-text-table-actions="header">
<NcActionButtonGroup>
Expand Down Expand Up @@ -130,11 +130,22 @@ export default {
required: true,
},
},
data() {
return {
isEditable: false,
}
},
computed: {
textAlign() {
return { 'text-align': this.node.attrs.textAlign }
},
},
beforeMount() {
this.isEditable = this.editor.isEditable
this.editor.on('update', ({ editor }) => {
this.isEditable = editor.isEditable
})
},
methods: {
alignCenter() {
this.align('center')
Expand Down
13 changes: 12 additions & 1 deletion src/nodes/Table/TableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<template>
<NodeViewWrapper data-text-el="table-view" class="table-wrapper">
<NcActions v-if="editor.isEditable"
<NcActions v-if="isEditable"
force-menu
data-text-table-actions="settings"
class="table-settings">
Expand Down Expand Up @@ -68,6 +68,17 @@ export default {
required: true,
},
},
data() {
return {
isEditable: false,
}
},
beforeMount() {
this.isEditable = this.editor.isEditable
this.editor.on('update', ({ editor }) => {
this.isEditable = editor.isEditable
})
},
}
</script>

Expand Down