Skip to content

Empty lines are stripped out of the value after update for a textarea component #6

Description

@coughsyrupgit

Test case

  1. Create a simple textarea component
  2. Fill it with a value that contains empty lines:
Line 1

Line 3


Line 6
  1. Trigger the component update, so loki_components/index/html ajax call is performed.

Expected result

Textarea preserves the value as it is, with empty lines

Actual result

Empty lines are stripped out of the value. The actual value of the textarea after the update:

Line1
Line3
Line6

Possible solution

The stripping part takes place in this class. It looks like this part of code only intends to normalize the line breaks, and empty line stripping is not intentional. So, possibly, the line

$htmlPart = preg_replace("/([\r\n]+)/", "\n", $htmlPart);

Can be replaced with

 $htmlPart = preg_replace("/\r\n|\r/", "\n", $htmlPart);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions