mkoskim / mawejs

Mawe (Mawe Advanced Writer's Editor) with ElectronJS, React and NodeJS. Third generation of the editors I have written for my own use.
MIT License
8 stars 5 forks source link

Study: Foldable / displaced comments & synopses #147

Open mkoskim opened 1 year ago

mkoskim commented 1 year ago

MaweJS scenes are made of different types of paragraphs:

  1. Text exported to draft: <p>,
    and` paragraphs. These are fine as they are now.
  2. Text not exported: <synopsis>, <comment>, <fill> and <tags> paragraphs.

So far, I have mostly used Synopsis to put a "bookmark" to the middle of the scene. Now, when struggling one of my stories, I am sketching an outline editor, which is meant to create synopses. This would mean, that the amount and length of synopsis text will grow.

Current implementation: Currently, comments and synopses are just plain paragraphs (<p> elements). They work fine, because that makes them editable in the editor itself. There is no need to click around to change them.

The drawback of current implementation is that you tend to keep comments and synopses quite short and scarce, so that they don't disturb the flow of the text. Earlier I have tried out many different styling of these blocks, but so far I have found best to keep them as un-intrusive as possible while stille being able to easily notice.

To encourage writers - that is, me - to write longer synopses and keep more comments around, we could try out some techniques to shorten longer blocks.

Margin notes: One of my old ideas have been, that comments and synopses could be pushed to "margin", that is, a floating box outside the text itself. They could also be pulled back to text somehow.

That is bit difficult to implement with SlateJS and React. The implementations I have investigated for this, generally work so that they have their own database for margin comments, and both comments and anchors are rendered separately. This may be fine, true, but this will also mean, that you can't edit the comment / synopsis together with the text, but you need to separately click your cursor to comment/synopsis box.

Folded notes: I have thought a "light-weight" solution for this. Now that editor has folding, it could be possible to use folding feature to compress synopses and comments to single like (disable word-wrap, give fixed max-width and give ellips, just like in index). This could help a bit.

This is not necessarily even difficult. We'd need to make p.comment.folded style, apply that style to comment block when rendering, and add some code to folding to recognize comment & synopsis blocks as foldable.

mkoskim commented 1 year ago

Tried it out shortly: comments, synopses and missing are truncated to oneliners when folded.

Folding needs more work, so that folded blocks are protected from cursor movement. When a block is truncated to oneliner (in CSS), SlateJS does not understand how it should move around.

mkoskim commented 1 month ago

One possible idea:

Tables? What if we make certain elements as 2-column tables? That way you could have some sort of table heading in the first column, and content in second column.

This could be possible implementation of so called metablock:

Metablock is meant to collect information together, so that it can be attached to scenes and chapters for various purposes.