Merge branch 'release/3.8.10' into main
This commit is contained in:
@@ -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<HTMLButtonElement>();
|
||||
const panelRef = useRef<HTMLDivElement>();
|
||||
const [closeOnBlur, setLockCloseOnBlur] = useCloseOnBlur(panelRef, setOpen);
|
||||
@@ -45,9 +48,12 @@ const SearchOptions = observer(({ appState }: Props) => {
|
||||
<Disclosure
|
||||
open={open}
|
||||
onChange={() => {
|
||||
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);
|
||||
}}
|
||||
>
|
||||
<DisclosureButton
|
||||
@@ -61,9 +67,9 @@ const SearchOptions = observer(({ appState }: Props) => {
|
||||
<DisclosurePanel
|
||||
ref={panelRef}
|
||||
style={{
|
||||
top: optionsPanelTop,
|
||||
...position,
|
||||
}}
|
||||
className="sn-dropdown sn-dropdown--anchor-right sn-dropdown--animated min-w-80 absolute grid gap-2 py-2"
|
||||
className="sn-dropdown sn-dropdown--animated min-w-80 fixed grid gap-2 py-2"
|
||||
onBlur={closeOnBlur}
|
||||
>
|
||||
<Switch
|
||||
|
||||
@@ -61,10 +61,11 @@ class HistoryMenuCtrl extends PureViewCtrl<unknown, HistoryState> {
|
||||
}
|
||||
}
|
||||
|
||||
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<unknown, HistoryState> {
|
||||
}
|
||||
this.application.presentRevisionPreviewModal(
|
||||
remoteRevision.payload.uuid,
|
||||
remoteRevision.payload.content
|
||||
remoteRevision.payload.content,
|
||||
this.previewRemoteHistoryTitle(revision)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -154,7 +156,7 @@ class HistoryMenuCtrl extends PureViewCtrl<unknown, HistoryState> {
|
||||
this.reloadState();
|
||||
}
|
||||
|
||||
previewRemoteHistoryTitle(revision: SingleRevision) {
|
||||
previewRemoteHistoryTitle(revision: RevisionListEntry) {
|
||||
return new Date(revision.created_at).toLocaleString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: '='
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { WebApplication } from "../application";
|
||||
|
||||
export class SearchOptionsState {
|
||||
includeProtectedContents = false;
|
||||
includeArchived = true;
|
||||
includeArchived = false;
|
||||
includeTrashed = false;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -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!(
|
||||
`<revision-preview-modal application='application' uuid='uuid' content='content'
|
||||
`<revision-preview-modal application='application' uuid='uuid' content='content' title='title'
|
||||
class='sk-modal'></revision-preview-modal>`
|
||||
)(scope);
|
||||
this.applicationElement.append(el);
|
||||
|
||||
@@ -105,6 +105,7 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
|
||||
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<unknown, EditorState> {
|
||||
|
||||
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<unknown, EditorState> {
|
||||
});
|
||||
}
|
||||
|
||||
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<unknown, EditorState> {
|
||||
},
|
||||
});
|
||||
|
||||
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<unknown, EditorState> {
|
||||
angular.element(editor).one('$destroy', () => {
|
||||
this.removeTabObserver?.();
|
||||
this.removeTabObserver = undefined;
|
||||
editor.removeEventListener('scroll', this.setScrollPosition);
|
||||
editor.removeEventListener('scroll', this.resetScrollPosition);
|
||||
this.scrollPosition = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -216,7 +216,7 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)"
|
||||
|
||||
@@ -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",
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user