Skip to content

Commit 8b6e081

Browse files
committed
Merge pull request #10 from nolastan/modal-fixes
Modal fixes
2 parents 3332bee + e5e6a5c commit 8b6e081

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Contents/Sketch/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"script" : "script.cocoascript",
66
"handler" : "onRun",
7-
"shortcut" : "option s",
7+
"shortcut" : "ctrl shift s",
88
"name" : "Sync",
99
"identifier" : "sync"
1010
},
@@ -16,7 +16,7 @@
1616
],
1717
},
1818
"identifier" : "com.github.nolastan.sync",
19-
"version" : "1.1",
19+
"version" : "1.2",
2020
"description" : "Sync styles and symbols",
2121
"authorEmail" : "nolastan@gmail.com",
2222
"name" : "Sync"

Contents/Sketch/script.cocoascript

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ var onRun = function(context) {
66
var doc = context.document;
77
var dict = NSThread.mainThread().threadDictionary();
88

9-
showOptions();
10-
loadFromURL(dict['syncSource']);
9+
if (showOptions() == NSAlertDefaultReturn) {
10+
loadFromURL(dict['syncSource']);
1111

12-
doc.showMessage('Sync complete!');
13-
doc.reloadInspector();
12+
doc.showMessage('Sync complete!');
13+
doc.reloadInspector();
14+
}
1415

1516
function loadFromURL(queryURL) {
1617
var data;
@@ -69,18 +70,18 @@ var onRun = function(context) {
6970
}
7071

7172
function showOptions() {
72-
var alert = [NSAlert alertWithMessageText: "Sync text styles"
73-
defaultButton:"Sync"
73+
var alert = [NSAlert alertWithMessageText: "Replace styles and colors"
74+
defaultButton:"Replace"
7475
alternateButton:"Cancel"
7576
otherButton:nil
76-
informativeTextWithFormat:"Enter the URL where your styles live."];
77+
informativeTextWithFormat:"Enter the URL where your styles and/or colors live. Any existing document styles or global colors will be replaced."];
7778

7879
var input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 54)];
7980
input.setStringValue(dict['syncSource'] || "https://docs.google.com/spreadsheets/d/17q6GOMM1X6kkvgeL3LeGkRr4C2vOhpM_JiQUWxbBtew/pubhtml");
8081
alert.setAccessoryView(input);
81-
var button = alert.runModal();
8282
input.validateEditing();
8383
dict['syncSource'] = input.stringValue();
84+
return alert.runModal();
8485
}
8586

8687
function capitalize(string) {

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Stan
3+
Copyright (c) 2016 Stan
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

0 commit comments

Comments
 (0)