Skip to content

Commit 8a24ec7

Browse files
committed
fix: Hide content highlight on comment drag, update on resize.
1 parent 51f153f commit 8a24ec7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

plugins/content-highlight/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"typescript": "^5.4.5"
4949
},
5050
"peerDependencies": {
51-
"blockly": "^11.0.0"
51+
"blockly": "^11.1.2"
5252
},
5353
"publishConfig": {
5454
"access": "public",

plugins/content-highlight/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const contentChangeEvents = [
1818
Blockly.Events.BLOCK_MOVE,
1919
Blockly.Events.BLOCK_DELETE,
2020
Blockly.Events.COMMENT_MOVE,
21+
Blockly.Events.COMMENT_RESIZE,
2122
Blockly.Events.COMMENT_CREATE,
2223
Blockly.Events.COMMENT_DELETE,
2324
];
@@ -196,7 +197,9 @@ export class ContentHighlight {
196197
this.position(this.cachedContentMetrics, absoluteMetrics);
197198
}
198199
} else if (event.type === Blockly.Events.BLOCK_DRAG) {
199-
this.handleBlockDrag(event as Blockly.Events.BlockDrag);
200+
this.handleDragEvent(event as Blockly.Events.BlockDrag);
201+
} else if (event.type === Blockly.Events.COMMENT_DRAG) {
202+
this.handleDragEvent(event as Blockly.Events.CommentDrag);
200203
} else if (event.type === Blockly.Events.BLOCK_CHANGE) {
201204
// Resizes the content highlight when it is a block change event
202205
const metricsManager = this.workspace.getMetricsManager();
@@ -211,7 +214,9 @@ export class ContentHighlight {
211214
*
212215
* @param event The BlockDrag event.
213216
*/
214-
private handleBlockDrag(event: Blockly.Events.BlockDrag) {
217+
private handleDragEvent(
218+
event: Blockly.Events.BlockDrag | Blockly.Events.CommentDrag,
219+
) {
215220
const opacity = event.isStart ? '0' : '1';
216221
this.svgGroup?.setAttribute('opacity', opacity);
217222
}

0 commit comments

Comments
 (0)