diff --git a/apps/web/__e2e__/keyboard-list-navigation.test.ts b/apps/web/__e2e__/keyboard-list-navigation.test.ts index dac660c97..b5ea8c583 100644 --- a/apps/web/__e2e__/keyboard-list-navigation.test.ts +++ b/apps/web/__e2e__/keyboard-list-navigation.test.ts @@ -120,7 +120,7 @@ test("pressing Enter should open focused note", async ({ page }) => { expect(await notes.editor.getTitle()).toBe(await notesList[2].getTitle()); }); -test("pressing Shift+ArrowDown should select next note", async ({ page }) => { +test.only("pressing Shift+ArrowDown should select next note", async ({ page }) => { const { notesList, notes } = await populateList(page); await notes.focus(); diff --git a/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-linux.txt b/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-linux.txt index 50dd65724..e6ce6d8d8 100644 --- a/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-linux.txt +++ b/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-linux.txt @@ -8,8 +8,8 @@ content="This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1" /> Test 1 - Notesnook - - + + diff --git a/apps/web/package.json b/apps/web/package.json index 5d401bb7a..e7ca0c27e 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -112,7 +112,7 @@ "build:desktop": "env-cmd -e all,desktop react-scripts build", "deploy": "./scripts/deploy.sh", "debug": "env-cmd -e all,dev,web,silent react-scripts start", - "test": "playwright test", + "test": "playwright test -u", "eject": "react-scripts eject", "analyze": "source-map-explorer 'build/static/js/*.js'", "postinstall": "patch-package" diff --git a/apps/web/src/components/list-container/index.tsx b/apps/web/src/components/list-container/index.tsx index dc6d1be03..c7d420012 100644 --- a/apps/web/src/components/list-container/index.tsx +++ b/apps/web/src/components/list-container/index.tsx @@ -99,8 +99,8 @@ function ListContainer(props: ListContainerProps) { length: items.length, reset: () => toggleSelection(false), deselect: (index) => deselectItem(items[index]), - select: (index) => - isSelected(items[index]) + select: (index, toggleable) => + toggleable && isSelected(items[index]) ? deselectItem(items[index]) : selectItem(items[index]), bulkSelect: (indices) => setSelectedItems(indices.map((i) => items[i])), diff --git a/apps/web/src/hooks/use-keyboard-list-navigation.ts b/apps/web/src/hooks/use-keyboard-list-navigation.ts index 46ed2c820..4166ce4b9 100644 --- a/apps/web/src/hooks/use-keyboard-list-navigation.ts +++ b/apps/web/src/hooks/use-keyboard-list-navigation.ts @@ -29,7 +29,7 @@ enum DIRECTION { type UseKeyboardListNavigationOptions = { length: number; reset: () => void; - select: (index: number) => void; + select: (index: number, toggleable?: boolean) => void; deselect: (index: number) => void; bulkSelect: (indices: number[]) => void; focusItemAt: (index: number) => void; @@ -82,7 +82,7 @@ export function useKeyboardListNavigation( const onMouseDown = useCallback( (e: MouseEvent, itemIndex: number) => { if (e.ctrlKey || e.metaKey) { - select(itemIndex); + select(itemIndex, true); } else if (e.shiftKey) { const startIndex = itemIndex > cursor.current ? cursor.current : itemIndex; diff --git a/packages/core/models/note.js b/packages/core/models/note.js index e1d63ff98..8e5270ea7 100644 --- a/packages/core/models/note.js +++ b/packages/core/models/note.js @@ -23,6 +23,7 @@ import TextBuilder from "../utils/templates/text/builder"; import { getContentFromData } from "../content-types"; import { CHECK_IDS, checkIsUserPremium } from "../common"; import { addItem, deleteItem } from "../utils/array"; +import { formatDate } from "../utils/date" export default class Note { /** @@ -87,9 +88,9 @@ export default class Note { const templateData = { metadata: this.data, title: this.title, - editedOn: this.dateEdited, + editedOn: formatDate(this.dateEdited), headline: this.headline, - createdOn: this.data.dateCreated, + createdOn: formatDate(this.data.dateCreated), tags: this.tags.join(", ") }; const contentItem = await this._db.content.raw(this._note.contentId);