mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
* 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
26 lines
733 B
JavaScript
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);
|
|
}
|