OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
main
/
ts
/
api
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 05:44:43 AM
rwxr-xr-x
📄
AddOnManager.ts
9.83 KB
02/20/2020 05:41:54 AM
rw-r--r--
📄
Annotator.ts
3.54 KB
02/20/2020 05:41:53 AM
rw-r--r--
📄
Editor.ts
35.88 KB
02/20/2020 05:41:55 AM
rw-r--r--
📄
EditorCommands.ts
16.78 KB
02/20/2020 05:41:55 AM
rw-r--r--
📄
EditorManager.ts
22 KB
02/20/2020 05:41:56 AM
rw-r--r--
📄
EditorObservable.ts
5.88 KB
02/20/2020 05:41:56 AM
rw-r--r--
📄
EditorUpload.ts
8.24 KB
02/20/2020 05:41:57 AM
rw-r--r--
📄
Env.ts
5.05 KB
02/20/2020 05:41:57 AM
rw-r--r--
📄
EventTypes.ts
3.4 KB
02/20/2020 05:41:58 AM
rw-r--r--
📄
Events.ts
1.17 KB
02/20/2020 05:41:58 AM
rw-r--r--
📄
FocusManager.ts
1.37 KB
02/20/2020 05:41:59 AM
rw-r--r--
📄
Formatter.ts
7.65 KB
02/20/2020 05:41:59 AM
rw-r--r--
📄
IconManager.ts
992 bytes
02/20/2020 05:42:00 AM
rw-r--r--
📄
Main.ts
786 bytes
02/20/2020 05:42:01 AM
rw-r--r--
📄
NotificationManager.ts
5.03 KB
02/20/2020 05:42:02 AM
rw-r--r--
📄
PluginManager.ts
493 bytes
02/20/2020 05:42:04 AM
rw-r--r--
📄
Settings.ts
5.44 KB
02/20/2020 05:42:04 AM
rw-r--r--
📄
SettingsTypes.ts
6.75 KB
02/20/2020 05:42:05 AM
rw-r--r--
📄
Shortcuts.ts
6.68 KB
02/20/2020 05:42:05 AM
rw-r--r--
📄
ThemeManager.ts
1016 bytes
02/20/2020 05:42:06 AM
rw-r--r--
📄
Tinymce.ts
7.54 KB
02/20/2020 05:42:06 AM
rw-r--r--
📄
UndoManager.ts
11.93 KB
02/20/2020 05:42:09 AM
rw-r--r--
📄
WindowManager.ts
7.1 KB
02/20/2020 05:42:09 AM
rw-r--r--
📁
dom
-
02/20/2020 06:46:12 AM
rwxr-xr-x
📁
file
-
02/20/2020 06:11:56 AM
rwxr-xr-x
📁
fmt
-
02/20/2020 06:11:59 AM
rwxr-xr-x
📁
geom
-
02/20/2020 06:12:03 AM
rwxr-xr-x
📁
html
-
02/20/2020 06:12:08 AM
rwxr-xr-x
📁
ui
-
02/20/2020 06:12:12 AM
rwxr-xr-x
📁
util
-
02/20/2020 06:12:21 AM
rwxr-xr-x
Editing: Annotator.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 { Element } from '@ephox/dom-globals'; import { Arr, Obj, Option } from '@ephox/katamari'; import { Remove } from '@ephox/sugar'; import * as AnnotationChanges from '../annotate/AnnotationChanges'; import * as AnnotationFilter from '../annotate/AnnotationFilter'; import { create } from '../annotate/AnnotationsRegistry'; import { findAll, identify } from '../annotate/Identification'; import { annotateWithBookmark, Decorator, DecoratorData } from '../annotate/Wrapping'; import Editor from './Editor'; export type AnnotationListenerApi = AnnotationChanges.AnnotationListener; /** * This is the annotator api. * * @class tinymce.Annotator */ export interface AnnotatorSettings { decorate: Decorator; persistent?: boolean; } interface Annotator { register: (name: string, settings: AnnotatorSettings) => void; annotate: (name: string, data: DecoratorData) => void; annotationChanged: (name: string, f: AnnotationListenerApi) => void; remove: (name: string) => void; getAll: (name: string) => Record<string, Element[]>; } const Annotator = function (editor: Editor): Annotator { const registry = create(); AnnotationFilter.setup(editor, registry); const changes = AnnotationChanges.setup(editor, registry); return { /** * Registers a specific annotator by name * * @method register * @param {String} name the name of the annotation * @param {Object} settings settings for the annotation (e.g. decorate) */ register: (name: string, settings: AnnotatorSettings) => { registry.register(name, settings); }, /** * Applies the annotation at the current selection using data * * @method annotate * @param {String} name the name of the annotation to apply * @param {Object} data information to pass through to this particular * annotation */ annotate: (name: string, data: { }) => { registry.lookup(name).each((settings) => { annotateWithBookmark(editor, name, settings, data); }); }, /** * Executes the specified callback when the current selection matches the annotation or not. * * @method annotationChanged * @param {String} name Name of annotation to listen for * @param {function} callback Calback with (state, name, and data) fired when the annotation * at the cursor changes. If state if false, data will not be provided. */ annotationChanged: (name: string, callback: AnnotationListenerApi) => { changes.addListener(name, callback); }, /** * Removes any annotations from the current selection that match * the name * * @param remove * @param {String} name the name of the annotation to remove */ remove: (name: string): void => { identify(editor, Option.some(name)).each(({ elements }) => { Arr.each(elements, Remove.unwrap); }); }, /** * Retrieve all the annotations for a given name * * @method getAll * @param {String} name the name of the annotations to retrieve * @return {Object} an index of annotations from uid => DOM nodes */ getAll: (name: string): Record<string, Element[]> => { const directory = findAll(editor, name); return Obj.map(directory, (elems) => Arr.map(elems, (elem) => elem.dom())); } }; }; export default Annotator;