OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
main
/
ts
/
caret
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 05:44:43 AM
rwxr-xr-x
📄
BlockBoundary.ts
1.53 KB
02/20/2020 05:42:20 AM
rw-r--r--
📄
CaretBr.ts
1.47 KB
02/20/2020 05:42:20 AM
rw-r--r--
📄
CaretCandidate.ts
2.68 KB
02/20/2020 05:42:21 AM
rw-r--r--
📄
CaretContainer.ts
5.4 KB
02/20/2020 05:42:21 AM
rw-r--r--
📄
CaretContainerInline.ts
2.23 KB
02/20/2020 05:42:22 AM
rw-r--r--
📄
CaretContainerInput.ts
1.87 KB
02/20/2020 05:42:22 AM
rw-r--r--
📄
CaretContainerRemove.ts
3.3 KB
02/20/2020 05:42:23 AM
rw-r--r--
📄
CaretFinder.ts
4.09 KB
02/20/2020 05:42:25 AM
rw-r--r--
📄
CaretPosition.ts
13.27 KB
02/20/2020 05:42:26 AM
rw-r--r--
📄
CaretPositionPredicates.ts
2.24 KB
02/20/2020 05:42:27 AM
rw-r--r--
📄
CaretUtils.ts
8.54 KB
02/20/2020 05:42:27 AM
rw-r--r--
📄
CaretWalker.ts
7.67 KB
02/20/2020 05:42:28 AM
rw-r--r--
📄
FakeCaret.ts
6.26 KB
02/20/2020 05:42:28 AM
rw-r--r--
📄
InsertText.ts
1.32 KB
02/20/2020 05:42:29 AM
rw-r--r--
📄
LineReader.ts
5.88 KB
02/20/2020 05:42:29 AM
rw-r--r--
📄
LineUtils.ts
4.11 KB
02/20/2020 05:42:30 AM
rw-r--r--
📄
LineWalker.ts
4.56 KB
02/20/2020 05:42:30 AM
rw-r--r--
📄
TableCells.ts
3.58 KB
02/20/2020 05:42:31 AM
rw-r--r--
Editing: CaretPositionPredicates.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 { Option, Fun } from '@ephox/katamari'; import NodeType from '../dom/NodeType'; import { Text, Node } from '@ephox/dom-globals'; import CaretPosition from './CaretPosition'; import { isWhiteSpace } from '../text/CharType'; import { getChildNodeAtRelativeOffset } from './CaretUtils'; import { Element, Css } from '@ephox/sugar'; const isChar = (forward: boolean, predicate: (chr: string) => boolean, pos: CaretPosition) => { return Option.from(pos.container()).filter(NodeType.isText).exists((text: Text) => { const delta = forward ? 0 : -1; return predicate(text.data.charAt(pos.offset() + delta)); }); }; const isBeforeSpace = Fun.curry(isChar, true, isWhiteSpace); const isAfterSpace = Fun.curry(isChar, false, isWhiteSpace); const isEmptyText = (pos: CaretPosition) => { const container = pos.container(); return NodeType.isText(container) && container.data.length === 0; }; const matchesElementPosition = (before: boolean, predicate: (node: Node) => boolean) => { return (pos: CaretPosition) => Option.from(getChildNodeAtRelativeOffset(before ? 0 : -1, pos)).filter(predicate).isSome(); }; const isImageBlock = (node: Node) => { return node.nodeName === 'IMG' && Css.get(Element.fromDom(node), 'display') === 'block'; }; const isCefNode = (node: Node) => NodeType.isContentEditableFalse(node) && !NodeType.isBogusAll(node); const isBeforeImageBlock = matchesElementPosition(true, isImageBlock); const isAfterImageBlock = matchesElementPosition(false, isImageBlock); const isBeforeTable = matchesElementPosition(true, NodeType.isTable); const isAfterTable = matchesElementPosition(false, NodeType.isTable); const isBeforeContentEditableFalse = matchesElementPosition(true, isCefNode); const isAfterContentEditableFalse = matchesElementPosition(false, isCefNode); export { isBeforeSpace, isAfterSpace, isEmptyText, isBeforeContentEditableFalse, isAfterContentEditableFalse, isBeforeTable, isAfterTable, isBeforeImageBlock as isBeforePageBreak, isAfterImageBlock as isAfterPageBreak };