Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[2012-11-26] ssbuttons.insertmedia not correctly loading the dimensions and alignment from the HTML #597

Closed
silverstripe-issues opened this Issue Apr 3, 2013 · 3 comments

Comments

Projects
None yet
2 participants

created by: hermit
created at: 2012-11-26
original ticket: http://open.silverstripe.org/ticket/8049


In SS 3.02 and 3.03 there's an issue where the SS additions to the TinyMCE editor are not correctly loading the dimensions and alignment from the HTML.

When I click on an image in the TinyMCE editor and click on the ssbuttons.insertmedia button I get a TypeError:

Uncaught TypeError: Object # has no method 'getAttribute'

Trace:
. (anonymous function)

. (anonymous function)jquery.entwine-dist.js:677?
. onejquery.entwine-dist.js:1020?
. prxyjquery.entwine-dist.js:1048?
. (anonymous function)HtmlEditorField.js:773?
. firejquery.js:1075?
. self.fireWithjquery.js:1193?
. donejquery.js:7553?
. callbackjquery.js:8324?

I don't know how to go from here as HtmlEditorField.js has a lot of information for a newcomer.

The dimensions in the Update Media pane are set to the image dimensions or to the maximum width an image can be. Alignment is set to align left. So it's just like how it would be when you add a new image.
If clients want to change alignment they have to set the current image dimensions manually and then change the alignment.

I've tested this in the latest Chrome 22.0.1229.92 and Firefox 16.0.2.

I'm new to SS, I tried to find existing bug reports but couldn't find any.

comment by: hermit
created at: 2012-11-26


It doesn't happen with all images. I couldn't find a pattern in it yet.

comment by: hermit
created at: 2012-11-27


This works for me:

https://github.com/hermiteu/sapphire/commit/32610565b1b4b5cf003b58ed5aaef202c1a9e476

Fixes the JS error and updates the dimensions and alignment correctly.

I haven't read about Entwine yet, maybe it's not needed to create a new updateFromNode() method but inherit it from another DOM element? I have no idea if that makes sense, I understand Entwine uses DOM elements as objects.

Contributor

simonwelsh commented Mar 16, 2014

Looks fixed to me.

@simonwelsh simonwelsh closed this Mar 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment