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() {
this.close();
const run = () => {
this.application!.presentPrivilegesManagementModal();
this.close();
};
const needsPrivilege = await this.application!.privilegesService!.actionRequiresPrivilege(
ProtectedAction.ManagePrivileges

View File

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

View File

@@ -102,7 +102,7 @@
)
.note(
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)'
)
.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';
export declare type ComponentModalScope = {
componentUuid: string;
callback: () => void;
onDismiss: (component: SNComponent) => void;
onDismiss: () => void;
application: WebApplication;
};
export declare class ComponentModalCtrl implements ComponentModalScope {
$element: JQLite;
componentUuid: string;
callback: () => void;
onDismiss: (component: SNComponent) => void;
onDismiss: () => void;
application: WebApplication;
liveComponent: LiveItem<SNComponent>;
component: SNComponent;

View File

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

View File

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

View File

@@ -8,6 +8,7 @@ export declare class Editor {
private removeStreamObserver;
isTemplateNote: boolean;
constructor(application: WebApplication, noteUuid?: string, noteTitle?: string);
deinit(): void;
private handleNoteStream;
insertTemplatedNote(): Promise<import("../../../../../snjs/dist/@types").SNItem>;
/**
@@ -15,7 +16,6 @@ export declare class Editor {
* and creating a placeholder note.
*/
reset(noteTitle?: string): Promise<void>;
deinit(): void;
/**
* 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.
*/
addChangeObserver(callback: EditorGroupChangeCallback): void;
addChangeObserver(callback: EditorGroupChangeCallback): () => void;
private notifyObservers;
}
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 { NotesView } from './notes/notes_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';
export declare enum NoteSortKey {
CreatedAt = "created_at",
UserUpdatedAt = "userModifiedDate",
Title = "title",
/** @legacy Use UserUpdatedAt instead */
UpdatedAt = "updated_at",
ClientUpdatedAt = "client_updated_at",
Title = "title"
/** @legacy Use UserUpdatedAt instead */
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 filterNotes(notes: SNNote[], selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): SNNote[];
export declare function sortNotes(notes: SNNote[] | undefined, sortBy: string, reverse: boolean): SNNote[];
export declare function notePassesFilter(note: SNNote, selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): boolean;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long