Static page toobar not working correctly

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

Static page toobar not working correctly

Post by Don Chambers »

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?
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled »

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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page toobar not working correctly

Post by Don Chambers »

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()
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled »

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
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled »

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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page toobar not working correctly

Post by Don Chambers »

so..... the solution is..... :?: :?: :?:
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled »

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
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Static page toobar not working correctly

Post by yellowled »

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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page toobar not working correctly

Post by Don Chambers »

I responded on Github.
=Don=
Post Reply