Closed ilyamore88 closed 7 months ago
⏭️ No files to mutate for ./packages/model
./packages/dom-adapters
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 100% | 0/0 |
🟢 | Branches | 100% | 0/0 |
🟢 | Functions | 100% | 0/0 |
🟢 | Lines | 100% | 0/0 |
1 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from 1aeae4099913cb09843eaf093ec5788a512a3ca8
⏭️ No files to mutate for ./packages/dom-adapters
./packages/model
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 96.27% (-3.73% 🔻) |
620/644 |
🟢 | Branches | 97.87% (-1.4% 🔻) |
138/141 |
🟢 | Functions | 91.52% (-7.82% 🔻) |
151/165 |
🟢 | Lines | 96.28% (-3.72% 🔻) |
595/618 |
347 tests passing in 20 suites.
Report generated by 🧪jest coverage report action from 1aeae4099913cb09843eaf093ec5788a512a3ca8
Changes description
Changes implement
BlockToolAdapter
class which connects DOM input (for now it works mostly with contenteditable elements) with EditorJSModel.Adapter listens to
beforeinput
events and dispatches data from the events to the model. On model update, adapter updates the DOM with relevant changes. We prevent allbeforeinput
events, so all updates to the DOM comes from the model.BlockToolAdapter
utilises theCaretAdapter
to update document selection after a model update.CaretAdapter
CaretAdapter
now updates the model on selection change and, vice versa, updates the DOM on the model updates.However, current implementation works only with one attached input, we would beed to re-implement it to work with the whole EditorJS document
Model updates
Caret
Class represents user caret in the EditorJSModel
Public signature
CaretManager
Class is a part of EditorJSModel which store registry of user carets.
Public signature
Each method dispatches corresponding event.
All
CaretManagement
methods and events are exposed to theEditorJSModel
public interface. So carets could be updated from external code (like dom-adapters)