PHP Classes

File: public/js/tinymce/src/themes/mobile/src/main/js/ui/HeadingSlider.js

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

Contents

Class file image Download
define( 'tinymce.themes.mobile.ui.HeadingSlider', [ 'ephox.katamari.api.Arr', 'ephox.sugar.api.dom.Compare', 'ephox.sugar.api.node.Element', 'ephox.sugar.api.node.Node', 'ephox.sugar.api.search.TransformFind', 'tinymce.themes.mobile.ui.SizeSlider', 'tinymce.themes.mobile.ui.ToolbarWidgets', 'tinymce.themes.mobile.util.UiDomFactory' ], function (Arr, Compare, Element, Node, TransformFind, SizeSlider, ToolbarWidgets, UiDomFactory) { var headings = [ 'p', 'h3', 'h2', 'h1' ]; var makeSlider = function (spec) { return SizeSlider.sketch({ category: 'heading', sizes: headings, onChange: spec.onChange, getInitialValue: spec.getInitialValue }); }; var sketch = function (realm, editor) { var spec = { onChange: function (value) { editor.execCommand('FormatBlock', null, headings[value].toLowerCase()); }, getInitialValue: function () { var node = editor.selection.getStart(); var elem = Element.fromDom(node); return TransformFind.closest(elem, function (e) { var nodeName = Node.name(e); return Arr.indexOf(headings, nodeName); }, function (e) { return Compare.eq(e, Element.fromDom(editor.getBody())); }).getOr(0); } }; return ToolbarWidgets.button(realm, 'heading', function () { return [ UiDomFactory.spec('<span class="${prefix}-toolbar-button ${prefix}-icon-small-heading ${prefix}-icon"></span>'), makeSlider(spec), UiDomFactory.spec('<span class="${prefix}-toolbar-button ${prefix}-icon-large-heading ${prefix}-icon"></span>') ]; }); }; return { sketch: sketch }; } );