app/assets/javascripts/ckeditor/config.js in ckeditor-3.7.2 vs app/assets/javascripts/ckeditor/config.js in ckeditor-3.7.3

- old
+ new

@@ -1,12 +1,10 @@ /* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ -jQuery.noConflict(); - CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; @@ -33,14 +31,29 @@ // The location of a script that handles file uploads. config.filebrowserUploadUrl = "/ckeditor/attachment_files"; // Rails CSRF token config.filebrowserParams = function(){ - var csrf_token = jQuery('meta[name=csrf-token]').attr('content'), - csrf_param = jQuery('meta[name=csrf-param]').attr('content'), + var csrf_token, csrf_param, meta, + metas = document.getElementsByTagName('meta'), params = new Object(); + for ( var i = 0 ; i < metas.length ; i++ ){ + meta = metas[i]; + + switch(meta.name) { + case "csrf-token": + csrf_token = meta.content; + break; + case "csrf-param": + csrf_param = meta.content; + break; + default: + continue; + } + } + if (csrf_param !== undefined && csrf_token !== undefined) { params[csrf_param] = csrf_token; } return params; @@ -64,10 +77,10 @@ // Take the dialog name and its definition from the event data. var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; var content, upload; - if (jQuery.inArray(dialogName, ['link', 'image', 'attachment', 'flash']) > -1) { + if (CKEDITOR.tools.indexOf(['link', 'image', 'attachment', 'flash'], dialogName) > -1) { content = (dialogDefinition.getContents('Upload') || dialogDefinition.getContents('upload')); upload = (content == null ? null : content.get('upload')); if (upload && upload.filebrowser['params'] == null) { upload.filebrowser['params'] = config.filebrowserParams();