This commit is contained in:
Mo Bitar
2020-04-14 19:59:31 -05:00
parent d91b7bc449
commit a2303aa7af
7 changed files with 37 additions and 61 deletions

View File

@@ -90,7 +90,7 @@ export class AppState {
createEditor(title?: string) { createEditor(title?: string) {
const activeEditor = this.getActiveEditor(); const activeEditor = this.getActiveEditor();
if (!activeEditor || this.multiEditorEnabled) { if (!activeEditor || this.multiEditorEnabled) {
this.application.editorGroup.createEditor(title); this.application.editorGroup.createEditor(undefined, title);
} else { } else {
activeEditor.reset(title); activeEditor.reset(title);
} }

View File

@@ -100,48 +100,39 @@ export class WebApplication extends SNApplication {
this.webServices = services; this.webServices = services;
} }
/** @access public */ public getAppState() {
getAppState() {
return this.webServices.appState; return this.webServices.appState;
} }
/** @access public */ public getDesktopService() {
getDesktopService() {
return this.webServices.desktopService; return this.webServices.desktopService;
} }
/** @access public */ public getLockService() {
getLockService() {
return this.webServices.lockService; return this.webServices.lockService;
} }
/** @access public */ public getArchiveService() {
getArchiveService() {
return this.webServices.archiveService; return this.webServices.archiveService;
} }
/** @access public */ public getNativeExtService() {
getNativeExtService() {
return this.webServices.nativeExtService; return this.webServices.nativeExtService;
} }
/** @access public */ public getStatusService() {
getStatusService() {
return this.webServices.statusService; return this.webServices.statusService;
} }
/** @access public */ public getThemeService() {
getThemeService() {
return this.webServices.themeService; return this.webServices.themeService;
} }
/** @access public */ public getPrefsService() {
getPrefsService() {
return this.webServices.prefsService; return this.webServices.prefsService;
} }
/** @access public */ public getKeyboardService() {
getKeyboardService() {
return this.webServices.keyboardService; return this.webServices.keyboardService;
} }

View File

@@ -39,7 +39,7 @@
application='self.application' application='self.application'
) )
input.tags-input( input.tags-input(
ng-blur='self.saveTagsFromStrings()', ng-blur='self.onTagsInputBlur()',
ng-disabled='self.noteLocked', ng-disabled='self.noteLocked',
ng-if='!(self.state.tagsComponent && self.state.tagsComponent.active)', ng-if='!(self.state.tagsComponent && self.state.tagsComponent.active)',
ng-keyup='$event.keyCode == 13 && $event.target.blur();', ng-keyup='$event.keyCode == 13 && $event.target.blur();',

View File

@@ -447,7 +447,6 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
return; return;
} }
if (this.editor.isTemplateNote) { if (this.editor.isTemplateNote) {
console.log("is template");
await this.editor.insertTemplatedNote(); await this.editor.insertTemplatedNote();
if (this.appState.selectedTag) { if (this.appState.selectedTag) {
await this.application.changeItem( await this.application.changeItem(
@@ -793,6 +792,11 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
this.saveTagsFromStrings(strings); this.saveTagsFromStrings(strings);
} }
onTagsInputBlur() {
this.saveTagsFromStrings();
this.focusEditor();
}
public async saveTagsFromStrings(strings?: string[]) { public async saveTagsFromStrings(strings?: string[]) {
if ( if (
!strings !strings

View File

@@ -167,21 +167,19 @@ class NotesViewCtrl extends PureViewCtrl {
} }
/** /**
* @access private
* Access the current state notes without awaiting any potential reloads * Access the current state notes without awaiting any potential reloads
* that may be in progress. This is the sync alternative to `async getMostValidNotes` * that may be in progress. This is the sync alternative to `async getMostValidNotes`
*/ */
getPossiblyStaleNotes() { private getPossiblyStaleNotes() {
return this.getState().notes!; return this.getState().notes!;
} }
/** /**
* @access private
* Access the current state notes after waiting for any pending reloads. * Access the current state notes after waiting for any pending reloads.
* This returns the most up to date notes, but is the asyncronous counterpart * This returns the most up to date notes, but is the asyncronous counterpart
* to `getPossiblyStaleNotes` * to `getPossiblyStaleNotes`
*/ */
async getMostValidNotes() { private async getMostValidNotes() {
await this.reloadNotesPromise; await this.reloadNotesPromise;
return this.getPossiblyStaleNotes(); return this.getPossiblyStaleNotes();
} }
@@ -190,9 +188,8 @@ class NotesViewCtrl extends PureViewCtrl {
* Triggered programatically to create a new placeholder note * Triggered programatically to create a new placeholder note
* when conditions allow for it. This is as opposed to creating a new note * when conditions allow for it. This is as opposed to creating a new note
* as part of user interaction (pressing the + button). * as part of user interaction (pressing the + button).
* @access private
*/ */
async createPlaceholderNote() { private async createPlaceholderNote() {
const selectedTag = this.application!.getAppState().getSelectedTag()!; const selectedTag = this.application!.getAppState().getSelectedTag()!;
if (selectedTag.isSmartTag() && !selectedTag.isAllTag) { if (selectedTag.isSmartTag() && !selectedTag.isAllTag) {
return; return;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long