Merge branch 'develop' into feature/account-menu-react

This commit is contained in:
Antonella Sgarlatta
2021-06-30 19:00:23 -03:00
19 changed files with 138 additions and 96 deletions

View File

@@ -170,7 +170,7 @@ class ApplicationViewCtrl extends PureViewCtrl<unknown, {
this.$location.search().demo === 'true' &&
!this.application.hasAccount()
) {
await this.application.setHost(
await this.application.setCustomHost(
'https://syncing-server-demo.standardnotes.org'
);
this.application.signIn(

View File

@@ -20,7 +20,7 @@
)
.sk-app-bar-item
a.no-decoration.sk-label.title(
href='https://standardnotes.org/help',
href='https://standardnotes.com/help',
rel='noopener',
target='_blank'
)

View File

@@ -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')

View File

@@ -310,58 +310,11 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
await this.selectNote(note, true);
}
if (this.state.selectedNotes[note.uuid]) {
const { clientHeight } = document.documentElement;
const defaultFontSize = window.getComputedStyle(
document.documentElement
).fontSize;
const maxContextMenuHeight = parseFloat(defaultFontSize) * 30;
const footerHeight = 32;
// Open up-bottom is default behavior
let openUpBottom = true;
const bottomSpace = clientHeight - footerHeight - e.clientY;
const upSpace = e.clientY;
// If not enough space to open up-bottom
if (maxContextMenuHeight > bottomSpace) {
// If there's enough space, open bottom-up
if (upSpace > maxContextMenuHeight) {
openUpBottom = false;
this.appState.notes.setContextMenuMaxHeight(
'auto'
);
// Else, reduce max height (menu will be scrollable) and open in whichever direction there's more space
} else {
if (upSpace > bottomSpace) {
this.appState.notes.setContextMenuMaxHeight(
upSpace - 2
);
openUpBottom = false;
} else {
this.appState.notes.setContextMenuMaxHeight(
bottomSpace - 2
);
}
}
} else {
this.appState.notes.setContextMenuMaxHeight(
'auto'
);
}
if (openUpBottom) {
this.appState.notes.setContextMenuPosition({
top: e.clientY,
left: e.clientX,
});
} else {
this.appState.notes.setContextMenuPosition({
bottom: clientHeight - e.clientY,
left: e.clientX,
});
}
this.appState.notes.setContextMenuClickLocation({
x: e.clientX,
y: e.clientY,
});
this.appState.notes.reloadContextMenuLayout();
this.appState.notes.setContextMenuOpen(true);
}
}