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: WindowManager.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 { Types } from '@ephox/bridge'; import { Arr, Option } from '@ephox/katamari'; import SelectionBookmark from '../selection/SelectionBookmark'; import WindowManagerImpl from '../ui/WindowManagerImpl'; import Editor from './Editor'; /** * This class handles the creation of native windows and dialogs. This class can be extended to provide for example inline dialogs. * * @class tinymce.WindowManager * @example * // Opens a new dialog with the file.htm file and the size 320x240 * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog. * tinymce.activeEditor.windowManager.open({ * url: 'file.htm', * width: 320, * height: 240 * }, { * custom_param: 1 * }); * * // Displays an alert box using the active editors window manager instance * tinymce.activeEditor.windowManager.alert('Hello world!'); * * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm * }); */ type InstanceApi<T> = Types.UrlDialog.UrlDialogInstanceApi | Types.Dialog.DialogInstanceApi<T>; export interface WindowManagerImpl { open: <T>(config: Types.Dialog.DialogApi<T>, params, closeWindow: (dialog: Types.Dialog.DialogInstanceApi<T>) => void) => Types.Dialog.DialogInstanceApi<T>; openUrl: <T>(config: Types.UrlDialog.UrlDialogApi, closeWindow: (dialog: Types.UrlDialog.UrlDialogInstanceApi) => void) => Types.UrlDialog.UrlDialogInstanceApi; alert: (message: string, callback: () => void) => void; confirm: (message: string, callback: (state: boolean) => void) => void; close: (dialog: InstanceApi<any>) => void; } interface WindowManager { open: <T>(config: Types.Dialog.DialogApi<T>, params?) => Types.Dialog.DialogInstanceApi<T>; openUrl: <T>(config: Types.UrlDialog.UrlDialogApi) => Types.UrlDialog.UrlDialogInstanceApi; alert: (message: string, callback?: () => void, scope?) => void; confirm: (message: string, callback?: (state: boolean) => void, scope?) => void; close: () => void; } const WindowManager = function (editor: Editor): WindowManager { let dialogs: InstanceApi<any>[] = []; const getImplementation = function (): WindowManagerImpl { const theme = editor.theme; return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl(); }; const funcBind = function (scope, f) { return function () { return f ? f.apply(scope, arguments) : undefined; }; }; const fireOpenEvent = function <T>(dialog: InstanceApi<T>) { editor.fire('OpenWindow', { dialog }); }; const fireCloseEvent = function <T>(dialog: InstanceApi<T>) { editor.fire('CloseWindow', { dialog }); }; const addDialog = function <T>(dialog: InstanceApi<T>) { dialogs.push(dialog); fireOpenEvent(dialog); }; const closeDialog = function <T>(dialog: InstanceApi<T>) { fireCloseEvent(dialog); dialogs = Arr.filter(dialogs, function (otherDialog) { return otherDialog !== dialog; }); // Move focus back to editor when the last window is closed if (dialogs.length === 0) { editor.focus(); } }; const getTopDialog = function () { return Option.from(dialogs[dialogs.length - 1]); }; const storeSelectionAndOpenDialog = <T extends InstanceApi<any>>(openDialog: () => T) => { editor.editorManager.setActive(editor); SelectionBookmark.store(editor); const dialog = openDialog(); addDialog(dialog); return dialog; }; const open = function <T>(args, params?): Types.Dialog.DialogInstanceApi<T> { return storeSelectionAndOpenDialog(() => getImplementation().open<T>(args, params, closeDialog)); }; const openUrl = function (args): Types.UrlDialog.UrlDialogInstanceApi { return storeSelectionAndOpenDialog(() => getImplementation().openUrl(args, closeDialog)); }; const alert = function (message, callback?: () => void, scope?) { getImplementation().alert(message, funcBind(scope ? scope : this, callback)); }; const confirm = function (message, callback?: (state: boolean) => void, scope?) { getImplementation().confirm(message, funcBind(scope ? scope : this, callback)); }; const close = function () { getTopDialog().each(function (dialog) { getImplementation().close(dialog); closeDialog(dialog); }); }; editor.on('remove', function () { Arr.each(dialogs, function (dialog) { getImplementation().close(dialog); }); }); return { /** * Opens a new window. * * @method open * @param {Object} args Optional name/value settings collection contains things like title/body etc. * @param {Object} params Options like title, file, width, height etc. * @option {String} title Window title. * @option {Object} body Object containing the items to render in the window. */ open, /** * Opens a new window for the specified url. * * @method openUrl * @param {Object} args Optional name/value settings collection contains things like width/height/url etc. * @param {Object} params Options like title, file, width, height etc. * @option {String} title Window title. * @option {String} url URL of the file to open in the window. * @option {Number} width Width in pixels. * @option {Number} height Height in pixels. */ openUrl, /** * Creates a alert dialog. Please don't use the blocking behavior of this * native version use the callback method instead then it can be extended. * * @method alert * @param {String} message Text to display in the new alert dialog. * @param {function} callback Callback function to be executed after the user has selected ok. * @param {Object} scope Optional scope to execute the callback in. * @example * // Displays an alert box using the active editors window manager instance * tinymce.activeEditor.windowManager.alert('Hello world!'); */ alert, /** * Creates a confirm dialog. Please don't use the blocking behavior of this * native version use the callback method instead then it can be extended. * * @method confirm * @param {String} message Text to display in the new confirm dialog. * @param {function} callback Callback function to be executed after the user has selected ok or cancel. * @param {Object} scope Optional scope to execute the callback in. * @example * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) { * if (s) * tinymce.activeEditor.windowManager.alert("Ok"); * else * tinymce.activeEditor.windowManager.alert("Cancel"); * }); */ confirm, /** * Closes the top most window. * * @method close */ close }; }; export default WindowManager;