From 28aab95bc0397eaafdefee694f708831e996eccd Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 23 Jun 2021 12:44:16 -0300 Subject: [PATCH 1/8] fix: make search options open on top of tags container --- .../javascripts/components/SearchOptions.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/components/SearchOptions.tsx b/app/assets/javascripts/components/SearchOptions.tsx index 9db46eeda..2099169a4 100644 --- a/app/assets/javascripts/components/SearchOptions.tsx +++ b/app/assets/javascripts/components/SearchOptions.tsx @@ -27,7 +27,10 @@ const SearchOptions = observer(({ appState }: Props) => { } = searchOptions; const [open, setOpen] = useState(false); - const [optionsPanelTop, setOptionsPanelTop] = useState(0); + const [position, setPosition] = useState({ + top: 0, + right: 0, + }); const buttonRef = useRef(); const panelRef = useRef(); const [closeOnBlur, setLockCloseOnBlur] = useCloseOnBlur(panelRef, setOpen); @@ -45,9 +48,12 @@ const SearchOptions = observer(({ appState }: Props) => { { - const { height } = buttonRef.current.getBoundingClientRect(); - setOptionsPanelTop(height); - setOpen((prevOpen) => !prevOpen); + const rect = buttonRef.current.getBoundingClientRect(); + setPosition({ + top: rect.bottom, + right: document.body.clientWidth - rect.right, + }); + setOpen(!open); }} > { Date: Wed, 23 Jun 2021 15:57:33 -0300 Subject: [PATCH 2/8] fix: scroll position changing when entering new line on editor --- .../javascripts/views/editor/editor_view.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/assets/javascripts/views/editor/editor_view.ts b/app/assets/javascripts/views/editor/editor_view.ts index 8cb4c3559..822c4d50e 100644 --- a/app/assets/javascripts/views/editor/editor_view.ts +++ b/app/assets/javascripts/views/editor/editor_view.ts @@ -105,6 +105,7 @@ class EditorViewCtrl extends PureViewCtrl { public editorValues: EditorValues = { title: '', text: '' }; onEditorLoad?: () => void; + private scrollPosition = 0; private removeAltKeyObserver?: any; private removeTrashKeyObserver?: any; private removeTabObserver?: any; @@ -131,6 +132,8 @@ class EditorViewCtrl extends PureViewCtrl { this.editorMenuOnSelect = this.editorMenuOnSelect.bind(this); this.onPanelResizeFinish = this.onPanelResizeFinish.bind(this); + this.setScrollPosition = this.setScrollPosition.bind(this); + this.resetScrollPosition = this.resetScrollPosition.bind(this); this.onEditorLoad = () => { this.application!.getDesktopService().redoSearch(); }; @@ -868,6 +871,20 @@ class EditorViewCtrl extends PureViewCtrl { }); } + setScrollPosition() { + const editor = document.getElementById( + ElementIds.NoteTextEditor + ) as HTMLInputElement; + this.scrollPosition = editor.scrollTop; + } + + resetScrollPosition() { + const editor = document.getElementById( + ElementIds.NoteTextEditor + ) as HTMLInputElement; + editor.scrollTop = this.scrollPosition; + } + onSystemEditorLoad() { if (this.removeTabObserver) { return; @@ -915,6 +932,9 @@ class EditorViewCtrl extends PureViewCtrl { }, }); + editor.addEventListener('scroll', this.setScrollPosition); + editor.addEventListener('input', this.resetScrollPosition); + /** * Handles when the editor is destroyed, * (and not when our controller is destroyed.) @@ -922,6 +942,9 @@ class EditorViewCtrl extends PureViewCtrl { angular.element(editor).one('$destroy', () => { this.removeTabObserver?.(); this.removeTabObserver = undefined; + editor.removeEventListener('scroll', this.setScrollPosition); + editor.removeEventListener('scroll', this.resetScrollPosition); + this.scrollPosition = 0; }); } } From b663faa49701d0dff605a9431ef2b5028139f03d Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 23 Jun 2021 17:16:48 -0300 Subject: [PATCH 3/8] fix: don't create placeholder note when there is an active search without results --- app/assets/javascripts/views/notes/notes_view.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/views/notes/notes_view.ts b/app/assets/javascripts/views/notes/notes_view.ts index e59300f28..6ed9e41c1 100644 --- a/app/assets/javascripts/views/notes/notes_view.ts +++ b/app/assets/javascripts/views/notes/notes_view.ts @@ -216,7 +216,7 @@ class NotesViewCtrl extends PureViewCtrl { break; case ApplicationEvent.CompletedFullSync: this.getMostValidNotes().then((notes) => { - if (notes.length === 0 && this.selectedTag?.isAllTag) { + if (notes.length === 0 && this.selectedTag?.isAllTag && this.state.noteFilter.text === '') { this.createPlaceholderNote(); } }); From 895126475768682c0b42ba66fa9b003b30cd42ac Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 23 Jun 2021 17:51:43 -0300 Subject: [PATCH 4/8] feat: show date on revision preview --- app/assets/javascripts/directives/views/historyMenu.ts | 10 ++++++---- .../directives/views/revisionPreviewModal.ts | 2 ++ app/assets/javascripts/ui_models/application.ts | 5 +++-- .../templates/directives/revision-preview-modal.pug | 6 +++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/directives/views/historyMenu.ts b/app/assets/javascripts/directives/views/historyMenu.ts index 2fcfad95f..54141eda8 100644 --- a/app/assets/javascripts/directives/views/historyMenu.ts +++ b/app/assets/javascripts/directives/views/historyMenu.ts @@ -61,10 +61,11 @@ class HistoryMenuCtrl extends PureViewCtrl { } } - async openSessionRevision(revision: HistoryEntry) { + async openSessionRevision(revision: HistoryEntry & { previewTitle: () => string }) { this.application.presentRevisionPreviewModal( revision.payload.uuid, - revision.payload.content + revision.payload.content, + revision.previewTitle() ); } @@ -84,7 +85,8 @@ class HistoryMenuCtrl extends PureViewCtrl { } this.application.presentRevisionPreviewModal( remoteRevision.payload.uuid, - remoteRevision.payload.content + remoteRevision.payload.content, + this.previewRemoteHistoryTitle(revision) ); } @@ -154,7 +156,7 @@ class HistoryMenuCtrl extends PureViewCtrl { this.reloadState(); } - previewRemoteHistoryTitle(revision: SingleRevision) { + previewRemoteHistoryTitle(revision: RevisionListEntry) { return new Date(revision.created_at).toLocaleString(); } } diff --git a/app/assets/javascripts/directives/views/revisionPreviewModal.ts b/app/assets/javascripts/directives/views/revisionPreviewModal.ts index a67755eb1..3332fbada 100644 --- a/app/assets/javascripts/directives/views/revisionPreviewModal.ts +++ b/app/assets/javascripts/directives/views/revisionPreviewModal.ts @@ -24,6 +24,7 @@ class RevisionPreviewModalCtrl extends PureViewCtrl implements RevisionPreviewSc $timeout: ng.ITimeoutService uuid!: string content!: PayloadContent + title?: string application!: WebApplication unregisterComponent?: any note!: SNNote @@ -139,6 +140,7 @@ export class RevisionPreviewModal extends WebDirective { this.scope = { uuid: '=', content: '=', + title: '=', application: '=' }; } diff --git a/app/assets/javascripts/ui_models/application.ts b/app/assets/javascripts/ui_models/application.ts index 3577b4703..80080ccd2 100644 --- a/app/assets/javascripts/ui_models/application.ts +++ b/app/assets/javascripts/ui_models/application.ts @@ -189,13 +189,14 @@ export class WebApplication extends SNApplication { this.applicationElement.append(el); } - presentRevisionPreviewModal(uuid: string, content: any) { + presentRevisionPreviewModal(uuid: string, content: any, title?: string) { const scope: any = this.scope!.$new(true); scope.uuid = uuid; scope.content = content; + scope.title = title; scope.application = this; const el = this.$compile!( - `` )(scope); this.applicationElement.append(el); diff --git a/app/assets/templates/directives/revision-preview-modal.pug b/app/assets/templates/directives/revision-preview-modal.pug index 339d4a2ba..ee0895408 100644 --- a/app/assets/templates/directives/revision-preview-modal.pug +++ b/app/assets/templates/directives/revision-preview-modal.pug @@ -5,7 +5,11 @@ .sn-component .sk-panel .sk-panel-header - .sk-panel-header-title Preview + div + .sk-panel-header-title Preview + .sk-subtitle.neutral.mt-1( + ng-if="ctrl.title" + ) {{ctrl.title}} .sk-horizontal-group a.sk-a.info.close-button( ng-click="ctrl.restore(false)" From 3648f29174b6ce3cc409a9cc1cb56187369534b0 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Thu, 24 Jun 2021 11:10:39 -0300 Subject: [PATCH 5/8] feat: make archived false by default on search options --- .../javascripts/ui_models/app_state/search_options_state.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/ui_models/app_state/search_options_state.ts b/app/assets/javascripts/ui_models/app_state/search_options_state.ts index 9b9b4aa50..7be4be6d2 100644 --- a/app/assets/javascripts/ui_models/app_state/search_options_state.ts +++ b/app/assets/javascripts/ui_models/app_state/search_options_state.ts @@ -4,7 +4,7 @@ import { WebApplication } from "../application"; export class SearchOptionsState { includeProtectedContents = false; - includeArchived = true; + includeArchived = false; includeTrashed = false; constructor( From e65861485f259b58b622c60f1048e424eda3a880 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Thu, 24 Jun 2021 13:06:20 -0300 Subject: [PATCH 6/8] chore(version-snjs): 2.7.7 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index dec3adcb4..79f770fe0 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@reach/checkbox": "^0.13.2", "@reach/dialog": "^0.13.0", "@standardnotes/sncrypto-web": "1.2.10", - "@standardnotes/snjs": "2.7.6", + "@standardnotes/snjs": "2.7.7", "mobx": "^6.1.6", "mobx-react-lite": "^3.2.0", "preact": "^10.5.12" diff --git a/yarn.lock b/yarn.lock index 9b3858e4f..5d8d0d757 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1936,10 +1936,10 @@ "@standardnotes/sncrypto-common" "^1.2.7" libsodium-wrappers "^0.7.8" -"@standardnotes/snjs@2.7.6": - version "2.7.6" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.6.tgz#f0b965bfad61e93af6803ec2698c02b1489d1073" - integrity sha512-E1Gj02gWvqypVpPed2YCSUnMUi2ZqFsb8NT2Jo8dqFS6Wk3FMzptWlFM/DuTifyzaYsmwPkXv1v5KpeU+dA+CQ== +"@standardnotes/snjs@2.7.7": + version "2.7.7" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.7.tgz#5a88269271c322889e67b4904cf63d040d09726e" + integrity sha512-trxDkLVtGM5XuewrZvMojoRQ7t3AQ4vuMNrGi6RNlCnhRV1evPYwn8Iq6N2fGCQ4GWjBYRddbG91xC7zAgkG+w== dependencies: "@standardnotes/auth" "^2.0.0" "@standardnotes/sncrypto-common" "^1.2.9" From 5561ab65ff02d1e1b4750e78ffcfbd621219ac05 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Thu, 24 Jun 2021 14:35:50 -0300 Subject: [PATCH 7/8] styles: make note flags wrap --- app/assets/javascripts/views/notes/notes-view.pug | 2 +- app/assets/stylesheets/_notes.scss | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/views/notes/notes-view.pug b/app/assets/javascripts/views/notes/notes-view.pug index c30554557..c05a8cd59 100644 --- a/app/assets/javascripts/views/notes/notes-view.pug +++ b/app/assets/javascripts/views/notes/notes-view.pug @@ -132,7 +132,7 @@ ng-class="{'selected' : self.isNoteSelected(note.uuid) }" ng-click='self.selectNote(note, true)' ) - .note-flags(ng-show='self.noteFlags[note.uuid].length > 0') + .note-flags.flex.flex-wrap(ng-show='self.noteFlags[note.uuid].length > 0') .flag(ng-class='flag.class', ng-repeat='flag in self.noteFlags[note.uuid]') .label {{flag.text}} .name(ng-show='note.title') diff --git a/app/assets/stylesheets/_notes.scss b/app/assets/stylesheets/_notes.scss index aa7a15c44..0ccf25e65 100644 --- a/app/assets/stylesheets/_notes.scss +++ b/app/assets/stylesheets/_notes.scss @@ -169,6 +169,7 @@ flex-direction: row; align-items: center; margin-bottom: 8px; + margin-top: -4px; .flag { padding: 4px; @@ -176,6 +177,7 @@ padding-right: 6px; border-radius: var(--sn-stylekit-general-border-radius); margin-right: 4px; + margin-top: 4px; &.info { background-color: var(--sn-stylekit-info-color); From ac6bd219f025c00d8191df9f384c4734c64a7221 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Thu, 24 Jun 2021 14:36:22 -0300 Subject: [PATCH 8/8] chore(version): 3.8.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 79f770fe0..686c14115 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "standard-notes-web", - "version": "3.8.9", + "version": "3.8.10", "license": "AGPL-3.0-or-later", "repository": { "type": "git",