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

Feature/remove zwj contenteditable false #394

Conversation

laurenbarker
Copy link
Contributor

@laurenbarker laurenbarker commented Apr 19, 2016

It may be beneficial if it was an option to use contenteditable="false" instead of the &zwj.

Purpose

Fix unusual contenteditable behavior in WebKit browsers as described in #393.

Changes

  • remove zero width joiner from end of span
  • add contenteditable="false" to inserted span

Side effects

Deleting the mention/emoji deletes the trigger (@, :, etc.).

Using contenteditable="false" may cause unexpected behavior in old browsers or IE. I only tested this in Chrome, Firefox, and Safari. This article from 2014 describes a bug when using contenteditable="false" in Chrome and Safari but I couldn't reproduce it so it appears to be fixed.

@laurenbarker laurenbarker changed the title [WIP] Feature/remove zwj contenteditable false Feature/remove zwj contenteditable false Jun 9, 2016
@laurenbarker
Copy link
Contributor Author

@ichord, this is ready for review. Please let me know if there are any changes that can be made to get this merged. Thanks!

if (range = this._getRange()) {
range.setEndAfter(this.query.el[0]);
range.collapse(false);
range.insertNode(suffixNode = this.app.document.createTextNode("\u200D" + suffix));
range.insertNode(suffixNode = this.app.document.createTextNode + suffix);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leb2dg Should it be this.app.document.createTextNode(suffix) ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I see you fix it in the next commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I can clean up the commits and resolve the conflicts on this 👍

@laurenbarker
Copy link
Contributor Author

Closing in favor of #423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants