3
0

Adjust RTE table styles

This commit is contained in:
Jože Fortun 2024-09-25 11:37:19 +02:00
parent 69494a9834
commit 89cde82a26
4 changed files with 105 additions and 94 deletions

View File

@ -43,70 +43,3 @@
padding-bottom: 0px !important; padding-bottom: 0px !important;
} }
} }
/* Basic editor styles */
.editor__content :first-child {
margin-top: 0;
}
/* Table-specific styling */
.editor__content table {
border-collapse: collapse;
margin: 0;
overflow: hidden;
table-layout: fixed;
width: 100%;
}
.editor__content td,
.editor__content th {
border: 1px solid var(--gray);
box-sizing: border-box;
min-width: 1em;
padding: 6px 8px;
position: relative;
vertical-align: top;
}
.editor__content td > *,
.editor__content th > * {
margin-bottom: 0;
}
.editor__content th {
background-color: var(--gray-dark);
font-weight: bold;
text-align: left;
}
.editor__content .selectedCell::after {
background: var(--gray-dark);
content: "";
left: 0;
right: 0;
top: 0;
bottom: 0;
pointer-events: none;
position: absolute;
z-index: 2;
}
.editor__content .column-resize-handle {
background-color: var(--purple);
bottom: -2px;
pointer-events: none;
position: absolute;
right: -2px;
top: 0;
width: 4px;
}
.editor__content .tableWrapper {
margin: 1.5rem 0;
overflow-x: auto;
}
.editor__content .resize-cursor {
cursor: ew-resize;
cursor: col-resize;
}

View File

@ -2,13 +2,15 @@
<b-dropdown <b-dropdown
menu-class="text-center" menu-class="text-center"
variant="link" variant="link"
boundary="window"
> >
<template slot="button-content"> <template slot="button-content">
<span class="text-dark font-weight-bold"> <span class="text-dark font-weight-bold">
<span :class="rootActiveClasses()"> <span :class="rootActiveClasses()">
<font-awesome-icon <font-awesome-icon
v-if="format.icon" v-if="format.icon"
:icon="format.icon" /> :icon="format.icon"
/>
<span v-else> <span v-else>
{{ format.label }} {{ format.label }}
</span> </span>
@ -19,12 +21,12 @@
<b-dropdown-item <b-dropdown-item
v-for="v of format.variants" v-for="v of format.variants"
:key="v.variant" :key="v.variant"
@click="dispatchTransaction(v)"> @click="dispatchTransaction(v)"
>
<b-button <b-button
variant="link" variant="link"
class="text-dark font-weight-bold"> class="text-dark font-weight-bold"
>
<span :class="activeClasses(v.attrs)"> <span :class="activeClasses(v.attrs)">
<font-awesome-icon <font-awesome-icon
v-if="format.icon" v-if="format.icon"
@ -47,7 +49,7 @@ import { nodeTypes } from '../../lib/formats'
* Component is used to display node alignment formatting * Component is used to display node alignment formatting
*/ */
export default { export default {
name: 't-nattr-alignment', name: 'TNattrAlignment',
extends: base, extends: base,
props: { props: {

View File

@ -1,13 +1,16 @@
<template> <template>
<b-dropdown <b-dropdown
menu-class="text-center" menu-class="text-center"
variant="link"> variant="link"
boundary="window"
>
<template slot="button-content"> <template slot="button-content">
<span class="text-dark font-weight-bold"> <span class="text-dark font-weight-bold">
<span :class="rootActiveClasses()"> <span :class="rootActiveClasses()">
<font-awesome-icon <font-awesome-icon
v-if="format.icon" v-if="format.icon"
:icon="format.icon" /> :icon="format.icon"
/>
<span v-else> <span v-else>
{{ format.label }} {{ format.label }}
</span> </span>
@ -21,7 +24,6 @@
@click="emitClick(v)" @click="emitClick(v)"
> >
{{ v.label }} {{ v.label }}
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
</template> </template>
@ -34,7 +36,7 @@ import { nodeTypes } from '../../lib/formats'
* Component is used to display node alignment formatting * Component is used to display node alignment formatting
*/ */
export default { export default {
name: 't-nattr-table', name: 'TNattrTable',
extends: base, extends: base,
props: { props: {

View File

@ -1,12 +1,14 @@
<template> <template>
<b-card no-body class="editor rt-content"> <b-card
no-body
class="editor rt-content"
>
<template v-if="editor"> <template v-if="editor">
<b-card-header header-class="p-0 border-bottom"> <b-card-header header-class="p-0 border-bottom">
<editor-menu-bar <editor-menu-bar
:editor="editor"
v-slot="{ commands, isActive, getMarkAttrs, getNodeAttrs }" v-slot="{ commands, isActive, getMarkAttrs, getNodeAttrs }"
:editor="editor"
> >
<r-toolbar <r-toolbar
:editor="editor" :editor="editor"
:formats="toolbar" :formats="toolbar"
@ -25,7 +27,6 @@
:editor="editor" :editor="editor"
class="editor__content" class="editor__content"
/> />
</b-card-body> </b-card-body>
</template> </template>
</b-card> </b-card>
@ -54,8 +55,8 @@ export default {
labels: { labels: {
type: Object, type: Object,
default: () => ({}) default: () => ({}),
} },
}, },
data () { data () {
@ -126,3 +127,76 @@ export default {
}, },
} }
</script> </script>
<style>
/* Basic editor styles */
.rt-content {
min-width: 12rem;
position: static;
}
.rt-content :first-child {
margin-top: 0;
}
/* Table-specific styling */
.rt-content table {
border-collapse: collapse;
margin: 0;
overflow: hidden;
table-layout: fixed;
width: 100%;
}
.rt-content td,
.rt-content th {
border: 1px solid var(--gray);
box-sizing: border-box;
min-width: 1em;
padding: 6px 8px;
position: relative;
vertical-align: top;
}
.rt-content td > *,
.rt-content th > * {
margin-bottom: 0;
}
.rt-content th {
background-color: var(--gray-dark);
font-weight: bold;
text-align: left;
}
.rt-content .selectedCell::after {
background: var(--gray-dark);
content: "";
left: 0;
right: 0;
top: 0;
bottom: 0;
pointer-events: none;
position: absolute;
z-index: 2;
}
.rt-content .column-resize-handle {
background-color: var(--purple);
bottom: -2px;
pointer-events: none;
position: absolute;
right: -2px;
top: 0;
width: 4px;
}
.rt-content .tableWrapper {
overflow-x: auto;
}
.rt-content .resize-cursor {
cursor: ew-resize;
cursor: col-resize;
}
</style>