diff --git a/js/src/admin/index.js b/js/src/admin/index.js deleted file mode 100644 index c318dfa..0000000 --- a/js/src/admin/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import app from 'flarum/admin/app'; - -// Keeping the old flagrow settings prefix because it's easier -const settingsPrefix = 'flagrow-html-errors.'; -const translationPrefix = 'fof-html-errors.admin.settings.'; - -app.initializers.add('fof-html-errors', (app) => { - app.extensionData.for('fof-html-errors').registerSetting(function () { - return [403, 404, 500, 503].map((error) => ( -
- - -
- )); - }); -}); diff --git a/js/src/admin/index.tsx b/js/src/admin/index.tsx new file mode 100644 index 0000000..08d36e8 --- /dev/null +++ b/js/src/admin/index.tsx @@ -0,0 +1,19 @@ +import app from 'flarum/admin/app'; + +// Keeping the old flagrow settings prefix because it's easier +const settingsPrefix = 'flagrow-html-errors.'; +const translationPrefix = 'fof-html-errors.admin.settings.'; + +app.initializers.add('fof-html-errors', () => { + const extensionData = app.extensionData.for('fof-html-errors'); + + [403, 404, 500, 503].map((error) => { + extensionData.registerSetting({ + setting: `${settingsPrefix}custom${error}ErrorHtml`, + label: app.translator.trans(`${translationPrefix}error.${error}`), + placeholder: app.translator.trans(`${translationPrefix}placeholder.empty_for_default`), + type: 'textarea', + rows: 10, + }); + }); +}); diff --git a/js/tsconfig.json b/js/tsconfig.json new file mode 100644 index 0000000..207c5b3 --- /dev/null +++ b/js/tsconfig.json @@ -0,0 +1,16 @@ +{ + // Use Flarum's tsconfig as a starting point + "extends": "flarum-tsconfig", + // This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder + // and also tells your Typescript server to read core's global typings for + // access to `dayjs` and `$` in the global namespace. + "include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*"], + "compilerOptions": { + // This will output typings to `dist-typings` + "declarationDir": "./dist-typings", + "baseUrl": ".", + "paths": { + "flarum/*": ["../vendor/flarum/core/js/dist-typings/*"] + } + } +}