linkfree-generator icon indicating copy to clipboard operation
linkfree-generator copied to clipboard

Allow import of existing index.html files

Open chriskthomas opened this issue 2 years ago • 6 comments

Right now, there is no way to import an index.html file to automatically fill the fields. I would like to rectify this. It is fine if the importation is not backwards compatible. I am thinking that the simplest way to do it is to store all of the text fields in json as a comment at the bottom of the document.

This json could then be imported when the index.html file is imported.

chriskthomas avatar Jun 05 '23 23:06 chriskthomas

Likely depends on #4 as the import option could just set the localStorage keys and refresh.

chriskthomas avatar Jun 06 '23 14:06 chriskthomas

Is this something we'd want to sort through the index and pull all related links to fill the fields? would the index.html be from someone's webpage or specifically built just for the auto import?

officialxndr avatar Jun 17 '23 04:06 officialxndr

Is this something we'd want to sort through the index and pull all related links to fill the fields?

Yes!

would the index.html be from someone's webpage or specifically built just for the auto import?

The later. My thought was that the page builder could insert an html comment after the closing html. We then put a json string inside the comment with the exact JavaScript object that we want for the import.

When the page is imported, this json in the comment is read and we can loop through the entries to fill the form.

chriskthomas avatar Jun 17 '23 14:06 chriskthomas

So, this consists of two steps:

  1. Add comment json object to api.php
  2. Add import option to index.js / index.php

Step 2 should probably be done in js and html without using php to process any inputs.

chriskthomas avatar Jun 17 '23 14:06 chriskthomas