Ask HN: Is there an JavaScript and HTML rich text editor that uses templates?
Concepts
Each template consists of text, variables and nested templates. A template can consist of multiple paragraphs, of a single paragraph or can be inline templates. Inline templates (ITPL) can be inserted in single-paragraph templates (STPL) and STPL can be inserted in multiple-paragraph templates (MTPL). MTPLs can be part of other MTPLs.
The user assigns values to variables found templates to generate the final document. Values can consist of text, image and any other primitives that the editor supports, including formatted text.
The document being edited is a template itself, but with variables replaced by their assigned values.
Editor UI
The editor should have three main areas: the main text editor (MTE), the list of templates (LOT) and the variables view (VV).
MTE displays the content of current entry in the LOT. This allows the user to change templates by editing the text, insert variables, insert other templates, format the code and so on. A template inserted in another (parent) template (or in the document) can be edited to differ from its base representation but, when doing so, a local template is created and is embedded inside the parent template; a link is saved to allow the user to revert to original template.
Variables in the VV can be assigned a value; for templates this represents the default value, for the document is the final value. As variables can contain formatted text and all other primitives, each variable has a text field and a toolbutton that allows its content to be edited into the MTE.
[1] https://prosemirror.net/ [2] https://quilljs.com/
0 comments
[ 4.8 ms ] story [ 8.3 ms ] threadNo comments yet.