I have installed latest version Wysiwyg module. I noticed after every submit there is always inserted <!--break-->. I have tried disabling TinyMCE (which i use with Wysiwyg) and this bug is still here.

I have search into code and i identify this lines of code:

/**
 * Implementation of hook_form_alter().
 *
 * Before Drupal 7, there is no way to easily identify form fields that are
 * input format enabled. As a workaround, we assign a form #after_build
 * processing callback that is executed on all forms after they have been
 * completely built, so form elements are in their effective order
 * and position already.
 *
 * @see wysiwyg_process_form()
 */
function wysiwyg_form_alter(&$form, &$form_state) {
  $form['#after_build'][] = 'wysiwyg_process_form';
  // Teaser splitter is unconditionally removed and NOT supported.
  if (isset($form['body_field'])) {
    unset($form['body_field']['teaser_js']);
  }
}

I try remove line with unset and now there is no problem. I think there is function in node.module which added this unwantend <!--break--> into text.

/**
 * See if the user used JS to submit a teaser.
 */
function node_teaser_js(&$form, &$form_state) {
  if (isset($form['#post']['teaser_js'])) {
    // Glue the teaser to the body.
    if (trim($form_state['values']['teaser_js'])) {
      // Space the teaser from the body
      $body = trim($form_state['values']['teaser_js']) ."\r\n<!--break-->\r\n". trim($form_state['values']['body']);
    }
    else {
      // Empty teaser, no spaces.
      $body = '<!--break-->'. $form_state['values']['body'];
    }
    // Pass updated body value on to preview/submit form processing.
    form_set_value($form['body'], $body, $form_state);
    // Pass updated body value back onto form for those cases
    // in which the form is redisplayed.
    $form['body']['#value'] = $body;
  }
  return $form;
}

Maybe I have some conflicting module or there is bug in Wysiwyg module? How can i resolve this? Thanks.

Comments

twod’s picture

I might finally have found a way to reproduce this issue. Between work and other commitments I don't have time for this right now, but I hope to continue debugging later this week.

twod’s picture

Status: Active » Closed (duplicate)
drupalninja99’s picture

<!--break--> keeps getting added to the beginning of the body textarea every time the node gets saved.

izarco’s picture

I have the same issue.