jsonkao / jasons-cms

A collaborative editor for stories that are both written and coded
https://jasons-cms.vercel.app
0 stars 0 forks source link

Editable graphic text #16

Closed jsonkao closed 7 months ago

jsonkao commented 7 months ago

An important pro of ArchieML is that you can write graphic copy without coding. Potential approaches...

1. Editable text

Inside any component, surround editable copy with editable(). That function would turn any text into a collaborative Prosemirror editor (or something simpler) inside the Y.Map in that graphic's BlockMap.

editable() wouldn't take a default value (that would be too confusing for future readers of the code when the text could be completely different). It should take a key that points to a specific value in the Y.Map. The default content will always be the same, like "Write here". The key could be any string, and it's suggested that it's descriptive. Editing and moving the keys themselves will likely be impossible.

This is great and smooth. But there are some tough things:

2. Managing copy in a separate tab.

Inside any component, instantiate a copy object with copy(). That function would provide a panel for each graphic that contained text that would get live-passed (store updates) to the graphic component. Now, you'd probably want both text and other parameters, so this would be like recreating JSON or ArchieML.

This doesn't have to be complex. It could be another tab in the code editor, called Writing. And it doesn't have to be abstracted away — it could just be style to import a new copy.json file or something. But then you pull writers into the code editor.

jsonkao commented 7 months ago

Resolved over the course of the day; developer vlog commit here: 26e563d9f3952b4acdd353c0edd73ae3500ad4e8