diff --git a/.changeset/flat-tomatoes-develop.md b/.changeset/flat-tomatoes-develop.md
new file mode 100644
index 000000000..3d777c708
--- /dev/null
+++ b/.changeset/flat-tomatoes-develop.md
@@ -0,0 +1,5 @@
+---
+'frontend-gelinkt-notuleren': patch
+---
+
+Wait until everything has loaded to setup plugins, schema and nodeviews
diff --git a/app/controllers/agendapoints/edit.js b/app/controllers/agendapoints/edit.js
index 37d0a7396..dd53045d7 100644
--- a/app/controllers/agendapoints/edit.js
+++ b/app/controllers/agendapoints/edit.js
@@ -13,11 +13,13 @@ import { getActiveEditableNode } from '@lblod/ember-rdfa-editor/plugins/_private
import SnippetInsertRdfaComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/snippet-insert-rdfa';
import { fixArticleConnections } from '../../utils/fix-article-connections';
+import { modifier } from 'ember-modifier';
export default class AgendapointsEditController extends Controller {
@service store;
@service router;
@service documentService;
+ @service intl;
@service('editor/agendapoint') agendapointEditor;
@@ -26,24 +28,21 @@ export default class AgendapointsEditController extends Controller {
@tracked _editorDocument;
@tracked controller;
@service features;
+ @tracked schema;
+ @tracked plugins;
+ @tracked editorSetup = false;
StructureControlCard = StructureControlCardComponent;
InsertArticle = InsertArticleComponent;
SnippetInsert = SnippetInsertRdfaComponent;
- config = this.agendapointEditor.config;
-
- nodeViews = this.agendapointEditor.nodeViews;
-
- citationPlugin = this.agendapointEditor.citationPlugin;
+ get config() {
+ return this.agendapointEditor.config;
+ }
- constructor(...args) {
- super(...args);
- const { schema, plugins } =
- this.agendapointEditor.getSchemaAndPlugins(false);
- this.schema = schema;
- this.plugins = plugins;
+ get nodeViews() {
+ return this.agendapointEditor.nodeViews;
}
get dirty() {
@@ -69,6 +68,38 @@ export default class AgendapointsEditController extends Controller {
return null;
}
+ get isBusy() {
+ return (
+ !this.editorSetup ||
+ this.saveTask.isRunning ||
+ this.copyAgendapunt.isRunning
+ );
+ }
+
+ get busyText() {
+ if (!this.editorSetup) {
+ return this.intl.t('rdfa-editor-container.loading');
+ }
+ if (this.saveTask.isRunning) {
+ return this.intl.t('rdfa-editor-container.making-copy');
+ }
+ if (this.copyAgendapunt.isRunning) {
+ return this.intl.t('rdfa-editor-container.saving');
+ }
+ return '';
+ }
+
+ setSchemaAndPlugins = modifier(() => {
+ const { schema, plugins } =
+ this.agendapointEditor.getSchemaAndPlugins(false);
+ this.schema = schema;
+ this.plugins = plugins;
+ this.editorSetup = true;
+ return () => {
+ this.editorSetup = false;
+ };
+ });
+
@action
async handleRdfaEditorInit(editor) {
this.controller = editor;
diff --git a/app/services/editor/agendapoint.js b/app/services/editor/agendapoint.js
index d6e4303ad..5cec2a198 100644
--- a/app/services/editor/agendapoint.js
+++ b/app/services/editor/agendapoint.js
@@ -126,11 +126,9 @@ export default class AgendapointEditorService extends Service {
@service intl;
@service currentSession;
- citationPlugin = citationPlugin(this.config.citation);
-
get config() {
const classificatie = this.currentSession.classificatie;
- const municipality = this.defaultMunicipality;
+ const municipality = this.currentSession.group;
return {
date: {
formats: [
@@ -338,7 +336,7 @@ export default class AgendapointEditorService extends Service {
const plugins = [
...tablePlugins,
tableKeymap,
- this.citationPlugin,
+ citationPlugin(this.config.citation),
createInvisiblesPlugin(
[hardBreak, paragraphInvisible, headingInvisible],
{
diff --git a/app/templates/agendapoints/edit.hbs b/app/templates/agendapoints/edit.hbs
index 734e465a1..6d4cf3a09 100644
--- a/app/templates/agendapoints/edit.hbs
+++ b/app/templates/agendapoints/edit.hbs
@@ -86,18 +86,15 @@
role='tabpanel'
tabindex='0'
aria-labelledby='tab-1'
+ {{this.setSchemaAndPlugins}}
>
diff --git a/translations/en-us.yaml b/translations/en-us.yaml
index bee4547ea..06fd611ef 100644
--- a/translations/en-us.yaml
+++ b/translations/en-us.yaml
@@ -593,6 +593,7 @@ rdfa-editor-container:
default-busy-text: Processing
saving: Saving
making-copy: Making copy
+ loading: Loading
regulatory-statements-plugin:
type: Regulatory Statement
diff --git a/translations/nl-BE.yaml b/translations/nl-BE.yaml
index a1f5403fb..96266bd88 100644
--- a/translations/nl-BE.yaml
+++ b/translations/nl-BE.yaml
@@ -597,6 +597,7 @@ rdfa-editor-container:
default-busy-text: Bezig met verwerken
saving: Bezig met opslaan
making-copy: Kopie aan het maken
+ loading: Bezig met laden
regulatory-statements-plugin:
type: Reglementaire bijlage