A Rust
re-implementation of the well known Quill HTML editor.
The functionality provided by this package is:
- Translate a
Delta
document to a HTMLDOM
- Edit the Delta document using operational transform commands
- Translate the current
DOM
state back to aDelta
document - Provide a set of formats that translate
Delta operations
to HTMLDOM
Documentation:
- user docs: https://mundo-68.github.io/quill-core-rs/
- design docs; see
dev-docs
folder
- clean up code and simplify
- automate wasm-pack tests (only run per crate now)
- see missing formats below
fn main() {
DocumentRoot::set_log_level(Level::Debug);
register_all();
//Assuming there is a <div id="some_id"></div>
let mut doc = DocumentRoot::new("some_id");
doc.open();
//fetch some delta document
doc.apply_dela(delta);
}
fn register_all() -> Result<()> {
let register = Registry::get_mut_ref()?;
register.register_block(NAME_OL_BLOCK, Arc::new(ListBlock::new_ol()));
register.register_block(NAME_UL_BLOCK, Arc::new(ListBlock::new_ul()));
register.register_block(NAME_HEADER, Arc::new(HeaderBlock::new()));
register.register_block(NAME_CODE, Arc::new(CodeBlock::new()));
register.register_block(NAME_P_BLOCK, Arc::new(Pblock::new()));
register.register_text(NAME_LINK, Arc::new(LinkFormat::new()));
register.register_text(NAME_IMAGE, Arc::new(ImageFormat::new()));
register.register_text(NAME_SOFT_BREAK, Arc::new(SoftBreak::new()));
register.register_text(NAME_TEXT, Arc::new(TextFormat::new()));
Ok(())
}
Line
nodes are horizontally aligned elements.
Font related:
- Background Color
- Bold
- Font Color
- Font
- Inline Code
- Italic
- Link
- Size
- Strikethrough
- Superscript/Subscript
- Underline
Other:
- Inline image
<img>
- emoji
- link
<a>
Block
nodes are used for vertical formatting.
- paragraphs
<P>
- Headings
<Hx>
- automatic header numbering
- Lists
- ordered
- bullet
- list headers with automatic numbering
- Code
- Tables
- table headers with automatic numbering
- Nicely formatted alert / warn / error blocks
- [ ]Blockquote - blockquote
- Header - header
- Indent - indent
- List - list
- Text Alignment - align
- Text Direction - direction
- Code Block - code-block
- Image - image
- automated image footer and numbering
- Formula - formula (Retex)
- Video - video
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
For WASM testing use:
wasm-pack test --headless --chrome --test document
wasm-pack test --headless --firefox
To run the other rust tests use:
cargo test