Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
3082d5bd
Commit
3082d5bd
authored
Jan 22, 2021
by
Evan W. Patton
Committed by
Jeffrey Schiller
Feb 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement a flag to control whitespace in Blockly XML
Change-Id: I11033332060ba9f9dee29fc41dd661a1e48f7081
parent
68089664
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/BlocklyPanel.java
.../appinventor/client/editor/youngandroid/BlocklyPanel.java
+1
-1
appinventor/blocklyeditor/src/savefile.js
appinventor/blocklyeditor/src/savefile.js
+6
-2
appinventor/blocklyeditor/src/workspace_svg.js
appinventor/blocklyeditor/src/workspace_svg.js
+3
-2
appinventor/common/src/com/google/appinventor/common/version/AppInventorFeatures.java
...oogle/appinventor/common/version/AppInventorFeatures.java
+7
-0
No files found.
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/BlocklyPanel.java
View file @
3082d5bd
...
...
@@ -700,7 +700,7 @@ public class BlocklyPanel extends HTMLPanel {
*/
public
native
String
getBlocksContent
()
/*-{
return this.@com.google.appinventor.client.editor.youngandroid.BlocklyPanel::workspace
.saveBlocksFile();
.saveBlocksFile(
@com.google.appinventor.common.version.AppInventorFeatures::doPrettifyXml()()
);
}-*/
;
/**
...
...
appinventor/blocklyeditor/src/savefile.js
View file @
3082d5bd
...
...
@@ -67,13 +67,17 @@ Blockly.SaveFile.load = function(preUpgradeFormJson, blocksContent) {
* get is called prior to writing out. Original ai2 apps had no versions in them
* so now we write out every time
*
* @param {boolean} prettify Specify true if the workspace should be pretty printed.
* @param {?Blockly.WorkspaceSvg} opt_workspace The workspace to serialize. If none is given,
* Blockly.mainWorkspace will be serialized.
* @return {string} XML serialization of the workspace
*/
Blockly
.
SaveFile
.
get
=
function
(
opt_workspace
)
{
Blockly
.
SaveFile
.
get
=
function
(
prettify
,
opt_workspace
)
{
var
workspace
=
opt_workspace
||
Blockly
.
mainWorkspace
;
var
xml
=
Blockly
.
Xml
.
workspaceToDom
(
workspace
,
false
);
var
element
=
goog
.
dom
.
createElement
(
'
yacodeblocks
'
);
element
.
setAttribute
(
'
ya-version
'
,
top
.
YA_VERSION
);
element
.
setAttribute
(
'
language-version
'
,
top
.
BLOCKS_VERSION
);
xml
.
appendChild
(
element
);
return
Blockly
.
Xml
.
domToPretty
Text
(
xml
);
return
prettify
?
Blockly
.
Xml
.
domToPrettyText
(
xml
)
:
Blockly
.
Xml
.
domTo
Text
(
xml
);
};
appinventor/blocklyeditor/src/workspace_svg.js
View file @
3082d5bd
...
...
@@ -511,10 +511,11 @@ Blockly.WorkspaceSvg.prototype.verifyAllBlocks = function() {
* Saves the workspace as an XML file and returns the contents as a
* string.
*
* @param {boolean} prettify Specify true if the resulting workspace should be pretty-printed.
* @returns {string} XML serialization of the workspace's blocks.
*/
Blockly
.
WorkspaceSvg
.
prototype
.
saveBlocksFile
=
function
()
{
return
Blockly
.
SaveFile
.
get
(
this
);
Blockly
.
WorkspaceSvg
.
prototype
.
saveBlocksFile
=
function
(
prettify
)
{
return
Blockly
.
SaveFile
.
get
(
prettify
,
this
);
};
/**
...
...
appinventor/common/src/com/google/appinventor/common/version/AppInventorFeatures.java
View file @
3082d5bd
...
...
@@ -124,4 +124,11 @@ public final class AppInventorFeatures {
return
false
;
}
/**
* If set to true, the Blockly XML will be prettified for human readability.
* If false, the XML is serialized to a more compact form with minimal whitespace.
*/
public
static
boolean
doPrettifyXml
()
{
return
false
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment