I have the text format set to Filtered, which has a WYSIWYG editor attached, but with the table field it doesn't show up. I'm using WYSIWYG, TinyMCE, and IMCE for images.

Comments

likewhoa’s picture

Title: Text Format Missing » Text Formats option is broken
Version: 7.x-2.1 » 7.x-2.x-dev
Issue summary: View changes
Priority: Normal » Major

This module seems to be ignoring "Text Formats" as using the default "Filtered HTML" as a test and pasting text with line breaks doesn't actually work as expected.

jenlampton’s picture

Status: Active » Postponed (maintainer needs more info)

I'm unable to reproduce this issue. Would you please update to the latest 2.x dev and try again. Please comment here if the issue is resolved or not for you! :)

jenlampton’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Since this was a fairly old issue I'm going to assume it has been fixed between now and when the issue was filed. If anyone has problems with text formats please reopen.

ishan.dikshit’s picture

Status: Closed (cannot reproduce) » Active

I can't find a solution to this. I am unable to enter line breaks in the table field cells even after selecting 'Filtered Text' option. Kindly help.

lolandese’s picture

Title: Text Formats option is broken » Allow a WYSIWIG editor to be used (text area instead of text field) or allow linebreaks to be copy-pasted (simplified)
Category: Bug report » Feature request
Priority: Major » Normal

Tablefield uses the form type text fields for the input instead of text areas. That probably explains why WYSIWYG editors are not applied.

Still all the allowed HTML tags that belong to a certain text format are retained and that is likely the intention of the option to apply them to the tablefield input fields. So to have multiple lines you should use the <br /> tag directly, like e.g.:
<em>first line<br />second line</em>

It's true that applying a WYSIWIG would allow for copy pasting line breaks correctly. This can be considered a feature request. If copying from another node's body field you can also Switch to plain text editor and use the HTML from there. You can also use an online text to HTML converter or use the body field of a temporary node for that.

I tend to go for a simpler solution where only line-breaks and paragraphs are converted to <br /> and <p></p> when pasting. See PHP: nl2br - Manual.

lolandese’s picture

Closed #1878222: Show markup styling in edit view? as a duplicate of this issue.

lolandese’s picture

StatusFileSize
new3.31 KB

Work in progress.

lolandese’s picture

lolandese’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
lolandese’s picture

Status: Active » Needs work

Also JSON display mode should be tested on validity as line breaks should then be converted correctly.

lolandese’s picture

Status: Needs work » Needs review
StatusFileSize
new4.93 KB
lolandese’s picture

Status: Needs review » Needs work

I guess double quotes should be escaped in Raw data (JSON) output.

lolandese’s picture

Status: Needs work » Needs review
StatusFileSize
new4.45 KB
lolandese’s picture

A start to get WYSIWYG would be:

  $form['input_type'] = array(
    '#type' => 'radios',
    '#title' => t('Input type'),
    '#default_value' => isset($instance['widget']['settings']['input_type']) ? $instance['widget']['settings']['input_type'] : 'textfield',
    '#required' => TRUE,
    '#options' => array(
      'textfield' => t('textfield'),
      'textarea' => t('textarea'),
      'text_format' => t('text_format (wysiwyg)'),
    ),
    '#weight' => 120,
  );

Note 'text_format' => t('text_format (wysiwyg)'),. It would however need additional changes. Furthermore instead of storing only the value of the field it stores an array consisting of 'format' and 'value'. I then requires an is_array() condition throughout the code. Advantage is that the text_format can be set per cell.

Above patch can still be reviewed but only implements a simple textarea, not a WYSIWYG. After implementing that a new issue should be opened specifically asking for the feature request WYSIWYG.

Also probably this existing snippet should be made optional:

    if (module_exists('wysiwyg')) {
      $element['#wysiwyg'] = FALSE;
    }
lolandese’s picture

Status: Needs review » Needs work

In Raw data (JSON or XML) output we should strip all line breaks if a cell is used as an array key.

lolandese’s picture

Status: Needs work » Needs review
StatusFileSize
new5.86 KB
new6.57 KB

  • lolandese committed e4ed2cf on 7.x-3.x
    Issue #1947072 by lolandese: Allow linebreaks (text area)
    
lolandese’s picture

Title: Allow a WYSIWIG editor to be used (text area instead of text field) or allow linebreaks to be copy-pasted (simplified) » Allow linebreaks in table cells (text area)
Status: Needs review » Fixed

Note that in some cases it is necessary to save content twice to get the line breaks applied correctly:

  • When changing from one text format to another.
  • When copy-pasting text with line breaks into a table cell.

Opened #2869429: Text area: save content twice to get the line breaks applied correctly.

lolandese’s picture

As follow up also opened #2869454: Text area: WYSIWYG support.

lolandese’s picture

Not sure why we used htmlspecialchars() on non plain text area but it results in undesired encoded stuff in out output.

Removing it.

  • lolandese committed 4571867 on 7.x-3.x
    Issue #1947072 by lolandese: Do not convert special characters to HTML...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

lolandese’s picture

Version: 7.x-3.x-dev » 8.x-2.x-dev
Status: Closed (fixed) » Patch (to be ported)