TinyMCE Bug
-
Hello! I am getting an error in combination with the Popup Maker Plugin (https://de.wordpress.org/plugins/popup-maker/). The plugin creates a custom post type which uses the normal WP Editor (visual & text).
customizer/assets/js/tinymce_set_customizer_css.js
ReferenceError: customizerPassedData is not defined
This results in tinymce isn´t working anymore.
I had a look into customizer/customizer.php and commented out the lines 81&82. After that the editor is working correctly. Is there anyway to hook into the method and prevent to load the js for specific post types?
Thanks in advance!
-
Dear @Timm
because LayTheme is written as a single Javascript-Application some things are not possible.
For example use extra post types, or include some jQuery scripts.
Also it is not recommended to modify the theme files, because the changes will get overwritten with the next update.It's all a compromise. If you want to use those features, I recommend to have a look at LayGridder.
Hope I could make things clear :-)
Best!
Marius
-
Hi @mariusjopen Marius! Thank you for the answer. I totally understand your position. Using LayGridder isn´t an option at the moment. So I had a look at the the JavaScript itself and fixed it by simply checking the type of the variable before executing the function.
tinymce.PluginManager.add('setcustomizercss', function( editor ) { if(typeof customizerPassedData !== 'undefined') { var css = String() +'a{' +'color:'+customizerPassedData.linkcolor+';' +'border-bottom-style: solid;' +'border-bottom-width: '+customizerPassedData.linkUnderlineStrokeWidth+'px;' +'}' +'body{' +'background-color:rgb(235,235,235)!important;' +'}'; editor.on('PreInit', function(e){ editor.contentStyles.push(css); }); } } );
This fixed the problem with tinymce in custom post types. And the customizer still works. Do you see any problem with this fix? If not it would be great if you could have a look at it and propably integrate it within the next update?
Thank you for your feedack!
-
Dear @Timm
thank you for contributing this!We will check if the code fits into the rest of LayTheme.
All the best and heads up!
Marius
-
Hey thanks!
I will include it in the next update <3
-
Hey @arminunruh
great! Thank you!
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it