Compare commits

...
20 changed files with 168 additions and 116 deletions
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.23.55](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/desktop
## [3.23.54](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/desktop
## [3.23.53](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/desktop
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@standardnotes/desktop",
"main": "./app/dist/index.js",
"version": "3.23.53",
"version": "3.23.55",
"license": "AGPL-3.0-or-later",
"author": "Standard Notes.",
"private": true,
+12
View File
@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.30.4](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/mobile
## [3.30.3](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/mobile
## [3.30.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/mobile
## [3.30.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/mobile
+2 -1
View File
@@ -45,7 +45,8 @@ platform :ios do
apple_id: ENV['APPLE_APP_ID'],
distribute_external: true,
notify_external_testers: true,
submit_beta_review: true
submit_beta_review: true,
changelog: 'Fixes and improvements.'
)
# refresh_dsyms
end
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/mobile",
"version": "3.30.1",
"version": "3.30.4",
"author": "Standard Notes.",
"private": true,
"license": "AGPL-3.0-or-later",
@@ -8,21 +8,21 @@
"android-dev": "react-native run-android --variant devDebug --appIdSuffix dev",
"android-prod-debug": "react-native run-android --variant prodDebug",
"android-prod-release": "yarn run android:bundle && react-native run-android --variant prodRelease",
"android:bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/",
"build": "yarn web:bundle && yarn install:pods && yarn android:bundle",
"clear-cache": "watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-*",
"format:fix": "yarn format --write",
"format": "prettier ./src",
"install:pods": "yarn pod-install ios",
"ios-dev": "react-native run-ios --scheme StandardNotesDev",
"ios-prod": "react-native run-ios --scheme StandardNotes",
"clear-cache": "watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-*",
"lint": "yarn tsc && yarn eslint . --ext .ts,.tsx",
"lint:fix": "yarn lint --fix",
"format": "prettier ./src",
"format:fix": "yarn format --write",
"build": "yarn web:bundle && yarn install:pods && yarn android:bundle",
"web:bundle": "mkdir -p html/Web.bundle/src/web-src/ && cp -r ../web/dist/. html/Web.bundle/src/web-src/",
"lint": "yarn tsc && yarn eslint . --ext .ts,.tsx",
"pods": "yarn install:pods",
"tsc": "tsc --noEmit",
"start": "react-native start",
"install:pods": "yarn pod-install ios",
"android:bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/",
"upgrade:snjs": "ncu -u '@standardnotes/*'"
"tsc": "tsc --noEmit",
"upgrade:snjs": "ncu -u '@standardnotes/*'",
"web:bundle": "mkdir -p html/Web.bundle/src/web-src/ && cp -r ../web/dist/. html/Web.bundle/src/web-src/"
},
"installConfig": {
"hoistingLimits": "workspaces"
+12
View File
@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.70](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/releases
## [1.2.69](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/releases
## [1.2.68](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/releases
## [1.2.67](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/releases
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/releases",
"version": "1.2.67",
"version": "1.2.70",
"license": "AGPL-3.0-or-later",
"main": "dist/releases.json",
"types": "dist/index.d.ts",
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.77](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/web-server
## [1.2.76](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/web-server
## [1.2.75](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/web-server
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/web-server",
"version": "1.2.75",
"version": "1.2.77",
"license": "AGPL-3.0-or-later",
"private": true,
"author": "Standard Notes.",
+10
View File
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.37.3](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
### Bug Fixes
* select next item when trashing or deleting item ([#1218](https://github.com/standardnotes/app/issues/1218)) ([2ee7912](https://github.com/standardnotes/app/commit/2ee791259dca709d03db2ebded7972ce7c3b788e))
## [3.37.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/web
## [3.37.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-07-06)
**Note:** Version bump only for package @standardnotes/web
+10 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/web",
"version": "3.37.1",
"version": "3.37.3",
"license": "AGPL-3.0-or-later",
"main": "dist/app.js",
"author": "Standard Notes.",
@@ -9,23 +9,23 @@
"dist"
],
"scripts": {
"start": "webpack-dev-server --config web.webpack.dev.js",
"watch": "webpack -w --config web.webpack.dev.js",
"clean": "rm -fr dist",
"prebuild": "yarn clean",
"build": "webpack --config web.webpack.prod.js && yarn tsc",
"lint": "eslint src/javascripts",
"clean": "rm -fr dist",
"format": "prettier --write src/javascripts",
"tsc": "tsc --project tsconfig.json",
"lint": "eslint src/javascripts",
"prebuild": "yarn clean",
"start": "webpack-dev-server --config web.webpack.dev.js",
"test": "jest --config jest.config.js --coverage",
"upgrade:snjs": "ncu -u '@standardnotes/*'"
"tsc": "tsc --project tsconfig.json",
"upgrade:snjs": "ncu -u '@standardnotes/*'",
"watch": "webpack -w --config web.webpack.dev.js"
},
"devDependencies": {
"@babel/core": "*",
"@babel/plugin-transform-react-jsx": "^7.17.3",
"@babel/preset-env": "*",
"@babel/preset-typescript": "^7.16.7",
"@types/jest": "^27.4.1",
"@types/jest": "^27.5.1",
"@types/react": "^17.0.42",
"@types/react-dom": "^18.0.5",
"@types/wicg-file-system-access": "^2020.9.5",
@@ -41,6 +41,7 @@
"html-webpack-plugin": "^5.5.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.5.1",
"jest-environment-jsdom": "^27.5.1",
"lint-staged": ">=12",
"mini-css-extract-plugin": "^2.6.0",
"node-sass": "*",
@@ -37,7 +37,7 @@ const ContentList: FunctionComponent<Props> = ({
selectedItems,
paginate,
}) => {
const { selectPreviousItem, selectNextItem } = itemListController
const { selectPreviousItem, selectNextItem } = selectionController
const { hideTags, hideDate, hideNotePreview, hideEditorIcon } = itemListController.webDisplayOptions
const { sortBy } = itemListController.displayOptions
@@ -57,11 +57,9 @@ const ContentListView: FunctionComponent<Props> = ({
panelWidth,
renderedItems,
searchBarElement,
selectNextItem,
selectPreviousItem,
} = itemListController
const { selectedItems } = selectionController
const { selectedItems, selectNextItem, selectPreviousItem } = selectionController
const isFilesSmartView = useMemo(
() => navigationController.selected?.uuid === SystemViewId.Files,
@@ -80,7 +80,7 @@ const NoteTag = ({ viewControllerManager, tag }: Props) => {
if (autocompleteInputFocused) {
return -1
}
return tags[0].uuid === tag.uuid ? 0 : -1
return tags[0]?.uuid === tag.uuid ? 0 : -1
}, [autocompleteInputFocused, tags, tag, focusedTagUuid])
const onKeyDown: KeyboardEventHandler = useCallback(
@@ -370,7 +370,7 @@ export class ItemListController extends AbstractViewController implements Intern
await this.selectFirstItem()
} else if (this.shouldCloseActiveItem(activeItem) && activeController) {
this.closeItemController(activeController)
this.selectNextItem()
this.selectionController.selectNextItem()
} else if (this.shouldSelectNextItemOrCreateNewNote(activeItem)) {
await this.selectNextItemOrCreateNewNote()
} else if (this.shouldSelectActiveItem(activeItem) && activeItem) {
@@ -547,27 +547,11 @@ export class ItemListController extends AbstractViewController implements Intern
return document.getElementById(ElementIdScrollContainer)
}
selectItemWithScrollHandling = async (
item: {
uuid: ListableContentItem['uuid']
},
{ userTriggered = false, scrollIntoView = true },
): Promise<void> => {
await this.selectionController.selectItem(item.uuid, userTriggered)
if (scrollIntoView) {
const itemElement = document.getElementById(item.uuid)
itemElement?.scrollIntoView({
behavior: 'smooth',
})
}
}
selectFirstItem = async () => {
const item = this.getFirstNonProtectedItem()
if (item) {
await this.selectItemWithScrollHandling(item, {
await this.selectionController.selectItemWithScrollHandling(item, {
userTriggered: false,
scrollIntoView: false,
})
@@ -576,77 +560,21 @@ export class ItemListController extends AbstractViewController implements Intern
}
}
selectNextItem = () => {
const displayableItems = this.items
const currentIndex = displayableItems.findIndex((candidate) => {
return candidate.uuid === this.selectionController.lastSelectedItem?.uuid
})
let nextIndex = currentIndex + 1
while (nextIndex < displayableItems.length) {
const nextItem = displayableItems[nextIndex]
nextIndex++
if (nextItem.protected) {
continue
}
this.selectItemWithScrollHandling(nextItem, { userTriggered: true }).catch(console.error)
const nextNoteElement = document.getElementById(nextItem.uuid)
nextNoteElement?.focus()
return
}
}
selectNextItemOrCreateNewNote = async () => {
const item = this.getFirstNonProtectedItem()
if (item) {
await this.selectItemWithScrollHandling(item, {
userTriggered: false,
scrollIntoView: false,
}).catch(console.error)
await this.selectionController
.selectItemWithScrollHandling(item, {
userTriggered: false,
scrollIntoView: false,
})
.catch(console.error)
} else {
await this.createNewNote()
}
}
selectPreviousItem = () => {
const displayableItems = this.items
if (!this.selectionController.lastSelectedItem) {
return
}
const currentIndex = displayableItems.indexOf(this.selectionController.lastSelectedItem)
let previousIndex = currentIndex - 1
while (previousIndex >= 0) {
const previousItem = displayableItems[previousIndex]
previousIndex--
if (previousItem.protected) {
continue
}
this.selectItemWithScrollHandling(previousItem, { userTriggered: true }).catch(console.error)
const previousNoteElement = document.getElementById(previousItem.uuid)
previousNoteElement?.focus()
return
}
}
setNoteFilterText = (text: string) => {
if (text === this.noteFilterText) {
return
@@ -201,7 +201,6 @@ export class NotesController extends AbstractViewController {
const notesDeleted = await this.deleteNotes(false)
if (notesDeleted) {
runInAction(() => {
this.unselectNotes()
this.contextMenuOpen = false
})
}
@@ -210,7 +209,6 @@ export class NotesController extends AbstractViewController {
mutator.trashed = trashed
})
runInAction(() => {
this.unselectNotes()
this.contextMenuOpen = false
})
}
@@ -242,10 +240,10 @@ export class NotesController extends AbstractViewController {
confirmButtonStyle: 'danger',
})
) {
this.selectionController.selectNextItem()
if (permanently) {
for (const note of this.getSelectedNotesList()) {
await this.application.mutator.deleteItem(note)
this.selectionController.deselectItem(note)
}
} else {
await this.changeSelectedNotes((mutator) => {
@@ -221,4 +221,78 @@ export class SelectedItemsController extends AbstractViewController {
didSelect: this.selectedItems[uuid] != undefined,
}
}
selectItemWithScrollHandling = async (
item: {
uuid: ListableContentItem['uuid']
},
{ userTriggered = false, scrollIntoView = true },
): Promise<void> => {
const { didSelect } = await this.selectItem(item.uuid, userTriggered)
if (didSelect && scrollIntoView) {
const itemElement = document.getElementById(item.uuid)
itemElement?.scrollIntoView({
behavior: 'smooth',
})
}
}
selectNextItem = () => {
const displayableItems = this.itemListController.items
const currentIndex = displayableItems.findIndex((candidate) => {
return candidate.uuid === this.lastSelectedItem?.uuid
})
let nextIndex = currentIndex + 1
while (nextIndex < displayableItems.length) {
const nextItem = displayableItems[nextIndex]
nextIndex++
if (nextItem.protected) {
continue
}
this.selectItemWithScrollHandling(nextItem, { userTriggered: true }).catch(console.error)
const nextNoteElement = document.getElementById(nextItem.uuid)
nextNoteElement?.focus()
return
}
}
selectPreviousItem = () => {
const displayableItems = this.itemListController.items
if (!this.lastSelectedItem) {
return
}
const currentIndex = displayableItems.indexOf(this.lastSelectedItem)
let previousIndex = currentIndex - 1
while (previousIndex >= 0) {
const previousItem = displayableItems[previousIndex]
previousIndex--
if (previousItem.protected) {
continue
}
this.selectItemWithScrollHandling(previousItem, { userTriggered: true }).catch(console.error)
const previousNoteElement = document.getElementById(previousItem.uuid)
previousNoteElement?.focus()
return
}
}
}
@@ -1,4 +1,5 @@
import { AlertService, ButtonType, sanitizeHtmlString } from '@standardnotes/snjs'
import { AlertService, ButtonType } from '@standardnotes/services'
import { sanitizeHtmlString } from '@standardnotes/utils'
import { SKAlert } from '@standardnotes/styles'
/** @returns a promise resolving to true if the user confirmed, false if they canceled */
+1 -1
View File
@@ -16,7 +16,7 @@
"declarationDir": "dist/@types",
"baseUrl": ".",
"jsx": "react-jsx",
"typeRoots": ["./src/javascripts/Types/External", "../../node_modules/@types"],
"typeRoots": ["./src/javascripts/Types/External", "../../node_modules/@types", "node_modules/@types"],
"paths": {
"@/*": ["./src/javascripts/*"],
"@Controllers/*": ["src/javascripts/Controllers/*"],
+3 -2
View File
@@ -7504,7 +7504,7 @@ __metadata:
"@standardnotes/snjs": "workspace:*"
"@standardnotes/styles": "workspace:*"
"@standardnotes/toast": "workspace:*"
"@types/jest": ^27.4.1
"@types/jest": ^27.5.1
"@types/react": ^17.0.42
"@types/react-dom": ^18.0.5
"@types/wicg-file-system-access": ^2020.9.5
@@ -7521,6 +7521,7 @@ __metadata:
html-webpack-plugin: ^5.5.0
identity-obj-proxy: ^3.0.0
jest: ^27.5.1
jest-environment-jsdom: ^27.5.1
lint-staged: ">=12"
mini-css-extract-plugin: ^2.6.0
mobx: ^6.5.0
@@ -8386,7 +8387,7 @@ __metadata:
languageName: node
linkType: hard
"@types/jest@npm:^27.4.1":
"@types/jest@npm:^27.4.1, @types/jest@npm:^27.5.1":
version: 27.5.2
resolution: "@types/jest@npm:27.5.2"
dependencies: