Skip to content
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

Add onLoad event #78

Closed
s0xDk opened this issue Nov 19, 2016 · 4 comments
Closed

Add onLoad event #78

s0xDk opened this issue Nov 19, 2016 · 4 comments

Comments

@s0xDk
Copy link

s0xDk commented Nov 19, 2016

Because of racing conditions, editor element isn't always has emojioneArea data attr.

I've hot fixed this issue in my copy of the code by changing

editor.data(source.data());

to

editor.data(source.data());
editor.data('emojioneArea', self);

hope this helps.

@brunomachado
Copy link

Same here. Thanks for the fix.

@carpii
Copy link
Contributor

carpii commented Sep 23, 2017

Did this ever make it into master, or is this workaround still required?

@mervick
Copy link
Owner

mervick commented Sep 23, 2017

Did this ever make it into master, or is this workaround still required?

The fix above is completely wrong.

EmojioneArea add emojioneArea data attr after loading emojione assets,
so if you run your code in $(document).ready() then emojioneArea still not ready and you need wait until emojione lib will load.
In new version of emojioneArea planned to add new event which will be trigger when emojioneArea will be ready.

For fix this you can use something like:

$("#emojionearea").emojioneArea();
var ready = function(next) {
  var timer = setInterval(function() {
    if ($("#emojionearea").is(":hidden")) {
      clearInterval(timer);
      next();
    }
  }, 200);
};

ready(function() {
   // your code here
});

p.s. PR are welcome

@carpii
Copy link
Contributor

carpii commented Sep 23, 2017

Thanks @mervick

I'm having an issue in Firefox where emojionearea has the keyboard focus, but typing into it does not result in characters being added (intermittently).
I thought maybe it was related the data() not being set properly, but I guess it's not

@mervick mervick changed the title editor is not always provided with "emojioneArea" data attribute Add onLoad event Oct 4, 2017
@mervick mervick added the feature label Oct 4, 2017
@mervick mervick closed this as completed in 464c18c Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants