Optimizing Context Menu

This commit is contained in:
Fabian 2019-06-03 18:14:19 +02:00
parent 311409d36d
commit ffe1dd6f9f
4 changed files with 16 additions and 5 deletions

View File

@ -8,6 +8,8 @@
>button {
margin: 0;
display: block;
background-color: rgb(224, 224, 224);
color: black;
}
>*:not(:last-child) {

View File

@ -59,6 +59,15 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
onContext(evt: MouseEvent, note: BaseNote) {
evt.preventDefault();
evt.stopPropagation();
const close = () => {
document.documentElement.removeEventListener("click", close);
this.setState({ context: undefined });
}
document.documentElement.addEventListener("click", close);
const shareNote = async () => {
let nav = window.navigator as any;
if (nav.share !== undefined) {
@ -82,7 +91,6 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
}).catch(err => {
Notifications.sendError(err);
})
}
let share;
@ -254,7 +262,7 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
<div class="uk-container">
<div style="display:flex;">
<input class="uk-input" type="text" onKeyUp={this.searchChanged} ref={elm => this.searchInput = elm} />
<button class="uk-button" style="padding: 0 10px;">
<button class="uk-button uk-button-primary" style="padding: 0 10px;">
<Search />
</button>
</div>

View File

@ -127,12 +127,13 @@ export default class VaultsPage extends Page<VaultsProps, { vaults: VaultList, m
onContext(evt: MouseEvent, vault: { name: string, encrypted: boolean, id: string }) {
evt.preventDefault();
evt.stopPropagation();
const close = () => {
window.removeEventListener("click", close);
document.documentElement.removeEventListener("click", close);
this.setState({ context: undefined });
}
window.addEventListener("click", close);
document.documentElement.addEventListener("click", close);
let deleteb = <button class="uk-button" onClick={async () => {
let delete_modal = new YesNoModal("Delete Vault? Cannot be undone!");

View File

@ -172,7 +172,7 @@ class NotesProvider {
}
this.syncedObservableServer.send((await this.oplogDB.getAll()).length <= 0);
let prs = this.apiLockRls.then(lock => lock.release());
prs.then(() => awaitTimeout(5000)).then(() => this.sync()).then(() => next());
prs.then(() => awaitTimeout(2000)).then(() => this.sync()).then(() => next());
return prs;
}