This commit is contained in:
Mo Bitar
2020-04-09 16:23:06 -05:00
parent 8835fd6ebf
commit 75bd2653f7
3 changed files with 10 additions and 16 deletions

View File

@@ -32,13 +32,11 @@ class ComponentViewCtrl {
this.unregisterComponentHandler(); this.unregisterComponentHandler();
this.unregisterComponentHandler = null; this.unregisterComponentHandler = null;
if (this.component && !this.manualDealloc) { if (this.component && !this.manualDealloc) {
const dontSync = true;
/* application and componentManager may be destroyed if this onDestroy is part of /* application and componentManager may be destroyed if this onDestroy is part of
the entire application being destroyed rather than part of just a single component the entire application being destroyed rather than part of just a single component
view being removed */ view being removed */
if (this.application && this.application.componentManager) { if (this.application && this.application.componentManager) {
this.application.componentManager this.application.componentManager.deregisterComponent(this.component);
.deactivateComponent(this.component, dontSync);
} }
} }
this.unregisterDesktopObserver(); this.unregisterDesktopObserver();
@@ -62,17 +60,14 @@ class ComponentViewCtrl {
const newComponent = this.component; const newComponent = this.component;
const oldComponent = this.lastComponentValue; const oldComponent = this.lastComponentValue;
this.lastComponentValue = newComponent; this.lastComponentValue = newComponent;
const dontSync = true;
if (oldComponent && oldComponent !== newComponent) { if (oldComponent && oldComponent !== newComponent) {
this.application.componentManager.deactivateComponent( this.application.componentManager.deregisterComponent(
oldComponent, oldComponent
dontSync
); );
} }
if (newComponent && newComponent !== oldComponent) { if (newComponent && newComponent !== oldComponent) {
this.application.componentManager.activateComponent( this.application.componentManager.registerComponent(
newComponent, newComponent
dontSync
).then(() => { ).then(() => {
this.reloadStatus(); this.reloadStatus();
}); });
@@ -136,8 +131,9 @@ class ComponentViewCtrl {
} }
}(); }();
this.expired = component.valid_until && component.valid_until <= new Date(); this.expired = component.valid_until && component.valid_until <= new Date();
if (!component.lockReadonly) { const readonlyState = this.application.componentManager.getReadonlyStateForComponent(component);
component.readonly = this.expired; if (!readonlyState.lockReadonly) {
this.application.componentManager.setReadonlyStateForComponent(component, true);
} }
this.componentValid = !offlineRestricted && !hasUrlError; this.componentValid = !offlineRestricted && !hasUrlError;
if (!this.componentValid) { if (!this.componentValid) {

View File

@@ -48,8 +48,7 @@ class RevisionPreviewModalCtrl {
contentType: ContentTypes.Component, contentType: ContentTypes.Component,
content: editorForNote.content content: editorForNote.content
}); });
editorCopy.readonly = true; this.application.component.setReadonlyStateForComponent(editorCopy, true, true);
editorCopy.lockReadonly = true;
this.unregisterComponent = this.application.componentManager.registerHandler({ this.unregisterComponent = this.application.componentManager.registerHandler({
identifier: editorCopy.uuid, identifier: editorCopy.uuid,
areas: ['editor-editor'], areas: ['editor-editor'],

View File

@@ -80,8 +80,7 @@ export class ThemeManager extends ApplicationService {
const activeThemes = this.application.componentManager.getActiveThemes(); const activeThemes = this.application.componentManager.getActiveThemes();
for (const theme of activeThemes) { for (const theme of activeThemes) {
if (theme) { if (theme) {
const dontSync = true; this.application.componentManager.deregisterComponent(theme);
this.application.componentManager.deactivateComponent(theme, dontSync);
} }
} }
this.activeThemes = []; this.activeThemes = [];