Keep plugin state in state manager (fixes #201)
Change-Id: If4a5305f3e41f1fcac4a47afeba613b3106c69fa
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index f98a3e6..13904ec 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -586,7 +586,17 @@
};
const input = form.addE("input");
+ input.setAttribute("type","text");
input.setAttribute("name","state");
+
+ const url = new URL(window.location.href);
+
+ // Access the query parameters to check for states
+ const state = new URLSearchParams(url.search).get('state');
+ if (state != null && state != "") {
+ input.setAttribute("value", state);
+ };
+
KorAP.States = stateManagerClass.create(input);
// Load Plugin Server first