OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
silver
/
main
/
ts
/
ui
/
core
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:40:48 AM
rwxr-xr-x
📄
AlignmentButtons.ts
1.45 KB
02/20/2020 06:38:07 AM
rw-r--r--
📄
ComplexControls.ts
716 bytes
02/20/2020 06:38:08 AM
rw-r--r--
📄
FormatControls.ts
1015 bytes
02/20/2020 06:38:08 AM
rw-r--r--
📄
IndentOutdent.ts
1.16 KB
02/20/2020 06:38:09 AM
rw-r--r--
📄
LinkTargets.ts
4.05 KB
02/20/2020 06:38:10 AM
rw-r--r--
📄
SimpleControls.ts
4.59 KB
02/20/2020 06:38:10 AM
rw-r--r--
📄
UndoRedo.ts
1.9 KB
02/20/2020 06:38:11 AM
rw-r--r--
📄
VisualAid.ts
1.22 KB
02/20/2020 06:38:11 AM
rw-r--r--
📁
color
-
02/20/2020 06:40:29 AM
rwxr-xr-x
📁
complex
-
02/20/2020 06:42:37 AM
rwxr-xr-x
Editing: UndoRedo.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 Editor from 'tinymce/core/api/Editor'; import { Menu } from '@ephox/bridge'; const toggleUndoRedoState = (api: Menu.MenuItemInstanceApi, editor: Editor, type: 'hasUndo' | 'hasRedo') => { const checkState = () => { return editor.undoManager ? editor.undoManager[type]() : false; }; const onUndoStateChange = () => { api.setDisabled(editor.readonly || !checkState()); }; api.setDisabled(!checkState()); editor.on('Undo Redo AddUndo TypingUndo ClearUndos SwitchMode', onUndoStateChange); return () => editor.off('Undo Redo AddUndo TypingUndo ClearUndos SwitchMode', onUndoStateChange); }; const registerMenuItems = (editor: Editor) => { editor.ui.registry.addMenuItem('undo', { text: 'Undo', icon: 'undo', shortcut: 'Meta+Z', onSetup: (api) => toggleUndoRedoState(api, editor, 'hasUndo'), onAction: () => editor.execCommand('undo') }); editor.ui.registry.addMenuItem('redo', { text: 'Redo', icon: 'redo', shortcut: 'Meta+Y', onSetup: (api) => toggleUndoRedoState(api, editor, 'hasRedo'), onAction: () => editor.execCommand('redo') }); }; const registerButtons = (editor: Editor) => { editor.ui.registry.addButton('undo', { tooltip: 'Undo', icon: 'undo', onSetup: (api) => toggleUndoRedoState(api, editor, 'hasUndo'), onAction: () => editor.execCommand('undo') }); editor.ui.registry.addButton('redo', { tooltip: 'Redo', icon: 'redo', onSetup: (api) => toggleUndoRedoState(api, editor, 'hasRedo'), onAction: () => editor.execCommand('redo') }); }; const register = (editor: Editor) => { registerMenuItems(editor); registerButtons(editor); }; export default { register };