Ticket #1979 (closed defect: fixed)

Opened 13 months ago

Last modified 10 months ago

Insert Images in TinyMCE in CMS crappy attributes

Reported by: dio5 Owned by: sminnee
Priority: medium Milestone: 2.2.3*
Component: CMS - TinyMCE editor Version:
Severity: medium effort / impact Keywords: image, tinymce, alt attributes, css
Cc: Hours:

Description

When inserting images with tinymce in SS2.2 I'm getting weird results.

Just inserting it from the right 'image' tool setting style to 'left with wrap' description to 'test' gives:

<img class="left" src="assets/Uploads/_resampled/ResizedImage333222-image.jpg" alt="test" title="null" align="null" height="222" hspace="null" vspace="null" width="333" />

- Title: null - hspace vspace align should be possible to leave them out.

I noticed that I could right-click on the image in the content area and get a popup. So I cleared the 'null' values, just erased them. This resulted in vspace and hspace gone, but the class was gone too, and the title had changed from null to undefined...

There should be a way that when inserting you just have:

- a title - an alt - a class (left, ... )

Without everything else.

A possible (crappy) solution for the hspace vspace align - stuff to disappear is: Erase hspace - vspace - align in cms/javascript/tinymce.template.js

That would make the right click - image properties quite unuseful and broken, but leaves out the crap.

It doesn't solve the 'title' issue though.

Change History

Changed 13 months ago by sminnee

  • milestone changed from 2.2.1 stable to 2.2.2 feature-lock

This is definitely not for the 2.2.1 release - 2.2.1 is for critical bugfixes only.

Seems like a good candidate for 2.2.2, though.

Changed 13 months ago by TimCopeland

Patch from http://www.silverstripe.com/site-builders-forum/flat/13774?showPost=14581#post14581

---

The solution:

find jsparty/tiny_mce_improvements.js

locate the line (665 here):

TinyMCE_AdvancedTheme._insertImage(relativeHref, altText, 0, null, null, $('Form_EditorToolbarImageForm_Width').value, $('Form_EditorToolbarImageForm_Height').value, null, null, null, null, cssClass);

and replace it with

TinyMCE_AdvancedTheme._insertImage(relativeHref, altText, 0, null, null, $('Form_EditorToolbarImageForm_Width').value, $('Form_EditorToolbarImageForm_Height').value, null, altText, null, null, cssClass);

(the third last null (=title) is replaced with the altText).

Changed 11 months ago by sminnee

  • milestone changed from 2.2.2 feature-lock to 2.2.3 feature-lock

Changed 10 months ago by ischommer

  • status changed from new to closed
  • resolution set to fixed

thanks for the patch! i've fixed up the other "null" attributes as well by passing empty strings to the image constructor function instead of "null" (which seems to be interpreted as a string and thus included together with an invalid attribute).

see r50761 (committed to trunk)

Note: See TracTickets for help on using tickets.