OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
silver
/
main
/
ts
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:33:47 AM
rwxr-xr-x
📄
Autocompleter.ts
5.13 KB
02/20/2020 06:45:58 AM
rw-r--r--
📄
ContextToolbar.ts
8 KB
02/20/2020 06:45:59 AM
rw-r--r--
📄
Events.ts
3.03 KB
02/20/2020 06:46:00 AM
rw-r--r--
📄
InlinePopup.ts
1.55 KB
02/20/2020 06:46:01 AM
rw-r--r--
📄
Render.ts
10.12 KB
02/20/2020 06:46:01 AM
rw-r--r--
📄
Theme.ts
1.4 KB
02/20/2020 06:46:02 AM
rw-r--r--
📁
alien
-
02/20/2020 06:33:51 AM
rwxr-xr-x
📁
api
-
02/20/2020 06:33:51 AM
rwxr-xr-x
📁
backstage
-
02/20/2020 06:33:58 AM
rwxr-xr-x
📁
modes
-
02/20/2020 06:34:02 AM
rwxr-xr-x
📁
ui
-
02/20/2020 06:40:48 AM
rwxr-xr-x
Editing: Events.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 { Channels, Attachment, SystemEvents } from '@ephox/alloy'; import { document } from '@ephox/dom-globals'; import { Arr } from '@ephox/katamari'; import { DomEvent, Element } from '@ephox/sugar'; import Editor from 'tinymce/core/api/Editor'; const setup = (editor: Editor, mothership, uiMothership) => { const onMousedown = DomEvent.bind(Element.fromDom(document), 'mousedown', function (evt) { Arr.each([ mothership, uiMothership ], function (ship) { ship.broadcastOn([ Channels.dismissPopups() ], { target: evt.target() }); }); }); const onTouchstart = DomEvent.bind(Element.fromDom(document), 'touchstart', function (evt) { Arr.each([ mothership, uiMothership ], function (ship) { ship.broadcastOn([ Channels.dismissPopups() ], { target: evt.target() }); }); }); const onMouseup = DomEvent.bind(Element.fromDom(document), 'mouseup', function (evt) { if (evt.raw().button === 0) { Arr.each([ mothership, uiMothership ], function (ship) { ship.broadcastOn([ Channels.mouseReleased() ], { target: evt.target() }); }); } }); const onContentMousedown = function (raw) { Arr.each([ mothership, uiMothership ], function (ship) { ship.broadcastOn([ Channels.dismissPopups() ], { target: Element.fromDom(raw.target) }); }); }; editor.on('mousedown', onContentMousedown); editor.on('touchstart', onContentMousedown); const onContentMouseup = function (raw) { if (raw.button === 0) { Arr.each([ mothership, uiMothership ], function (ship) { ship.broadcastOn([ Channels.mouseReleased() ], { target: Element.fromDom(raw.target) }); }); } }; editor.on('mouseup', onContentMouseup); const onWindowScroll = (evt) => { Arr.each([ mothership, uiMothership ], (ship) => { ship.broadcastEvent(SystemEvents.windowScroll(), evt); }); }; editor.on('ScrollWindow', onWindowScroll); const onWindowResize = (evt) => { Arr.each([ mothership, uiMothership ], (ship) => { ship.broadcastEvent(SystemEvents.windowResize(), evt); }); }; editor.on('ResizeWindow', onWindowResize); editor.on('remove', () => { // We probably don't need these unbinds, but it helps to have them if we move this code out. editor.off('mousedown', onContentMousedown); editor.off('touchstart', onContentMousedown); editor.off('mouseup', onContentMouseup); editor.off('ResizeWindow', onWindowResize); editor.off('ScrollWindow', onWindowScroll); onMousedown.unbind(); onTouchstart.unbind(); onMouseup.unbind(); }); editor.on('detach', () => { Attachment.detachSystem(mothership); Attachment.detachSystem(uiMothership); mothership.destroy(); uiMothership.destroy(); }); }; export default { setup };