OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
main
/
ts
/
delete
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 05:44:43 AM
rwxr-xr-x
📄
BlockBoundaryDelete.ts
950 bytes
02/20/2020 05:42:46 AM
rw-r--r--
📄
BlockMergeBoundary.ts
3.03 KB
02/20/2020 05:42:46 AM
rw-r--r--
📄
BlockRangeDelete.ts
2.51 KB
02/20/2020 05:42:47 AM
rw-r--r--
📄
CefBoundaryDelete.ts
3.77 KB
02/20/2020 05:42:47 AM
rw-r--r--
📄
CefDelete.ts
3.16 KB
02/20/2020 05:42:48 AM
rw-r--r--
📄
CefDeleteAction.ts
5.63 KB
02/20/2020 05:42:49 AM
rw-r--r--
📄
DeleteCommands.ts
2.09 KB
02/20/2020 05:42:49 AM
rw-r--r--
📄
DeleteElement.ts
6.5 KB
02/20/2020 05:42:50 AM
rw-r--r--
📄
DeleteUtils.ts
2.39 KB
02/20/2020 05:42:50 AM
rw-r--r--
📄
ImageBlockDelete.ts
1.23 KB
02/20/2020 05:42:51 AM
rw-r--r--
📄
InlineBoundaryDelete.ts
4.91 KB
02/20/2020 05:42:52 AM
rw-r--r--
📄
InlineFormatDelete.ts
2.38 KB
02/20/2020 05:42:52 AM
rw-r--r--
📄
MergeBlocks.ts
3.69 KB
02/20/2020 05:42:53 AM
rw-r--r--
📄
MergeText.ts
2.9 KB
02/20/2020 05:42:53 AM
rw-r--r--
📄
TableDelete.ts
5.81 KB
02/20/2020 05:42:54 AM
rw-r--r--
📄
TableDeleteAction.ts
4.26 KB
02/20/2020 05:42:54 AM
rw-r--r--
Editing: DeleteUtils.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, Options } from '@ephox/katamari'; import { Compare, Element, PredicateFind } from '@ephox/sugar'; import CaretFinder from '../caret/CaretFinder'; import * as ElementType from '../dom/ElementType'; import InlineUtils from '../keyboard/InlineUtils'; import Editor from '../api/Editor'; import CaretPosition from '../caret/CaretPosition'; const isBeforeRoot = function (rootNode) { return function (elm) { return Compare.eq(rootNode, Element.fromDom(elm.dom().parentNode)); }; }; const getParentBlock = function (rootNode, elm) { return Compare.contains(rootNode, elm) ? PredicateFind.closest(elm, function (element) { return ElementType.isTextBlock(element) || ElementType.isListItem(element); }, isBeforeRoot(rootNode)) : Option.none(); }; const placeCaretInEmptyBody = function (editor: Editor) { const body = editor.getBody(); const node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body; editor.selection.setCursorLocation(node, 0); }; const paddEmptyBody = function (editor: Editor) { if (editor.dom.isEmpty(editor.getBody())) { editor.setContent(''); placeCaretInEmptyBody(editor); } }; const willDeleteLastPositionInElement = function (forward: boolean, fromPos: CaretPosition, elm) { return Options.liftN([ CaretFinder.firstPositionIn(elm), CaretFinder.lastPositionIn(elm) ], function (firstPos, lastPos) { const normalizedFirstPos = InlineUtils.normalizePosition(true, firstPos); const normalizedLastPos = InlineUtils.normalizePosition(false, lastPos); const normalizedFromPos = InlineUtils.normalizePosition(false, fromPos); if (forward) { return CaretFinder.nextPosition(elm, normalizedFromPos).map(function (nextPos) { return nextPos.isEqual(normalizedLastPos) && fromPos.isEqual(normalizedFirstPos); }).getOr(false); } else { return CaretFinder.prevPosition(elm, normalizedFromPos).map(function (prevPos) { return prevPos.isEqual(normalizedFirstPos) && fromPos.isEqual(normalizedLastPos); }).getOr(false); } }).getOr(true); }; export default { getParentBlock, paddEmptyBody, willDeleteLastPositionInElement };