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: NotificationManager.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, Option } from '@ephox/katamari'; import EditorView from '../EditorView'; import { NotificationManagerImpl } from '../ui/NotificationManagerImpl'; import Editor from './Editor'; import Delay from './util/Delay'; export interface NotificationManagerImpl { open (spec: NotificationSpec, closeCallback?: () => void): Notification; close <T extends Notification>(notification: T): void; reposition <T extends Notification>(notifications: T[]): void; getArgs <T extends Notification>(notification: T): NotificationSpec; } export interface NotificationSpec { type: 'info' | 'warn' | 'error' | 'success'; text: string; icon?: string; progressBar?: boolean; timeout?: number; } export interface Notification { close: () => void; progressBar: { value: (percent: number) => void; }; text: (text: string) => void; } interface NotificationManager { open: (spec: NotificationSpec) => Notification; close: () => void; getNotifications: () => Notification[]; } /** * This class handles the creation of TinyMCE's notifications. * * @class tinymce.NotificationManager * @example * // Opens a new notification of type "error" with text "An error occurred." * tinymce.activeEditor.notificationManager.open({ * text: 'An error occurred.', * type: 'error' * }); */ function NotificationManager(editor: Editor): NotificationManager { const notifications: Notification[] = []; const getImplementation = function (): NotificationManagerImpl { const theme = editor.theme; return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl(); }; const getTopNotification = function (): Option<Notification> { return Option.from(notifications[0]); }; const isEqual = function (a: NotificationSpec, b: NotificationSpec) { return a.type === b.type && a.text === b.text && !a.progressBar && !a.timeout && !b.progressBar && !b.timeout; }; const reposition = function () { if (notifications.length > 0) { getImplementation().reposition(notifications); } }; const addNotification = function (notification: Notification) { notifications.push(notification); }; const closeNotification = function (notification: Notification) { Arr.findIndex(notifications, function (otherNotification) { return otherNotification === notification; }).each(function (index) { // Mutate here since third party might have stored away the window array // TODO: Consider breaking this api notifications.splice(index, 1); }); }; const open = function (spec: NotificationSpec) { // Never open notification if editor has been removed. if (editor.removed || !EditorView.isEditorAttachedToDom(editor)) { return; } return Arr.find(notifications, function (notification) { return isEqual(getImplementation().getArgs(notification), spec); }).getOrThunk(function () { editor.editorManager.setActive(editor); const notification = getImplementation().open(spec, function () { closeNotification(notification); reposition(); }); addNotification(notification); reposition(); return notification; }); }; const close = function () { getTopNotification().each(function (notification) { getImplementation().close(notification); closeNotification(notification); reposition(); }); }; const getNotifications = function (): Notification[] { return notifications; }; const registerEvents = function (editor: Editor) { editor.on('SkinLoaded', function () { const serviceMessage = editor.settings.service_message; if (serviceMessage) { open({ text: serviceMessage, type: 'warn', timeout: 0, }); } }); // NodeChange is needed for inline mode and autoresize as the positioning is done // from the bottom up, which changes when the content in the editor changes. editor.on('ResizeEditor ResizeWindow NodeChange', function () { Delay.requestAnimationFrame(reposition); }); editor.on('remove', function () { Arr.each(notifications.slice(), function (notification) { getImplementation().close(notification); }); }); }; registerEvents(editor); return { /** * Opens a new notification. * * @method open * @param {Object} args Optional name/value settings collection contains things like timeout/color/message etc. */ open, /** * Closes the top most notification. * * @method close */ close, /** * Returns the currently opened notification objects. * * @method getNotifications * @return {Array} Array of the currently opened notifications. */ getNotifications }; } export default NotificationManager;