Skip to content

Commit

Permalink
Merge pull request #10 from nolastan/modal-fixes
Browse files Browse the repository at this point in the history
Modal fixes
  • Loading branch information
nolastan committed Feb 5, 2016
2 parents 3332bee + e5e6a5c commit 8b6e081
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"script" : "script.cocoascript",
"handler" : "onRun",
"shortcut" : "option s",
"shortcut" : "ctrl shift s",
"name" : "Sync",
"identifier" : "sync"
},
Expand All @@ -16,7 +16,7 @@
],
},
"identifier" : "com.github.nolastan.sync",
"version" : "1.1",
"version" : "1.2",
"description" : "Sync styles and symbols",
"authorEmail" : "nolastan@gmail.com",
"name" : "Sync"
Expand Down
17 changes: 9 additions & 8 deletions Contents/Sketch/script.cocoascript
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ var onRun = function(context) {
var doc = context.document;
var dict = NSThread.mainThread().threadDictionary();

showOptions();
loadFromURL(dict['syncSource']);
if (showOptions() == NSAlertDefaultReturn) {
loadFromURL(dict['syncSource']);

doc.showMessage('Sync complete!');
doc.reloadInspector();
doc.showMessage('Sync complete!');
doc.reloadInspector();
}

function loadFromURL(queryURL) {
var data;
Expand Down Expand Up @@ -69,18 +70,18 @@ var onRun = function(context) {
}

function showOptions() {
var alert = [NSAlert alertWithMessageText: "Sync text styles"
defaultButton:"Sync"
var alert = [NSAlert alertWithMessageText: "Replace styles and colors"
defaultButton:"Replace"
alternateButton:"Cancel"
otherButton:nil
informativeTextWithFormat:"Enter the URL where your styles live."];
informativeTextWithFormat:"Enter the URL where your styles and/or colors live. Any existing document styles or global colors will be replaced."];

var input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 54)];
input.setStringValue(dict['syncSource'] || "https://docs.google.com/spreadsheets/d/17q6GOMM1X6kkvgeL3LeGkRr4C2vOhpM_JiQUWxbBtew/pubhtml");
alert.setAccessoryView(input);
var button = alert.runModal();
input.validateEditing();
dict['syncSource'] = input.stringValue();
return alert.runModal();
}

function capitalize(string) {
Expand Down
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Stan
Copyright (c) 2016 Stan

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

0 comments on commit 8b6e081

Please sign in to comment.