Files
blockly/scripts/package/node/core.js
Beka Westberg 9c81e7591a fix: message types being incorrect (#6414)
* chore: regen msg dts files

* fix: package tasks not packaging msg.d.ts files

* fix: add setLocale to blockly.ts

* chore: format

* chore: move setLocale

* chore: add comment about setLocale not being useful when used with script tags

* chore: format
2022-09-26 14:02:57 -07:00

26 lines
733 B
JavaScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Blockly core module for Node. It includes blockly-node.js
* and adds a helper method for setting the locale.
*/
/* eslint-disable */
'use strict';
// Override textToDomDocument and provide Node.js alternatives to DOMParser and
// XMLSerializer.
if (typeof globalThis.document !== 'object') {
const jsdom = require('jsdom/lib/jsdom/living');
globalThis.DOMParser = jsdom.DOMParser;
globalThis.XMLSerializer = jsdom.XMLSerializer;
const xmlDocument = Blockly.utils.xml.textToDomDocument(
`<xml xmlns="${Blockly.utils.xml.NAME_SPACE}"></xml>`);
Blockly.utils.xml.setDocument(xmlDocument);
}