New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tinyMCE DRY for the inline script #8366
Conversation
I got other things seems work fine 😄 |
@Fedik normality restored... |
one more: |
preg_match('/y:\s*+\d{2,4}/', $options, $modalHeight); | ||
$modalWidth = filter_var(implode("", $modalWidth), FILTER_SANITIZE_NUMBER_INT); | ||
$modalHeight = filter_var(implode("", $modalHeight), FILTER_SANITIZE_NUMBER_INT); | ||
preg_match('/\s*+(window)/', $options, $matches); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe better idea is to move it to javascript and parse on the client side, with Function constructor:
var getOptions = new Function("return {handler: 'iframe', size: {x:window.getSize().x-100, y: window.getSize().y-100}}");
var options = getOptions();
var width = options.size && options.size.x ? options.size.x : 0;
var height = options.size && options.size.y ? options.size.y : 0;
but I have no idea what to do with bootstrap modals, where the width/height need to be set in the iframe layout 🙊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buttons are not available with bootstrap modal, yet!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore my previous comment,
I totally missed that getSize()
in window.getSize()
comes from mootools,
nor eval
nor my suggestion will not work here without mootools loaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fedik we should be able to extract or copy the logic that calculates the modal size or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm,
I see only 2 way (revert changes I not count):
- or load mootools
- or create own method
window.getSize
like:
window.getSize = window.getSize || function(){
return {x: jQuery(window).width(), y: jQuery(window).height() };
};
(but no idea where to place this code)
then it can work with that suggestion https://github.com/dgt41/joomla-cms/pull/27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fedik still got errors, the problem is that we need to revaluate the width and height since it is not just the window size (we should parse the integer and subtract from the window width). I think hardcoding these values is way easier...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which errors you got?
here "...{x:window.getSize().x-100, y: window.getSize().y-100}.."
seems work fine with Fedik@faf1fa5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fedik I am stupid, I had edited the line "...{x:window.getSize().x-100, y: window.getSize().y-100}.."
that’s why I was getting an error 🙈
This works fine, thanks again!
I have tested this item ✅ successfully on 2b774e6 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8366. |
I have tested this item ✅ successfully on 2b774e6 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8366. |
@joomla-cms-bot are you sleeping? |
Cool @dgt41 i also got worried about him. Thanks for wake up @joomla-cms-bot :) |
tinyMCE DRY for the inline script
DRY
Few lines are repeated on the 3 different modes. We don’t have to…
Also instead of using tinyMCE.activeEditor we target exactly the editor we want.
Testing
Use tinyMCE as your editor. Try all different modes (simple, advanced, extended).