4
* Copyright, Moxiecode Systems AB
5
* Released under LGPL License.
7
* License: http://www.tinymce.com/license
8
* Contributing: http://www.tinymce.com/contributing
11
/*global tinymce:true */
13
tinymce.PluginManager.add('colorpicker', function(editor) {
14
function colorPickerCallback(callback, value) {
15
function setColor(value) {
16
var color = new tinymce.util.Color(value), rgb = color.toRgb();
22
hex: color.toHex().substr(1)
25
showPreview(color.toHex());
28
function showPreview(hexColor) {
29
win.find('#preview')[0].getEl().style.background = hexColor;
32
var win = editor.windowManager.open({
45
onchange: function() {
49
win.find('#r').value(rgb.r);
50
win.find('#g').value(rgb.g);
51
win.find('#b').value(rgb.b);
52
win.find('#hex').value(this.value().substr(1));
53
showPreview(this.value());
67
onchange: function() {
68
var colorPickerCtrl = win.find('colorpicker')[0];
77
colorPickerCtrl.value(value);
82
r: win.find('#r').value(),
83
g: win.find('#g').value(),
84
b: win.find('#b').value()
87
colorPickerCtrl.value(value);
92
{name: 'r', label: 'R', autofocus: 1},
93
{name: 'g', label: 'G'},
94
{name: 'b', label: 'B'},
95
{name: 'hex', label: '#', value: '000000'},
96
{name: 'preview', type: 'container', border: 1}
101
onSubmit: function() {
102
callback('#' + this.toJSON().hex);
109
if (!editor.settings.color_picker_callback) {
110
editor.settings.color_picker_callback = colorPickerCallback;
b'\\ No newline at end of file'