Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Other: Don't set contenteditable property for widgets on Edge. #46

Merged
merged 3 commits into from
Jul 6, 2018

Conversation

jodator
Copy link
Contributor

@jodator jodator commented Jul 5, 2018

Suggested merge commit message (convention)

Other: Don't set contenteditable property for widgets on Edge.


Additional information

@coveralls
Copy link

coveralls commented Jul 5, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling f312541 on t/ckeditor5/1079 into bbf9298 on master.

@jodator jodator force-pushed the t/ckeditor5/1079 branch from 4b3c731 to 090544a Compare July 5, 2018 12:10
@jodator jodator requested a review from Mgsy July 5, 2018 12:14
@jodator
Copy link
Contributor Author

jodator commented Jul 5, 2018

@Mgsy This one might not work (although it should) before merging ckeditor/ckeditor5-engine#1450. You could check it now quickly but I'll ping you after ckeditor/ckeditor5-engine#1450 anyway :).

src/utils.js Outdated
// https://github.com/ckeditor/ckeditor5/issues/1079
if ( !env.isEdge ) {
writer.setAttribute( 'contenteditable', 'false', element );
}
Copy link
Member

Choose a reason for hiding this comment

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

Missing blank line.

src/utils.js Outdated
@@ -57,7 +58,11 @@ export function isWidget( element ) {
* @returns {module:engine/view/element~Element} Returns same element.
*/
export function toWidget( element, writer, options = {} ) {
writer.setAttribute( 'contenteditable', 'false', element );
// The selection on Edge behaves better when whole editor contents is in single contentedible element.
Copy link
Member

Choose a reason for hiding this comment

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

the whole

in a single contenteditable element

src/utils.js Outdated
editable.on( 'change:isReadOnly', ( evt, property, is ) => {
writer.setAttribute( 'contenteditable', is ? 'false' : 'true', editable );
} );
// Bind contenteditable property to element#isReadOnly.
Copy link
Member

Choose a reason for hiding this comment

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

Bind the contenteditable property

src/utils.js Outdated
@@ -154,13 +159,17 @@ export function getLabel( element ) {
export function toWidgetEditable( editable, writer ) {
writer.addClass( [ 'ck-editor__editable', 'ck-editor__nested-editable' ], editable );

// Set initial contenteditable value.
writer.setAttribute( 'contenteditable', editable.isReadOnly ? 'false' : 'true', editable );
// The selection on Edge behaves better when whole editor contents is in single contentedible element.
Copy link
Member

Choose a reason for hiding this comment

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

the whole

in a single contenteditable element

@Reinmar
Copy link
Member

Reinmar commented Jul 5, 2018

CC dropped. We need to cover this. You can stub env.isEdge

@jodator jodator changed the title Feature: Add env.isEdge property. Other: Don't set contenteditable property for widgets on Edge. Jul 5, 2018
@Mgsy
Copy link
Member

Mgsy commented Jul 6, 2018

It works properly. I only noticed that in Edge the cursor changes to text while hovering a widget.

bug_cke5

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

Successfully merging this pull request may close these issues.

4 participants