Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up shadow blocks in insertion markers for expandable blocks #10315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pxtblocks/composableMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,17 @@ export function initExpandableBlock(info: pxtc.BlocksInfo, b: Blockly.Block, def
// use domToBlockInternal so that we don't trigger a render while
// the block is still being initialized
newBlock = Blockly.Xml.domToBlockInternal(shadow, b.workspace);

// we don't know at this time whether the parent block is an insertion marker
// or not. doing this check lets us clean up the block in the case that it is,
// though we get an annoying flicker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it looks too bad, but I was wondering if there is any sort of css that we could also use/override to make the shadow blocks not render in the insertion marker?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait, is the GIF in the comment the way the insertion marker looks with the bug or how it looks with the fix for it?

setTimeout(() => {
if (newBlock.isInsertionMarker()) {
Blockly.Events.disable();
newBlock.dispose();
Blockly.Events.enable();
}
})
}
else {
newBlock = Blockly.Xml.domToBlock(shadow, b.workspace);
Expand Down
Loading