PHP Classes

File: public/js/tinymce/src/plugins/textcolor/src/main/js/core/TextColor.js

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

Contents

Class file image Download
/** * TextColor.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.textcolor.core.TextColor', [ ], function () { var getCurrentColor = function (editor, format) { var color; editor.dom.getParents(editor.selection.getStart(), function (elm) { var value; if ((value = elm.style[format === 'forecolor' ? 'color' : 'background-color'])) { color = value; } }); return color; }; var mapColors = function (colorMap) { var i, colors = []; for (i = 0; i < colorMap.length; i += 2) { colors.push({ text: colorMap[i + 1], color: '#' + colorMap[i] }); } return colors; }; var applyFormat = function (editor, format, value) { editor.undoManager.transact(function () { editor.focus(); editor.formatter.apply(format, { value: value }); editor.nodeChanged(); }); }; var removeFormat = function (editor, format) { editor.undoManager.transact(function () { editor.focus(); editor.formatter.remove(format, { value: null }, null, true); editor.nodeChanged(); }); }; return { getCurrentColor: getCurrentColor, mapColors: mapColors, applyFormat: applyFormat, removeFormat: removeFormat }; } );