These changes were prompted by the need to show an error message when shacl-vue
fails to load the specified config file correctly. Such an error message would
ideally be configurable, with markdown support. Adding markdown support to a new
dialog in the 'ShaclVue' component highlighted the fact that markdown functionality
was already duplicated across the 'MarkdownEditor' and the 'WizardEditor' components.
This was factored out by doing the following:
- creating a 'useMarkdown' composable with the common functionality, and using this
in 'ShaclVue', 'MarkdownEditor', and 'WizardEditor'
- moving common css, specifically the 'markdown-render' class, into
'src/assets/style.css', which can now be used anywhere in the app
Then, the configuration composable was updated to load a config error message from the
new build-time configuration option CONFIG_ERROR_TEXT. A build-time config is necessary
here because the nature of the config error means that a normal runtime config option
won't be available to be displayed. The CONFIG_ERROR_TEXT option has to be supplied via
the config yaml file, which is passed via the BUILD_CONFIG='path/to/config/file.yaml'
option supplied at build time.
If this build-time config option is not supplied, the config error message defaults to:
'
There was a problem loading the configuraton source.
Please reload the page, or contact the site administrator if the problem persists.
'
This new error will show up in a dialog when a user opens shacl-vue in their browser, if:
- the main config URL cannot be fetched successfully
- the external config URL cannot be fetched successfully