mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
Unpack self-closing tags when converting domToText (#3665)
* Unpack self-closing tags when converting domToText
This commit is contained in:
@@ -303,7 +303,9 @@ Blockly.Xml.domToText = function(dom) {
|
||||
oldText = text;
|
||||
text = text.replace(regexp, '$1 $2');
|
||||
} while (text != oldText);
|
||||
return text;
|
||||
// Unpack self-closing tags. These tags fail when embedded in HTML.
|
||||
// <block name="foo"/> -> <block name="foo"></block>
|
||||
return text.replace(/<(\w+)([^<]*)\/>/g, '<$1$2></$1>');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -340,10 +340,6 @@ WorkspaceFactoryController.prototype.exportXmlFile = function(exportMode) {
|
||||
throw Error(msg);
|
||||
}
|
||||
|
||||
// Unpack self-closing tags. These tags fail when embedded in HTML.
|
||||
// <block name="foo"/> -> <block name="foo"></block>
|
||||
configXml = configXml.replace(/<(\w+)([^<]*)\/>/g, '<$1$2></$1>');
|
||||
|
||||
// Download file.
|
||||
var data = new Blob([configXml], {type: 'text/xml'});
|
||||
this.view.createAndDownloadFile(fileName, data);
|
||||
|
||||
@@ -29,7 +29,7 @@ var XML_TEXT = ['<xml xmlns="https://developers.google.com/blockly/xml">',
|
||||
' <block type="variables_set" inline="true">',
|
||||
' <field name="VAR">item</field>',
|
||||
' <value name="VALUE">',
|
||||
' <block type="lists_create_empty" />',
|
||||
' <block type="lists_create_empty"></block>',
|
||||
' </value>',
|
||||
' <next>',
|
||||
' <block type="text_print" inline="false">',
|
||||
|
||||
Reference in New Issue
Block a user