@editorjs/dom
Utils useful for work with dom for Editor.js tools development
Installation
npm install @editorjs/dom
Function list
- allInputsSelector - Returns CSS selector for all text inputs
- append - Append one or several elements to the parent
- blockElements - Return array of names of block html elements
- calculateBaseline - Calculates the Y coordinate of the text baseline from the top of the element's margin box,
- canSetCaret - Checks if we can set caret
- containsOnlyInlineElements - Check if passed content includes only inline elements
- findAllInputs - Find all contenteditable, textarea and editable input elements passed holder contains
- fragmentToString - Returns the HTML content of passed Document Fragment
- getContentLength - Return length of node`s text content
- getDeepestBlockElements - Find and return all block elements in the passed parent (including subtree)
- getDeepestNode - Search for deepest node which is Leaf.
- isCollapsedWhitespaces - Determine whether a passed text content is a collapsed whitespace.
- isContentEditable - Check if passed element is contenteditable
- isElement - Check if object is DOM node
- isEmpty - breadth-first search (BFS)
- isFragment - Check if object is DocumentFragment node
- isHTMLString - Check if string contains html elements
- isLeaf - checks node if it is doesn't have any child nodes
- isLineBreakTag - Check if element is BR or WBR
- isNativeInput - Checks target if it is native input
- isNodeEmpty - Checks node if it is empty
- isSingleTag - Check if passed tag has no closed tag
- make - Helper for making Elements with class name and attributes
- offset - Return element's offset related to the document
prepend - Append element or a couple to the beginning of the parent elements
About CodeX
CodeX is a team of digital specialists around the world interested in building high-quality open source products on a global market. We are open for young people who want to constantly improve their skills and grow professionally with experiments in cutting-edge technologies.
| 🌐 | Join 👋 | Twitter | Instagram | | -- | -- | -- | -- | | codex.so | codex.so/join |@codex_team | @codex_team |