Skip to content

Commit

Permalink
Merge pull request #426 from penge/cells-resizing
Browse files Browse the repository at this point in the history
Improve code to resize table rows and columns
  • Loading branch information
penge authored Apr 25, 2024
2 parents 2749c33 + 7e94395 commit 8e52ceb
Show file tree
Hide file tree
Showing 15 changed files with 446 additions and 405 deletions.
23 changes: 16 additions & 7 deletions public/notes.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:root {
--default-sidebar-width: 25%;
--resizing-div-overflow: -10000px;
}

html {
Expand Down Expand Up @@ -372,6 +373,7 @@ body.resizing-sidebar-locked-max { cursor: w-resize; }
border: var(--table-border);
border-spacing: 0;
border-collapse: collapse;
overflow: hidden !important;
}

#content table td {
Expand Down Expand Up @@ -461,26 +463,33 @@ body.with-control.resizing-img #content {

.table-resizing-div {
position: absolute;
z-index: 100;
}

.table-resizing-div.active {
body:not(.resizing-table) .table-resizing-div:hover, .table-resizing-div.active {
background: var(--resizing-line-color);
}

.table-column-resizing-div {
top: 0;
top: var(--resizing-div-overflow);
bottom: var(--resizing-div-overflow);
right: 0;
bottom: 0;
width: var(--table-resizing-div-thickness);
}

body:not(.resizing-table) .table-column-resizing-div {
cursor: col-resize;
width: 4px;
}

.table-row-resizing-div {
left: 0;
right: 0;
left: var(--resizing-div-overflow);
right: var(--resizing-div-overflow);
bottom: 0;
height: var(--table-resizing-div-thickness);
}

body:not(.resizing-table) .table-row-resizing-div {
cursor: row-resize;
height: 4px;
}

body.resizing-table-column { cursor: col-resize; }
Expand Down
1 change: 1 addition & 0 deletions public/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
--table-border: 3px solid #454545;
--table-td-border: 1px solid #222;
--table-td-heading-background-color: #222;
--table-resizing-div-thickness: 4px;
--resizing-line-color: #0000ff;


Expand Down
1 change: 1 addition & 0 deletions public/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
--table-border: 3px solid #171717;
--table-td-border: 1px solid silver;
--table-td-heading-background-color: #dddddd;
--table-resizing-div-thickness: 4px;
--resizing-line-color: #0000ff;


Expand Down
156 changes: 0 additions & 156 deletions src/notes/content/__tests__/table.test.ts

This file was deleted.

5 changes: 4 additions & 1 deletion src/notes/content/init.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { dispatchNoteEdited } from "notes/events";

import { initImgs } from "./img";
import { initTables } from "./table";
import renderTableContextMenu from "./render-table-context-menu";
import renderTableContextMenu from "./table/render/render-table-context-menu";

export default () => {
initImgs();
initTables({
onResize: dispatchNoteEdited,
contextMenuRenderFunction: renderTableContextMenu,
});
};
Loading

0 comments on commit 8e52ceb

Please sign in to comment.