TinyDOC Editor
TinyDOC Editor is a HTML5 Rich Text Editor. The idea of this project is to provide a lightweight text editor with simple and easy-to-use features.
IMPORTANT: TinyDOC works with execCommand (deprecated), use TinyDOC 2.
Web
https://lrusso.github.io/tinyDOC/tinyDOC.htm
TinyDOC Constructor
# | TYPE | REQUIRED |
---|---|---|
1 | Container | Yes |
2 | Default text | No |
3 | Save function | No |
4 | Template 1 | No |
5 | Template 2 | No |
6 | Template 3 | No |
Example:
new tinyDOC(document.getElementById("myTestContainer"), "Welcome", saveFunction, "My Template1", "My Template2", "My Template3")
TinyDOC Methods
# | METHOD | DETAILS |
---|---|---|
1 | new | Deletes the document content. |
2 | Prints the document content. | |
3 | save | Executes the save function. |
4 | focus | Focus the document. |
5 | enable | Enables the document. |
6 | disable | Disables the document. |
7 | resize | Resizes the document to fit the container. |
8 | scrollToTop | Scrolls to the top of the document. |
9 | getText(boolean) | Returns the document content with or without encoding. |
Accessing the ContentEditable Div used by TinyDOC
let myExample = new tinyDOC(document.getElementById("myTestContainer"))
myExample.document.scrollTop = 0
Calc Button Sample 1 - Single Line Evaluation
lorem ipsum (5.40+4.70-3.90)*2/1 lorem ipsum
Select (5.40+4.70-3.90)*2/1, then click in the Calc Button, and the result will be inserted next to the selected text.
lorem ipsum (5.40+4.70-3.90)*2/1 = 12.40 lorem ipsum
Calc Button Sample 2 - Multi Line Addition Operation
$ 100.10
$ 200.20
$ 300.30
Select all, then click in the Calc Button, and the result will be inserted below to the selected text.
$ 100.10
$ 200.20
$ 300.30
----------
600.60