11<!--
2- - SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
2+ - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
33 - SPDX-License-Identifier: AGPL-3.0-or-later
44-->
55
3636 {{ t('text', 'Delete this row') }}
3737 </NcActionButton >
3838 </NcActions >
39- </div >
39+ </td >
4040 </NodeViewWrapper >
4141</template >
4242
@@ -52,31 +52,40 @@ import {
5252} from ' ../../components/icons.js'
5353
5454export default {
55- name: ' TableCellView ' ,
55+ name: ' TableRowView ' ,
5656 components: {
5757 NcActionButton,
5858 NcActions,
5959 NodeViewWrapper,
6060 NodeViewContent,
61- TableAddRowBefore,
6261 TableAddRowAfter,
62+ TableAddRowBefore,
6363 TrashCan,
6464 },
65+
6566 props: {
6667 editor: {
6768 type: Object ,
6869 required: true ,
6970 },
71+
7072 getPos: {
7173 type: Function ,
7274 required: true ,
7375 },
76+
77+ node: {
78+ type: Object ,
79+ required: true ,
80+ },
7481 },
82+
7583 data () {
7684 return {
7785 isEditable: false ,
7886 }
7987 },
88+
8089 computed: {
8190 textAlign () {
8291 return { ' text-align' : this .node .attrs .textAlign }
@@ -85,81 +94,76 @@ export default {
8594 return this .node .attrs .dir || ' '
8695 },
8796 },
97+
8898 beforeMount () {
8999 this .isEditable = this .editor .isEditable
90100 this .editor .on (' update' , ({ editor }) => {
91101 this .isEditable = editor .isEditable
92102 })
93103 },
104+
94105 methods: {
95106 deleteRow () {
96107 this .editor
97108 .chain ()
98109 .focus ()
99- .setTextSelection (this .getPos ())
110+ .setTextSelection (this .getPos () + 1 )
100111 .deleteRow ()
101112 .run ()
102113 },
114+
103115 addRowBefore () {
104116 this .editor
105117 .chain ()
106118 .focus ()
107- .setTextSelection (this .getPos ())
119+ .setTextSelection (this .getPos () + 1 )
108120 .addRowBefore ()
109121 .run ()
110122 },
123+
111124 addRowAfter () {
112125 this .editor
113126 .chain ()
114127 .focus ()
115- .setTextSelection (this .getPos ())
128+ .setTextSelection (this .getPos () + 1 )
116129 .addRowAfter ()
117130 .run ()
118131 },
132+
119133 t,
120134 },
121135}
122136 </script >
123137
124138<style scoped lang="scss">
125- td {
126- position : relative ;
127-
128- .container {
129- display : flex ;
130- flex-wrap : wrap ;
131- }
139+ .table-row-cells {
140+ display : contents ;
141+ }
132142
133- .content {
134- flex : 1 1 0 ;
135- margin : 0 ;
136- padding : calc (
137- (var (--default-clickable-area ) - var (--default-font-size ) * 1.5 ) / 2
138- )
139- 0.75em ;
140- }
143+ td .row-actions {
144+ position : sticky ;
145+ right : 0 ;
146+ z-index : 4 ;
147+ background-color : var (--color-main-background );
148+ width : calc (var (--clickable-area-small ) + var (--default-grid-baseline ));
149+ padding : 0 ;
150+ // Required to prevent focus outline from being cut off
151+ padding-right : 2px ;
152+ padding-left : var (--default-grid-baseline );
153+ vertical-align : middle ;
154+ border : none ;
155+ border-radius : 0 ;
141156
142157 .action-item {
143- position : absolute ;
144- right : calc ((var (--clickable-area-small ) * -1 ) - 4px );
145- flex : 0 1 auto ;
146- display : none ;
147- top : calc ((var (--default-clickable-area ) - var (--clickable-area-small )) / 2 );
158+ opacity : 0.5 ;
148159 }
149160
150- & :last-child {
161+ & :hover ,
162+ & :active ,
163+ & :focus ,
164+ & :focus-within {
151165 .action-item {
152- display : block ;
153- opacity : 50% ;
154- }
155-
156- & :hover ,
157- & :active ,
158- & :focus ,
159- & :focus-within {
160- .action-item {
161- opacity : 100% ;
162- }
166+ opacity : 1 ;
163167 }
164168 }
165169}
0 commit comments