Static page toobar not working correctly

Creating and modifying plugins.
Post Reply
User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Static page toobar not working correctly

Post by Don Chambers » Thu Feb 04, 2016 5:56 am

Not sure how long this has been an issue... I'm using latest snapshot.

I rarely use any wysiwyg editor.. today, while editing a static page, I noticed the first several toolbar buttons (NoBr, I, B, U & quote) don't seem to work. Using them results in "undefined" being inserted instead of the proper html code. Can anyone verify this?

User avatar
yellowled
Regular
Posts: 7005
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled » Thu Feb 04, 2016 10:40 am

Nope. WYSIWYG editor (= CK editor) in static pages works just fine (in current master). “Undefined” sounds like a JS error, can you check the JS console for errors?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page toobar not working correctly

Post by Don Chambers » Thu Feb 04, 2016 5:05 pm

I don't think I was clear - I noticed the error when NOT using any wysiwyg editor.

console references the following file:
serendipity_admin.php?serendipity[action]=admin&serendipity[adminModule]=event_display&serendipity[adminAction]=staticpages&serendipity[staticpagecategory]=pages&serendipity[staticid]=1

Error is:
ReferenceError: wrapSelection is not defined
onclick()

User avatar
yellowled
Regular
Posts: 7005
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled » Thu Feb 04, 2016 7:16 pm

Don Chambers wrote:I don't think I was clear - I noticed the error when NOT using any wysiwyg editor.
I did indeed think you meant the wysiwyg editor.

I can reproduce it using the non-wysiwyg editor buttons. It is unrelated to the s9y version, I can reproduce it in a current master as well as in 2.0.3. Combined with the fact that the same buttons in the entry editor still work, it seems likely that this is an error in static pages only.

wrapSelection is a function that is defined in templates/2k11/admin/serendipity_editor.js.tpl, which the static page editor does include. However, that function has been namespaced, and the onclick handler for these buttons in static pages still references the old function name. Meaning it calls a function that now is called serendipity.wrapSelection.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 7005
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled » Thu Feb 04, 2016 7:20 pm

The same for wrapInsImage and wrapSelectionWithLink on the img and URL buttons. The media db button does work because the related function is called via the class on the button.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page toobar not working correctly

Post by Don Chambers » Thu Feb 04, 2016 7:21 pm

so..... the solution is..... :?: :?: :?:

User avatar
yellowled
Regular
Posts: 7005
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled » Thu Feb 04, 2016 7:29 pm

Don Chambers wrote:so..... the solution is..... :?: :?: :?:
To use the properly namespaced function call in the onclick handler, but this could be tricky. If we update the plugin to do that, it will break for people that still use versions < 2.0 (because it is not namespaced there).

We do have a policy that it is okay to break things now, but this is something that we can get around easily (I think) by using a version switch. There is the discussion if these version switches perform well, but since this is broken (I can't believe no one has reported this earlier, by the way!), it needs to be fixed.

However, Ian will probably be able to fix this quicker than I could, I guess? (And he might have some more thoughts on this.)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 7005
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled » Thu Feb 04, 2016 8:18 pm

https://github.com/s9y/Serendipity/issues/389

According to Ian, the solution is to use his newer version of the static pages plugin, which is not available on spartacus or through the spartacus plugin.

I think it should be fixed in the version available on spartacus or Ians new version should replace the one on spartacus. I don't think we should expect all users to install a non-spartacus version manually.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page toobar not working correctly

Post by Don Chambers » Thu Feb 04, 2016 8:44 pm

I responded on Github.

Post Reply