-
Notifications
You must be signed in to change notification settings - Fork 152
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
onTextInput not triggered on tab #400
Comments
bantic
added a commit
that referenced
this issue
Aug 30, 2016
Change the event manager to delegate insertion of tab key to the input handler rather than simply inserting the string. Also: Lot of cleanup to tests. Fixes #400
bantic
added a commit
that referenced
this issue
Aug 30, 2016
Change the event manager to delegate insertion of tab key to the input handler rather than simply inserting the string. Also: Lot of cleanup to tests. Fixes #400
johnelliott
pushed a commit
to dailybeast/mobiledoc-kit
that referenced
this issue
Feb 7, 2017
…ustle#479) Change the event manager to delegate insertion of tab key to the input handler rather than simply inserting the string. Also: Lot of cleanup to tests. Fixes bustle#400
@bantic I believe the same is happening with line breaks. editor.onTextInput({
name: 'linkify',
match: /\b(https?:\/\/[^\s]+)\s$/,
run(editor, matches) {
let url = matches[0];
// the editor's current range is the cursor position, 1
// character after the URL (to account for the space).
// Keep a reference to this range so that it can be restored later
let currentRange = editor.range;
// 1. Create a logical range containing the URL.
// Move the range 1 space backward (to skip over the space), and
// then extend it backward the length of the URL:
let linkRange = currentRange.move(-1).extend(-url.length);
// 2. Create the markup
let linkMarkup = editor.builder.createMarkup('a', { href: url });
// 3. apply the markup to the range
editor.run((postEditor) => {
postEditor.addMarkupToRange(linkRange, linkMarkup);
});
// 4. restore the cursor position
editor.selectRange(currentRange);
}
}); Since we're using |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
quoting @bantic
The text was updated successfully, but these errors were encountered: