summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWiktor Walc2008-10-09 12:49:05 (GMT)
committer Wiktor Walc2008-10-09 12:49:05 (GMT)
commit79a1debacca72617d07ffac7ac590f5c246f732f (patch)
tree2c54ef33b16da74cf5e46b34cc498530b3743b49
parent0c75a7144df5c918133983b1ed7bf2f1a495318b (diff)
#240230 Another attempt to fix issues with teaser brake
-rw-r--r--CHANGELOG.txt1
-rw-r--r--fckeditor.module26
2 files changed, 22 insertions, 5 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 6e26987..ee46e7f 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -3,6 +3,7 @@ $Id$
-- 2008-10-09 version 6.x-1.x-dev
* #310988 Extended default exclusion list, added hack for module developers allowing to disable fckeditor on specific textareas
* #318540 Fixed: formatting output doesn't format properly
+* #240230 Another attempt to fix issues with teaser brake
-- 2008-10-08 version 6.x-1.x-dev
* Added upgrading instructions
diff --git a/fckeditor.module b/fckeditor.module
index fafec95..c3afc14 100644
--- a/fckeditor.module
+++ b/fckeditor.module
@@ -634,8 +634,12 @@ function fckeditor_is_enabled($excl_mode, $excl_fields, $excl_paths, $element_id
function fckeditor_process_textarea($element) {
static $is_running = FALSE;
static $num = 1;
+ static $id2id = array();
+ static $processed_elements = array();
global $user, $fckeditor_simple_toolbar_ids;
+ $processed = in_array($element['#id'], $processed_elements);
+
//hack for module developers that want to disable FCKeditor on their textareas
if (key_exists('#fckeditor', $element) && !$element['#fckeditor']) {
return $element;
@@ -700,7 +704,13 @@ function fckeditor_process_textarea($element) {
$element['#resizable'] = FALSE;
}
- $js_id = 'oFCK_'. $num++;
+ if (in_array($element['#id'], $processed_elements)) {
+ $js_id = $id2id[$element['#id']];
+ }
+ else {
+ $js_id = 'oFCK_'. $num++;
+ $id2id[$element['#id']] = $js_id;
+ }
$fckeditor_on = ($conf['default']=='t') ? 1 : 0 ;
$content = "";
@@ -712,7 +722,7 @@ function fckeditor_process_textarea($element) {
$wysiwyg_link .= "<a href=\"javascript:Toggle('{$js_id}','{$element['#id']}','". str_replace("'", "\\'", t("Switch to plain text editor")) ."','". str_replace("'", "\\'", t("Switch to rich text editor")) ."');\" id=\"switch_{$js_id}\" ". ($fckeditor_on?"style=\"display:none\"":"") .">";
$wysiwyg_link .= $fckeditor_on ? t("Switch to plain text editor") : t("Switch to rich text editor");
$wysiwyg_link .= "</a>";
- if ($conf['show_toggle'] == 't') {
+ if ($conf['show_toggle'] == 't' && !$processed) {
drupal_add_js('if (Drupal.jsEnabled) {$(document).ready(function() {CreateToggle("'.$element['#id'].'","'.$js_id.'", '.$fckeditor_on.');});}', 'inline');
}
//settings are saved as strings, not booleans
@@ -886,17 +896,21 @@ function fckeditor_process_textarea($element) {
$js .= $js_id .".Config['EditorAreaCSS'] = \"". str_replace(array('%h', '%t'), array($host, $host . $themepath), $conf['css_path']) .",". $module_full_path ."/fckeditor.css\";";
}
- drupal_add_js('var '. $js_id .';if (Drupal.jsEnabled) {$(document).ready(function() {'. $js .'});}', 'inline');
+ if (!$processed) {
+ drupal_add_js('var '. $js_id .';if (Drupal.jsEnabled) {$(document).ready(function() {'. $js .'});}', 'inline');
+ }
if ($conf['popup']=="t") {
// Add the script file with the popup open function.
- drupal_add_js($module_drupal_path .'/fckeditor.popup.js');
+ if (!$processed) {
+ drupal_add_js($module_drupal_path .'/fckeditor.popup.js');
+ }
$element['#suffix'] .= " <span class=\"fckeditor_popuplink\">(<a href=\"#\" onclick=\"FCKeditor_OpenPopup('". $module_full_path ."/fckeditor.popup.html?var=". $js_id ."&el=". $element['#id'] ."');return false;\">". t('Open rich editor') ."</a>)</span>";
}
else {
// if no popup mode, add the editor initialization to the footer
// this obviously needs print($closure) in page.tpl.php
- if ($fckeditor_on) {
+ if ($fckeditor_on && !$processed) {
drupal_add_js('if (Drupal.jsEnabled) {$(document).ready(function() {if (typeof ('. $js_id .') != "undefined") {
if ($("#edit-teaser-js").size() && $("#edit-teaser-js").val().length){
$("#edit-body").val($("#edit-teaser-js").val() + "<!--break-->" + $("#edit-body").val());
@@ -914,6 +928,8 @@ function fckeditor_process_textarea($element) {
'!path' => $_GET['q'],
)) .'</div>';
}
+
+ $processed_elements[] = $element['#id'];
return $element;
}