From e9349992f8c601cfe6191b0a8c028c040957ea64 Mon Sep 17 00:00:00 2001 From: Michael Zetterberg Date: Tue, 26 Mar 2024 12:57:28 +0100 Subject: [PATCH] feat: improve handling of config to allow overrides --- README.md | 8 ++++++++ rte/main.tsx | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 465982d..70e66db 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,11 @@ The code is in `remix` folder. ## Custom RTE field The code is in `rte` folder. + +### Configuration + +The RTE plugin has the following configuration available. The values should be set on App Config level and overriden when needed on Plugin Config level. + +- `baseUrl`: The base url for Contentstack, most likely `https://eu-app.contentstack.com/` +- `formatId`: The id for the format in ImageVault to use when selecting an asset in ImageVault +- `imageVaultUrl`: The URL to the ImageVault instance to use when selecting an asset. diff --git a/rte/main.tsx b/rte/main.tsx index a1f5169..6fac35a 100644 --- a/rte/main.tsx +++ b/rte/main.tsx @@ -181,7 +181,17 @@ async function init() { const savedSelection = rte?.selection?.get() ?? undefined; // @ts-expect-error: Added at runtime - const config = await rte.getConfig(); + const appConfig = await rte.getConfig(); + + // This is the configuration for this instance of the plugin. + // You edit this in the content types settings RTE plugin section. + // @ts-expect-error: Added at runtime + const pluginConfig = await rte.getFieldConfig(); + + const config = { + ...appConfig, + ...pluginConfig, + }; openImageVault({ config,