Skip to content

Commit 9fe885a

Browse files
mejo-backportbot[bot]
authored andcommitted
fix(table): fix button layout in wide table scroll container
Fixes: #8262 Signed-off-by: Jonas <jonas@freesources.org>
1 parent 7440bae commit 9fe885a

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/css/prosemirror.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,9 @@ div.ProseMirror {
340340

341341
table {
342342
border-spacing: 0;
343-
// Needs to be sync with `.table-add-row` button width in `TableView.vue`
344-
width: calc(100% - (2 * var(--clickable-area-small)) - 8px);
343+
// Needs to be in sync with `.table-add-row` button width in `TableView.vue`
344+
--table-width-offset: calc(var(--clickable-area-small) + 4px);
345+
width: calc(100% - var(--table-width-offset));
345346
table-layout: auto;
346347
white-space: normal; // force text to wrapping
347348
margin-bottom: calc(var(--clickable-area-small) + 8px);

src/nodes/Table/TableView.vue

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
{{ t('text', 'Delete this table') }}
2828
</NcActionButton>
2929
</NcActions>
30-
<NodeViewContent class="content" as="table" />
30+
<div class="table-scroll">
31+
<NodeViewContent class="content" as="table" />
32+
</div>
3133
<NcButton
3234
v-if="isEditable"
3335
class="table-add-column"
@@ -50,7 +52,6 @@
5052
<TableAddRowAfter />
5153
</template>
5254
</NcButton>
53-
<div class="clearfix" />
5455
</NodeViewWrapper>
5556
</template>
5657

@@ -143,7 +144,6 @@ export default {
143144
<style scoped lang="scss">
144145
.table-wrapper {
145146
position: relative;
146-
overflow-x: auto;
147147
148148
&.focused,
149149
&:hover {
@@ -153,7 +153,13 @@ export default {
153153
}
154154
}
155155
156+
.table-scroll {
157+
overflow-x: auto;
158+
width: calc(100% - var(--clickable-area-small) - 4px);
159+
}
160+
156161
.table-settings {
162+
z-index: 3;
157163
padding-left: 3px;
158164
opacity: 0.5;
159165
position: absolute;
@@ -187,20 +193,13 @@ export default {
187193
position: absolute;
188194
left: 0;
189195
bottom: 4px;
190-
// Needs to be in sync with table width in `prosemirror.css`
191-
width: calc(100% - (2 * var(--clickable-area-small)) - 8px) !important;
196+
// Needs to be in sync with `table` in `prosemirror.scss`
197+
--table-width-offset: calc(var(--clickable-area-small) + 4px);
198+
width: calc(100% - (2 * var(--table-width-offset))) !important;
192199
193200
&:hover {
194201
opacity: 1;
195202
}
196203
}
197204
}
198-
199-
.clearfix {
200-
clear: both;
201-
}
202-
203-
table {
204-
float: left;
205-
}
206205
</style>

0 commit comments

Comments
 (0)