Show read-only editor in versions (not actually versioning yet)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-11-02 22:33:13 -06:00
parent 26e8d6ecd6
commit ab811bb54c
12 changed files with 56 additions and 147 deletions

View File

@@ -1,22 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { EditorPageRoutingModule } from './editor-routing.module';
import { EditorPage } from './editor.page';
import {ComponentsModule} from '../../components/components.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
EditorPageRoutingModule,
ComponentsModule
],
declarations: [EditorPage]
})
export class EditorPageModule {}

View File

@@ -7,6 +7,7 @@
<ion-title #titleBar>
<ion-input
[(ngModel)]="editorService.mutablePageName"
[readonly]="!editorService.canEdit()"
placeholder="Click to edit page name..."
class="title-input"
></ion-input>
@@ -43,7 +44,7 @@
>
<div class="host-icons">
<i class="type-icon fa" [ngClass]="typeIcons[(node.isNorm() ? 'node' : node.type)] + ' ' + (node.isNorm() ? 'node' : node.type)"></i>
<button (click)="onOptionsClick($event, node)">
<button (click)="onOptionsClick($event, node)" *ngIf="editorService.canEdit()">
<i class="fa fa-ellipsis-v" title="Node options"></i>
</button>
</div>
@@ -63,7 +64,7 @@
<editor-files style="flex: 1;" [nodeId]="node.UUID" [editorUUID]="editorService.instanceUUID"></editor-files>
</ng-container>
</div>
<button class="host-add-button" (click)="onAddClick($event)">
<button *ngIf="editorService.canEdit()" class="host-add-button" (click)="onAddClick($event)">
<i class="fa fa-plus"></i> Add Node
</button>
</div>

View File

@@ -17,6 +17,17 @@ import {VersionModalComponent} from '../../components/version-modal/version-moda
export class EditorPage implements OnInit {
public typeIcons = NodeTypeIcons;
@Input() pageId: string;
@Input() hosted = false;
@Input() version?: number;
@Input()
set readonly(val: boolean) {
this.editorService.forceReadonly = val;
}
get readonly() {
return this.editorService.forceReadonly;
}
constructor(
protected route: ActivatedRoute,
@@ -39,7 +50,7 @@ export class EditorPage implements OnInit {
ionViewDidEnter() {
if ( this.pageId ) {
this.editorService.startEditing(this.pageId);
} else {
} else if ( !this.hosted ) {
this.router.navigate(['/home']);
}
}