Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2012-08-09 15:51:34

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Reporting an issue between msd_minibar and latest Txp 4.5 Beta (from SVN): forum.textpattern.com/viewtopic.php?pid=264308#p264308


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#17 2012-08-09 16:36:38

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Maniqui, I wasn’t able to recreate this behavior. Do you have any custom buttons you’ve added?

Steps I took to try and reproduce:

  • Highlighted text in existing article and used one of the mini_bar buttons to modify it.
  • Clicked Save
  • Saw “Article Saved” message
  • Created new article
  • Highlighted text in new article and used one of the mini_bar buttons to modify it.
  • Clicked Publish
  • Saw “Article Published” message

I tried this using both the Classic theme and Hive on 4.5.0-beta (r4033). I only tested using IE8 (because I’m at work shhhhh).

Last edited by MattD (2012-08-09 16:38:05)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#18 2012-08-09 16:53:07

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Hi Matt. Thanks for the prompt reply & for taking the time of doing a test.

I’ve more info about this issue (which I’m not sure it will get covered by the warranty ;) ): I’m using the plugin from the plugin cache dir. I’ve just tried installing it directly on the DB (as any good Txp citizen would do) and it worked flawlessly. :D
Now, I wonder if there is any solution for us, badasses who run plugins from plugin cache dir ;)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#19 2012-08-09 17:00:16

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

No idea on why that would cause any difference. There aren’t any lifecycle events that take place on install for this plugin or anything complicated going on.

Maybe diff the html source of the write page with the plugin loaded each way and see if something is different?
Also compare the output of http://yoursite.com/textpattern/?msd_minibar_js=jquery.caret.js
and http://yoursite.com/textpattern/?msd_minibar_js=msd_minibar.css with the plugin loaded each way.

I can do this later this evening if needed.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#20 2012-08-10 01:59:56

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

maniqui wrote:

Now, I wonder if there is any solution for us, badasses who run plugins from plugin cache dir

Plugin’s in the cache directory are loaded globally, and as such, will cause issues. For instance these plugins that add markup to the admin-pages interface, will be active on the async ajax responses too. These response pages have same callback events available and a plugin that inject markup to the admin-side interface, will inject it’s markup to the response script too, making it invalid and causing the issue you are describing.

MattD wrote:

No idea on why that would cause any difference. There aren’t any lifecycle events that take place on install for this plugin or anything complicated going on.

Difference is where the plugin is loaded when the plugin cache directory is used. There is nothing wrong with your plugin, and I would say you do not really have to do any changes to it. The code itself is very much fine. Anyways, the line that is causing the mentioned issue is:

register_callback("msd_minibar", "article");

The above line will add msd_minibar function’s output to the script response when plugin is loaded using the wrong type (i.e. using plugin cache directory). To remedy the issue, you could change that callback event to a one that isn’t ran on the ajax script responses. For instance the admin_side.head_end is safe to use. E.g.

register_callback("msd_minibar", "admin_side", "head_end");

You can then prevent the script from running on all admin-side panels by adding something like this to the top of the msd_minibar function:

global $event;
if($event !== 'article') {
	return;
}

Last edited by Gocom (2012-08-10 02:10:53)

Offline

#21 2012-08-10 02:43:54

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Thanks for the follow up, Gocom.

I’ve applied the changes you suggested Matt, but so far, it doesn’t seem it has made any difference: the alert message is still popping up after saving. If you have any other suggestion, let me know & I’ll test it.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#22 2012-08-10 16:01:17

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

I’ve taken Gocom’s suggestions and updated the plugin. Maniqui, give version 0.6 a try.

For now it still loads on every page.

Last edited by MattD (2012-08-10 16:14:31)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#23 2012-08-10 16:59:21

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

I’m running v0.6 from plugin cache dir and it seems to be working flawlessly (no more alert message).
Many thanks, Matt & Gocom!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#24 2012-08-11 05:23:35

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,414
Website GitHub Mastodon

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Gocom wrote:

Plugin’s in the cache directory are loaded globally, and as such, will cause issues.

Somebody should really fix this issue. There’s even a thread for this.

While I don’t expect an immediate solution in core a plugin cache loader plugin would be a nice community contribution to flesh out a proper method (hint, hint).

I don’t think that relying on every individual plugin author to adapt her plugins for our current naive cache method is a sustainable tactic.

Last edited by wet (2012-08-11 05:25:12)

Offline

#25 2012-08-11 08:45:15

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

wet wrote:

I don’t think that relying on every individual plugin author to adapt her plugins for our current naive cache method is a sustainable tactic.

Agreed. Wondering if txplib_misc could fit a @deprecated tag.

Offline

#26 2012-08-11 08:47:40

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,414
Website GitHub Mastodon

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Gocom wrote:

Agreed. Wondering if txplib_misc could fit a @deprecated tag.

Sure. If it is accompanied by a // TODO #needs-patch ;)

Offline

#27 2012-08-13 17:26:29

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Hi Matt,

did this post go under the radar?
I see it wasn’t implemented in v0.6 (of course, it’s your plugin, you are the one to decide what goes into it :) ).


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#28 2012-08-13 20:00:39

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Added to version 0.7 which is now available.

Thanks,


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#29 2012-08-13 22:58:09

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

Thanks, Matt.
one little thing, I totally forgot to suggest to do the same for #msd_link & #msd_image

$("#msd_link").click(function(e) {
                e.preventDefault();
                (...)
$("#msd_image").click(function(e) {
                e.preventDefault();
                (...)

I hope it justifies version 0.7.1 :)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#30 2012-08-13 23:54:09

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: msd_minibar: Adds a Microsoft Office style "minibar" to the Write tab

I should have been paying attention and thought of that myself. Fixed now. I didn’t increment the version number.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB