Skip to content

Commit 74b99b0

Browse files
committed
Add option to disable workspace auto focus
Resolve #40 Signed-off-by: Songlin Jiang <songlin.jiang@csc.fi>
1 parent 3e7bc0e commit 74b99b0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ options = {
4040
// Keep the fields of multiple selected same-type blocks with the same value
4141
multiFieldUpdate: true,
4242

43+
// Auto focus the workspace when the mouse enters.
44+
workspaceAutoFocus: true,
45+
4346
// Use custom icon for the multi select controls.
4447
multiselectIcon: {
4548
hideIcon: false,

src/multiselect.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export class Multiselect {
5252
this.onFocusOutWrapper_ = Blockly.browserEvents.conditionalBind(
5353
injectionDiv, 'focusout', this, this.onBlur_);
5454
injectionDiv.addEventListener('mouseenter', () => {
55-
if (document.activeElement === this.workspace_.svgGroup_.parentElement ||
55+
if (options.workspaceAutoFocus === false ||
56+
document.activeElement === this.workspace_.svgGroup_.parentElement ||
5657
document.activeElement.nodeName.toLowerCase() === 'input' ||
5758
document.activeElement.nodeName.toLowerCase() === 'textarea') {
5859
return;

0 commit comments

Comments
 (0)