I checked it and it very simple. Attached some code for example.
The question is where to put the "share" button".
diff --git a/src/Display.ts b/src/Display.ts
index 1cd72fe..318fd3d 100644
--- a/src/Display.ts
+++ b/src/Display.ts
@@ -58,6 +58,7 @@ class StorageContext
private readonly LOCAL_STORAGE_VCN_KEY = "VCN";
private readonly LOCAL_STORAGE_VCN_VAL = "1";
private readonly LOCAL_STORAGE_KEY_PREFIX = "crossword_";
+ private readonly LOCAL_STORAGE_URL_PARAM = this.LOCAL_STORAGE_KEY_PREFIX + "data";
constructor(crossword_id: number, rows: number, cols: number)
{
@@ -84,8 +85,15 @@ class StorageContext
private loadInput()
{
- const input = localStorage.getItem(this.local_storage_key);
-
+ let input = localStorage.getItem(this.local_storage_key);
+ if (input == null || input == ""){
+ const urlParams = new URLSearchParams(window.location.search);
+ input = "";
+ if (urlParams.has(this.LOCAL_STORAGE_URL_PARAM)) {
+ input = decodeURIComponent(urlParams.get(this.LOCAL_STORAGE_URL_PARAM));
+ }
+ }
+
try
{
if (input == null || input == "")