#80 - clean up file box read only mode
continuous-integration/drone/push Build is passing Details

master
Garrett Mills 3 years ago
parent f5258429af
commit 0e0a36db72
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

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

Loading…
Cancel
Save