OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
main
/
ts
/
annotate
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 05:44:43 AM
rwxr-xr-x
📄
AnnotationChanges.ts
3.4 KB
02/20/2020 05:41:47 AM
rw-r--r--
📄
AnnotationContext.ts
1.82 KB
02/20/2020 05:41:46 AM
rw-r--r--
📄
AnnotationFilter.ts
1 KB
02/20/2020 05:41:47 AM
rw-r--r--
📄
AnnotationsRegistry.ts
1.02 KB
02/20/2020 05:41:48 AM
rw-r--r--
📄
Identification.ts
2.51 KB
02/20/2020 05:41:48 AM
rw-r--r--
📄
Markings.ts
532 bytes
02/20/2020 05:41:49 AM
rw-r--r--
📄
Wrapping.ts
5.2 KB
02/20/2020 05:41:49 AM
rw-r--r--
Editing: AnnotationContext.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 { Unicode } from '@ephox/katamari'; import { Node, Text, Traverse } from '@ephox/sugar'; import { isCaretNode } from '../fmt/FormatContainer'; import FormatUtils from '../fmt/FormatUtils'; import { isAnnotation } from './Identification'; import Editor from '../api/Editor'; export const enum ChildContext { // Was previously used for br and zero width cursors. Keep as a state // because we'll probably want to reinstate it later. Skipping = 'skipping', Existing = 'existing', InvalidChild = 'invalid-child', Caret = 'caret', Valid = 'valid' } const isZeroWidth = (elem): boolean => { // TODO: I believe this is the same cursor used in tinymce (Unicode.zeroWidth)? return Node.isText(elem) && Text.get(elem) === Unicode.zeroWidth(); }; const context = (editor: Editor, elem: any, wrapName: string, nodeName: string): ChildContext => { return Traverse.parent(elem).fold( () => ChildContext.Skipping, (parent) => { // We used to skip these, but given that they might be representing empty paragraphs, it probably // makes sense to treat them just like text nodes if (nodeName === 'br' || isZeroWidth(elem)) { return ChildContext.Valid; } else if (isAnnotation(elem)) { return ChildContext.Existing; } else if (isCaretNode(elem)) { return ChildContext.Caret; } else if (!FormatUtils.isValid(editor, wrapName, nodeName) || !FormatUtils.isValid(editor, Node.name(parent), wrapName)) { return ChildContext.InvalidChild; } else { return ChildContext.Valid; } } ); }; export { context };