OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
main
/
ts
/
keyboard
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 05:44:43 AM
rwxr-xr-x
📄
ArrowKeys.ts
2.28 KB
02/20/2020 05:43:50 AM
rw-r--r--
📄
BoundaryCaret.ts
2.59 KB
02/20/2020 05:43:50 AM
rw-r--r--
📄
BoundaryLocation.ts
6.56 KB
02/20/2020 05:43:51 AM
rw-r--r--
📄
BoundarySelection.ts
4.54 KB
02/20/2020 05:43:52 AM
rw-r--r--
📄
CefNavigation.ts
9.07 KB
02/20/2020 05:43:52 AM
rw-r--r--
📄
CefUtils.ts
2.54 KB
02/20/2020 05:43:53 AM
rw-r--r--
📄
ContentEndpointNavigation.ts
2.99 KB
02/20/2020 05:43:54 AM
rw-r--r--
📄
DeleteBackspaceKeys.ts
3.49 KB
02/20/2020 05:43:54 AM
rw-r--r--
📄
EnterKey.ts
1.29 KB
02/20/2020 05:43:55 AM
rw-r--r--
📄
FormatShortcuts.ts
886 bytes
02/20/2020 05:43:55 AM
rw-r--r--
📄
HomeEndKeys.ts
980 bytes
02/20/2020 05:43:56 AM
rw-r--r--
📄
InlineUtils.ts
3.26 KB
02/20/2020 05:43:56 AM
rw-r--r--
📄
InputKeys.ts
1.55 KB
02/20/2020 05:43:57 AM
rw-r--r--
📄
InsertSpace.ts
2.3 KB
02/20/2020 05:43:57 AM
rw-r--r--
📄
KeyboardOverrides.ts
1011 bytes
02/20/2020 05:43:58 AM
rw-r--r--
📄
MatchKeys.ts
1.64 KB
02/20/2020 05:43:58 AM
rw-r--r--
📄
Nbsps.ts
5.95 KB
02/20/2020 05:43:59 AM
rw-r--r--
📄
SpaceKey.ts
1 KB
02/20/2020 05:43:59 AM
rw-r--r--
📄
TableNavigation.ts
6.86 KB
02/20/2020 05:44:00 AM
rw-r--r--
Editing: BoundaryCaret.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, Cell } from '@ephox/katamari'; import * as CaretContainer from '../caret/CaretContainer'; import * as CaretContainerInline from '../caret/CaretContainerInline'; import CaretContainerRemove from '../caret/CaretContainerRemove'; import CaretFinder from '../caret/CaretFinder'; import CaretPosition from '../caret/CaretPosition'; import NodeType from '../dom/NodeType'; import { Text } from '@ephox/dom-globals'; const insertInlinePos = function (pos: CaretPosition, before: boolean) { if (NodeType.isText(pos.container())) { return CaretContainerInline.insertInline(before, pos.container()); } else { return CaretContainerInline.insertInline(before, pos.getNode()); } }; const isPosCaretContainer = function (pos: CaretPosition, caret: Cell<Text>) { const caretNode = (<Cell<any>> caret).get(); return caretNode && pos.container() === caretNode && CaretContainer.isCaretContainerInline(caretNode); }; const renderCaret = function (caret: Cell<Text>, location) { return location.fold( function (element) { // Before CaretContainerRemove.remove(caret.get()); const text = CaretContainerInline.insertInlineBefore(element); caret.set(text); return Option.some(CaretPosition(text, text.length - 1)); }, function (element) { // Start return CaretFinder.firstPositionIn(element).map(function (pos) { if (!isPosCaretContainer(pos, caret)) { CaretContainerRemove.remove(caret.get()); const text = insertInlinePos(pos, true); caret.set(text); return CaretPosition(text, 1); } else { return CaretPosition(caret.get(), 1); } }); }, function (element) { // End return CaretFinder.lastPositionIn(element).map(function (pos) { if (!isPosCaretContainer(pos, caret)) { CaretContainerRemove.remove(caret.get()); const text = insertInlinePos(pos, false); caret.set(text); return CaretPosition(text, text.length - 1); } else { return CaretPosition(caret.get(), caret.get().length - 1); } }); }, function (element) { // After CaretContainerRemove.remove(caret.get()); const text = CaretContainerInline.insertInlineAfter(element); caret.set(text); return Option.some(CaretPosition(text, 1)); } ); }; export default { renderCaret };