Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#8065 closed defect (fixed)

TextArea: Removing words in a dijit.form.Textarea will remove spaces in the underlying html textarea

Reported by: rodeoclown Owned by: Douglas Hays
Priority: high Milestone: 1.3
Component: Dijit - Form Version: 1.2.1
Keywords: Cc:
Blocked By: Blocking:

Description

If you have text "blah foo bar" and delete "foo ", the space in front of it is replaced with a  , which is then filtered out in the Textarea.setValue() function.

This means that words can be concatenated, but this won't be visible until the value from the text area is saved, and then retrieved later.

I spent 4 and a half hours today tracking it down, and the problem is on line 90 of Textarea.js - the very first replace regEx is stripping out   and replacing it with "".

My fix was to remove the   from that regex, and add another replace call to the list replacing   with " ".

Change History (6)

comment:1 Changed 11 years ago by bill

Owner: set to Douglas Hays
Summary: Removing words in a dijit.form.Textarea will remove spaces in the underlying html textareaTextArea: Removing words in a dijit.form.Textarea will remove spaces in the underlying html textarea

Sounds like a simple fix. I'm not sure if there are other adverse affects though (i.e., if there are a bunch of spurious   in other situations, that need to be removed.

Doug, could we avoid all the regex stuff by using innerText?

comment:2 Changed 11 years ago by Douglas Hays

Milestone: tbd1.3

comment:3 Changed 11 years ago by Douglas Hays

[15663] Fixes #8065. Changed nbsp entities to spaces. This reverts a change made in [10045] but I couldn't figure out why it was changed. innerText could not be used since it consolidates multiple spaces, and the Firefox equivalent textContent throws away newlines.

comment:4 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

comment:5 Changed 11 years ago by bill

I spoke to Doug about this and #8063 yesterday.

The problem with innerText is that it collapses multiple spaces into one space, and it also converts newlines into spaces. Should really find a way to use a real <textarea> rather than a <div> for this widget... see #8063 for more details.

comment:6 Changed 9 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.