PHP Classes

File: public/js/tinymce/src/themes/mobile/src/main/js/util/StyleConversions.js

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

Contents

Class file image Download
define( 'tinymce.themes.mobile.util.StyleConversions', [ 'ephox.boulder.api.Objects', 'ephox.katamari.api.Arr', 'ephox.katamari.api.Merger' ], function (Objects, Arr, Merger) { var getFromExpandingItem = function (item) { var newItem = Merger.deepMerge( Objects.exclude(item, [ 'items' ]), { menu: true } ); var rest = expand(item.items, item.title); var newMenus = Merger.deepMerge( rest.menus, Objects.wrap( item.title, rest.items ) ); var newExpansions = Merger.deepMerge( rest.expansions, Objects.wrap(item.title, item.title) ); return { item: newItem, menus: newMenus, expansions: newExpansions }; }; var getFromItem = function (item) { return Objects.hasKey(item, 'items') ? getFromExpandingItem(item) : { item: item, menus: { }, expansions: { } }; }; // Takes items, and consolidates them into its return value var expand = function (items) { return Arr.foldr(items, function (acc, item) { var newData = getFromItem(item); return { menus: Merger.deepMerge(acc.menus, newData.menus), items: [ newData.item ].concat(acc.items), expansions: Merger.deepMerge(acc.expansions, newData.expansions) }; }, { menus: { }, expansions: { }, items: [ ] }); }; return { expand: expand }; } );