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

This commit is contained in:
Antonella Sgarlatta
2021-06-22 15:30:18 -03:00
15 changed files with 41 additions and 53 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

@@ -140,7 +140,7 @@ class PanelResizerCtrl implements PanelResizerScope {
return;
}
this.resizerColumn = this.$element[0];
this.currentMinWidth = this.minWidth || this.resizerColumn.offsetWidth;
this.currentMinWidth = this.minWidth || (this.resizerColumn.offsetWidth + 2);
this.pressed = false;
this.startWidth = this.panel.scrollWidth;
this.lastDownX = 0;

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: 4px;
height: 100%;
position: absolute;
cursor: col-resize;

View File

@@ -30,7 +30,7 @@
<script>
window._default_sync_server = "<%= ENV['SF_DEFAULT_SERVER'] %>";
window._next_version_sync_server = "<%= ENV['SF_NEXT_VERSION_SERVER'] %>";
window._next_version_sync_server = "<%= ENV['SF_NEXT_VERSION_SERVER'] || ENV['SF_DEFAULT_SERVER'] %>";
window._extensions_manager_location = "<%= ENV['EXTENSIONS_MANAGER_LOCATION'] %>";
window._batch_manager_location = "<%= ENV['BATCH_MANAGER_LOCATION'] %>";
window._bugsnag_api_key = "<%= ENV['BUGSNAG_API_KEY'] %>";

View File

@@ -30,7 +30,7 @@
<body
data-default-sync-server="<%= env.DEV_DEFAULT_SYNC_SERVER %>"
data-next-version-sync-server="<%= env.DEV_NEXT_VERSION_SYNC_SERVER %>"
data-next-version-sync-server="<%= env.DEV_NEXT_VERSION_SYNC_SERVER || env.DEV_DEFAULT_SYNC_SERVER %>"
data-extensions-manager-location="<%= env.DEV_EXTENSIONS_MANAGER_LOCATION %>"
data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>"
>

View File

@@ -1,6 +1,6 @@
{
"name": "standard-notes-web",
"version": "3.8.2",
"version": "3.8.8",
"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"
@@ -71,7 +71,7 @@
"@reach/checkbox": "^0.13.2",
"@reach/dialog": "^0.13.0",
"@standardnotes/sncrypto-web": "1.2.10",
"@standardnotes/snjs": "2.7.1",
"@standardnotes/snjs": "2.7.5",
"mobx": "^6.1.6",
"mobx-react-lite": "^3.2.0",
"preact": "^10.5.12"

View File

@@ -1936,10 +1936,10 @@
"@standardnotes/sncrypto-common" "^1.2.7"
libsodium-wrappers "^0.7.8"
"@standardnotes/snjs@2.7.1":
version "2.7.1"
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.1.tgz#e8073942fe9a8f762989ab75df94407b9934ea3e"
integrity sha512-kCZU4Tx6vNYcEeh22ax8Vfr/LYEbgAqI9nSC6jB8MTg6nJzCuh4b/nngW+yVUz91phu156XN0YeMyj7HJ3DWVw==
"@standardnotes/snjs@2.7.5":
version "2.7.5"
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.5.tgz#5ac5d071912a974acda73bb0720fa66bc5c14448"
integrity sha512-I15S2pwh+7w7pExnXJAUkLmhTySgMdnpUDEpKceufH9uUVvgdsZdz+Kfapv5/pFGOMBL3iDrY30anUSJWSsO1Q==
dependencies:
"@standardnotes/auth" "^2.0.0"
"@standardnotes/sncrypto-common" "^1.2.9"