Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit de88e07

Browse files
committed
Add a input form to publish icon command
1 parent bd96735 commit de88e07

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

‎src/dev-library/publish-new-icon-to-uikit.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default function() {
55
const selection = document.selectedLayers.layers
66
const Settings = sketch.Settings
77

8-
const ciToken = Settings.documentSettingForKey(document,'ci-token')
9-
const ciUrl = Settings.documentSettingForKey(document,'ci-url')
8+
let ciToken = Settings.settingForKey('ci-token')
9+
let ciUrl = 'https://codingcorp.coding.net/api/cci/job/252169/trigger'
1010

1111
function postIcon(iconCatalog, iconName, iconCode) {
1212
console.log(iconCatalog)
@@ -47,7 +47,7 @@ export default function() {
4747
)
4848
}
4949

50-
if(ciToken) {
50+
functionmain() {
5151
let iconCatalog = []
5252
let iconName = []
5353
let iconCode = []
@@ -61,8 +61,27 @@ export default function() {
6161
iconCode.push(sketchSVG.toString())
6262
})
6363
postIcon(JSON.stringify(iconCatalog).toString(), JSON.stringify(iconName).toString(), JSON.stringify(iconCode).toString())
64+
}
65+
66+
if (ciToken) {
67+
main()
6468
} else {
65-
console.log('The ci-token setting not found in this document! Make sure your current docmuent is Coding-Icons Library.')
66-
sketch.UI.alert('⛔️ Wrong File!', 'The ci-token setting not found in this document! \nPlease make sure current docmuent is the Coding-Icons Library.')
69+
sketch.UI.getInputFromUser(
70+
"第一次使用需填写 CI 触发令牌",
71+
{
72+
description: '访问此链接获取令牌 https://codingcorp.coding.net/p/Design-Center/wiki/1495',
73+
initialValue: '在此输入',
74+
},
75+
(err, value) => {
76+
if (err) {
77+
sketch.UI.message('Publish has been canceled.')
78+
return
79+
}
80+
Settings.setSettingForKey('ci-token', value)
81+
ciToken = Settings.settingForKey('ci-token')
82+
sketch.UI.message('Publish start ...')
83+
main()
84+
}
85+
)
6786
}
6887
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /