I believe this may be same bug as #2473025. I'm not sure if this is a wysiwyg bug, a better_formats bug or a paragraphs bug. My basic page has a title field and a subtitle field. The subtitle field is limited to the "filtered_html" text format. If I try to add a paragraph with 'full_html' and any wyswiyg plugins (such as linkit or media), the wysiwyg will fail to load. However, if I do this on a content type with no wysiwyg initially loaded on the page, the wysiwyg loads fine.

Steps to Reproduce

  1. Install media module, better_formats, and wysiwsyg module with ckeditor
  2. Add two text formats and create a wyswiyg profile for each format. One should have the media plugin (e.g. 'full_html') and one shouldn't (e.g. 'filtered_html').
  3. Create a content type with a "long_text" field and a paragraphs field. The "long_text" settings should have the wysiwyg limited to "filtered_html."
  4. Create a paragraph entity with a "long_text" field.
  5. Go to node/add/[CONTENT_TYPE] and try to add a new paragraph entity with the "long_text" field

Screenshot:

paragraphs bug

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bennybobw’s picture

Issue summary: View changes
tinny’s picture

Im not sure if I have a similar issue or different:

The WYSIWYG doesnt load if the Paragraph is set to "Closed" as the default edit mode AND a wysiwyg has not been loaded on page load from another field.

Im using the WYSIWYG module with CKeditor library.

  1. Create a content type with a single paragraph field.
  2. Choose "Closed" as the default edit mode.
  3. Create a node and open the paragraph. The field will not have a wysiwyg (bad).
  4. Edit the content type and the paragraph field. Choose "Open" as the default edit mode.
  5. Create a node and look at the paragraph field. The field will have a wysiwyg (good).

I believe this has something to do with the wysiwyg module using drupal_add_js() to include javascript (see: wysiwyg_load_editor()) which doesnt work with ajax calls.

scoff’s picture

Similar problem here. I'm using Editor module and it's default CKEditor. If the host node doesn't have any wysiwyg fields and Paragraphs field's widget is Closed then there's no wysiwyg for the text fields in that paragraph. Instead there's a 404 for some ckeditor's skin CSS and a JS error.

I don't have better_formats installed BTW. The problem must be obvious for those who understands how and when wysiwyg (editor module in my case) decides to load it's js/css etc. For now I'm looking for a way to force wysiwyg to load on any node edit form regardless. No luck so far.

johnennew’s picture

Sam problem, seems to be the order the JS is firing. Making sure the JS is on the page before adding any paragraphs works (for example adding the following code being used with the WYSIWYG module) ...

/**
 * Implements hook_form_alter().
 *
 * On node forms which need to load in wysiwyg via paragraphs
 * always include the wysiwyg JS on the page.
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  $form_ids = [
    'article_node_form',
  ];

  if (in_array($form_id, $form_ids)) {
    $profile = wysiwyg_get_profile('full_html'); // This assumes there is a full_html text format.
    $theme = wysiwyg_get_editor_themes($profile, 'seven'); // This assumes your edit form uses the seven theme.
    wysiwyg_add_plugin_settings($profile);
    wysiwyg_add_editor_settings($profile, $theme);
  }
}
autopoietic’s picture

I had this (or similar) issue, but it turned out just to be that I had better_formats enabled and had not ticked 'Show format selection for paragraphs_items' permission for the relevant roles.

tom.burton’s picture

The same occurs if file fields with Media Browser are used inside paragraphs: the required media.js file is not loaded, so there is no way for loading the media browser dialog. A workaround like #4 is required to specifically load the media.js file in the form:

/**
 * Implements hook_form_alter().
 */
function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'YOUR_FORM_ID':
      $form['#attached']['js'][] = array(
        'type' => 'setting',
        'data' => array('media' =>
          array('elements' =>
            array('#edit-YOUR_FIELDNAME_PARAGRAPHS-und-0-YOUR_FIELDNAME_MEDIA-und-0-upload' => array(),
              )
            )
          )
        );
      $form['#attached']['js'][] = array(
        'data' => drupal_get_path('module', 'media') . '/js/media.js',
        'type' => 'file',
        );
      break;
  }
}
jstoller’s picture

Status: Active » Closed (outdated)

In an effort to cleanup the Paragraphs issue queue I'm closing this ticket and marking it "outdated." If you find this is still a problem with the latest Paragraphs 7.x-1.x-dev release than feel free to reopen the issue.

shra’s picture

FileSize
6.65 KB

The issue is still there. Also I've tried to use latest Paragraphs 7.x-1.x-dev release to check if it can solve the problem. But it made everything even worse:
Screenshot

Paragraph type selector doesn't work and type is not displayed (even for existing data).