mkoskim / mawejs Goto Github PK
View Code? Open in Web Editor NEWMawe writer's editor with ElectronJS, React and NodeJS. Third generation of the editors I have written for my own use.
License: MIT License
Mawe writer's editor with ElectronJS, React and NodeJS. Third generation of the editors I have written for my own use.
License: MIT License
Although it is good that writer can write just those characters s/he wants, it would be great to have extra whitespace removal: leading and trailing whitespaces, and unnecessary extra spaces between words.
When doubleclicking an item in organizer, switch to editor and move cursor to double-clicked item.
NOTE: Before we can have support for collections, there needs to be support for workspace first. Then, it would be nice to export stories in the workspace as a collection. Example use cases:
Short story collections: You are making a collection from short novellas or novellettes: collect them to one workspace, and export that workspace as a collection.
Long novels: There will be limit how much text is manageable in one story, even if we implement support for multiple sections. When the limit comes, you may split your story to multiple "substories", e.g.
You keep the parts in the same workspace, and then export the whole story as one.
REMINDER: To support splitting a story over multiple files, there is a need to support moving scenes & parts between files. That same feature then of course serves for creating "spin-offs" (scene or part in one story is moved to new story) as well as merging stories.
Support for collection:
Collection can also be a solution to make multi-part novels (trilogies etc). We might need support common notes section for a workspace.
There are issues with block IDs generated for indexing.
It happens in various circumstances, like copy-pasting indexd elements when editor leaves tails. Also, when you use browser's internal drag'n'drop in editor, if you move indexed elements, there will be duplicate IDs when the DnD leaves "a tail" behind and it will retain the ID of the moved block.
At this point, it would probably be better to make brute force solution: when normalizing, go through the blocks with ID, and generate new ones, if there are conflicts.
When changing view, Slate editors loose their history. It might be little annoying, so we might need to do something about it.
It looks like when moving parts between sections, scene drop zone included in the part is not always working correctly. Need closer investingations.
Background
Many modern coding editors like Visual Code create a list of matches when searching. It is very handy! So, we need to implement similar.
Implementation
For right hand index, add a search match list as an option (in addition to body index).
If anyhow possible, it would be best to generate the search match list from the SlateJS editor decorations. We already use decorate() function, which generates an up-to-date list of matches to be highlighted. If we can access that and show it to user, our problems may be solved.
Possible idea
Add an arrow-left button to search box. Pressing it will take search box to body index menu, and replace body index with list of matches. Also, search box left arrow will be changed to right arrow, and pressing it will take search box back to editor menu, and show index menu.
Split text to words and show individual words with their count in text.
For various reasons, you may hae scenes and parts that contain only comments and no exported text at all. Filter them out.
Currently, editor does not know, if the file is saved or not. So, you can press Ctrl-Q (Quit) without receiving any warnings.
Implement a mechanism to check, if editor buffer is dirty.
Usable file access: At least one workspace, which allows you to continue where you were last time, but multiple workspaces would be great to switch between projects.
TODO (Basic features):
It would be good that you could edit text in preview. Nothing fancy, thought, but for example fix typos and such without switching back to editor.
What is possible:
What is not likely possible:
Currently, search forward (Ctrl-G) and backward (Ctrl-Shift-G) do not work very intuitively when there is nothing more to find. Backward search removes the selection and stays at the first char. Forward search removes the selection and goes forward one step at time.
Correct behaviour: in both cases, keep the word selected. Give some audio/visual feedback that there is nothing more to find.
To be honest, there is not much joy just showing the diagram. To fulfill its purpose, you should be able to edit the story in the diagram view!
Currently it only works for complete stories, and for a tool it is far too late. The diagram should work also for incomplete stories, when you have the best chances to modify the story structure!
The diagram needs tools to "speculate" the story from early on.
Indices: We need to add both body and notes index to diagram view, with drag'n'drop enabled. This way you can move parts and scenes within the body, and also between body and notes.
Filling: You should be able to "speculate" the length of scenes and parts. I have thought that there would be "fill" attribute in parts and scenes, which is sort of "minimum length" for that block in the diagram view. Modifying "fill" would modify the length of the block in the diagram.
I have many incomplete stories which I try to use as a test bench when developing the features. What I can say at this point, is that incomplete stories are really incomplete. They have lots of small scenes which will be merged together later, and they really don't have any real structure. So, completing this issue will be a challenging task :) But we can go with small steps at time.
Currently MaweJS is single file editor. To make it usable, make it hold multiple files at once.
This will cause problems with SlateJS editor component, so we need to examine the issue more closely.
We need to ensure, that part breaks are followed by scene break.
It is not mandatory for editor and file load/save, but index drag-n-drop will break, if they are not generated. Generating breaks will mess up drag-and-drop, so they need to be added by editor itself.
In some point of future, we want to remove "visual clutter" from text in editor by hiding unnecessary breaks, but the approach is different.
Locating cursor to certain loction, scrolling editor view to make that location visible and focusing the editor is needed in many places:
We need to find a reliable way to do this. Current implementation trust on delays and such, but it has all sorts of errors & warnings when rendering is not yet finished after the delay.
For many stories, you need names for your characters (and sometimes places as well). One of my long time plan has been to integrate name generators to stories. Some ideas about it:
Create clickable index to export preview to help go through the draft.
Use tags to create clickable links and their (invisible) targets.
Currently, Chrome browser - used with ElectronJS - supports practically only English spellchecking. It does not check the lang property of a HTML element to turn spellchecking off.
If story language is something else, spellchecking needs to be turned off.
In the future, try to choose some suitable spellchecking / hyphenation framework / library, and use it with the editor.
Implement document export to RTF file. It can be ported from python version. Exporting also needs head info (title, author, etc) editing, but that's another issue.
Find a good enough presentation of the sizes (e.g. percentages, pages, minutes) of the parts in Hero's Journey, and add it to a template.
Editor should be able to load files in different formats, and convert them to a mawe story:
Supported file formats:
Currently, settings are resetted when editor is restarted. We need to save the settings.
The most important persistent settings would be:
Organize settings to different "domains":
Background
Very old MaweJS used Redux state, wrote settings to disk and loaded them on startup. I just wasnt satisfied with that solution. Redux is not currently used, although it probably comes back in the future.
When making a new doc, editor wont allow creating a scene.
Head info editing:
Index:
Bonus:
Basic search and replace.
It would be great to have an indicator, when all the missing text is finally removed from scene/part and that is somewhat ready.
If part is empty, it is not possible to drag scenes into it.
Workaround: Make a dmmy scene inside a part.
In certain cases, an element filling the word count to certain number could be useful:
Let's consider to make an element to fill the missing words.
Show total amount of occurrences in search, as well as the index of the current occurence.
At some point of future, we want to implement word frequency counter. When this is implemented, it would be really nice that you can go through the occurences.
Editing head info in various places: editor itself, exporting preview.
Basic head info:
Other head info, e.g.
When doubleclicking part of preview, switch to editor and put cursor to that part. Sppeds up fixing issues while reading draft preview.
Currently, pressing Ctrl-F (Find) focuses search text box only when the text is changed. What we like to have is that you can go to search box anytime you want to modify search string by pressing Ctrl-F.
Allow users to drag and drop files to editor.
Native files (.mawe, .moe) are opened as they are. Non-native files (.txt, .rtf) are imported. We might open a dialog to preview the drop, at least when we are dropping non-native files.
Integrate file management features to mawejs. This would make working with larger projects consisting several stories easier. Features:
We need to escape control characters (<, >, &) in .mawe files, otherwise they can not be loaded.
Looks like xmljs loader can "de-escape" escaped characters, so we only need escape text content when saving.
Addition: It looks like it is a bug / missing feature at xml-js side: nashwaan/xml-js#69
DnD reorder of parts and scenes in two places:
For best possible first time user experience, it would be great that the empty document does now show unnecessary breaks, so that in editor the text would look like this:
Head elements [title, author]
...text...
Scene 2
...text...
Scene 3
...
Part 2
...text...
Scene 2
...text...
...
Internally, those breaks are needed, so data inside the editor would look like this:
Head elements
[hidden Part 1]
[hidden Scene 1]
...text...
Scene 2
...text...
Scene 3
...
Part 2
[hidden Scene 1]
...text...
Scene 2
...text...
...
That is, scene and part breaks act more like separators, not container headers. These breaks need to be placed correctly in editor anyways! They just can't be omitted, but they might be invisible!
The problem: Getting them visible for naming! There needs to be some glues in GUI that there are some hidden elements there, so that you can access them.
Word table only lists whole words. When they are moved to search box, it finds also partial matches. So:
Placing regexp control chars to search box can crash the editor.
When item is dropped, next render uses old value and causes flicker. This is caused by deferred rendering. React first renders the old index, and only after that it renders the updated one.
Without deferred render, the responsiveness of editor is not good.
At some point, find a way to remove flicker.
First: Organizer as it is currently, lacks the ability to add & remove scenes are parts. It can only move scenes & parts around.
Second: After lots of improvements to basic editor, it seems that current Organizer view is bit useless feature. It will be even more useless, when you can reorganize your story in the Diagram view.
If we want to keep Organizer, it needs to rediscover its purpose - what it is used for, and why it would be useful for writer.
Versioning - or archiving - means to store an existing version of your manuscript, and start working with new one.
We should support viewing current and old versions side-by-side, to use the old one to help writing the new.
Implement scene/part folding in editor.
Current editor index DnD implementation has certain bugs.
First bug is "ghost" parts and scenes. They are related to attempts to keep data coherent: In edit2section(), and empty part or scene block is implicitly created if there are "hanging" paragraphs (e.g. between title and first part, or between part and first scene). These will be shown in indices, but they don't exist in editor.
The second one is "flickering" when DnD ends. This is caused by deferred rendering. React first renders the old index, and only after that it renders the updated one.
Implement a feature to change entire paragraph rendering style: regular, bold, italic. Not very high priority, thought.
By default, MaweJS most probably will never support any fancy text formatting. Most likely the only supported styling will be emphasis, to emphase (italic) certain words from the text.
But there is some niche needs to bold or cursive certain text blocks. I'm not that fascinated about them - many times the italic blocks are dream descriptions and such - but even I have some need for those things.
SlateJS editor itself is quite good in terms of performance and responsiveness. But when combined with indices and such, we make lots of operations each time a key is pressed:
We could (1) combine operations needed for index, and (2) delay them a bit, so that they are not refreshed immediately.
Open a directory, scan all .mawe / .moe story files, peek their header info (title, status, word count) and make them a list.
Furthermore, group the found docs in different ways (published, sketch, draft, etc).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.