A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: improve table styling * make tool buttons more prominent * match scroll styling to rest of app * add padding to cells * add bg to header row
01zulfi1ae9e04e7a12
diff --git a/packages/editor/src/extensions/table/component.tsx b/packages/editor/src/extensions/table/component.tsxindex cb45c08ca..9cb5783c4 100644--- a/packages/editor/src/extensions/table/component.tsx+++ b/packages/editor/src/extensions/table/component.tsx@@ -32,7 +32,7 @@ import {TableProperties} from "../../toolbar/tools/table.js";import { getToolDefinition } from "../../toolbar/tool-definitions.js";-import { getPosition } from "@notesnook/ui";+import { getPosition, ScrollContainer } from "@notesnook/ui";import {findSelectedDOMNode,hasSameAttributes@@ -67,17 +67,25 @@ export function TableComponent(props: ReactNodeViewProps) {textDirection={textDirection}/></DesktopOnly>- <div className="tableWrapper" dir={textDirection}>- <table- ref={(ref) => {- forwardRef?.(ref);- tableRef.current = ref || undefined;- }}- >- <colgroup ref={colgroupRef} />- {/* <tbody /> */}- </table>- </div>+ <ScrollContainer+ style={{ display: "flex", overscrollBehavior: "contain" }}+ trackStyle={() => ({+ backgroundColor: "transparent",+ "--ms-track-size": "6px"+ })}+ >+ <div dir={textDirection}>+ <table+ ref={(ref) => {+ forwardRef?.(ref);+ tableRef.current = ref || undefined;+ }}+ >+ <colgroup ref={colgroupRef} />+ {/* <tbody /> */}+ </table>+ </div>+ </ScrollContainer></>);}@@ -181,7 +189,7 @@ function TableRowToolbar(props: TableToolbarProps) {flexWrap: "nowrap",borderRadius: "default",flexDirection: "column",- opacity: 0.3,+ opacity: 0.8,":hover": {opacity: 1}@@ -231,9 +239,10 @@ function TableColumnToolbar(props: TableToolbarProps) {yOffset: 2});- columnToolsRef.current.style.left = `${- pos.left - (table.current.parentElement?.scrollLeft || 0)- }px`;+ const scrollLeft =+ table.current.parentElement?.parentElement?.scrollLeft || 0;++ columnToolsRef.current.style.left = `${pos.left - scrollLeft}px`;columnToolsRef.current.style.top = `${pos.top}px`;}@@ -255,7 +264,7 @@ function TableColumnToolbar(props: TableToolbarProps) {bg: "background",flexWrap: "nowrap",borderRadius: "default",- opacity: 0.3,+ opacity: 0.8,":hover": {opacity: 1}diff --git a/packages/editor/styles/styles.css b/packages/editor/styles/styles.cssindex 962e11935..f61153c6b 100644--- a/packages/editor/styles/styles.css+++ b/packages/editor/styles/styles.css@@ -229,7 +229,7 @@ img.ProseMirror-separator {border: 1px solid var(--border);box-sizing: border-box;min-width: 1em;- padding: 3px 5px;+ padding: 7px 9px;position: relative;vertical-align: top;}@@ -244,6 +244,7 @@ img.ProseMirror-separator {}.ProseMirror table th {+ background-color: var(--background-secondary);font-weight: bold;text-align: left;}@@ -275,11 +276,6 @@ img.ProseMirror-separator {margin: 0;}-.tableWrapper {- /* padding: 1rem 0; */- overflow-x: auto;-}-.resize-cursor {cursor: ew-resize;cursor: col-resize;