Support Javascript injection (#3132)

This commit is contained in:
CJ
2022-11-16 16:37:06 -06:00
committed by GitHub
parent 3a63f1f9b7
commit ca9c8e0a34
12 changed files with 125 additions and 0 deletions

View File

@@ -510,6 +510,36 @@ export const SettingsInterfacePanel: React.FC = () => {
}}
/>
</SettingSection>
<SettingSection headingID="config.ui.custom_javascript.heading">
<BooleanSetting
id="custom-javascript-enabled"
headingID="config.ui.custom_javascript.option_label"
checked={iface.javascriptEnabled ?? undefined}
onChange={(v) => saveInterface({ javascriptEnabled: v })}
/>
<ModalSetting<string>
id="custom-javascript"
headingID="config.ui.custom_javascript.heading"
subHeadingID="config.ui.custom_javascript.description"
value={iface.javascript ?? undefined}
onChange={(v) => saveInterface({ javascript: v })}
renderField={(value, setValue) => (
<Form.Control
as="textarea"
value={value}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
setValue(e.currentTarget.value)
}
rows={16}
className="text-input code"
/>
)}
renderValue={() => {
return <></>;
}}
/>
</SettingSection>
<SettingSection headingID="config.ui.custom_locales.heading">
<BooleanSetting
id="custom-locales-enabled"