Updates
This commit is contained in:
@@ -17,6 +17,7 @@ export class PureCtrl {
|
|||||||
this.addAppStateObserver();
|
this.addAppStateObserver();
|
||||||
this.addAppEventObserver();
|
this.addAppEventObserver();
|
||||||
$scope.$on('$destroy', () => {
|
$scope.$on('$destroy', () => {
|
||||||
|
console.log("On destroy", this);
|
||||||
this.unsubApp();
|
this.unsubApp();
|
||||||
this.unsubState();
|
this.unsubState();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -74,8 +74,12 @@ class EditorCtrl extends PureCtrl {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.leftResizeControl = {};
|
this.leftPanelPuppet = {
|
||||||
this.rightResizeControl = {};
|
onReady: () => this.reloadPreferences()
|
||||||
|
};
|
||||||
|
this.rightPanelPuppet = {
|
||||||
|
onReady: () => this.reloadPreferences()
|
||||||
|
};
|
||||||
this.addSyncStatusObserver();
|
this.addSyncStatusObserver();
|
||||||
this.registerKeyboardShortcuts();
|
this.registerKeyboardShortcuts();
|
||||||
|
|
||||||
@@ -98,7 +102,7 @@ class EditorCtrl extends PureCtrl {
|
|||||||
data.previousNote
|
data.previousNote
|
||||||
);
|
);
|
||||||
} else if (eventName === AppStateEvents.PreferencesChanged) {
|
} else if (eventName === AppStateEvents.PreferencesChanged) {
|
||||||
this.loadPreferences();
|
this.reloadPreferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +240,7 @@ class EditorCtrl extends PureCtrl {
|
|||||||
noteReady: true,
|
noteReady: true,
|
||||||
});
|
});
|
||||||
this.reloadTagsString();
|
this.reloadTagsString();
|
||||||
this.loadPreferences();
|
this.reloadPreferences();
|
||||||
|
|
||||||
if (note.dummy) {
|
if (note.dummy) {
|
||||||
this.focusEditor();
|
this.focusEditor();
|
||||||
@@ -748,7 +752,7 @@ class EditorCtrl extends PureCtrl {
|
|||||||
PrefKeys.EditorWidth,
|
PrefKeys.EditorWidth,
|
||||||
width
|
width
|
||||||
);
|
);
|
||||||
this.leftResizeControl.setWidth(width);
|
this.leftPanelPuppet.setWidth(width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (left !== undefined && left !== null) {
|
if (left !== undefined && left !== null) {
|
||||||
@@ -756,12 +760,12 @@ class EditorCtrl extends PureCtrl {
|
|||||||
PrefKeys.EditorLeft,
|
PrefKeys.EditorLeft,
|
||||||
left
|
left
|
||||||
);
|
);
|
||||||
this.rightResizeControl.setLeft(left);
|
this.rightPanelPuppet.setLeft(left);
|
||||||
}
|
}
|
||||||
this.preferencesManager.syncUserPreferences();
|
this.preferencesManager.syncUserPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPreferences() {
|
reloadPreferences() {
|
||||||
const monospaceEnabled = this.preferencesManager.getValue(
|
const monospaceEnabled = this.preferencesManager.getValue(
|
||||||
PrefKeys.EditorMonospaceEnabled,
|
PrefKeys.EditorMonospaceEnabled,
|
||||||
true
|
true
|
||||||
@@ -787,22 +791,26 @@ class EditorCtrl extends PureCtrl {
|
|||||||
|
|
||||||
this.reloadFont();
|
this.reloadFont();
|
||||||
|
|
||||||
if (this.state.marginResizersEnabled) {
|
if (
|
||||||
|
this.state.marginResizersEnabled &&
|
||||||
|
this.leftPanelPuppet.ready &&
|
||||||
|
this.rightPanelPuppet.ready
|
||||||
|
) {
|
||||||
const width = this.preferencesManager.getValue(
|
const width = this.preferencesManager.getValue(
|
||||||
PrefKeys.EditorWidth,
|
PrefKeys.EditorWidth,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
if (width != null) {
|
if (width != null) {
|
||||||
this.leftResizeControl.setWidth(width);
|
this.leftPanelPuppet.setWidth(width);
|
||||||
this.rightResizeControl.setWidth(width);
|
this.rightPanelPuppet.setWidth(width);
|
||||||
}
|
}
|
||||||
const left = this.preferencesManager.getValue(
|
const left = this.preferencesManager.getValue(
|
||||||
PrefKeys.EditorLeft,
|
PrefKeys.EditorLeft,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
if (left != null) {
|
if (left != null) {
|
||||||
this.leftResizeControl.setLeft(left);
|
this.leftPanelPuppet.setLeft(left);
|
||||||
this.rightResizeControl.setLeft(left);
|
this.rightPanelPuppet.setLeft(left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -845,8 +853,8 @@ class EditorCtrl extends PureCtrl {
|
|||||||
this.reloadFont();
|
this.reloadFont();
|
||||||
} else if (key === PrefKeys.EditorResizersEnabled && this[key] === true) {
|
} else if (key === PrefKeys.EditorResizersEnabled && this[key] === true) {
|
||||||
this.$timeout(() => {
|
this.$timeout(() => {
|
||||||
this.leftResizeControl.flash();
|
this.leftPanelPuppet.flash();
|
||||||
this.rightResizeControl.flash();
|
this.rightPanelPuppet.flash();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ class FooterCtrl extends PureCtrl {
|
|||||||
this.nativeExtManager = nativeExtManager;
|
this.nativeExtManager = nativeExtManager;
|
||||||
this.statusManager = statusManager;
|
this.statusManager = statusManager;
|
||||||
this.godService = godService;
|
this.godService = godService;
|
||||||
|
this.state = {
|
||||||
|
hasPasscode: false
|
||||||
|
};
|
||||||
|
|
||||||
this.rooms = [];
|
this.rooms = [];
|
||||||
this.themesWithIcons = [];
|
this.themesWithIcons = [];
|
||||||
@@ -46,7 +49,9 @@ class FooterCtrl extends PureCtrl {
|
|||||||
|
|
||||||
application.onUnlock(() => {
|
application.onUnlock(() => {
|
||||||
this.application.hasPasscode().then((value) => {
|
this.application.hasPasscode().then((value) => {
|
||||||
this.hasPasscode = value;
|
this.setState({
|
||||||
|
hasPasscode: value
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.godService.checkForSecurityUpdate().then((available) => {
|
this.godService.checkForSecurityUpdate().then((available) => {
|
||||||
@@ -234,7 +239,7 @@ class FooterCtrl extends PureCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lockApp() {
|
lockApp() {
|
||||||
this.$rootScope.lockApplication();
|
this.application.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshData() {
|
refreshData() {
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ class NotesCtrl extends PureCtrl {
|
|||||||
noteFilter: { text: '' },
|
noteFilter: { text: '' },
|
||||||
};
|
};
|
||||||
|
|
||||||
this.panelController = {};
|
this.panelPuppet = {
|
||||||
|
onReady: () => this.reloadPreferences()
|
||||||
|
};
|
||||||
window.onresize = (event) => {
|
window.onresize = (event) => {
|
||||||
this.resetPagination({
|
this.resetPagination({
|
||||||
keepCurrentIfLarger: true
|
keepCurrentIfLarger: true
|
||||||
@@ -309,12 +311,12 @@ class NotesCtrl extends PureCtrl {
|
|||||||
const width = this.preferencesManager.getValue(
|
const width = this.preferencesManager.getValue(
|
||||||
PrefKeys.NotesPanelWidth
|
PrefKeys.NotesPanelWidth
|
||||||
);
|
);
|
||||||
if (width) {
|
if (width && this.panelPuppet.ready) {
|
||||||
this.panelController.setWidth(width);
|
this.panelPuppet.setWidth(width);
|
||||||
if (this.panelController.isCollapsed()) {
|
if (this.panelPuppet.isCollapsed()) {
|
||||||
this.appState.panelDidResize({
|
this.appState.panelDidResize({
|
||||||
name: PANEL_NAME_NOTES,
|
name: PANEL_NAME_NOTES,
|
||||||
collapsed: this.panelController.isCollapsed()
|
collapsed: this.panelPuppet.isCollapsed()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Challenges, ChallengeResponse } from 'snjs';
|
import { Challenges, ChallengeResponse, ApplicationEvents } from 'snjs';
|
||||||
import { getPlatformString } from '@/utils';
|
import { getPlatformString } from '@/utils';
|
||||||
import template from '%/root.pug';
|
import template from '%/root.pug';
|
||||||
import { AppStateEvents } from '@/state';
|
import { AppStateEvents } from '@/state';
|
||||||
@@ -7,9 +7,9 @@ import {
|
|||||||
PANEL_NAME_TAGS
|
PANEL_NAME_TAGS
|
||||||
} from '@/controllers/constants';
|
} from '@/controllers/constants';
|
||||||
import {
|
import {
|
||||||
STRING_SESSION_EXPIRED,
|
// STRING_SESSION_EXPIRED,
|
||||||
STRING_DEFAULT_FILE_ERROR,
|
STRING_DEFAULT_FILE_ERROR,
|
||||||
StringSyncException
|
// StringSyncException
|
||||||
} from '@/strings';
|
} from '@/strings';
|
||||||
import { PureCtrl } from './abstract/pure_ctrl';
|
import { PureCtrl } from './abstract/pure_ctrl';
|
||||||
|
|
||||||
@@ -86,9 +86,6 @@ class RootCtrl extends PureCtrl {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
await this.application.launch();
|
await this.application.launch();
|
||||||
this.setState({ needsUnlock: false });
|
|
||||||
this.application.componentManager.setDesktopManager(this.desktopManager);
|
|
||||||
this.application.registerService(this.themeManager);
|
|
||||||
// this.addSyncStatusObserver();
|
// this.addSyncStatusObserver();
|
||||||
// this.addSyncEventHandler();
|
// this.addSyncEventHandler();
|
||||||
}
|
}
|
||||||
@@ -97,6 +94,15 @@ class RootCtrl extends PureCtrl {
|
|||||||
this.$rootScope.$broadcast('new-update-available');
|
this.$rootScope.$broadcast('new-update-available');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async onApplicationEvent(eventName) {
|
||||||
|
if (eventName === ApplicationEvents.ApplicationUnlocked) {
|
||||||
|
this.setState({ needsUnlock: false });
|
||||||
|
this.application.componentManager.setDesktopManager(this.desktopManager);
|
||||||
|
this.application.registerService(this.themeManager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
async onAppStateEvent(eventName, data) {
|
async onAppStateEvent(eventName, data) {
|
||||||
if (eventName === AppStateEvents.PanelResized) {
|
if (eventName === AppStateEvents.PanelResized) {
|
||||||
|
|||||||
@@ -19,14 +19,21 @@ class TagsPanelCtrl extends PureCtrl {
|
|||||||
super($scope, $timeout, application, appState);
|
super($scope, $timeout, application, appState);
|
||||||
this.$rootScope = $rootScope;
|
this.$rootScope = $rootScope;
|
||||||
this.preferencesManager = preferencesManager;
|
this.preferencesManager = preferencesManager;
|
||||||
this.panelController = {};
|
this.panelPuppet = {
|
||||||
this.loadPreferences();
|
onReady: () => this.loadPreferences()
|
||||||
this.registerComponentHandler();
|
};
|
||||||
this.state = {
|
this.state = {
|
||||||
smartTags: [],
|
smartTags: [],
|
||||||
noteCounts: {}
|
noteCounts: {}
|
||||||
};
|
};
|
||||||
application.onUnlock(() => {
|
}
|
||||||
|
|
||||||
|
$onInit() {
|
||||||
|
this.application.onStart(() => {
|
||||||
|
this.registerComponentHandler();
|
||||||
|
});
|
||||||
|
this.application.onUnlock(() => {
|
||||||
|
this.loadPreferences();
|
||||||
this.beginStreamingItems();
|
this.beginStreamingItems();
|
||||||
const smartTags = this.application.getSmartTags();
|
const smartTags = this.application.getSmartTags();
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -35,7 +42,7 @@ class TagsPanelCtrl extends PureCtrl {
|
|||||||
this.selectTag(smartTags[0]);
|
this.selectTag(smartTags[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
application.onSync(() => {
|
this.application.onSync(() => {
|
||||||
this.reloadNoteCounts();
|
this.reloadNoteCounts();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -94,13 +101,16 @@ class TagsPanelCtrl extends PureCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadPreferences() {
|
loadPreferences() {
|
||||||
|
if(!this.panelPuppet.ready) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const width = this.preferencesManager.getValue(PrefKeys.TagsPanelWidth);
|
const width = this.preferencesManager.getValue(PrefKeys.TagsPanelWidth);
|
||||||
if (width) {
|
if (width) {
|
||||||
this.panelController.setWidth(width);
|
this.panelPuppet.setWidth(width);
|
||||||
if (this.panelController.isCollapsed()) {
|
if (this.panelPuppet.isCollapsed()) {
|
||||||
this.appState.panelDidResize({
|
this.appState.panelDidResize({
|
||||||
name: PANEL_NAME_TAGS,
|
name: PANEL_NAME_TAGS,
|
||||||
collapsed: this.panelController.isCollapsed()
|
collapsed: this.panelPuppet.isCollapsed()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ class PanelResizerCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
this.configureControl();
|
|
||||||
this.configureDefaults();
|
this.configureDefaults();
|
||||||
this.addDoubleClickHandler();
|
|
||||||
this.reloadDefaultValues();
|
this.reloadDefaultValues();
|
||||||
|
this.configureControl();
|
||||||
|
this.addDoubleClickHandler();
|
||||||
this.addMouseDownListener();
|
this.addMouseDownListener();
|
||||||
this.addMouseMoveListener();
|
this.addMouseMoveListener();
|
||||||
this.addMouseUpListener();
|
this.addMouseUpListener();
|
||||||
@@ -61,6 +61,9 @@ class PanelResizerCtrl {
|
|||||||
this.control.isCollapsed = () => {
|
this.control.isCollapsed = () => {
|
||||||
return this.isCollapsed();
|
return this.isCollapsed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.control.ready = true;
|
||||||
|
this.control.onReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
configureDefaults() {
|
configureDefaults() {
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export class LockManager {
|
|||||||
this.lockAfterDate &&
|
this.lockAfterDate &&
|
||||||
new Date() > this.lockAfterDate
|
new Date() > this.lockAfterDate
|
||||||
) {
|
) {
|
||||||
this.application.passcodeLock();
|
this.application.lock();
|
||||||
}
|
}
|
||||||
this.cancelAutoLockTimer();
|
this.cancelAutoLockTimer();
|
||||||
} else {
|
} else {
|
||||||
@@ -125,7 +125,7 @@ export class LockManager {
|
|||||||
this.lockAfterDate = addToNow(interval / MILLISECONDS_PER_SECOND);
|
this.lockAfterDate = addToNow(interval / MILLISECONDS_PER_SECOND);
|
||||||
this.lockTimeout = setTimeout(() => {
|
this.lockTimeout = setTimeout(() => {
|
||||||
this.cancelAutoLockTimer();
|
this.cancelAutoLockTimer();
|
||||||
this.application.passcodeLock();
|
this.application.lock();
|
||||||
this.lockAfterDate = null;
|
this.lockAfterDate = null;
|
||||||
}, interval);
|
}, interval);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,12 @@ export class AppState {
|
|||||||
$timeout,
|
$timeout,
|
||||||
$rootScope,
|
$rootScope,
|
||||||
application,
|
application,
|
||||||
|
godService
|
||||||
) {
|
) {
|
||||||
this.$timeout = $timeout;
|
this.$timeout = $timeout;
|
||||||
this.$rootScope = $rootScope;
|
this.$rootScope = $rootScope;
|
||||||
this.application = application;
|
this.application = application;
|
||||||
|
this.godService = godService;
|
||||||
this.observers = [];
|
this.observers = [];
|
||||||
this.registerVisibilityObservers();
|
this.registerVisibilityObservers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@
|
|||||||
ng-if='self.state.noteReady && !self.state.note.errorDecrypting'
|
ng-if='self.state.noteReady && !self.state.note.errorDecrypting'
|
||||||
)
|
)
|
||||||
panel-resizer.left(
|
panel-resizer.left(
|
||||||
control='self.leftResizeControl',
|
control='self.leftPanelPuppet',
|
||||||
hoverable='true',
|
hoverable='true',
|
||||||
min-width='300',
|
min-width='300',
|
||||||
ng-if='self.state.marginResizersEnabled',
|
ng-if='self.state.marginResizersEnabled',
|
||||||
@@ -219,7 +219,7 @@
|
|||||||
)
|
)
|
||||||
| {{self.onSystemEditorLoad()}}
|
| {{self.onSystemEditorLoad()}}
|
||||||
panel-resizer(
|
panel-resizer(
|
||||||
control='self.rightResizeControl',
|
control='self.rightPanelPuppet',
|
||||||
hoverable='true', min-width='300',
|
hoverable='true', min-width='300',
|
||||||
ng-if='self.state.marginResizersEnabled',
|
ng-if='self.state.marginResizersEnabled',
|
||||||
on-resize-finish='self.onPanelResizeFinish',
|
on-resize-finish='self.onPanelResizeFinish',
|
||||||
|
|||||||
@@ -84,10 +84,10 @@
|
|||||||
elem-ready='ctrl.initSvgForShortcut(shortcut)',
|
elem-ready='ctrl.initSvgForShortcut(shortcut)',
|
||||||
ng-attr-id='dock-svg-{{shortcut.component.uuid}}'
|
ng-attr-id='dock-svg-{{shortcut.component.uuid}}'
|
||||||
)
|
)
|
||||||
.sk-app-bar-item.border(ng-if='ctrl.hasPasscode')
|
.sk-app-bar-item.border(ng-if='ctrl.state.hasPasscode')
|
||||||
#lock-item.sk-app-bar-item(
|
#lock-item.sk-app-bar-item(
|
||||||
ng-click='ctrl.lockApp()',
|
ng-click='ctrl.lockApp()',
|
||||||
ng-if='ctrl.hasPasscode',
|
ng-if='ctrl.state.hasPasscode',
|
||||||
title='Locks application and wipes unencrypted data from memory.'
|
title='Locks application and wipes unencrypted data from memory.'
|
||||||
)
|
)
|
||||||
.sk-label
|
.sk-label
|
||||||
|
|||||||
@@ -143,7 +143,7 @@
|
|||||||
.faded {{note.savedTagsString || note.tagsString()}}
|
.faded {{note.savedTagsString || note.tagsString()}}
|
||||||
panel-resizer(
|
panel-resizer(
|
||||||
collapsable="true"
|
collapsable="true"
|
||||||
control="self.panelController"
|
control="self.panelPuppet"
|
||||||
default-width="300"
|
default-width="300"
|
||||||
hoverable="true"
|
hoverable="true"
|
||||||
on-resize-finish="self.onPanelResize"
|
on-resize-finish="self.onPanelResize"
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
.main-ui-view(
|
.main-ui-view(
|
||||||
ng-class='self.platformString'
|
ng-class='self.platformString'
|
||||||
)
|
)
|
||||||
lock-screen(
|
lock-screen(
|
||||||
ng-if='self.state.needsUnlock'
|
ng-if='self.state.needsUnlock'
|
||||||
on-value='self.state.onLockscreenValue',
|
on-value='self.state.onLockscreenValue',
|
||||||
puppet='self.lockScreenPuppet'
|
puppet='self.lockScreenPuppet'
|
||||||
)
|
)
|
||||||
#app.app(
|
#app.app(
|
||||||
ng-class='self.state.appClass',
|
ng-class='self.state.appClass',
|
||||||
ng-if='!self.state.needsUnlock'
|
ng-if='!self.state.needsUnlock'
|
||||||
)
|
)
|
||||||
tags-panel
|
tags-panel
|
||||||
notes-panel
|
notes-panel
|
||||||
editor-panel
|
editor-panel
|
||||||
|
|
||||||
footer(
|
footer(
|
||||||
ng-if='!self.state.needsUnlock'
|
ng-if='!self.state.needsUnlock'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
| No tags. Create one using the add button above.
|
| No tags. Create one using the add button above.
|
||||||
panel-resizer(
|
panel-resizer(
|
||||||
collapsable='true',
|
collapsable='true',
|
||||||
control='self.panelController',
|
control='self.panelPuppet',
|
||||||
default-width='150',
|
default-width='150',
|
||||||
hoverable='true',
|
hoverable='true',
|
||||||
on-resize-finish='self.onPanelResize',
|
on-resize-finish='self.onPanelResize',
|
||||||
|
|||||||
367
dist/javascripts/app.js
vendored
367
dist/javascripts/app.js
vendored
File diff suppressed because one or more lines are too long
2
dist/javascripts/app.js.map
vendored
2
dist/javascripts/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user