PHP Classes

File: public/js/tinymce/src/plugins/autosave/src/main/js/ui/Buttons.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/autosave/src/main/js/ui/Buttons.js   Download  
File: public/js/tinymce/src/plugins/autosave/src/main/js/ui/Buttons.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,486 bytes
 

Contents

Class file image Download
/** * Buttons.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.plugins.autosave.ui.Buttons', [ 'tinymce.plugins.autosave.core.Storage' ], function (Storage) { var postRender = function (editor, started) { return function (e) { var ctrl = e.control; ctrl.disabled(!Storage.hasDraft(editor)); editor.on('StoreDraft RestoreDraft RemoveDraft', function () { ctrl.disabled(!Storage.hasDraft(editor)); }); // TODO: Investigate why this is only done on postrender that would // make the feature broken if only the menu item was rendered since // it is rendered when the menu appears Storage.startStoreDraft(editor, started); }; }; var register = function (editor, started) { editor.addButton('restoredraft', { title: 'Restore last draft', onclick: function () { Storage.restoreLastDraft(editor); }, onPostRender: postRender(editor, started) }); editor.addMenuItem('restoredraft', { text: 'Restore last draft', onclick: function () { Storage.restoreLastDraft(editor); }, onPostRender: postRender(editor, started), context: 'file' }); }; return { register: register }; } );