Merge remote-tracking branch 'upstream/develop' into account-menu-splitted

# Conflicts:
#	app/assets/javascripts/directives/views/accountMenu.ts
This commit is contained in:
VardanHakobyan
2021-06-17 13:37:16 +04:00
12 changed files with 33 additions and 45 deletions

View File

@@ -19,6 +19,7 @@ export const AutocompleteTagHint = observer(
const onTagHintClick = async () => {
await appState.noteTags.createAndAddNewTag();
appState.noteTags.setAutocompleteInputFocused(true);
};
const onFocus = () => {

View File

@@ -5,6 +5,7 @@ import { AppState } from '@/ui_models/app_state';
import { AutocompleteTagResult } from './AutocompleteTagResult';
import { AutocompleteTagHint } from './AutocompleteTagHint';
import { observer } from 'mobx-react-lite';
import { SNTag } from '@standardnotes/snjs';
type Props = {
appState: AppState;
@@ -41,8 +42,13 @@ export const AutocompleteTagInput = observer(({ appState }: Props) => {
const onSearchQueryChange = (event: Event) => {
const query = (event.target as HTMLInputElement).value;
appState.noteTags.setAutocompleteSearchQuery(query);
appState.noteTags.searchActiveNoteAutocompleteTags();
if (query === '') {
appState.noteTags.clearAutocompleteSearch();
} else {
appState.noteTags.setAutocompleteSearchQuery(query);
appState.noteTags.searchActiveNoteAutocompleteTags();
}
};
const onFormSubmit = async (event: Event) => {
@@ -83,10 +89,6 @@ export const AutocompleteTagInput = observer(({ appState }: Props) => {
appState.noteTags.setAutocompleteInputFocused(false);
};
useEffect(() => {
appState.noteTags.searchActiveNoteAutocompleteTags();
}, [appState.noteTags]);
useEffect(() => {
if (autocompleteInputFocused) {
inputRef.current.focus();
@@ -120,7 +122,7 @@ export const AutocompleteTagInput = observer(({ appState }: Props) => {
onBlur={closeOnBlur}
>
<div className="overflow-y-auto">
{autocompleteTagResults.map((tagResult) => (
{autocompleteTagResults.map((tagResult: SNTag) => (
<AutocompleteTagResult
key={tagResult.uuid}
appState={appState}

View File

@@ -1,5 +1,4 @@
import { ApplicationService } from '@standardnotes/snjs';
import { isDesktopApplication } from '@/utils';
const MILLISECONDS_PER_SECOND = 1000;
const POLL_INTERVAL = 50;
@@ -18,9 +17,7 @@ export class AutolockService extends ApplicationService {
private lockAfterDate?: Date
onAppLaunch() {
if (!isDesktopApplication()) {
this.beginPolling();
}
this.beginPolling();
return super.onAppLaunch();
}

View File

@@ -33,10 +33,6 @@ export class NativeExtManager extends ApplicationService {
return (window as any)._extensions_manager_location;
}
get batchMgrUrl() {
return (window as any)._batch_manager_location;
}
reload() {
this.application!.singletonManager!.registerPredicate(this.extManagerPred);
this.resolveExtensionsManager();

View File

@@ -98,7 +98,7 @@ export class NoteTagsState {
clearAutocompleteSearch(): void {
this.setAutocompleteSearchQuery('');
this.searchActiveNoteAutocompleteTags();
this.setAutocompleteTagResults([]);
}
async createAndAddNewTag(): Promise<void> {
@@ -198,15 +198,9 @@ export class NoteTagsState {
async removeTagFromActiveNote(tag: SNTag): Promise<void> {
const { activeNote } = this;
if (activeNote) {
const descendantTags = this.application.getTagDescendants(tag);
const tagsToRemove = [...descendantTags, tag];
await Promise.all(
tagsToRemove.map(async (tag) => {
await this.application.changeItem(tag.uuid, (mutator) => {
mutator.removeItemAsRelationship(activeNote);
});
})
);
await this.application.changeItem(tag.uuid, (mutator) => {
mutator.removeItemAsRelationship(activeNote);
});
this.application.sync();
this.reloadTags();
}

View File

@@ -346,17 +346,11 @@ export class NotesState {
async removeTagFromSelectedNotes(tag: SNTag): Promise<void> {
const selectedNotes = Object.values(this.selectedNotes);
const descendantTags = this.application.getTagDescendants(tag);
const tagsToRemove = [...descendantTags, tag];
await Promise.all(
tagsToRemove.map(async (tag) => {
await this.application.changeItem(tag.uuid, (mutator) => {
for (const note of selectedNotes) {
mutator.removeItemAsRelationship(note);
}
});
})
);
await this.application.changeItem(tag.uuid, (mutator) => {
for (const note of selectedNotes) {
mutator.removeItemAsRelationship(note);
}
});
this.application.sync();
}

View File

@@ -92,7 +92,6 @@
action="self.selectedMenuItem(true); self.toggleWebPrefKey(self.prefKeyMarginResizers)"
circle="self.state.marginResizersEnabled ? 'success' : 'neutral'",
desc="'Allows for editor left and right margins to be resized'",
faded='!self.state.marginResizersEnabled',
label="'Margin Resizers'"
)
.sk-app-bar-item(

View File

@@ -285,9 +285,6 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
if (note.dirty) {
this.showSavingStatus();
}
if (note.safeText().length === 0 && !showProtectedWarning) {
this.focusTitle();
}
}
async dismissProtectedWarning() {

View File

@@ -411,6 +411,8 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
await this.flushUI();
await this.reloadNotes();
await this.appState.noteTags.reloadTags();
const noteTitleEditorElement = document.getElementById('note-title-editor');
noteTitleEditorElement?.focus();
}
async handleTagChange(tag: SNTag) {
@@ -789,7 +791,10 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
return candidate.uuid === this.activeEditorNote?.uuid;
});
if (currentIndex + 1 < displayableNotes.length) {
this.selectNote(displayableNotes[currentIndex + 1]);
const nextNote = displayableNotes[currentIndex + 1];
this.selectNote(nextNote);
const nextNoteElement = document.getElementById(`note-${nextNote.uuid}`);
nextNoteElement?.focus();
}
}
@@ -806,7 +811,10 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
const displayableNotes = this.state.notes;
const currentIndex = displayableNotes.indexOf(this.activeEditorNote!);
if (currentIndex - 1 >= 0) {
this.selectNote(displayableNotes[currentIndex - 1]);
const previousNote = displayableNotes[currentIndex - 1];
this.selectNote(previousNote);
const previousNoteElement = document.getElementById(`note-${previousNote.uuid}`);
previousNoteElement?.focus();
return true;
} else {
return false;

View File

@@ -136,7 +136,7 @@ $footer-height: 32px;
top: 0;
right: 0;
z-index: $z-index-panel-resizer;
width: 8px;
width: 2px;
height: 100%;
position: absolute;
cursor: col-resize;

View File

@@ -1,6 +1,6 @@
{
"name": "standard-notes-web",
"version": "3.8.2",
"version": "3.8.3",
"license": "AGPL-3.0-or-later",
"repository": {
"type": "git",
@@ -14,7 +14,7 @@
"bundle": "webpack --config webpack.prod.js && yarn tsc",
"bundle:desktop": "webpack --config webpack.prod.js --env.platform='desktop'",
"bundle:desktop:beta": "webpack --config webpack.prod.js --env.platform='desktop' --env.public_beta='true'",
"build": "bundle install && yarn install --pure-lockfile && bundle exec rails assets:precompile && yarn bundle",
"build": "bundle install && yarn install --frozen-lockfile && bundle exec rails assets:precompile && yarn bundle",
"submodules": "git submodule update --init --force",
"lint": "eslint --fix app/assets/javascripts",
"tsc": "tsc --project app/assets/javascripts/tsconfig.json"