-
Notifications
You must be signed in to change notification settings - Fork 333
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
Need a way to trigger resetWidth
aside from window resize
#158
Comments
Hmm, this is a good question. I'd have to look into the code and see how hard it'd be to check for a hidden/unhidden state set by something else (like some random bit of JS or CSS). Until then have you tried using |
Yup, that works perfectly. So just hiding the container is definitely not the way to go. Only thing I had to make sure to do is check the state of the editor before calling load or unload to prevent any errors from showing up. Example:
Awesome, thank you :D |
Cool, yeah I'll try to get if (eEditor.is('loaded')) {
eEditor.unload();
} |
Question tho, what errors showed up and why? Doing unload if the editor was unloaded? |
I got this: Something else (which I'm sure I'm just doing it wrong) here is how I'm initializing EpicEditor:
Not sure if this is how I'm suppose to do it but if I don't load it first, then unload, I get an error later on when I try to load for the first time. The reason I have to unload is because EpicEditor may not be the initial active editor. |
Thanks, this is really helpful. I've been building the editor so much I haven't had a lot of time to actually implement it anywhere for real so I don't know real life issues and use cases. The error you see is an error I'm throwing myself to notify the developer. It's not actually harmful and wont break anything. I was working on a way to by default hide those unless you want to see them here in #118. For example: ee.on('error', function (err) {
if (err.type == 'not_loaded') {
// Custom error handler here
}
}); As for the loading and unloading thing... If you need to do anything that interacts with the DOM of the iframe, then you need to load it before you can do anything with it. Methods that this would be required are like Why do you need to unload it at first? Why can't you wait for the first request to open the editor then do load like: // the default editor is the "HTML" one lets say...
var eEditor = new EpicEditor(opts);
$('.ee-tab').on('click', function () {
if (!eEditor.eeState.loaded) {
eEditor.load();
}
});
$('.other-tabs').on('click', function () {
if (eEditor.eeState.loaded) {
eEditor.unload();
}
}); |
That's pretty much how I am doing it. The problem is that if it's not initially loaded, I don't have access to |
mm, good point. This will be fixed once I get the eEditor.eeState.loaded = false;
eEditor.eeState.unloaded = true;
// Now you can use the code above Basically, just manually set them before using them in the if/elses |
@sebnitu I added the |
Yes, this works perfectly! Thank you :D |
The issue I'm having is that in some instances I'm hiding EpicEditor's container and if the browser get's resized the width of the editor's width gets set to
0
. Then when EpicEditor's container gets toggled, the editor's width is still set to0
and isn't shown until another window resize is triggered.Or maybe there's another way of doing this? Maybe don't fire the
resetWidth
function if the editor is hidden?Or maybe I'm doing this wrong to begin with? Should the editor never be hidden and instead only use the
load
andunload
methods?Here's a quick video demonstration: http://cl.ly/IC4y
The text was updated successfully, but these errors were encountered: