JS error after dragging a Selector into another folder

This topic contains 10 replies, has 2 voices, and was last updated by  Sebastian 4 years, 9 months ago.

Author Posts

hzesen1221

Hello, I just downloaded and installed MicroThemer and encountered an obvious problem:

after creating my first Selector, I dragged it into the ‘Content’ folder, however, I couldn’t adjust the properties of this selector anymore:

1: When I tried to change its color, it loads for quite a long time and then gives me:

Something’s wrong
Saving settings took more than 30 seconds. A JavaScript error may be preventing the action from completing. The following errors were detected:
Error:
Uncaught TypeError: Cannot read property ‘split’ of undefined
URL: /wp-content/plugins/microthemer/js-min/microthemer.js?v=5.1.1.6&ver=4.9.1

2: When I tried to switch to the ‘Text’ pane it gives me:

Uncaught TypeError: r.attr is not a function (line1)
URL: /wp-content/plugins/microthemer/js-min/microthemer.js?v=5.1.1.6&ver=4.9.1

3: When I tried to disable all styles under the ‘Content’ folder, it gives me:

Uncaught TypeError: Cannot read property ‘split’ of undefined

—————————————-

PS1: side-question: when dragging a Selector around folders, if I hover on other folders before eventually placing it inside the desired one, all folders that I accidentally hovered across get opened and I would have to manually collapse them all afterwards. This behavior is kind of undesirable.

PS2: after dragging a Selector to another folder, if I immediately refresh the page. All bugs mentioned above go away. All properties could be updated again and all folders get collapsed.

I am not sure if there is something wrong with my setup or what since such obvious bugs shouldn’t exist in a mature product like MT I suppose.

Thanks for any help!


Sebastian

Hey,

Sorry for the trouble. Thanks for reporting this. It does sound like it could be a conflict causing the JS error. Or it might be because I updated the folder drag system before the weekend and may have introduced a new bug.

PS1 Answer: yes the auto-open folders feature was added fairly recently because users reported that is was inconvenient to manually open folders before dragging the selector. But I see what you mean about accidentally opening folders. I was going to add an expand/close all option for the folders. Would that be an acceptable antidote, or would you prefer a different solution entirely for opening folders?

PS2 answer: When one JS error occurs, the browser often prevents further actions from happening that depend on JavaScript. After a page refresh, the script is no longer blocked by the error, and so actions can be performed again.

Would you mind sending me access details for your site via our secure contact form so I can troubleshot the cause of the error?

Many thanks,
Sebastian


Sebastian

P.S. Could you make sure you’re running the latest version of Microthemer too. And if you would prefer not to send access details at this stage, temporarily disabling other plugins to see if there is a conflict might give us a useful clue. I wasn’t able to replicate the selector dragging issue which suggests it might be a conflict issue.

Cheers,
Sebastian


hzesen1221

Open / Collapse All would be cool.

I am still playing around with MT on my local dev environment but I will get a canvas site online for your to review in a minute.

Thanks!


Sebastian

Got the access details. Thank you! I’ll play around and update you shortly.


hzesen1221

Hey Sebastian,

Just set up a canvas site with only MT installed as plugin. Sent you the password already please take a look.
Thanks!

By the way, I don’t need that Preference submenu since it is accessible in the main MT app, so I would like to have the main MT app shown as a submenu under Appearance.

I hacked the core (tvr-microthemer.php) by adding the following code at the very end of function microthemer_dedicated_menu:


remove_menu_page($this->microthemeruipage);
add_theme_page(__('Microthemer UI', 'microthemer'), 'Microthemer', 'customize', $this->microthemeruipage, array(&$this,'microthemer_ui_page'));

is there a way that would allow me to do this as an independent plugin rather than hacking the core? I think the microthemer_ui_page method is not accessible outsite this class is it?


Sebastian

Hey,

If you don’t want to show the shortcut to Microthemer’s preferences from the WP admin area, you could add the following CSS to run on the admin side:

#toplevel_page_tvr-microthemer ul.wp-submenu {
display:none;
}

To run CSS on the admin area (add to your theme’s functions.php file):

add_action('admin_head', 'my_custom_fonts');

function my_custom_fonts() {
echo '<style>
#toplevel_page_tvr-microthemer ul.wp-submenu {
display:none;
}
</style>';
}

You are right that the microthemer_ui_page method isn’t available outside the class. So the CSS approach is probably the most easy way to accomplish your goal without redoing the core hack when you update Microthemer.

I’m still working on your other issue.


hzesen1221

Thanks Sebastian,

In my opinion, using the CSS approach would involve more work than what you just proposed if you also want to get rid of that triangle hover effect on the main menu (since WordPress still thinks there are submenus attached).

If removing the Preference submenu is all I need I guess I would simply do this:

remove_submenu_page('tvr-microthemer.php', 'tvr-microthemer-preferences.php');

.. provided that these menu slugs won’t be changed in future updates.

However my main interest is to move MicroThemer under Appearance as a submenu. But really, don’t worry about this at all. It’s not that big of a deal after all 🙂


Sebastian

Ah yes, you make a good point about the customising menu item. Sorry I can’t offer an ideal workaround there.

With regards to the bugs you reported, I think I’ve fixed the root cause – following your hint about the case of a single selector. Dragging a selector between folders, when only one selector had been created, caused Microthemer to think there were zero selectors for a split second. And this wiped out some internal references to the selector in focus (the one displayed in the top toolbar). Subsequent actions triggered various undefined errors as a result.

Version 5.1.1.7 fixes this. You should be able to update via your WordPress dashboard now.

Please let me know if you notice any other issues, I will get them sorted ASAP.

Thanks!
Sebastian


hzesen1221

Thanks for the quick fix. Hope that the updates and supports for MT will still be around for the next millenary to come. License upgraded. Can’t miss the steal before it’s gone forever, sorry 🙂


Sebastian

Haha, thanks for upgrading. I’m confident that Microthemer will be around for a long time 🙂

You must login or register to reply to this topic.