Skip to content

Commit

Permalink
增加一个 preview 的功能。
Browse files Browse the repository at this point in the history
  • Loading branch information
bugluo committed Sep 21, 2017
1 parent 044364e commit 58a394f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"handler" : "hidePreview"
},
{
"name" : "Show Preview",
"name" : "Preview",
"identifier" : "showPreview",
"script" : "showPreview.js",
"shortcut": "",
Expand Down
2 changes: 1 addition & 1 deletion WeSketch.sketchplugin/Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"handler" : "hidePreview"
},
{
"name" : "Show Preview",
"name" : "Preview",
"identifier" : "showPreview",
"script" : "showPreview.js",
"shortcut": "",
Expand Down
2 changes: 1 addition & 1 deletion WeSketch.sketchplugin/Contents/Sketch/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -2444,7 +2444,7 @@
if (ua.match(/MicroMessenger/i) == "micromessenger") {
$('.wechat').show();
} else {
if (!navigator.standalone) {
if (!navigator.standalone && ua.indexOf('iphone')>-1) {
$('.icon').show();
setTimeout(function(){
$('.icon').hide();
Expand Down
10 changes: 10 additions & 0 deletions WeSketch.sketchplugin/Contents/Sketch/previewToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import 'commonPreview.js';
@import 'localPreview.js';
@import 'webPreview.js';
@import 'showPreview.js';

function previewToolbar(context) {
var i18 = _(context).toolbar;
Expand Down Expand Up @@ -145,6 +146,15 @@ function previewToolbar(context) {

xlocation = 20;

var linkButton11 = addButton(NSMakeRect(xlocation, 19, 45, 45), "preview" + prefix,
function (sender) {
var nowcontext = uploadContext(context);
showPreview(nowcontext);
});

contentView.addSubview(linkButton11);
xlocation = xlocation + 60;

var linkButton8 = addButton(NSMakeRect(xlocation, 19, 45, 45), "local" + prefix,
function (sender) {
var nowcontext = uploadContext(context);
Expand Down

0 comments on commit 58a394f

Please sign in to comment.