Sha256: dd7771ec2a14493c9aa212d32f206afe74b57b9519cb1cd52e97291c5c3b028b

Contents?: true

Size: 1.58 KB

Versions: 12

Compression:

Stored size: 1.58 KB

Contents

/**
 * plugin.js
 *
 * Released under LGPL License.
 * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

/*global tinymce:true */

tinymce.PluginManager.add('emoticons', function(editor, url) {
	var emoticons = [
		["cool", "cry", "embarassed", "foot-in-mouth"],
		["frown", "innocent", "kiss", "laughing"],
		["money-mouth", "sealed", "smile", "surprised"],
		["tongue-out", "undecided", "wink", "yell"]
	];

	function getHtml() {
		var emoticonsHtml;

		emoticonsHtml = '<table role="list" class="mce-grid">';

		tinymce.each(emoticons, function(row) {
			emoticonsHtml += '<tr>';

			tinymce.each(row, function(icon) {
				var emoticonUrl = url + '/img/smiley-' + icon + '.gif';

				emoticonsHtml += '<td><a href="#" data-mce-url="' + emoticonUrl + '" data-mce-alt="' + icon + '" tabindex="-1" ' +
					'role="option" aria-label="' + icon + '"><img src="' +
					emoticonUrl + '" style="width: 18px; height: 18px" role="presentation" /></a></td>';
			});

			emoticonsHtml += '</tr>';
		});

		emoticonsHtml += '</table>';

		return emoticonsHtml;
	}

	editor.addButton('emoticons', {
		type: 'panelbutton',
		panel: {
			role: 'application',
			autohide: true,
			html: getHtml,
			onclick: function(e) {
				var linkElm = editor.dom.getParent(e.target, 'a');

				if (linkElm) {
					editor.insertContent(
						'<img src="' + linkElm.getAttribute('data-mce-url') + '" alt="' + linkElm.getAttribute('data-mce-alt') + '" />'
					);

					this.hide();
				}
			}
		},
		tooltip: 'Emoticons'
	});
});

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
mosaico-2.0.0 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js
mosaico-1.1.1 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js
mosaico-1.1.0 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js
mosaico-1.0.2 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js
mosaico-1.0.1 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js
goldencobra-2.3.4 app/assets/javascripts/goldencobra/html_editors/tinymce_v4/plugins/emoticons/plugin.js
goldencobra-2.3.3 app/assets/javascripts/goldencobra/html_editors/tinymce_v4/plugins/emoticons/plugin.js
mosaico-1.0.0 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js
jinda_bsb-0.0.1 lib/generators/jinda_bsb/templates/app/assets/jinda_assets/plugins/tinymce/plugins/emoticons/plugin.js
spiderfw-1.0.1 apps/core/components/public/js/tinymce/plugins/emoticons/plugin.js
spiderfw-1.0.0 apps/core/components/public/js/tinymce/plugins/emoticons/plugin.js
spiderfw-0.6.39 apps/core/components/public/js/tinymce/plugins/emoticons/plugin.js