fix: note comparison in template

This commit is contained in:
Mo Bitar
2020-04-21 13:55:16 -05:00
parent 35434f8af3
commit 9023f76417
13 changed files with 38 additions and 42 deletions

View File

@@ -319,9 +319,9 @@ class AccountMenuCtrl extends PureViewCtrl {
} }
async openPrivilegesModal() { async openPrivilegesModal() {
this.close();
const run = () => { const run = () => {
this.application!.presentPrivilegesManagementModal(); this.application!.presentPrivilegesManagementModal();
this.close();
}; };
const needsPrivilege = await this.application!.privilegesService!.actionRequiresPrivilege( const needsPrivilege = await this.application!.privilegesService!.actionRequiresPrivilege(
ProtectedAction.ManagePrivileges ProtectedAction.ManagePrivileges

View File

@@ -90,21 +90,18 @@ class RevisionPreviewModalCtrl implements RevisionPreviewScope {
restore(asCopy: boolean) { restore(asCopy: boolean) {
const run = async () => { const run = async () => {
let item;
if (asCopy) { if (asCopy) {
const contentCopy = Object.assign({}, this.content); const contentCopy = Object.assign({}, this.content);
if (contentCopy.title) { if (contentCopy.title) {
contentCopy.title += " (copy)"; contentCopy.title += " (copy)";
} }
item = await this.application.createManagedItem( await this.application.createManagedItem(
ContentType.Note, ContentType.Note,
contentCopy, contentCopy,
true true
); );
} else { } else {
const uuid = this.uuid; this.application.changeAndSaveItem(this.uuid, (mutator) => {
item = this.application.findItem(uuid)!;
this.application.changeAndSaveItem(item.uuid, (mutator) => {
mutator.setContent(this.content); mutator.setContent(this.content);
}, true, PayloadSource.RemoteActionRetrieved); }, true, PayloadSource.RemoteActionRetrieved);
} }

View File

@@ -102,7 +102,7 @@
) )
.note( .note(
ng-repeat='note in self.state.renderedNotes track by note.uuid' ng-repeat='note in self.state.renderedNotes track by note.uuid'
ng-class="{'selected' : self.activeEditorNote == note}" ng-class="{'selected' : self.activeEditorNote.uuid == note.uuid}"
ng-click='self.selectNote(note)' ng-click='self.selectNote(note)'
) )
.note-flags(ng-show='self.noteFlags[note.uuid].length > 0') .note-flags(ng-show='self.noteFlags[note.uuid].length > 0')

View File

@@ -4,15 +4,13 @@ import { SNComponent, LiveItem } from 'snjs';
import { WebDirective } from './../../types'; import { WebDirective } from './../../types';
export declare type ComponentModalScope = { export declare type ComponentModalScope = {
componentUuid: string; componentUuid: string;
callback: () => void; onDismiss: () => void;
onDismiss: (component: SNComponent) => void;
application: WebApplication; application: WebApplication;
}; };
export declare class ComponentModalCtrl implements ComponentModalScope { export declare class ComponentModalCtrl implements ComponentModalScope {
$element: JQLite; $element: JQLite;
componentUuid: string; componentUuid: string;
callback: () => void; onDismiss: () => void;
onDismiss: (component: SNComponent) => void;
application: WebApplication; application: WebApplication;
liveComponent: LiveItem<SNComponent>; liveComponent: LiveItem<SNComponent>;
component: SNComponent; component: SNComponent;

View File

@@ -1,6 +1,5 @@
export { AccountMenu } from './accountMenu'; export { AccountMenu } from './accountMenu';
export { ActionsMenu } from './actionsMenu'; export { ActionsMenu } from './actionsMenu';
export { ChallengeModal } from './challengeModal';
export { ComponentModal } from './componentModal'; export { ComponentModal } from './componentModal';
export { ComponentView } from './componentView'; export { ComponentView } from './componentView';
export { EditorMenu } from './editorMenu'; export { EditorMenu } from './editorMenu';

View File

@@ -2,12 +2,12 @@ import { WebApplication } from '@/ui_models/application';
import { ApplicationService, WebPrefKey } from 'snjs'; import { ApplicationService, WebPrefKey } from 'snjs';
export declare class PreferencesManager extends ApplicationService { export declare class PreferencesManager extends ApplicationService {
private userPreferences; private userPreferences;
private loadingPrefs;
/** @override */ /** @override */
onAppLaunch(): Promise<void>; onAppLaunch(): Promise<void>;
get webApplication(): WebApplication; get webApplication(): WebApplication;
streamPreferences(): void; streamPreferences(): void;
loadSingleton(): Promise<void>; private loadSingleton;
preferencesDidChange(): void;
syncUserPreferences(): void; syncUserPreferences(): void;
getValue(key: WebPrefKey, defaultValue?: any): any; getValue(key: WebPrefKey, defaultValue?: any): any;
setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): Promise<void>; setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): Promise<void>;

View File

@@ -8,6 +8,7 @@ export declare class Editor {
private removeStreamObserver; private removeStreamObserver;
isTemplateNote: boolean; isTemplateNote: boolean;
constructor(application: WebApplication, noteUuid?: string, noteTitle?: string); constructor(application: WebApplication, noteUuid?: string, noteTitle?: string);
deinit(): void;
private handleNoteStream; private handleNoteStream;
insertTemplatedNote(): Promise<import("../../../../../snjs/dist/@types").SNItem>; insertTemplatedNote(): Promise<import("../../../../../snjs/dist/@types").SNItem>;
/** /**
@@ -15,7 +16,6 @@ export declare class Editor {
* and creating a placeholder note. * and creating a placeholder note.
*/ */
reset(noteTitle?: string): Promise<void>; reset(noteTitle?: string): Promise<void>;
deinit(): void;
/** /**
* Register to be notified when the editor's note changes. * Register to be notified when the editor's note changes.
*/ */

View File

@@ -16,7 +16,7 @@ export declare class EditorGroup {
/** /**
* Notifies observer when the active editor has changed. * Notifies observer when the active editor has changed.
*/ */
addChangeObserver(callback: EditorGroupChangeCallback): void; addChangeObserver(callback: EditorGroupChangeCallback): () => void;
private notifyObservers; private notifyObservers;
} }
export {}; export {};

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class ChallengeModal extends WebDirective {
constructor();
}

View File

@@ -6,3 +6,4 @@ export { EditorView } from './editor/editor_view';
export { FooterView } from './footer/footer_view'; export { FooterView } from './footer/footer_view';
export { NotesView } from './notes/notes_view'; export { NotesView } from './notes/notes_view';
export { TagsView } from './tags/tags_view'; export { TagsView } from './tags/tags_view';
export { ChallengeModal } from './challenge_modal/challenge_modal';

View File

@@ -1,10 +1,11 @@
import { SNNote, SNTag } from 'snjs'; import { SNNote, SNTag } from 'snjs';
export declare enum NoteSortKey { export declare enum NoteSortKey {
CreatedAt = "created_at", CreatedAt = "created_at",
UserUpdatedAt = "userModifiedDate",
Title = "title",
/** @legacy Use UserUpdatedAt instead */
UpdatedAt = "updated_at", UpdatedAt = "updated_at",
ClientUpdatedAt = "client_updated_at", /** @legacy Use UserUpdatedAt instead */
Title = "title" ClientUpdatedAt = "client_updated_at"
} }
export declare function filterAndSortNotes(notes: SNNote[], selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string, sortBy: string, reverse: boolean): SNNote[]; export declare function notePassesFilter(note: SNNote, selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): boolean;
export declare function filterNotes(notes: SNNote[], selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): SNNote[];
export declare function sortNotes(notes: SNNote[] | undefined, sortBy: string, reverse: boolean): SNNote[];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long