UNPKG

substance

Version:

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing system. It is developed to power our online editing platform [Substance](http://substance.io).

12 lines (11 loc) 303 B
export default function getContainerRoot (doc, containerPath, nodeId) { let current = doc.get(nodeId) const containerId = containerPath[0] while (current) { const parent = current.getParent() if (parent && parent.id === containerId) { return current } current = parent } }