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

Fix for: Paste buttons has wrong state in read-only mode #2867

Merged
merged 15 commits into from
Mar 26, 2019
Merged

Conversation

engineering-this
Copy link
Contributor

What is the purpose of this pull request?

Bugfix

Does your PR contain necessary tests?

All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

Included editor.readOnly in check for command state function.

Closes #2775

@Comandeer Comandeer self-requested a review February 27, 2019 11:34
@Comandeer Comandeer self-assigned this Feb 27, 2019
@Comandeer Comandeer changed the base branch from major to master February 27, 2019 12:00
@@ -1222,11 +1222,14 @@
}

function stateFromNamedCommand( command ) {
if ( inReadOnly && command in { paste: 1, cut: 1 } )
// We need to correctly update toolbar states on readOnly (#2775).
if ( ( inReadOnly || editor.readOnly ) && command in { paste: 1, cut: 1 } ) {
Copy link
Member

Choose a reason for hiding this comment

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

Won't it be better to ensure that inReadOnly variable contains correct info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This variable is used only here, but it is updated in other places, I'll move it here.

@@ -58,4 +58,47 @@ var tests = {

tests = bender.tools.createTestsForEditors( CKEDITOR.tools.objectKeys( bender.editors ), tests );

tests = CKEDITOR.tools.object.merge( tests, {
Copy link
Member

Choose a reason for hiding this comment

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

You can simply:

Suggested change
tests = CKEDITOR.tools.object.merge( tests, {
tests[ 'test paste command state in divarea editor' ] = function() {

assertCommands( CKEDITOR.TRISTATE_DISABLED, 'true' );

editor.setReadOnly( false );
assertCommands( CKEDITOR.TRISTATE_OFF, 'false.' );
Copy link
Member

Choose a reason for hiding this comment

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

Such message is totally unhelpful. Please write more descriptive messages.

@engineering-this engineering-this self-assigned this Mar 1, 2019
@engineering-this engineering-this removed their assignment Mar 1, 2019
@f1ames f1ames requested review from f1ames and removed request for Comandeer March 26, 2019 14:46
@f1ames f1ames assigned f1ames and unassigned Comandeer Mar 26, 2019
@f1ames
Copy link
Contributor

f1ames commented Mar 26, 2019

Overtaking this PR review.

@f1ames
Copy link
Contributor

f1ames commented Mar 26, 2019

Rebased on latest master.

Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

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

Very small adjustments added. Looks good 👍

@f1ames f1ames requested review from Comandeer and removed request for Comandeer March 26, 2019 16:55
@f1ames f1ames dismissed Comandeer’s stale review March 26, 2019 16:57

Took over this review. Changes requested earlier where added.

@f1ames f1ames merged commit 460d751 into master Mar 26, 2019
@CKEditorBot CKEditorBot deleted the t/2775 branch March 26, 2019 16:58
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.

3 participants