Add a function "workspace.refresh()"
See original GitHub issuei was unable to refresh workspace after reinitialize a block by Blockly.Blocks['a']
then i found out that blocks inside workspace don’t update but blocks inside toolbox are updating fine so, we need to refresh workspace after reinitializing a block.
As mentioned at https://github.com/google/blockly/issues/3940#issuecomment-640267246
-
A solution for refreshing workspace
- export xml of blocks
- clear the workspace
- reimport blocks from xml
-
A solution to refresh toolbox by using
workspace.refreshToolboxSelection()
Now we can add a function workspace.refresh()
something like
Blockly.Workspace.prototype.refresh = function() {
var xml = Blockly.Xml.workspaceToDom(this);
this.clear();
Blockly.Xml.domToWorkspace(xml, this);
this.refreshToolboxSelection();
};
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Is it possible to refresh the Google Workspace Add-on sidebar ...
I have a Google Workspace Add-on, I want to update the sidebar card everytime there's a new sheet. Below is my code: function...
Read more >Is it possible to programatically refresh a Workspace Add-On
A google workspace add-on has a Refresh menu option. I would like to do the same thing programmatically. The challenge I am finding...
Read more >How can you reload the form in an agent workspace
and I have tried using reloadWindow(window); as well as location. reload() and g_form. save() and g_form.
Read more >refreshTab() for Lightning Experience - Salesforce Developers
Refreshes a workspace tab or a subtab specified by tabId. ... or workspace is refreshed. Save: Changes are saved and then the tab...
Read more >MATLAB assignin - MathWorks
Update Base Workspace Variable from Function. In a file in your current working folder, create a function that adds two numbers and then...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @BeksOmega for pointing me in the right direction. I just realized I had my
workspace
variable declared asWorkspace
instead ofWorkspaceSvg
and that method wasn’t working when I tried it first. I fixed it and I am now usingBlockly.svgResize
and it works as expected.Hello @genemars ! This issue is slightly different from resizing the workspace. The person in this issue wanted all of the blocks on the workspace to update when they modified the block definition, which we do not generally want to support.
However, if you want to resize the workspace that is definitely supported. You can call
Blockly.svgResize(myWorkspace)
. I hope that helps!