Skip to content
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

Fix 3.7 api change #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function doExport() {
// Export the artboard to the correct file location
var artboardPath = pageDirectoryUrl.URLByAppendingPathComponent(artboard.name() + FILE_EXTENSION).path()

var sizes = artboard.exportOptions().sizes().array()
var sizes = artboard.exportOptions().exportFormats().array()
var slices = _getSlices(artboard, sizes)
while(slice = slices.nextObject()) {
doc.saveArtboardOrSlice_toFile(slice, artboardPath);
Expand Down Expand Up @@ -136,8 +136,13 @@ function hideScreenDescriptions(layers) {
function _getSlices( artboard, sizes ) {
if ( MSSliceMaker.slicesFromExportableLayer_sizes ) {
return MSSliceMaker.slicesFromExportableLayer_sizes(artboard, sizes).objectEnumerator()
} else if ( MSSliceMaker.slicesFromExportableLayer_sizes_useIDForName ) {
return MSSliceMaker.slicesFromExportableLayer_sizes_useIDForName(artboard, sizes, false).objectEnumerator()
} else if ( MSSliceMaker.slicesFromExportableLayer ) {
return MSSliceMaker.slicesFromExportableLayer(artboard).objectEnumerator()
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding which version of Sketch each of these relates to? Likely not needed, but might be useful if you decide to drop support for some versions in the future.

print( "Can't export slices. Probably an upgrade problem…");
}
return MSSliceMaker.slicesFromExportableLayer_sizes_useIDForName(artboard, sizes, false).objectEnumerator()
}

function getArtboardData(artboard) {
Expand Down Expand Up @@ -172,8 +177,9 @@ function parseName(name) {
var original = new String(name);
var nameParts = name.split(" ");
if (nameParts.length === 1) {
doc.showMessage('"' + name + '" is not formatted correctly. Please use a name such as "01 Home"');
return;
return {
exclude: true
};
}

var tag = nameParts[ 0 ];
Expand Down
2 changes: 1 addition & 1 deletion User Flow Docs.sketchplugin/Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"identifier" : "uk.co.ribot.sketch.user-flow-docs",
"version" : "1.1",
"description" : "Example Sketch Plugin using resources from within the bundle and a library script.",
"description" : "Export every artboard in your design document and create a user flows document for clients by populating a template.",
"authorEmail" : "[email protected]",
"name" : "User Flow Docs"
}
Loading