(ed: Editor, rng: RangeLikeObject, start?: boolean)
| 59 | const isChildOfInlineParent = (dom: DOMUtils, node: Node, parent: Node): boolean => dom.isChildOf(node, parent) && node !== parent && !dom.isBlock(parent); |
| 60 | |
| 61 | const getContainer = (ed: Editor, rng: RangeLikeObject, start?: boolean) => { |
| 62 | let container = rng[start ? 'startContainer' : 'endContainer']; |
| 63 | let offset = rng[start ? 'startOffset' : 'endOffset']; |
| 64 | |
| 65 | if (NodeType.isElement(container)) { |
| 66 | const lastIdx = container.childNodes.length - 1; |
| 67 | |
| 68 | if (!start && offset) { |
| 69 | offset--; |
| 70 | } |
| 71 | |
| 72 | container = container.childNodes[offset > lastIdx ? lastIdx : offset]; |
| 73 | } |
| 74 | |
| 75 | // If start text node is excluded then walk to the next node |
| 76 | if (NodeType.isText(container) && start && offset >= container.data.length) { |
| 77 | container = new DomTreeWalker(container, ed.getBody()).next() || container; |
| 78 | } |
| 79 | |
| 80 | // If end text node is excluded then walk to the previous node |
| 81 | if (NodeType.isText(container) && !start && offset === 0) { |
| 82 | container = new DomTreeWalker(container, ed.getBody()).prev() || container; |
| 83 | } |
| 84 | |
| 85 | return container; |
| 86 | }; |
| 87 | |
| 88 | const normalizeTableSelection = (node: Node, start: boolean): Node => { |
| 89 | const prop = start ? 'firstChild' : 'lastChild'; |
no test coverage detected
searching dependent graphs…