mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
Fix parsing and passing of workspace options around Blockly (#3616)
This commit is contained in:
@@ -166,18 +166,17 @@ Blockly.Mutator.prototype.createEditor_ = function() {
|
||||
({
|
||||
// If you want to enable disabling, also remove the
|
||||
// event filter from workspaceChanged_ .
|
||||
disable: false,
|
||||
languageTree: quarkXml,
|
||||
parentWorkspace: this.block_.workspace,
|
||||
pathToMedia: this.block_.workspace.options.pathToMedia,
|
||||
RTL: this.block_.RTL,
|
||||
toolboxPosition: this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT :
|
||||
'disable': false,
|
||||
'parentWorkspace': this.block_.workspace,
|
||||
'media': this.block_.workspace.options.pathToMedia,
|
||||
'rtl': this.block_.RTL,
|
||||
'toolboxPosition': this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT :
|
||||
Blockly.TOOLBOX_AT_LEFT,
|
||||
horizontalLayout: false,
|
||||
getMetrics: this.getFlyoutMetrics_.bind(this),
|
||||
setMetrics: null,
|
||||
renderer: this.block_.workspace.options.renderer
|
||||
'horizontalLayout': false,
|
||||
'renderer': this.block_.workspace.options.renderer
|
||||
}));
|
||||
workspaceOptions.languageTree = quarkXml;
|
||||
workspaceOptions.getMetrics = this.getFlyoutMetrics_.bind(this);
|
||||
this.workspace_ = new Blockly.WorkspaceSvg(workspaceOptions);
|
||||
this.workspace_.isMutator = true;
|
||||
this.workspace_.addChangeListener(Blockly.Events.disableOrphans);
|
||||
|
||||
@@ -155,7 +155,7 @@ Blockly.Options = function(options) {
|
||||
* workspace.
|
||||
* @type {Blockly.Workspace}
|
||||
*/
|
||||
this.parentWorkspace = null;
|
||||
this.parentWorkspace = options['parentWorkspace'];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -182,13 +182,14 @@ Blockly.Toolbox.prototype.init = function() {
|
||||
var workspaceOptions = new Blockly.Options(
|
||||
/** @type {!Blockly.BlocklyOptions} */
|
||||
({
|
||||
parentWorkspace: workspace,
|
||||
RTL: workspace.RTL,
|
||||
oneBasedIndex: workspace.options.oneBasedIndex,
|
||||
horizontalLayout: workspace.horizontalLayout,
|
||||
toolboxPosition: workspace.options.toolboxPosition,
|
||||
renderer: workspace.options.renderer
|
||||
'parentWorkspace': workspace,
|
||||
'rtl': workspace.RTL,
|
||||
'oneBasedIndex': workspace.options.oneBasedIndex,
|
||||
'horizontalLayout': workspace.horizontalLayout,
|
||||
'toolboxPosition': workspace.options.toolboxPosition,
|
||||
'renderer': workspace.options.renderer
|
||||
}));
|
||||
|
||||
if (workspace.horizontalLayout) {
|
||||
if (!Blockly.HorizontalFlyout) {
|
||||
throw Error('Missing require for Blockly.HorizontalFlyout');
|
||||
|
||||
@@ -63,11 +63,11 @@ Blockly.Trashcan = function(workspace) {
|
||||
var flyoutWorkspaceOptions = new Blockly.Options(
|
||||
/** @type {!Blockly.BlocklyOptions} */
|
||||
({
|
||||
scrollbars: true,
|
||||
parentWorkspace: this.workspace_,
|
||||
RTL: this.workspace_.RTL,
|
||||
oneBasedIndex: this.workspace_.options.oneBasedIndex,
|
||||
renderer: this.workspace_.options.renderer
|
||||
'scrollbars': true,
|
||||
'parentWorkspace': this.workspace_,
|
||||
'rtl': this.workspace_.RTL,
|
||||
'oneBasedIndex': this.workspace_.options.oneBasedIndex,
|
||||
'renderer': this.workspace_.options.renderer
|
||||
}));
|
||||
// Create vertical or horizontal flyout.
|
||||
if (this.workspace_.horizontalLayout) {
|
||||
|
||||
@@ -895,12 +895,12 @@ Blockly.WorkspaceSvg.prototype.addFlyout = function(tagName) {
|
||||
var workspaceOptions = new Blockly.Options(
|
||||
/** @type {!Blockly.BlocklyOptions} */
|
||||
({
|
||||
parentWorkspace: this,
|
||||
RTL: this.RTL,
|
||||
oneBasedIndex: this.options.oneBasedIndex,
|
||||
horizontalLayout: this.horizontalLayout,
|
||||
toolboxPosition: this.options.toolboxPosition,
|
||||
renderer: this.options.renderer
|
||||
'parentWorkspace': this,
|
||||
'rtl': this.RTL,
|
||||
'oneBasedIndex': this.options.oneBasedIndex,
|
||||
'horizontalLayout': this.horizontalLayout,
|
||||
'toolboxPosition': this.options.toolboxPosition,
|
||||
'renderer': this.options.renderer
|
||||
}));
|
||||
if (this.horizontalLayout) {
|
||||
if (!Blockly.HorizontalFlyout) {
|
||||
|
||||
Reference in New Issue
Block a user