mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
fix: Add hack to copy accessors to global Blockly namespace object (#5536)
Ugly, but it works.
This commit is contained in:
committed by
GitHub
parent
a598751d48
commit
06a41de61e
@@ -159,6 +159,7 @@ const {BlockSvg} = goog.require('Blockly.BlockSvg');
|
|||||||
const {Blocks} = goog.require('Blockly.blocks');
|
const {Blocks} = goog.require('Blockly.blocks');
|
||||||
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
||||||
const {Cursor} = goog.require('Blockly.Cursor');
|
const {Cursor} = goog.require('Blockly.Cursor');
|
||||||
|
const {globalThis} = goog.require('Blockly.utils.global');
|
||||||
/** @suppress {extraRequire} */
|
/** @suppress {extraRequire} */
|
||||||
goog.require('Blockly.Events.BlockCreate');
|
goog.require('Blockly.Events.BlockCreate');
|
||||||
/** @suppress {extraRequire} */
|
/** @suppress {extraRequire} */
|
||||||
@@ -673,3 +674,20 @@ exports.thrasos = thrasos;
|
|||||||
exports.uiPosition = uiPosition;
|
exports.uiPosition = uiPosition;
|
||||||
exports.utils = utils;
|
exports.utils = utils;
|
||||||
exports.zelos = zelos;
|
exports.zelos = zelos;
|
||||||
|
|
||||||
|
// Temporary hack to copy accessor properties from exports to the
|
||||||
|
// global Blockly object as the routine to copy exports in
|
||||||
|
// goog.exportPath_ (see closure/goog/base.js) invoked by
|
||||||
|
// declareLegacyNamespace only copies normal data properties, not
|
||||||
|
// accessors. This can be removed once all remaining calls to
|
||||||
|
// declareLegacyNamspace have been removed.
|
||||||
|
if (globalThis.Blockly && typeof globalThis.Blockly === 'object') {
|
||||||
|
const descriptors = Object.getOwnPropertyDescriptors(exports);
|
||||||
|
const accessors = {};
|
||||||
|
for (const key in descriptors) {
|
||||||
|
if (descriptors[key].get || descriptors[key].set) {
|
||||||
|
accessors[key] = descriptors[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object.defineProperties(globalThis.Blockly, accessors);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user