Skip to content

Commit

Permalink
Alert when there is nothing to export
Browse files Browse the repository at this point in the history
  • Loading branch information
kardeslik committed Jul 11, 2019
1 parent 1f90ae0 commit 84ceb5d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Zeplin.sketchplugin/Contents/Sketch/export.cocoascript
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ var exportArtboardsFromCurrentPage = function (context) {

var artboards = layersOfPagesWithClassName(NSArray.arrayWithObject(context.document.currentPage()), "MSArtboardGroup");

if (![artboards count]) {
[NSApp displayDialog:@"Please create an artboard to export to Zeplin." withTitle:@"No artboard found"];

return;
}

exportArtboards(context, artboards);
}

Expand All @@ -100,6 +106,12 @@ var exportArtboardsFromAllPages = function (context) {

var artboards = layersOfPagesWithClassName(context.document.pages(), "MSArtboardGroup");

if (![artboards count]) {
[NSApp displayDialog:@"Please create an artboard to export to Zeplin." withTitle:@"No artboard found"];

return;
}

exportArtboards(context, artboards);
}

Expand All @@ -110,6 +122,12 @@ var exportSymbolsFromCurrentPage = function (context) {

var artboards = layersOfPagesWithClassName(NSArray.arrayWithObject(context.document.currentPage()), "MSSymbolMaster");

if (![artboards count]) {
[NSApp displayDialog:@"Please create a symbol to export to Zeplin." withTitle:@"No symbol found"];

return;
}

exportArtboards(context, artboards);
}

Expand All @@ -120,5 +138,11 @@ var exportSymbolsFromAllPages = function (context) {

var artboards = layersOfPagesWithClassName(context.document.pages(), "MSSymbolMaster");

if (![artboards count]) {
[NSApp displayDialog:@"Please create a symbol to export to Zeplin." withTitle:@"No symbol found"];

return;
}

exportArtboards(context, artboards);
}

0 comments on commit 84ceb5d

Please sign in to comment.