-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Input Events Level {1,2} #580
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The default behavior is rarely what we want: <b> instead of <strong>, <i> instead of <em>, etc.
We don't technically need to cancel them and support is varied between Level 1 and 2 so skip it altogether for clarity.
To support Composition's special cases for removing formatting, selecting attachments, etc. when the selection is collapsed.
# Conflicts: # .blade.yml
… all disabled attributes
Fixes reordering images in galleries, and generally ensures that attachments remain managed.
Fixes handling multiple deletions within a single animation frame.
…ing attachments Looking at you, Safari. Setting *any* dataTransfer values fixes it.
Safari's beforeinput.insertFromPaste event doesn't include files in its dataTransfer, and, annoyingly, does include text/html with an unusable <img src="blob:http://…">. So, handle and cancel the paste event just for file pastes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the way Trix records input—particularly on mobile—by adding support for Level 2
InputEvents, which are currently implemented in Safari and Chrome, and in their companion webview implementations on iOS and Android. In all other browsers, Trix will continue to work exactly as it does today. Here's how:First, Trix tests for
InputEventsupport:trix/src/trix/index.coffee.erb
Lines 21 to 24 in 650ee9a
Then, when a
<trix-editor>initializes, its editor controller installs one of two input controllers:trix/src/trix/controllers/editor_controller.coffee
Lines 24 to 26 in 650ee9a
Trix.Level2InputControllerif input events are supportedTrix.Level0InputController, which is equivalent to the currentTrix.InputController, if input events are not supportedFixes #575
Fixes #574
Fixes #520
Fixes #494
Fixes #396
Fixes #315
Fixes #178
Closes #564