Skip to content

Commit

Permalink
Merge pull request #45 from weixin/color
Browse files Browse the repository at this point in the history
Color
  • Loading branch information
bugluo committed Sep 17, 2017
2 parents 92305d2 + 761303d commit 9eaa440
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
4 changes: 3 additions & 1 deletion WeSketch.sketchplugin/Contents/Sketch/commonPreviewJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,17 @@ var commonPreviewJson = function (context, filePath) {
}
var i18nKey = "com.sketchplugins.wechat.i18n";
var loadingTips = '正在加载所有素材文件<br>请稍后...';
var desktop = 'i2';
var lang = NSUserDefaults.standardUserDefaults().objectForKey(i18nKey);
if (encodeURIComponent(lang).indexOf('enUS') > -1) {
loadingTips = 'Loading all the images<br>Please wait...';
desktop = 'i1';
}

var htmlPath = context.plugin.url().URLByAppendingPathComponent("Contents").URLByAppendingPathComponent("Sketch").URLByAppendingPathComponent("preview.html").path();
var previewData = NSData.dataWithContentsOfFile(htmlPath);
previewData = [[NSString alloc] initWithData: previewData encoding: NSUTF8StringEncoding];
previewData = previewData.replace('{{json}}', JSON.stringify(exportSVGJson)).replace('{{barstyle}}', fxstyle).replace(/{{local}}/ig, fxlocal).replace('{{loading}}',loadingTips);
previewData = previewData.replace('{{json}}', JSON.stringify(exportSVGJson)).replace('{{barstyle}}', fxstyle).replace(/{{local}}/ig, fxlocal).replace('{{loading}}',loadingTips).replace('{{desktop}}',desktop);
writeFile({
content: previewData,
path: filePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"handler" : "setNoBuild"
},
{
"name" : "清楚设置",
"name" : "清除设置",
"identifier" : "previewClear",
"script" : "commonPreview.js",
"shortcut": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@

.qr {
overflow: hidden;
margin: 10px auto;
margin: 10px auto 0 auto;
width: 240px;
height: 260px;
}

.text {
cursor: pointer;
margin: 0 auto;
width: 240px;
font-size: 12px;
Expand Down
Loading

0 comments on commit 9eaa440

Please sign in to comment.