glebtv-ckeditor 4.0.2.2 → 4.0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/lib/ckeditor.rb +4 -4
- data/lib/ckeditor/rails_admin/{config/fields/types/ckeditor.rb → field.rb} +0 -0
- data/lib/ckeditor/version.rb +1 -1
- data/vendor/assets/javascripts/ckeditor/config.js.erb +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/CKCss/dialogs/ckcss.js +18 -30
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +340 -0
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/lang/en.js +11 -0
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/lang/ru.js +11 -0
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/plugin.js +65 -0
- metadata +8 -4
data/Gemfile
CHANGED
data/lib/ckeditor.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
require 'orm_adapter'
|
2
2
|
require 'pathname'
|
3
3
|
|
4
|
-
if Object.const_defined?("RailsAdmin")
|
5
|
-
require "ckeditor/rails_admin/config/fields/types/ckeditor"
|
6
|
-
end
|
7
|
-
|
8
4
|
module Ckeditor
|
9
5
|
IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/pjpeg', 'image/tiff', 'image/x-png']
|
10
6
|
|
@@ -80,3 +76,7 @@ end
|
|
80
76
|
|
81
77
|
require 'ckeditor/engine'
|
82
78
|
require 'ckeditor/version'
|
79
|
+
|
80
|
+
if Object.const_defined?("RailsAdmin")
|
81
|
+
require "ckeditor/rails_admin/field"
|
82
|
+
end
|
File without changes
|
data/lib/ckeditor/version.rb
CHANGED
@@ -28,7 +28,7 @@ CKEDITOR.editorConfig = function( config )
|
|
28
28
|
config.filebrowserUploadUrl = "/ckeditor/attachment_files";
|
29
29
|
|
30
30
|
config.stylesSet = [];
|
31
|
-
config.extraPlugins = "font,magicline,codemirror,mediaembed,stylesheetparser,LoremIpsum,CKCss";
|
31
|
+
config.extraPlugins = "colordialog,font,magicline,codemirror,mediaembed,stylesheetparser,LoremIpsum,CKCss";
|
32
32
|
config.contentsCss = "<%= stylesheet_path('ckcontent.css') %>";
|
33
33
|
|
34
34
|
// Rails CSRF token
|
@@ -675,16 +675,14 @@
|
|
675
675
|
},
|
676
676
|
{
|
677
677
|
type: 'button',
|
678
|
-
id: '
|
678
|
+
id: 'txcolorChoose',
|
679
679
|
label: editor.lang.CKCss.choose,
|
680
680
|
style: 'margin-left: 10px',
|
681
681
|
onClick: function () {
|
682
682
|
var self = this;
|
683
|
-
|
683
|
+
editor.getColorFromDialog(function(val) {
|
684
684
|
var destElem = self.getDialog().getContentElement('page1', 'color');
|
685
|
-
destElem.setValue(
|
686
|
-
colorDialog.getContentElement('picker', 'selectedColor').getValue()
|
687
|
-
);
|
685
|
+
destElem.setValue(val);
|
688
686
|
preview(destElem);
|
689
687
|
});
|
690
688
|
}
|
@@ -1019,16 +1017,14 @@
|
|
1019
1017
|
},
|
1020
1018
|
{
|
1021
1019
|
type: 'button',
|
1022
|
-
id: '
|
1020
|
+
id: 'bgcolorChoose',
|
1023
1021
|
label: editor.lang.CKCss.choose,
|
1024
1022
|
style: 'margin-left: 10px',
|
1025
1023
|
onClick: function () {
|
1026
1024
|
var self = this;
|
1027
|
-
|
1025
|
+
editor.getColorFromDialog(function(val) {
|
1028
1026
|
var destElem = self.getDialog().getContentElement('page3', 'backgroundColor');
|
1029
|
-
destElem.setValue(
|
1030
|
-
colorDialog.getContentElement('picker', 'selectedColor').getValue()
|
1031
|
-
);
|
1027
|
+
destElem.setValue(val);
|
1032
1028
|
preview(destElem);
|
1033
1029
|
});
|
1034
1030
|
}
|
@@ -1383,16 +1379,14 @@
|
|
1383
1379
|
},
|
1384
1380
|
{
|
1385
1381
|
type: 'button',
|
1386
|
-
id: '
|
1382
|
+
id: 'btcolorChoose',
|
1387
1383
|
label: editor.lang.CKCss.choose,
|
1388
1384
|
style: 'margin-left: 10px',
|
1389
1385
|
onClick: function () {
|
1390
1386
|
var self = this;
|
1391
|
-
|
1387
|
+
editor.getColorFromDialog(function(val) {
|
1392
1388
|
var destElem = self.getDialog().getContentElement('page4', 'borderTopColor');
|
1393
|
-
destElem.setValue(
|
1394
|
-
colorDialog.getContentElement('picker', 'selectedColor').getValue()
|
1395
|
-
);
|
1389
|
+
destElem.setValue(val);
|
1396
1390
|
preview(destElem);
|
1397
1391
|
var dialog = destElem.getDialog();
|
1398
1392
|
var elem = dialog.getContentElement('page4', 'borderColorAll');
|
@@ -1485,16 +1479,14 @@
|
|
1485
1479
|
},
|
1486
1480
|
{
|
1487
1481
|
type: 'button',
|
1488
|
-
id: '
|
1482
|
+
id: 'brcolorChoose',
|
1489
1483
|
label: editor.lang.CKCss.choose,
|
1490
1484
|
style: 'margin-left: 10px',
|
1491
1485
|
onClick: function () {
|
1492
1486
|
var self = this;
|
1493
|
-
|
1487
|
+
editor.getColorFromDialog(function(val) {
|
1494
1488
|
var destElem = self.getDialog().getContentElement('page4', 'borderRightColor');
|
1495
|
-
destElem.setValue(
|
1496
|
-
colorDialog.getContentElement('picker', 'selectedColor').getValue()
|
1497
|
-
);
|
1489
|
+
destElem.setValue(val);
|
1498
1490
|
preview(destElem);
|
1499
1491
|
});
|
1500
1492
|
}
|
@@ -1584,16 +1576,14 @@
|
|
1584
1576
|
},
|
1585
1577
|
{
|
1586
1578
|
type: 'button',
|
1587
|
-
id: '
|
1579
|
+
id: 'bbcolorChoose',
|
1588
1580
|
label: editor.lang.CKCss.choose,
|
1589
1581
|
style: 'margin-left: 10px',
|
1590
1582
|
onClick: function () {
|
1591
1583
|
var self = this;
|
1592
|
-
|
1584
|
+
editor.getColorFromDialog(function(val) {
|
1593
1585
|
var destElem = self.getDialog().getContentElement('page4', 'borderBottomColor');
|
1594
|
-
destElem.setValue(
|
1595
|
-
colorDialog.getContentElement('picker', 'selectedColor').getValue()
|
1596
|
-
);
|
1586
|
+
destElem.setValue(val);
|
1597
1587
|
preview(destElem);
|
1598
1588
|
});
|
1599
1589
|
}
|
@@ -1683,16 +1673,14 @@
|
|
1683
1673
|
},
|
1684
1674
|
{
|
1685
1675
|
type: 'button',
|
1686
|
-
id: '
|
1676
|
+
id: 'blcolorChoose',
|
1687
1677
|
label: editor.lang.CKCss.choose,
|
1688
1678
|
style: 'margin-left: 10px',
|
1689
1679
|
onClick: function () {
|
1690
1680
|
var self = this;
|
1691
|
-
|
1681
|
+
editor.getColorFromDialog(function(val) {
|
1692
1682
|
var destElem = self.getDialog().getContentElement('page4', 'borderLeftColor');
|
1693
|
-
destElem.setValue(
|
1694
|
-
colorDialog.getContentElement('picker', 'selectedColor').getValue()
|
1695
|
-
);
|
1683
|
+
destElem.setValue(val);
|
1696
1684
|
preview(destElem);
|
1697
1685
|
});
|
1698
1686
|
}
|
@@ -0,0 +1,340 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.html or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
CKEDITOR.dialog.add( 'colordialog', function( editor ) {
|
7
|
+
// Define some shorthands.
|
8
|
+
var $el = CKEDITOR.dom.element,
|
9
|
+
$doc = CKEDITOR.document,
|
10
|
+
lang = editor.lang.colordialog;
|
11
|
+
|
12
|
+
// Reference the dialog.
|
13
|
+
var dialog;
|
14
|
+
|
15
|
+
var spacer = {
|
16
|
+
type: 'html',
|
17
|
+
html: ' '
|
18
|
+
};
|
19
|
+
|
20
|
+
var selected;
|
21
|
+
|
22
|
+
function clearSelected() {
|
23
|
+
$doc.getById( selHiColorId ).removeStyle( 'background-color' );
|
24
|
+
dialog.getContentElement( 'picker', 'selectedColor' ).setValue( '' );
|
25
|
+
selected && selected.removeAttribute( 'aria-selected' );
|
26
|
+
selected = null;
|
27
|
+
}
|
28
|
+
|
29
|
+
function updateSelected( evt ) {
|
30
|
+
var target = evt.data.getTarget(),
|
31
|
+
color;
|
32
|
+
|
33
|
+
if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) {
|
34
|
+
selected = target;
|
35
|
+
selected.setAttribute( 'aria-selected', true );
|
36
|
+
dialog.getContentElement( 'picker', 'selectedColor' ).setValue( color );
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
// Basing black-white decision off of luma scheme using the Rec. 709 version
|
41
|
+
function whiteOrBlack( color ) {
|
42
|
+
color = color.replace( /^#/, '' );
|
43
|
+
for ( var i = 0, rgb = []; i <= 2; i++ )
|
44
|
+
rgb[ i ] = parseInt( color.substr( i * 2, 2 ), 16 );
|
45
|
+
var luma = ( 0.2126 * rgb[ 0 ] ) + ( 0.7152 * rgb[ 1 ] ) + ( 0.0722 * rgb[ 2 ] );
|
46
|
+
return '#' + ( luma >= 165 ? '000' : 'fff' );
|
47
|
+
}
|
48
|
+
|
49
|
+
// Distinguish focused and hover states.
|
50
|
+
var focused, hovered;
|
51
|
+
|
52
|
+
// Apply highlight style.
|
53
|
+
function updateHighlight( event ) {
|
54
|
+
// Convert to event.
|
55
|
+
!event.name && ( event = new CKEDITOR.event( event ) );
|
56
|
+
|
57
|
+
var isFocus = !( /mouse/ ).test( event.name ),
|
58
|
+
target = event.data.getTarget(),
|
59
|
+
color;
|
60
|
+
|
61
|
+
if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) {
|
62
|
+
removeHighlight( event );
|
63
|
+
|
64
|
+
isFocus ? focused = target : hovered = target;
|
65
|
+
|
66
|
+
// Apply outline style to show focus.
|
67
|
+
if ( isFocus ) {
|
68
|
+
target.setStyle( 'border-color', whiteOrBlack( color ) );
|
69
|
+
target.setStyle( 'border-style', 'dotted' );
|
70
|
+
}
|
71
|
+
|
72
|
+
$doc.getById( hicolorId ).setStyle( 'background-color', color );
|
73
|
+
$doc.getById( hicolorTextId ).setHtml( color );
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
function clearHighlight() {
|
78
|
+
var color = focused.getChild( 0 ).getHtml();
|
79
|
+
focused.setStyle( 'border-color', color );
|
80
|
+
focused.setStyle( 'border-style', 'solid' );
|
81
|
+
$doc.getById( hicolorId ).removeStyle( 'background-color' );
|
82
|
+
$doc.getById( hicolorTextId ).setHtml( ' ' );
|
83
|
+
focused = null;
|
84
|
+
}
|
85
|
+
|
86
|
+
// Remove previously focused style.
|
87
|
+
function removeHighlight( event ) {
|
88
|
+
var isFocus = !( /mouse/ ).test( event.name ),
|
89
|
+
target = isFocus && focused;
|
90
|
+
|
91
|
+
if ( target ) {
|
92
|
+
var color = target.getChild( 0 ).getHtml();
|
93
|
+
target.setStyle( 'border-color', color );
|
94
|
+
target.setStyle( 'border-style', 'solid' );
|
95
|
+
}
|
96
|
+
|
97
|
+
if ( !( focused || hovered ) ) {
|
98
|
+
$doc.getById( hicolorId ).removeStyle( 'background-color' );
|
99
|
+
$doc.getById( hicolorTextId ).setHtml( ' ' );
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
function onKeyStrokes( evt ) {
|
104
|
+
var domEvt = evt.data;
|
105
|
+
|
106
|
+
var element = domEvt.getTarget();
|
107
|
+
var relative, nodeToMove;
|
108
|
+
var keystroke = domEvt.getKeystroke(),
|
109
|
+
rtl = editor.lang.dir == 'rtl';
|
110
|
+
|
111
|
+
switch ( keystroke ) {
|
112
|
+
// UP-ARROW
|
113
|
+
case 38:
|
114
|
+
// relative is TR
|
115
|
+
if ( ( relative = element.getParent().getPrevious() ) ) {
|
116
|
+
nodeToMove = relative.getChild( [ element.getIndex() ] );
|
117
|
+
nodeToMove.focus();
|
118
|
+
}
|
119
|
+
domEvt.preventDefault();
|
120
|
+
break;
|
121
|
+
// DOWN-ARROW
|
122
|
+
case 40:
|
123
|
+
// relative is TR
|
124
|
+
if ( ( relative = element.getParent().getNext() ) ) {
|
125
|
+
nodeToMove = relative.getChild( [ element.getIndex() ] );
|
126
|
+
if ( nodeToMove && nodeToMove.type == 1 ) {
|
127
|
+
nodeToMove.focus();
|
128
|
+
}
|
129
|
+
}
|
130
|
+
domEvt.preventDefault();
|
131
|
+
break;
|
132
|
+
|
133
|
+
// SPACE
|
134
|
+
// ENTER
|
135
|
+
case 32:
|
136
|
+
case 13:
|
137
|
+
updateSelected( evt );
|
138
|
+
domEvt.preventDefault();
|
139
|
+
break;
|
140
|
+
|
141
|
+
// RIGHT-ARROW
|
142
|
+
case rtl ? 37:
|
143
|
+
39 :
|
144
|
+
// relative is TD
|
145
|
+
if ( ( nodeToMove = element.getNext() ) ) {
|
146
|
+
if ( nodeToMove.type == 1 ) {
|
147
|
+
nodeToMove.focus();
|
148
|
+
domEvt.preventDefault( true );
|
149
|
+
}
|
150
|
+
}
|
151
|
+
// relative is TR
|
152
|
+
else if ( ( relative = element.getParent().getNext() ) ) {
|
153
|
+
nodeToMove = relative.getChild( [ 0 ] );
|
154
|
+
if ( nodeToMove && nodeToMove.type == 1 ) {
|
155
|
+
nodeToMove.focus();
|
156
|
+
domEvt.preventDefault( true );
|
157
|
+
}
|
158
|
+
}
|
159
|
+
break;
|
160
|
+
|
161
|
+
// LEFT-ARROW
|
162
|
+
case rtl ? 39:
|
163
|
+
37 :
|
164
|
+
// relative is TD
|
165
|
+
if ( ( nodeToMove = element.getPrevious() ) ) {
|
166
|
+
nodeToMove.focus();
|
167
|
+
domEvt.preventDefault( true );
|
168
|
+
}
|
169
|
+
// relative is TR
|
170
|
+
else if ( ( relative = element.getParent().getPrevious() ) ) {
|
171
|
+
nodeToMove = relative.getLast();
|
172
|
+
nodeToMove.focus();
|
173
|
+
domEvt.preventDefault( true );
|
174
|
+
}
|
175
|
+
break;
|
176
|
+
default:
|
177
|
+
// Do not stop not handled events.
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
function createColorTable() {
|
183
|
+
table = CKEDITOR.dom.element.createFromHtml( '<table tabIndex="-1" aria-label="' + lang.options + '"' +
|
184
|
+
' role="grid" style="border-collapse:separate;" cellspacing="0">' +
|
185
|
+
'<caption class="cke_voice_label">' + lang.options + '</caption>' +
|
186
|
+
'<tbody role="presentation"></tbody></table>' );
|
187
|
+
|
188
|
+
table.on( 'mouseover', updateHighlight );
|
189
|
+
table.on( 'mouseout', removeHighlight );
|
190
|
+
|
191
|
+
// Create the base colors array.
|
192
|
+
var aColors = [ '00', '33', '66', '99', 'cc', 'ff' ];
|
193
|
+
|
194
|
+
// This function combines two ranges of three values from the color array into a row.
|
195
|
+
function appendColorRow( rangeA, rangeB ) {
|
196
|
+
for ( var i = rangeA; i < rangeA + 3; i++ ) {
|
197
|
+
var row = new $el( table.$.insertRow( -1 ) );
|
198
|
+
row.setAttribute( 'role', 'row' );
|
199
|
+
|
200
|
+
for ( var j = rangeB; j < rangeB + 3; j++ ) {
|
201
|
+
for ( var n = 0; n < 6; n++ ) {
|
202
|
+
appendColorCell( row.$, '#' + aColors[ j ] + aColors[ n ] + aColors[ i ] );
|
203
|
+
}
|
204
|
+
}
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
// This function create a single color cell in the color table.
|
209
|
+
function appendColorCell( targetRow, color ) {
|
210
|
+
var cell = new $el( targetRow.insertCell( -1 ) );
|
211
|
+
cell.setAttribute( 'class', 'ColorCell' );
|
212
|
+
cell.setAttribute( 'tabIndex', -1 );
|
213
|
+
cell.setAttribute( 'role', 'gridcell' );
|
214
|
+
|
215
|
+
cell.on( 'keydown', onKeyStrokes );
|
216
|
+
cell.on( 'click', updateSelected );
|
217
|
+
cell.on( 'focus', updateHighlight );
|
218
|
+
cell.on( 'blur', removeHighlight );
|
219
|
+
|
220
|
+
cell.setStyle( 'background-color', color );
|
221
|
+
cell.setStyle( 'border', '1px solid ' + color );
|
222
|
+
|
223
|
+
cell.setStyle( 'width', '14px' );
|
224
|
+
cell.setStyle( 'height', '14px' );
|
225
|
+
|
226
|
+
var colorLabel = numbering( 'color_table_cell' );
|
227
|
+
cell.setAttribute( 'aria-labelledby', colorLabel );
|
228
|
+
cell.append( CKEDITOR.dom.element.createFromHtml( '<span id="' + colorLabel + '" class="cke_voice_label">' + color + '</span>', CKEDITOR.document ) );
|
229
|
+
}
|
230
|
+
|
231
|
+
appendColorRow( 0, 0 );
|
232
|
+
appendColorRow( 3, 0 );
|
233
|
+
appendColorRow( 0, 3 );
|
234
|
+
appendColorRow( 3, 3 );
|
235
|
+
|
236
|
+
// Create the last row.
|
237
|
+
var oRow = new $el( table.$.insertRow( -1 ) );
|
238
|
+
oRow.setAttribute( 'role', 'row' );
|
239
|
+
|
240
|
+
// Create the gray scale colors cells.
|
241
|
+
for ( var n = 0; n < 6; n++ ) {
|
242
|
+
appendColorCell( oRow.$, '#' + aColors[ n ] + aColors[ n ] + aColors[ n ] );
|
243
|
+
}
|
244
|
+
|
245
|
+
// Fill the row with black cells.
|
246
|
+
for ( var i = 0; i < 12; i++ ) {
|
247
|
+
appendColorCell( oRow.$, '#000000' );
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
var numbering = function( id ) {
|
252
|
+
return CKEDITOR.tools.getNextId() + '_' + id;
|
253
|
+
},
|
254
|
+
hicolorId = numbering( 'hicolor' ),
|
255
|
+
hicolorTextId = numbering( 'hicolortext' ),
|
256
|
+
selHiColorId = numbering( 'selhicolor' ),
|
257
|
+
table;
|
258
|
+
|
259
|
+
createColorTable();
|
260
|
+
|
261
|
+
return {
|
262
|
+
title: lang.title,
|
263
|
+
minWidth: 360,
|
264
|
+
minHeight: 220,
|
265
|
+
onLoad: function() {
|
266
|
+
// Update reference.
|
267
|
+
dialog = this;
|
268
|
+
},
|
269
|
+
onHide: function() {
|
270
|
+
clearSelected();
|
271
|
+
clearHighlight();
|
272
|
+
},
|
273
|
+
contents: [
|
274
|
+
{
|
275
|
+
id: 'picker',
|
276
|
+
label: lang.title,
|
277
|
+
accessKey: 'I',
|
278
|
+
elements: [
|
279
|
+
{
|
280
|
+
type: 'hbox',
|
281
|
+
padding: 0,
|
282
|
+
widths: [ '70%', '10%', '30%' ],
|
283
|
+
children: [
|
284
|
+
{
|
285
|
+
type: 'html',
|
286
|
+
html: '<div></div>',
|
287
|
+
onLoad: function() {
|
288
|
+
CKEDITOR.document.getById( this.domId ).append( table );
|
289
|
+
},
|
290
|
+
focus: function() {
|
291
|
+
// Restore the previously focused cell,
|
292
|
+
// otherwise put the initial focus on the first table cell.
|
293
|
+
( focused || this.getElement().getElementsByTag( 'td' ).getItem( 0 ) ).focus();
|
294
|
+
}
|
295
|
+
},
|
296
|
+
spacer,
|
297
|
+
{
|
298
|
+
type: 'vbox',
|
299
|
+
padding: 0,
|
300
|
+
widths: [ '70%', '5%', '25%' ],
|
301
|
+
children: [
|
302
|
+
{
|
303
|
+
type: 'html',
|
304
|
+
html: '<span>' + lang.highlight + '</span>\
|
305
|
+
<div id="' + hicolorId + '" style="border: 1px solid; height: 74px; width: 74px;"></div>\
|
306
|
+
<div id="' + hicolorTextId + '"> </div><span>' + lang.selected + '</span>\
|
307
|
+
<div id="' + selHiColorId + '" style="border: 1px solid; height: 20px; width: 74px;"></div>'
|
308
|
+
},
|
309
|
+
{
|
310
|
+
type: 'text',
|
311
|
+
label: lang.selected,
|
312
|
+
labelStyle: 'display:none',
|
313
|
+
id: 'selectedColor',
|
314
|
+
style: 'width: 74px',
|
315
|
+
onChange: function() {
|
316
|
+
// Try to update color preview with new value. If fails, then set it no none.
|
317
|
+
try {
|
318
|
+
$doc.getById( selHiColorId ).setStyle( 'background-color', this.getValue() );
|
319
|
+
} catch ( e ) {
|
320
|
+
clearSelected();
|
321
|
+
}
|
322
|
+
}
|
323
|
+
},
|
324
|
+
spacer,
|
325
|
+
{
|
326
|
+
type: 'button',
|
327
|
+
id: 'clear',
|
328
|
+
style: 'margin-top: 5px',
|
329
|
+
label: lang.clear,
|
330
|
+
onClick: clearSelected
|
331
|
+
}
|
332
|
+
]
|
333
|
+
}
|
334
|
+
]
|
335
|
+
}
|
336
|
+
]
|
337
|
+
}
|
338
|
+
]
|
339
|
+
};
|
340
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
For licensing, see LICENSE.html or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
CKEDITOR.plugins.setLang( 'colordialog', 'en', {
|
6
|
+
clear: 'Clear',
|
7
|
+
highlight: 'Highlight',
|
8
|
+
options: 'Color Options',
|
9
|
+
selected: 'Selected Color',
|
10
|
+
title: 'Select color'
|
11
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
For licensing, see LICENSE.html or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
CKEDITOR.plugins.setLang( 'colordialog', 'ru', {
|
6
|
+
clear: 'Очистить',
|
7
|
+
highlight: 'Под курсором',
|
8
|
+
options: 'Настройки цвета',
|
9
|
+
selected: 'Выбранный цвет',
|
10
|
+
title: 'Выберите цвет'
|
11
|
+
});
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.html or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
CKEDITOR.plugins.colordialog = {
|
7
|
+
requires: 'dialog',
|
8
|
+
lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en-au,en-ca,en-gb,en,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,ug,uk,vi,zh-cn,zh', // %REMOVE_LINE_CORE%
|
9
|
+
init: function( editor ) {
|
10
|
+
editor.addCommand( 'colordialog', new CKEDITOR.dialogCommand( 'colordialog' ) );
|
11
|
+
CKEDITOR.dialog.add( 'colordialog', this.path + 'dialogs/colordialog.js' );
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Open up color dialog and to receive the selected color.
|
15
|
+
*
|
16
|
+
* @param {Function} callback The callback when color dialog is closed
|
17
|
+
* @param {String} callback.color The color value received if selected on the dialog.
|
18
|
+
* @param [scope] The scope in which the callback will be bound.
|
19
|
+
* @member CKEDITOR.editor
|
20
|
+
*/
|
21
|
+
editor.getColorFromDialog = function( callback, scope ) {
|
22
|
+
var onClose = function( evt ) {
|
23
|
+
releaseHandlers( this );
|
24
|
+
var color = evt.name == 'ok' ? this.getValueOf( 'picker', 'selectedColor' ) : null;
|
25
|
+
callback.call( scope, color );
|
26
|
+
};
|
27
|
+
var releaseHandlers = function( dialog ) {
|
28
|
+
dialog.removeListener( 'ok', onClose );
|
29
|
+
dialog.removeListener( 'cancel', onClose );
|
30
|
+
};
|
31
|
+
var bindToDialog = function( dialog ) {
|
32
|
+
dialog.on( 'ok', onClose );
|
33
|
+
dialog.on( 'cancel', onClose );
|
34
|
+
};
|
35
|
+
|
36
|
+
editor.execCommand( 'colordialog' );
|
37
|
+
|
38
|
+
if ( editor._.storedDialogs && editor._.storedDialogs.colordialog )
|
39
|
+
bindToDialog( editor._.storedDialogs.colordialog );
|
40
|
+
else {
|
41
|
+
CKEDITOR.on( 'dialogDefinition', function( e ) {
|
42
|
+
if ( e.data.name != 'colordialog' )
|
43
|
+
return;
|
44
|
+
|
45
|
+
var definition = e.data.definition;
|
46
|
+
|
47
|
+
e.removeListener();
|
48
|
+
definition.onLoad = CKEDITOR.tools.override( definition.onLoad,
|
49
|
+
function( orginal ) {
|
50
|
+
return function() {
|
51
|
+
bindToDialog( this );
|
52
|
+
definition.onLoad = orginal;
|
53
|
+
if ( typeof orginal == 'function' )
|
54
|
+
orginal.call( this );
|
55
|
+
};
|
56
|
+
} );
|
57
|
+
} );
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
|
62
|
+
}
|
63
|
+
};
|
64
|
+
|
65
|
+
CKEDITOR.plugins.add( 'colordialog', CKEDITOR.plugins.colordialog );
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glebtv-ckeditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.2.
|
4
|
+
version: 4.0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mime-types
|
@@ -87,7 +87,7 @@ files:
|
|
87
87
|
- lib/ckeditor/http.rb
|
88
88
|
- lib/ckeditor/hooks/formtastic.rb
|
89
89
|
- lib/ckeditor/hooks/simple_form.rb
|
90
|
-
- lib/ckeditor/rails_admin/
|
90
|
+
- lib/ckeditor/rails_admin/field.rb
|
91
91
|
- lib/ckeditor/engine.rb
|
92
92
|
- lib/ckeditor/orm/mongoid.rb
|
93
93
|
- lib/ckeditor/orm/base.rb
|
@@ -143,6 +143,10 @@ files:
|
|
143
143
|
- vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js
|
144
144
|
- vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js
|
145
145
|
- vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js
|
146
|
+
- vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js
|
147
|
+
- vendor/assets/javascripts/ckeditor/plugins/colordialog/plugin.js
|
148
|
+
- vendor/assets/javascripts/ckeditor/plugins/colordialog/lang/en.js
|
149
|
+
- vendor/assets/javascripts/ckeditor/plugins/colordialog/lang/ru.js
|
146
150
|
- vendor/assets/javascripts/ckeditor/plugins/font/plugin.js
|
147
151
|
- vendor/assets/javascripts/ckeditor/plugins/font/lang/en.js
|
148
152
|
- vendor/assets/javascripts/ckeditor/plugins/font/lang/ru.js
|
@@ -370,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
370
374
|
version: '0'
|
371
375
|
requirements: []
|
372
376
|
rubyforge_project:
|
373
|
-
rubygems_version: 1.8.
|
377
|
+
rubygems_version: 1.8.25
|
374
378
|
signing_key:
|
375
379
|
specification_version: 3
|
376
380
|
summary: Rails gem for easy integration ckeditor in your application
|