Skip to content

Commit

Permalink
Made the tables responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
praveen-murali-ind committed Nov 5, 2024
1 parent b414dd2 commit b2e5ccb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const Table = TiptapTable.extend({
}
);

return ["table", {}, ["colgroup", ...colgroups], ["tbody", 0]];
return [
"div",
{ class: "table-responsive" },
["table", {}, ["colgroup", ...colgroups], ["tbody", 0]],
];
},

addKeyboardShortcuts() {
Expand Down
12 changes: 9 additions & 3 deletions src/styles/editor/_table.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.neeto-editor-table {
display: relative;
position: relative;
width: fit-content;
margin: 8px 0 0;
max-width: 100%;
overflow-x: auto;

table {

th,
td {
p {
Expand Down Expand Up @@ -31,6 +34,8 @@
&__wrapper {
display: flex;
gap: 2px;
max-width: 100%;
overflow-x: auto;
}

&__add-row,
Expand All @@ -50,7 +55,7 @@
color: rgb(var(--neeto-ui-gray-500)) !important;
font-size: var(--neeto-ui-text-base) !important;
line-height: 16px !important;
font-weight: var( --neeto-ui-font-light) !important;
font-weight: var(--neeto-ui-font-light) !important;
}

&:hover {
Expand All @@ -59,6 +64,7 @@
}

&:hover {

.neeto-editor-table__add-row,
.neeto-editor-table__add-column {
visibility: visible;
Expand All @@ -79,4 +85,4 @@

.ProseMirror.resize-cursor {
cursor: col-resize;
}
}
5 changes: 5 additions & 0 deletions src/styles/editor/editor-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
word-break: break-word;
tab-size: 2;

.table-responsive {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}

// Sizing
&--size-large {
--neeto-editor-content-paragraph-font-size: 1.125rem;
Expand Down

0 comments on commit b2e5ccb

Please sign in to comment.