IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
34 | 34 | var target = evt.getTarget(), |
35 | 35 | color; |
36 | 36 | |
37 | | if ( target.getName() == 'a' && ( color = target.getChild( 0 ).getHtml() ) ) |
| 37 | if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) |
38 | 38 | dialog.getContentElement( 'picker', 'selectedColor' ).setValue( color ); |
39 | 39 | } |
40 | 40 | |
| 41 | // Basing black-white decision off of luma scheme using the Rec. 709 version |
| 42 | function whiteOrBlack( color ) |
| 43 | { |
| 44 | color = color.replace( /^#/, '' ); |
| 45 | for ( var i = 0, rgb = []; i <= 2; i++ ) |
| 46 | rgb[i] = parseInt( color.substr( i * 2, 2 ), 16 ); |
| 47 | var luma = (0.2126 * rgb[0]) + (0.7152 * rgb[1]) + (0.0722 * rgb[2]); |
| 48 | return '#' + ( luma >= 165 ? '000' : 'fff' ); |
| 49 | } |
| 50 | |
| 51 | var focused; |
41 | 52 | function updateHighlight( event ) |
42 | 53 | { |
43 | 54 | if ( ! ( event instanceof CKEDITOR.dom.event ) ) |
44 | 55 | event = event.data; |
45 | 56 | |
46 | | var target = event.getTarget(), |
47 | | color; |
| 57 | var target = event.getTarget(), color, orgColor; |
48 | 58 | |
49 | | if ( target.getName() == 'a' && ( color = target.getChild( 0 ).getHtml() ) ) |
| 59 | if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) |
50 | 60 | { |
| 61 | // Remove previously focused style. |
| 62 | if ( focused ) |
| 63 | { |
| 64 | orgColor = focused.getChild( 0 ).getHtml(); |
| 65 | focused.setStyle( 'border-color', orgColor ); |
| 66 | focused.setStyle( 'border-style', 'solid' ); |
| 67 | } |
| 68 | |
| 69 | focused = target; |
| 70 | |
| 71 | // Apply outline style to show focus. |
| 72 | focused.setStyle( 'border-color', whiteOrBlack( color ) ); |
| 73 | focused.setStyle( 'border-style', 'dotted' ); |
| 74 | |
51 | 75 | $doc.getById( hicolorId ).setStyle( 'background-color', color ); |
52 | 76 | $doc.getById( hicolorTextId ).setHtml( color ); |
53 | 77 | } |
… |
… |
|
76 | 100 | // UP-ARROW |
77 | 101 | case 38 : |
78 | 102 | // relative is TR |
79 | | if ( ( relative = element.getParent().getParent().getPrevious() ) ) |
| 103 | if ( ( relative = element.getParent().getPrevious() ) ) |
80 | 104 | { |
81 | | nodeToMove = relative.getChild( [element.getParent().getIndex(), 0] ); |
| 105 | nodeToMove = relative.getChild( [ element.getIndex() ] ); |
82 | 106 | nodeToMove.focus(); |
83 | 107 | } |
84 | 108 | ev.preventDefault(); |
… |
… |
|
86 | 110 | // DOWN-ARROW |
87 | 111 | case 40 : |
88 | 112 | // relative is TR |
89 | | if ( ( relative = element.getParent().getParent().getNext() ) ) |
| 113 | if ( ( relative = element.getParent().getNext() ) ) |
90 | 114 | { |
91 | | nodeToMove = relative.getChild( [ element.getParent().getIndex(), 0 ] ); |
| 115 | nodeToMove = relative.getChild( [ element.getIndex() ] ); |
92 | 116 | if ( nodeToMove && nodeToMove.type == 1 ) |
93 | 117 | { |
94 | 118 | nodeToMove.focus(); |
… |
… |
|
106 | 130 | // RIGHT-ARROW |
107 | 131 | case rtl ? 37 : 39 : |
108 | 132 | // relative is TD |
109 | | if ( ( relative = element.getParent().getNext() ) ) |
| 133 | if ( ( nodeToMove = element.getNext() ) ) |
110 | 134 | { |
111 | | nodeToMove = relative.getChild( 0 ); |
112 | 135 | if ( nodeToMove.type == 1 ) |
113 | 136 | { |
114 | 137 | nodeToMove.focus(); |
… |
… |
|
116 | 139 | } |
117 | 140 | } |
118 | 141 | // relative is TR |
119 | | else if ( ( relative = element.getParent().getParent().getNext() ) ) |
| 142 | else if ( ( relative = element.getParent().getNext() ) ) |
120 | 143 | { |
121 | | nodeToMove = relative.getChild( [ 0, 0 ] ); |
| 144 | nodeToMove = relative.getChild( [ 0 ] ); |
122 | 145 | if ( nodeToMove && nodeToMove.type == 1 ) |
123 | 146 | { |
124 | 147 | nodeToMove.focus(); |
… |
… |
|
130 | 153 | // LEFT-ARROW |
131 | 154 | case rtl ? 39 : 37 : |
132 | 155 | // relative is TD |
133 | | if ( ( relative = element.getParent().getPrevious() ) ) |
| 156 | if ( ( nodeToMove = element.getPrevious() ) ) |
134 | 157 | { |
135 | | nodeToMove = relative.getChild( 0 ); |
136 | 158 | nodeToMove.focus(); |
137 | 159 | ev.preventDefault( true ); |
138 | 160 | } |
139 | 161 | // relative is TR |
140 | | else if ( ( relative = element.getParent().getParent().getPrevious() ) ) |
| 162 | else if ( ( relative = element.getParent().getPrevious() ) ) |
141 | 163 | { |
142 | | nodeToMove = relative.getLast().getChild( 0 ); |
| 164 | nodeToMove = relative.getLast(); |
143 | 165 | nodeToMove.focus(); |
144 | 166 | ev.preventDefault( true ); |
145 | 167 | } |
… |
… |
|
160 | 182 | { |
161 | 183 | for ( var i = rangeA ; i < rangeA + 3 ; i++ ) |
162 | 184 | { |
163 | | var row = table.$.insertRow( -1 ); |
| 185 | var row = new $el( table.$.insertRow( -1 ) ); |
| 186 | row.setAttribute( 'role', 'row' ); |
164 | 187 | |
165 | 188 | for ( var j = rangeB ; j < rangeB + 3 ; j++ ) |
166 | 189 | { |
167 | 190 | for ( var n = 0 ; n < 6 ; n++ ) |
168 | 191 | { |
169 | | appendColorCell( row, '#' + aColors[j] + aColors[n] + aColors[i] ); |
| 192 | appendColorCell( row.$, '#' + aColors[j] + aColors[n] + aColors[i] ); |
170 | 193 | } |
171 | 194 | } |
172 | 195 | } |
… |
… |
|
177 | 200 | { |
178 | 201 | var cell = new $el( targetRow.insertCell( -1 ) ); |
179 | 202 | cell.setAttribute( 'class', 'ColorCell' ); |
| 203 | cell.setAttribute( 'tabIndex', -1 ); |
| 204 | cell.setAttribute( 'role', 'gridcell' ); |
| 205 | cell.setAttribute( 'onkeydown', 'CKEDITOR.tools.callFunction( ' + onKeydownHandler + ', event, this )' ); |
| 206 | cell.setAttribute( 'onclick', 'CKEDITOR.tools.callFunction( ' + onClickHandler + ', event, this )' ); |
180 | 207 | cell.setStyle( 'background-color', color ); |
| 208 | cell.setStyle( 'border', '1px solid ' + color ); |
181 | 209 | |
182 | | cell.setStyle( 'width', '15px' ); |
183 | | cell.setStyle( 'height', '15px' ); |
| 210 | cell.setStyle( 'width', '14px' ); |
| 211 | cell.setStyle( 'height', '14px' ); |
184 | 212 | |
185 | | var index = cell.$.cellIndex + 1 + 18 * targetRow.rowIndex; |
186 | | cell.append( CKEDITOR.dom.element.createFromHtml( |
187 | | '<a href="javascript: void(0);" role="option"' + |
188 | | ' aria-posinset="' + index + '"' + |
189 | | ' aria-setsize="' + 13 * 18 + '"' + |
190 | | ' style="cursor: pointer;display:block;width:100%;height:100% " title="'+ CKEDITOR.tools.htmlEncode( color )+ '"' + |
191 | | ' onkeydown="CKEDITOR.tools.callFunction( ' + onKeydownHandler + ', event, this )"' + |
192 | | ' onclick="CKEDITOR.tools.callFunction(' + onClickHandler + ', event, this ); return false;"' + |
193 | | ' tabindex="-1"><span class="cke_voice_label">' + color + '</span> </a>', CKEDITOR.document ) ); |
| 213 | cell.append( CKEDITOR.dom.element.createFromHtml( '<span class="cke_voice_label">' + color + '</span>', CKEDITOR.document ) ); |
194 | 214 | } |
195 | 215 | |
196 | 216 | appendColorRow( 0, 0 ); |
… |
… |
|
251 | 271 | [ |
252 | 272 | { |
253 | 273 | type : 'html', |
254 | | html : '<table role="listbox" aria-labelledby="' + tableLabelId + '" onmouseout="CKEDITOR.tools.callFunction( ' + onMouseout + ' );">' + |
255 | | ( !CKEDITOR.env.webkit ? html : '' ) + |
256 | | '</table><span id="' + tableLabelId + '" class="cke_voice_label">' + lang.options +'</span>', |
| 274 | html : '<table tabIndex="-1" role="grid" aria-labelledby="' + tableLabelId + |
| 275 | '" onmouseout="CKEDITOR.tools.callFunction( ' + onMouseout + |
| 276 | ' );" style="border-collapse:separate;" cellspacing="0">' + |
| 277 | ( !CKEDITOR.env.webkit ? html : '' ) + '</table><span id="' + tableLabelId + '" class="cke_voice_label">' + lang.options +'</span>', |
257 | 278 | onLoad : function() |
258 | 279 | { |
259 | 280 | var table = CKEDITOR.document.getById( this.domId ); |
… |
… |
|
267 | 288 | }, |
268 | 289 | focus: function() |
269 | 290 | { |
270 | | var firstColor = this.getElement().getElementsByTag( 'a' ).getItem( 0 ); |
| 291 | var firstColor = this.getElement().getElementsByTag( 'td' ).getItem( 0 ); |
271 | 292 | firstColor.focus(); |
272 | 293 | } |
273 | 294 | }, |