Merge branch '004' into crypto-refactor

# Conflicts:
#	package.json
This commit is contained in:
Baptiste Grob
2020-06-09 16:52:01 +02:00
12 changed files with 75 additions and 45 deletions

View File

@@ -49,6 +49,7 @@ import {
} from './directives/views';
import { trusted } from './filters';
import { isDev } from './utils';
angular.module('app', ['ngSanitize']);
@@ -109,3 +110,14 @@ angular
// Services
angular.module('app').service('mainApplicationGroup', ApplicationGroup);
// Debug
if (isDev) {
Object.defineProperties(window, {
application: {
get: () =>
(angular.element(document).injector().get('mainApplicationGroup') as any)
.application,
},
});
}

View File

@@ -82,6 +82,10 @@ export class Editor {
}
}
public clearNoteChangeListener() {
this._onNoteChange = undefined;
}
/**
* Register to be notified when the editor's note's values change
* (and thus a new object reference is created)

View File

@@ -1,3 +1,5 @@
export const isDev = process.env.NODE_ENV === 'development';
export function getParameterByName(name: string, url: string) {
name = name.replace(/[[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');

View File

@@ -17,13 +17,13 @@ export class PureViewCtrl {
/* @ngInject */
constructor($timeout: ng.ITimeoutService) {
this.$timeout = $timeout;
/* Allow caller constructor to finish setting instance variables */
setImmediate(() => {
this.state = this.getInitialState();
});
}
$onInit() {
this.state = {
...this.getInitialState(),
...this.state,
}
this.addAppEventObserver();
this.addAppStateObserver();
}
@@ -33,7 +33,6 @@ export class PureViewCtrl {
this.unsubState();
this.unsubApp = undefined;
this.unsubState = undefined;
(this.application as any) = undefined;
if (this.stateTimeout) {
this.$timeout.cancel(this.stateTimeout);
}
@@ -141,4 +140,4 @@ export class PureViewCtrl {
/** Optional override */
}
}
}

View File

@@ -144,6 +144,7 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
}
deinit() {
this.editor.clearNoteChangeListener();
this.removeTagsObserver();
this.removeComponentsObserver();
(this.removeTagsObserver as any) = undefined;