added ability to load a file from disk, or choose text
This commit is contained in:
@@ -11,20 +11,48 @@ export function setupTextLoaderModuleNodes(nodeType, nodeData, app) {
|
||||
const me = onNodeCreated?.apply(this);
|
||||
const widget_loader_type = this.widgets.find(w => w.name === 'loader');
|
||||
const widget_text = this.widgets.find(w=> w.name === 'text');
|
||||
const file_path = this.widgets.find(w=> w.name === 'file_path');
|
||||
const widget_url = this.widgets.find(w=> w.name === 'url');
|
||||
const upload_button = this.widgets.find(w=> w.name === 'choose text to upload');
|
||||
const input_source = this.widgets.find(w=> w.name === 'input_source');
|
||||
|
||||
// Hide both widgets
|
||||
// Hide widgets
|
||||
widget_loader_type.callback = async() => {
|
||||
hideWidget(this, widget_url);
|
||||
|
||||
hideWidget(this, input_source);
|
||||
switch (widget_loader_type.value) {
|
||||
case "WebLoader":
|
||||
showWidget(widget_url);
|
||||
break;
|
||||
case "TextLoader":
|
||||
showWidget(input_source);
|
||||
break;
|
||||
case "CsvLoader":
|
||||
showWidget(input_source);
|
||||
break;
|
||||
}
|
||||
}
|
||||
input_source.callback = async() => {
|
||||
hideWidget(this, file_path);
|
||||
hideWidget(this, upload_button);
|
||||
console.log(input_source.value);
|
||||
if (input_source.value == "File Path") {
|
||||
showWidget(file_path);
|
||||
showWidget(upload_button);
|
||||
}
|
||||
else {
|
||||
hideWidget(this, file_path);
|
||||
hideWidget(this, upload_button);
|
||||
}
|
||||
|
||||
setTimeout(() => { widget_loader_type.callback() }, 5);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
input_source.callback();
|
||||
}, 5);
|
||||
setTimeout(() => {
|
||||
widget_loader_type.callback();
|
||||
}, 5);
|
||||
return me;
|
||||
// setupMessageStyle(this.message);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user