-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
plugins/clipboard/plugin.js
Outdated
@@ -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 } ) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
tests/plugins/clipboard/readonly.js
Outdated
@@ -58,4 +58,47 @@ var tests = { | |||
|
|||
tests = bender.tools.createTestsForEditors( CKEDITOR.tools.objectKeys( bender.editors ), tests ); | |||
|
|||
tests = CKEDITOR.tools.object.merge( tests, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply:
tests = CKEDITOR.tools.object.merge( tests, { | |
tests[ 'test paste command state in divarea editor' ] = function() { |
tests/plugins/clipboard/readonly.js
Outdated
assertCommands( CKEDITOR.TRISTATE_DISABLED, 'true' ); | ||
|
||
editor.setReadOnly( false ); | ||
assertCommands( CKEDITOR.TRISTATE_OFF, 'false.' ); |
There was a problem hiding this comment.
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.
Overtaking this PR review. |
Rebased on latest |
There was a problem hiding this 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 👍
Took over this review. Changes requested earlier where added.
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
What changes did you make?
Included
editor.readOnly
in check for command state function.Closes #2775