Skip to content

Commit

Permalink
Allow the user to select a different eye marker
Browse files Browse the repository at this point in the history
  • Loading branch information
atimmer committed Nov 12, 2018
1 parent 8259c5c commit 43b7e55
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions js/src/decorator/gutenberg.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ function getAnnotationsForBlockAttribute( attribute, block, marks ) {
} ) );
}

/**
* Removes all annotations from the editor.
*
* @returns {void}
*/
function removeAllAnnotations() {
annotationQueue = [];
dispatch( "core/annotations" ).__experimentalRemoveAnnotationsBySource( ANNOTATION_SOURCE );
}

/**
* Applies the given marks as annotations in the block editor.
*
Expand All @@ -224,9 +234,10 @@ function getAnnotationsForBlockAttribute( attribute, block, marks ) {
* @returns {void}
*/
export function applyAsAnnotations( paper, marks ) {
// Do this always to allow people to select a different eye marker.
removeAllAnnotations();

if ( marks.length === 0 ) {
annotationQueue = [];
dispatch( "core/annotations" ).__experimentalRemoveAnnotationsBySource( ANNOTATION_SOURCE );
return;
}

Expand Down

0 comments on commit 43b7e55

Please sign in to comment.