Fix: The value of the AttributeCommand is taken from the first allowed node #72
Conversation
src/attributecommand.js
Outdated
const ranges = Array.from( selection.getRanges() ); | ||
|
||
if ( selection.isBackward ) { | ||
ranges.reverse(); |
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.
Are you sure it is needed here?
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.
Hm...
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.
Checking range direction is removed.
src/attributecommand.js
Outdated
@@ -41,7 +41,7 @@ export default class AttributeCommand extends Command { | |||
* Flag indicating whether the command is active. The command is active when the | |||
* {@link module:engine/model/selection~Selection#hasAttribute selection has the attribute} which means that: | |||
* | |||
* * If the selection is not empty – That it starts in a text (or another node) which has the attribute set. | |||
* * If the selection is not empty – That the first node in the selection that allows the attribute has the attribute set. |
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.
the selection that allows the attribute has the attribute set
Something is wrong in this sentence.
src/attributecommand.js
Outdated
* Checks the attribute value of the first node in the selection that allows the attribute. | ||
* For the collapsed selection returns the selection attribute. | ||
* | ||
* **Note** Selection direction is taken into consideration. |
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.
No, it's not anymore ;)
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.
Right :)
Suggested merge commit message (convention)
Fix: The value of the
AttributeCommand
is taken from the first allowed node. Closes ckeditor/ckeditor5#5548.Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.