From 934a22d0b9bd0877c3d68b3ad87a14d1a7942854 Mon Sep 17 00:00:00 2001 From: michal Date: Fri, 23 Sep 2011 15:10:08 +0200 Subject: [PATCH] [#1286192] CKEditor just showing on imagefield textareas on editing, not on node creation --- includes/ckeditor.utils.js | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-) diff --git a/includes/ckeditor.utils.js b/includes/ckeditor.utils.js index 71e93ff..0fa93e8 100644 --- a/includes/ckeditor.utils.js +++ b/includes/ckeditor.utils.js @@ -54,7 +54,7 @@ Drupal.ckeditorOn = function(textarea_id) { if (teaser.button.attr('value') != Drupal.t('Split summary at cursor')) { try { teaser.button.click(); - } + } catch (e) { teaser.button.val(Drupal.t('Split summary at cursor')); } @@ -98,7 +98,7 @@ Drupal.ckeditorOn = function(textarea_id) { var dtd = CKEDITOR.dtd; for ( var e in CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { ev.editor.dataProcessor.writer.setRules( e, textarea_settings.custom_formatting); - } + } ev.editor.dataProcessor.writer.setRules( 'pre', { indent: textarea_settings.output_pre_indent @@ -163,7 +163,7 @@ Drupal.ckeditorOff = function(textarea_id) { if (teaser.button.attr('value') != Drupal.t('Join summary')) { try { teaser.button.click(); - } + } catch (e) { teaser.button.val(Drupal.t('Join summary')); } @@ -178,7 +178,7 @@ Drupal.ckeditorOff = function(textarea_id) { if (teaser.button.attr('value') != Drupal.t('Split summary at cursor')) { try { teaser.button.click(); - } + } catch (e) { teaser.button.val(Drupal.t('Split summary at cursor')); } @@ -196,7 +196,7 @@ Drupal.ckeditorOff = function(textarea_id) { */ function ckeditorOpenPopup(jsID, textareaID, width){ popupUrl = Drupal.settings.ckeditor.module_path + '/includes/ckeditor.popup.html?var=' + jsID + '&el=' + textareaID; - + var percentPos = width.indexOf('%'); if (percentPos != -1) { width = width.substr(0, percentPos); @@ -239,7 +239,7 @@ Drupal.ckeditorTeaserInfo = function(taid) { if (Drupal.ckeditorTeaser.cache[taid]) { return Drupal.ckeditorTeaser.cache[taid]; } - + // build a lookup table if (!Drupal.ckeditorTeaser.lookupSetup) { Drupal.ckeditorTeaser.lookupSetup = true; @@ -247,7 +247,7 @@ Drupal.ckeditorTeaserInfo = function(taid) { Drupal.ckeditorTeaser.lookup[Drupal.settings.teaser[x]] = x; } } - + // find the elements if (Drupal.ckeditorTeaser.lookup[taid]) { var obj; @@ -262,19 +262,19 @@ Drupal.ckeditorTeaserInfo = function(taid) { checkbox: $('#' + Drupal.settings.teaserCheckbox[Drupal.ckeditorTeaser.lookup[taid]]) }; } - + obj.textareaContainer = obj.textarea.parent(); obj.checkboxContainer = obj.checkbox.parent(); - + obj.button = $('input.teaser-button', obj.checkbox.parents('div.teaser-checkbox').get(0)); obj.buttonContainer = obj.button.parent(); - + Drupal.ckeditorTeaser.cache[taid] = obj; } else { Drupal.ckeditorTeaser.cache[taid] = null; } - + return Drupal.ckeditorTeaser.cache[taid]; }; @@ -368,6 +368,18 @@ Drupal.behaviors.ckeditor = function (context) { Drupal.behaviors.textarea(context); } + //Support for imageField [#1286192] + if(Drupal.behaviors.filefieldButtons) + { + imagefield = $('textarea',$(context).html()); + if (imagefield.length == 1) + { + imagefield_id = imagefield.attr('id') + Drupal.settings.ckeditor.settings[imagefield_id] = []; + Drupal.ckeditorOn(imagefield_id); + } + } + // Support for Panels [#679976] if ($(context).attr('id') == 'modal-content') { if (CKEDITOR.instances['edit-body'] != 'undefined') { @@ -385,7 +397,7 @@ Drupal.behaviors.ckeditor = function (context) { $('body').unbind('keypress'); }; }); - } + } $("textarea.ckeditor-mod:not(.ckeditor-processed)").each(function () { var ta_id=$(this).attr("id"); -- 1.7.4.msysgit.0