Révision 8fa03d70
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/media_ckeditor/js/plugins/media/library.js | ||
---|---|---|
63 | 63 |
} |
64 | 64 |
else { |
65 | 65 |
$alreadyInsertedMedia = jQuery(data.node).find('[data-media-element]'); |
66 |
// For some reason, in MS Edge, data.node is a descendant of what |
|
67 |
// we are looking for, so we should also look "upwards" for media. |
|
68 |
if (!$alreadyInsertedMedia.length) { |
|
69 |
$alreadyInsertedMedia = jQuery(data.node).closest('[data-media-element]'); |
|
70 |
} |
|
66 | 71 |
} |
67 | 72 |
// First check to see if we are using an Insert button. |
68 | 73 |
if (typeof Drupal.ckeditorInstance.mediaInsert !== 'undefined') { |
... | ... | |
178 | 183 |
ckeditorInstance.insertElement(editorElement); |
179 | 184 |
|
180 | 185 |
// Initialize widget on our html if possible. |
181 |
if (parseFloat(CKEDITOR.version) >= 4.3 && hasWidgetSupport) {
|
|
186 |
if (Drupal.settings.ckeditor.plugins['media'].compareVersions(CKEDITOR.version, '4.3') >= 0 && hasWidgetSupport) {
|
|
182 | 187 |
ckeditorInstance.widgets.initOn( editorElement, 'mediabox' ); |
183 | 188 |
|
184 | 189 |
// Also support the image2 plugin. |
... | ... | |
186 | 191 |
} |
187 | 192 |
}, |
188 | 193 |
|
194 |
/** |
|
195 |
* Compare versions of CKEditor to determine if one version |
|
196 |
* is less than, greater than, or equal to another. |
|
197 |
* |
|
198 |
* @param a |
|
199 |
* A first instance of CKEditor. |
|
200 |
* @param b |
|
201 |
* A second instance of CKEditor. |
|
202 |
* @return |
|
203 |
* A number less than, greater than, or equal to zero. |
|
204 |
* - If a < b, a number less than zero is returned. |
|
205 |
* - If a > b, a number greater than zero is return. |
|
206 |
* - If a = b, the value of 0 is returned. |
|
207 |
*/ |
|
208 |
compareVersions: function (a, b) { |
|
209 |
var i, diff; |
|
210 |
var regExStrip0 = /(\.0+)+$/; |
|
211 |
var segmentsA = a.replace(regExStrip0, '').split('.'); |
|
212 |
var segmentsB = b.replace(regExStrip0, '').split('.'); |
|
213 |
var l = Math.min(segmentsA.length, segmentsB.length); |
|
214 |
|
|
215 |
for (i = 0; i < l; i++) { |
|
216 |
diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10); |
|
217 |
if (diff) { |
|
218 |
return diff; |
|
219 |
} |
|
220 |
} |
|
221 |
|
|
222 |
return segmentsA.length - segmentsB.length; |
|
223 |
}, |
|
224 |
|
|
189 | 225 |
/** |
190 | 226 |
* Forces custom attributes into the class field of the specified image. |
191 | 227 |
* |
Formats disponibles : Unified diff
Weekly update of contrib modules