OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
main
/
ts
/
dom
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 05:44:43 AM
rwxr-xr-x
📄
Dimensions.ts
1.28 KB
02/20/2020 05:42:59 AM
rw-r--r--
📄
DomSerializer.ts
4.65 KB
02/20/2020 05:42:59 AM
rw-r--r--
📄
DomSerializerFilters.ts
6.91 KB
02/20/2020 05:43:00 AM
rw-r--r--
📄
DomSerializerPreProcess.ts
1.81 KB
02/20/2020 05:43:00 AM
rw-r--r--
📄
ElementType.ts
2.39 KB
02/20/2020 05:43:01 AM
rw-r--r--
📄
Empty.ts
2.18 KB
02/20/2020 05:43:02 AM
rw-r--r--
📄
MousePosition.ts
2.37 KB
02/20/2020 05:43:03 AM
rw-r--r--
📄
NodePath.ts
970 bytes
02/20/2020 05:43:03 AM
rw-r--r--
📄
NodeType.ts
3.37 KB
02/20/2020 05:43:04 AM
rw-r--r--
📄
PaddingBr.ts
1.7 KB
02/20/2020 05:43:04 AM
rw-r--r--
📄
Parents.ts
1020 bytes
02/20/2020 05:43:05 AM
rw-r--r--
📄
Position.ts
2.9 KB
02/20/2020 05:43:05 AM
rw-r--r--
📄
RangePoint.ts
639 bytes
02/20/2020 05:43:06 AM
rw-r--r--
📄
ScrollIntoView.ts
3.27 KB
02/20/2020 05:43:07 AM
rw-r--r--
📄
StyleSheetLoader.ts
6.49 KB
02/20/2020 05:43:08 AM
rw-r--r--
📄
TrimHtml.ts
1.62 KB
02/20/2020 05:43:08 AM
rw-r--r--
📄
TrimNode.ts
2.58 KB
02/20/2020 05:43:09 AM
rw-r--r--
Editing: Empty.ts
Close
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { Fun } from '@ephox/katamari'; import { Compare, Element, SelectorExists } from '@ephox/sugar'; import * as CaretCandidate from '../caret/CaretCandidate'; import NodeType from './NodeType'; import TreeWalker from '../api/dom/TreeWalker'; const hasWhitespacePreserveParent = function (rootNode, node) { const rootElement = Element.fromDom(rootNode); const startNode = Element.fromDom(node); return SelectorExists.ancestor(startNode, 'pre,code', Fun.curry(Compare.eq, rootElement)); }; const isWhitespace = function (rootNode, node) { return NodeType.isText(node) && /^[ \t\r\n]*$/.test(node.data) && hasWhitespacePreserveParent(rootNode, node) === false; }; const isNamedAnchor = function (node) { return NodeType.isElement(node) && node.nodeName === 'A' && node.hasAttribute('name'); }; const isContent = function (rootNode, node) { return (CaretCandidate.isCaretCandidate(node) && isWhitespace(rootNode, node) === false) || isNamedAnchor(node) || isBookmark(node); }; const isBookmark = NodeType.hasAttribute('data-mce-bookmark'); const isBogus = NodeType.hasAttribute('data-mce-bogus'); const isBogusAll = NodeType.hasAttributeValue('data-mce-bogus', 'all'); const isEmptyNode = function (targetNode) { let node, brCount = 0; if (isContent(targetNode, targetNode)) { return false; } else { node = targetNode.firstChild; if (!node) { return true; } const walker = new TreeWalker(node, targetNode); do { if (isBogusAll(node)) { node = walker.next(true); continue; } if (isBogus(node)) { node = walker.next(); continue; } if (NodeType.isBr(node)) { brCount++; node = walker.next(); continue; } if (isContent(targetNode, node)) { return false; } node = walker.next(); } while (node); return brCount <= 1; } }; const isEmpty = (elm) => isEmptyNode(elm.dom()); export default { isEmpty };