mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 21:30:45 +00:00
use file type from file schema in ace components
This commit is contained in:
@ -63,6 +63,7 @@ import ValueUtils from "qqq/utils/qqq/ValueUtils";
|
||||
|
||||
import "ace-builds/src-noconflict/mode-java";
|
||||
import "ace-builds/src-noconflict/mode-javascript";
|
||||
import "ace-builds/src-noconflict/mode-velocity";
|
||||
import "ace-builds/src-noconflict/mode-json";
|
||||
import "ace-builds/src-noconflict/theme-github";
|
||||
import "ace-builds/src-noconflict/ext-language_tools";
|
||||
@ -260,6 +261,20 @@ export default function ScriptViewer({scriptId, associatedScriptTableName, assoc
|
||||
return (getSelectedVersionCode()[selectedFileName] ?? "");
|
||||
}
|
||||
|
||||
const getSelectedFileType = (): string =>
|
||||
{
|
||||
for (let i = 0; i < scriptTypeFileSchemaList.length; i++)
|
||||
{
|
||||
let name = scriptTypeFileSchemaList[i].values.get("name");
|
||||
if(name == selectedFileName)
|
||||
{
|
||||
return (scriptTypeFileSchemaList[i].values.get("fileType"));
|
||||
}
|
||||
}
|
||||
|
||||
return ("javascript"); // have some default...
|
||||
}
|
||||
|
||||
const getSelectedVersionCode = (): {[name: string]: string} =>
|
||||
{
|
||||
let rs: {[name: string]: string} = {}
|
||||
@ -476,7 +491,7 @@ export default function ScriptViewer({scriptId, associatedScriptTableName, assoc
|
||||
</FormControl>
|
||||
}
|
||||
<AceEditor
|
||||
mode="javascript"
|
||||
mode={getSelectedFileType()}
|
||||
theme="github"
|
||||
name={"viewData"}
|
||||
readOnly
|
||||
|
Reference in New Issue
Block a user