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: InlineFormatDelete.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 { Arr, Fun } from '@ephox/katamari'; import { Element, Traverse } from '@ephox/sugar'; import CaretPosition from '../caret/CaretPosition'; import DeleteElement from './DeleteElement'; import DeleteUtils from './DeleteUtils'; import * as ElementType from '../dom/ElementType'; import Parents from '../dom/Parents'; import * as CaretFormat from '../fmt/CaretFormat'; import Editor from '../api/Editor'; const getParentInlines = function (rootElm, startElm) { const parents = Parents.parentsAndSelf(startElm, rootElm); return Arr.findIndex(parents, ElementType.isBlock).fold( Fun.constant(parents), function (index) { return parents.slice(0, index); } ); }; const hasOnlyOneChild = function (elm) { return Traverse.children(elm).length === 1; }; const deleteLastPosition = function (forward: boolean, editor: Editor, target, parentInlines) { const isFormatElement = Fun.curry(CaretFormat.isFormatElement, editor); const formatNodes = Arr.map(Arr.filter(parentInlines, isFormatElement), function (elm) { return elm.dom(); }); if (formatNodes.length === 0) { DeleteElement.deleteElement(editor, forward, target); } else { const pos = CaretFormat.replaceWithCaretFormat(target.dom(), formatNodes); editor.selection.setRng(pos.toRange()); } }; const deleteCaret = function (editor: Editor, forward: boolean) { const rootElm = Element.fromDom(editor.getBody()); const startElm = Element.fromDom(editor.selection.getStart()); const parentInlines = Arr.filter(getParentInlines(rootElm, startElm), hasOnlyOneChild); return Arr.last(parentInlines).map(function (target) { const fromPos = CaretPosition.fromRangeStart(editor.selection.getRng()); if (DeleteUtils.willDeleteLastPositionInElement(forward, fromPos, target.dom()) && !CaretFormat.isEmptyCaretFormatElement(target)) { deleteLastPosition(forward, editor, target, parentInlines); return true; } else { return false; } }).getOr(false); }; const backspaceDelete = function (editor: Editor, forward: boolean) { return editor.selection.isCollapsed() ? deleteCaret(editor, forward) : false; }; export default { backspaceDelete };