danse / meta

A repo about other repos
0 stars 0 forks source link

editable - referentially transparent content system #12

Open danse opened 7 years ago

danse commented 7 years ago

Currently, when i want to develop lightweight logic on top of some accessible technology i use the file system, but this seems suboptimal given the past development of web technologies. The file system is, for me, a content system, which means that i can access and modify most contents stored in a file system, without the need of any custom software. I think that i could easily build the foundation for a similar content system also on a single web page, to start with. That would easily be comparable with essential operations i perform on a file system:

  1. create content
  2. list contents
  3. nest contents
  4. edit text content
  5. store arbitrarily encoded content

Among these tasks, 5 seems the hardest to port to a single web page, but it's also not the most frequent i perform

danse commented 7 years ago

contenteditable seems to offer a good base support for this. I mainly need some lightweight logic to save a document on local storage upon modification, and restore it at the next access

danse commented 7 years ago

a list of links can be in itself a powerful tool, that's how Abanico started

danse commented 7 years ago

this is the most popular local storage library for Purescript. The types seem overcomplicated to me though, and i am afraid that this could create problems when i want to create keys dynamically. A solution could be to not create keys dynamically, and just store dynamically defined data in the same record with the same key

danse commented 7 years ago

document.body.innerHTML can be got and set, representing the whole body content

danse commented 7 years ago

here is the body element and to get it i can use this code from Pangolin as a reference. This seems to be the interface for elements, but it does not include innerHTML, because it's deprecated

danse commented 7 years ago

So, the W3C does not like innerHTML but it doesn't look like an alternative serialisation and parsing method is offered. So i think that i will have to write my serialisation and parsing logic. Since JSON can represent tree-like structures and it's easily serializable and parsable, i could write two functions converting an HTML element into JSON and vice versa.

danse commented 7 years ago

Alternatively to writing my serialisation and parsing logic, i could just define a foreign function importing innerHTML. I could use existing code from the HTMLElement module as a reference