-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsBindings: Add support for writing documents to files #1252
Conversation
259b5e0
to
05efdb8
Compare
05efdb8
to
ee8ae63
Compare
@@ -451,5 +466,47 @@ | |||
return _readFromXmlString(doc, result.data, searchPath, readOptions, filesLoaded, result.filePath); | |||
}); | |||
}; | |||
|
|||
// Write a document to a file. | |||
Module.writeToXmlFile = function(doc, fileName, writeOptions = null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This two functions are exactly the same except a word, can we rewrite it?
Maybe one function for checking the arguments
// Export inlining included content | ||
const exportOptions = new mx.XmlExportOptions(); | ||
exportOptions.writeXIncludeEnable = false; | ||
mx.writeToXmlFile(doc, filename, exportOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be exportToXmlFile?
|
||
// Node only, because we cannot read from a downloaded file in the browser | ||
it('Write XML to file', async () => { | ||
const filename = '_build/testFile.mtlx'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests are exactly the same? why not run a loop or something? Maybe we dont need XmlExport.spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually just copied the test because I was too lazy to write a more specific one for it 😅
Replaced it with one that actually checks the specifics of the export function 👍
This PR enables writing documents to files. In the browser, the file will be downloaded automatically.
Update #1184