Disable event manager when editing is disabled #573
Merged
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.
Previously, manual (as opposed to programmatic) editing was being
prevented for an editor after calling
#disableEditing
by setting"contenteditable" back to false for the editor's element. This prevents the
browser from sending most of the edit-related events (keyup, keydown,
etc) that occur when editing manually. But some events (like paste) are
still emitted by the browser even though "contenteditable" is false.
This change calls
EventManager#stop
when editing is disabled, andinternally the event manager ignores all events when it is stopped.
Also some rearrangement
Other changes
isEditable
prop to default to true ratherthan null (incidentally allows a user to specify that an editor
should start disabled by passing in that prop to the constructor)
assert.isBlank
hasElement
andhasNoElement
getData
(for parity with thesetData
inelement-utils and to avoid using jQuery's
.data()
method)editor#render
calldisableEditing
orenableEditing
afterit sets
hasRendered
to ensure that the event manager is stopped ifthe user calls
editor.disableEditing()
before callingeditor.render()
Fixes #572