PHP Classes

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

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/toc/src/main/js/ui/Buttons.js   Download  
File: public/js/tinymce/src/plugins/toc/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,469 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.toc.ui.Buttons', [ 'tinymce.plugins.toc.api.Settings', 'tinymce.plugins.toc.core.Toc' ], function (Settings, Toc) { var toggleState = function (editor) { return function (e) { var ctrl = e.control; editor.on('LoadContent SetContent change', function () { ctrl.disabled(editor.readonly || !Toc.hasHeaders(editor)); }); }; }; var isToc = function (editor) { return function (elm) { return elm && editor.dom.is(elm, '.' + Settings.getTocClass(editor)) && editor.getBody().contains(elm); }; }; var register = function (editor) { editor.addButton('toc', { tooltip: 'Table of Contents', cmd: 'mceInsertToc', icon: 'toc', onPostRender: toggleState(editor) }); editor.addButton('tocupdate', { tooltip: 'Update', cmd: 'mceUpdateToc', icon: 'reload' }); editor.addMenuItem('toc', { text: "Table of Contents", context: 'insert', cmd: 'mceInsertToc', onPostRender: toggleState(editor) }); editor.addContextToolbar(isToc(editor), 'tocupdate'); }; return { register: register }; } );