Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Study: Multisection, multifile editor #329

Open
mkoskim opened this issue Mar 10, 2025 · 1 comment
Open

Study: Multisection, multifile editor #329

mkoskim opened this issue Mar 10, 2025 · 1 comment

Comments

@mkoskim
Copy link
Owner

mkoskim commented Mar 10, 2025

Currently, there is two sections in a MAWE file: body and notes. There is a need to improve the situation:

  1. You want to split long stories to separate sections
  2. You want sections not part of your story (preface, appendixes), but still exported
  3. You want sections not exported (notes and so on)
  4. You want to move text pieces between files: you may want to split or merge stories
  5. You want to make collections (edit & export smaller stories together, with preface)
  6. You want to keep common notes with multiple stories (e.g. stories happening in same universe, same characters)

So, we want a system, where you can have several sections visible in index, so that you can drag'n'drop elements between sections, you want sections from multiple files.


General discussion about draft content elements:

Some earlier thoughts about workspaces and multifile editing:

@mkoskim
Copy link
Owner Author

mkoskim commented Mar 23, 2025

Brainstorming

Performance

Most important: The main concern when designing the features is the editor performance. From performance point of view, the most important thing is that inserting and deleting (backspace) paragraph text is as fast and responsive as possible.

It does not matter that much, if some complex operations take some time. But when typing text, you want your editor to respond immediately.

But let's first imagine there is no performance problems. How could we make multifile, multisection editor?

File sections

The most important sections for a story are: (1) the body of a story, (2) clipboard/notes section to store sketches, comments and other such content not exported to a story, (3) frontmatter (preface) and backmatter (appendix) sections, which are not part of the story (in story arc view), but are exported to a story.

In addition to these, it probably would make sense that you would have story heading information as an editable section. Heading information would contain title, subtitle, author and such things, as well as possible backcover text and publishing information.

We could consider collecting these sections to an array, which is given to single SlateJS editor instance for editing:

const sections = [
  {type: "head", ...},
  {type: "sect", content: "frontmatter", children: [ ... ],
  {type: "sect", content: "body", children: [ ... ],
  {type: "sect", content: "backmatter", children: [ ... ],
  {type: "sect", content: "clipboard", children: [ ... ],
  {type: "sect", content: "trashcan", children: [ ... ]
]

The idea of the trashcan section is that you could drag'n'drop scenes, chapters and acts there, before they are deleted. I have initial implementation for that, but it could be improved a bit. Currently it works just like any other section, which means, that you need to have a container there to drop scenes and chapters. If you don't have one, you can't drop them in.

Editing all the sections with the same SlateJS editor instance could be good for another reason: undoing a drag'n'drop (SlateJS history) would move the dropped element back to its original place.

Section content

It would probably be good to restrict the section content:

  • Body, clipboard and trashcan: These sections need to accept acts (or whatever is the highest level container)
  • Front and backmatter: It probably makes no sense, that these sections can be divided to acts, but it is probably good that they can be divided to chapters and scenes.

Splitting body section

Depending on the performance issues, there could be need to split body of a long story to multiple sections. I am not sure about this, because you could use (folded) acts for the same purpose.

The same might hold true for clipboard/notes section, too.

Multifile editing

The other way to split a really long story to a more manageable pieces is to split it to several files. This could be really good for other purposes, too: you could have your background material loaded with the story, so that you can keep it up to date while writing your story.

Probably the best way to make multi-file editing would be to collect the all to a list (workspace):

const workspace = [
  {type: "file", children: [ ... ]},
  {type: "file", children: [ ... ]},
  ...
]

...And make one single SlateJS editor instance to edit all of them at once. Why a list? Because if you are making collections of short stories, you like to put them in certain order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant