#80 - clean up file box read only mode
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Garrett Mills 2021-02-04 15:08:42 -06:00
parent f5258429af
commit 0e0a36db72
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -102,17 +102,13 @@ export class FileBoxComponent extends EditorNodeContract implements OnInit {
return; return;
} }
console.log('file box compt', this);
if ( !this.node.Value.Value && !this.readonly ) { if ( !this.node.Value.Value && !this.readonly ) {
this.record = await this.api.createFileBox(this.page.UUID, this.fileBoxName); this.record = await this.api.createFileBox(this.page.UUID, this.fileBoxName);
console.log(this.record);
this.node.Value.Value = this.record.UUID; this.node.Value.Value = this.record.UUID;
this.node.value = this.record.UUID; this.node.value = this.record.UUID;
this.dirty = true; this.dirty = true;
} else if ( this.node.Value.Value ) { } else if ( this.node.Value.Value ) {
this.record = await this.api.getFileBox(this.page.UUID, this.node.Value.Value); this.record = await this.api.getFileBox(this.page.UUID, this.node.Value.Value);
console.log(this.record);
} }
if ( !this.record ) { if ( !this.record ) {
@ -199,6 +195,10 @@ export class FileBoxComponent extends EditorNodeContract implements OnInit {
} }
async onSurfaceContextMenu(event: MouseEvent) { async onSurfaceContextMenu(event: MouseEvent) {
if ( this.readonly ) {
return;
}
if ( !event.ctrlKey ) { if ( !event.ctrlKey ) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
@ -241,6 +241,10 @@ export class FileBoxComponent extends EditorNodeContract implements OnInit {
} }
async onRecordNameChange(event) { async onRecordNameChange(event) {
if ( this.readonly ) {
return;
}
const name = event.target.value; const name = event.target.value;
this.fileBoxName = name; this.fileBoxName = name;
this.record.name = name; this.record.name = name;
@ -249,6 +253,10 @@ export class FileBoxComponent extends EditorNodeContract implements OnInit {
} }
async onItemContextMenu(item: FileBoxItem, event: MouseEvent) { async onItemContextMenu(item: FileBoxItem, event: MouseEvent) {
if ( this.readonly ) {
return;
}
if ( !event.ctrlKey ) { if ( !event.ctrlKey ) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
@ -275,6 +283,10 @@ export class FileBoxComponent extends EditorNodeContract implements OnInit {
} }
async onUploadFilesClick(event) { async onUploadFilesClick(event) {
if ( this.readonly ) {
return;
}
if ( this.fileInput ) { if ( this.fileInput ) {
this.fileInput.nativeElement.click(); this.fileInput.nativeElement.click();
} }
@ -324,6 +336,10 @@ export class FileBoxComponent extends EditorNodeContract implements OnInit {
} }
async onActionClick(action: string, item?: FileBoxItem) { async onActionClick(action: string, item?: FileBoxItem) {
if ( this.readonly ) {
return;
}
if ( action === 'folder-add' ) { if ( action === 'folder-add' ) {
await this.actionNewFolder(); await this.actionNewFolder();
} else if ( action === 'rename' && item ) { } else if ( action === 'rename' && item ) {