PHP Classes

File: public/js/tinymce/src/ui/src/main/js/editorui/UndoRedo.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/ui/src/main/js/editorui/UndoRedo.js   Download  
File: public/js/tinymce/src/ui/src/main/js/editorui/UndoRedo.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,757 bytes
 

Contents

Class file image Download
/** * UndoRedo.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.ui.editorui.UndoRedo', [ ], function () { var toggleUndoRedoState = function (editor, type) { return function () { var self = this; var checkState = function () { var typeFn = type === 'redo' ? 'hasRedo' : 'hasUndo'; return editor.undoManager ? editor.undoManager[typeFn]() : false; }; self.disabled(!checkState()); editor.on('Undo Redo AddUndo TypingUndo ClearUndos SwitchMode', function () { self.disabled(editor.readonly || !checkState()); }); }; }; var registerMenuItems = function (editor) { editor.addMenuItem('undo', { text: 'Undo', icon: 'undo', shortcut: 'Meta+Z', onPostRender: toggleUndoRedoState(editor, 'undo'), cmd: 'undo' }); editor.addMenuItem('redo', { text: 'Redo', icon: 'redo', shortcut: 'Meta+Y', onPostRender: toggleUndoRedoState(editor, 'redo'), cmd: 'redo' }); }; var registerButtons = function (editor) { editor.addButton('undo', { tooltip: 'Undo', onPostRender: toggleUndoRedoState(editor, 'undo'), cmd: 'undo' }); editor.addButton('redo', { tooltip: 'Redo', onPostRender: toggleUndoRedoState(editor, 'redo'), cmd: 'redo' }); }; var register = function (editor) { registerMenuItems(editor); registerButtons(editor); }; return { register: register }; } );