You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-1
Original file line number
Diff line number
Diff line change
@@ -117,11 +117,15 @@ function MyBlocklyHookEmbed() {
117
117
All properties are optional.
118
118
119
119
*`initialXml`: The XML of the program to initially load in the editor.
120
+
*`initialJson`: The JSON of the program to initially load in the editor.
121
+
*`updateXml`: A reference to XML of the program. If this value is changed (i.e. external to the BlocklyWorkspace component or useBlocklyWorkspace hook), the Blockly workspace will update to reflect the new XML.
122
+
*`updateJson`: A reference to JSON of the program. If this value is changed (i.e. external to the BlocklyWorkspace component or useBlocklyWorkspace hook), the Blockly workspace will update to reflect the new JSON.
120
123
*`workspaceConfiguration`: Any configuration options to be passed into `Blockly.inject` (except for `toolbox`, which is a separate prop).
121
124
*`toolboxConfiguration`: A JSON toolbox configuration (see [the Blockly documentation](https://developers.google.com/blockly/guides/configure/web/toolbox#json) for details on this format).
122
125
*`className`: The value for the `class` attribute to be used on the `<div>` elements generated by this component. Typically you'll need to use this to set the height of the Blockly editor, using either an explicit `height` style, flexboxes, or some other means.
123
126
*`onWorkspaceChange`: A function called every time the content of the workspace changes. It should take a single argument, which is the Blockly workspace object. (You can call methods such as Blockly.JavaScript.workspaceToCode on this object.)
124
-
*`onXmlChange`: A function called every time the content of the workspace, debounced to be called at most once every 200 milliseconds. This function should take a single argument, which is the new XML generated from the workspace.
127
+
*`onXmlChange`: A function called every time the content of the workspace changes, debounced to be called at most once every 200 milliseconds. This function should take a single argument, which is the new XML generated from the workspace.
128
+
*`onJsonChange`: A function called every time the content of the workspace changes, debounced to be called at most once every 200 milliseconds. This function should take a single argument, which is the new JSON generated from the workspace.
125
129
*`onImportXmlError`: A function called if `initialXml` can't be imported. This function takes a single argument, which is the error thrown during XML import.
126
130
*`onInject`: A function called after the Blockly workspace is injected. This function takes a single argument, which is the newly-injected Blockly workspace object. This is a good place to add Blockly plugins, if desired.
127
131
*`onDispose`: A function called after the Blockly workspace is disposed and removed from the page. This function takes a single argument, which is the just-disposed Blockly workspace object. Some Blockly plugins need to use this to dispose their own resources.
0 commit comments