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

Commit

Permalink
Improved docs in Writer.
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2ciek committed Jan 26, 2018
1 parent 39a1362 commit 427e841
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/model/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,18 @@ export default class Writer {
/**
* Sets attribute(s) on the selection. If attribute with the same key already is set, it's value is overwritten.
*
* Using key and value pair:
*
* writer.setSelectionAttribute( 'italic', true );
*
* Using key-value object:
*
* writer.setSelectionAttribute( { italic: true, bold: false } );
*
* Using iterable object:
*
* writer.setSelectionAttribute( new Map( [ [ 'italic', true ] ] ) );
*
* @param {String|Object|Iterable.<*>} keyOrObjectOrIterable Key of the attribute to set
* or object / iterable of key - value attribute pairs.
* @param {*} [value] Attribute value.
Expand All @@ -873,7 +885,15 @@ export default class Writer {
}

/**
* Removes an attribute with given key from the selection.
* Removes attribute(s) with given key(s) from the selection.
*
* Using key
*
* writer.removeSelectionAttribute( 'italic' );
*
* Using iterable of keys
*
* writer.removeSelectionAttribute( [ 'italic', 'bold' ] );
*
* @param {String|Iterable.<String>} keyOrIterableOfKeys Key of the attribute to remove or an iterable of attribute keys to remove.
*/
Expand Down

0 comments on commit 427e841

Please sign in to comment.