Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3729 (closed defect: untested)

Opened 3 years ago

Last modified 2 years ago

[PATCH] InPlaceEditor strips HTML tags

Reported by: Bill Burcham Assigned to: thomas@fesch.at
Priority: normal Milestone:
Component: script.aculo.us Version: 1.1.1
Severity: normal Keywords: InPlaceEditor strips tags
Cc:

Description

When I use InPlaceEditor (1.5.0_pre0) to edit this div:

<div title="Click to edit" class="in_place_editor_field" id="document_version_body_1_in_place_editor" style="border: 5px solid rgb(204, 204, 204); background-color: transparent; background-image: none;"> <p> para </p>

</div>

The paragraph tags are stripped before the text is presented in the textarea. Note that there is no problem entering paragraph tags in the textarea -- they are handled just fine and added to the DOM just fine. It's when I go back to edit them that they get elided. All tags seem to get "sanitized" out this way before editing so e.g. <em> tags are elided too.

Attachments

3729-1.diff (360 bytes) - added by Bill Burcham on 02/12/06 12:53:13.
diff (not svn diff) of controls.js illustrating fix to make handleLineBreaks option work when rows option > 1
load_text_url_stripping_html_tags_patch.diff (0.8 kB) - added by m.drozdzynski@gmail.com on 06/18/06 18:07:56.
Patch for preventing loadTextUrl stripping HTML tags from response

Change History

02/08/06 03:42:33 changed by anonymous

  • type changed from enhancement to defect.

02/09/06 22:38:40 changed by jon.tirsen@gmail.com

I don't think I understand the issue here. Do you want to keep the tags in the InPlaceEditor or do you want them to go away? You should be able to remove the line-break handling by specifying the handleLineBreaks option to false like this:

new InPlaceEditor($('blah'), 'url', {handleLineBreaks: false});

Is this issue that all the tags get stripped out? Because I'm not too sure that they do...

Cheers, Jon

02/12/06 12:30:03 changed by Bill Burcham

What I want/expect is to be able to edit the HTML directly. If I enter <p>hello</p> in a textarea and save it and then edit it again I expect to see <p>hello</p> in the textarea the second time. This sort of "round tripping" doesn't work.

I saw the handleLineBreaks options after I submitted #3729. A perusal of the code leads me to the conclusion however, that the ability to elide the convertHTMLLineBreaks call is only available for text fields -- not for text areas. In createEditField if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) then a text field is used as the editor and convertHTMLLineBreaks is not called. On the other hand, if this.options.rows != 1 then a textarea is used as the editor and convertHTMLLineBreaks is called unconditionally.

Regards, Bill

02/12/06 12:53:13 changed by Bill Burcham

  • attachment 3729-1.diff added.

diff (not svn diff) of controls.js illustrating fix to make handleLineBreaks option work when rows option > 1

02/17/06 13:43:09 changed by anonymous

  • summary changed from InPlaceEditor strips HTML tags to [PATCH] InPlaceEditor strips HTML tags.

02/17/06 13:43:50 changed by anonymous

  • version set to 1.0.0.

06/18/06 18:05:57 changed by anonymous

  • version changed from 1.0.0 to 1.1.1.

InPlaceEditor still strips HTML tags if using loadTextUrl option, which is different from its default behaviour (no stripping).

06/18/06 18:07:56 changed by m.drozdzynski@gmail.com

  • attachment load_text_url_stripping_html_tags_patch.diff added.

Patch for preventing loadTextUrl stripping HTML tags from response

09/06/06 20:14:12 changed by madrobby

  • status changed from new to closed.
  • resolution set to untested.