diff --git a/src/css/tsumiqiita.css b/src/css/tsumiqiita.css
index 8b097d7..b092219 100644
--- a/src/css/tsumiqiita.css
+++ b/src/css/tsumiqiita.css
@@ -13,11 +13,20 @@ html,body {
margin: 0;
width: calc(100vw - 2px);
}
+#tags-label {
+ font-size: 1rem;
+ width: 3rem;
+}
+#tags {
+ border: 1px solid darkgray;
+ margin: 0;
+ width: calc(100vw - 22px - 3rem);
+}
#tsumiqiita-editor {
overflow-x: hidden;
overflow-y: scroll;
border: 1px solid darkgray;
- height: calc(50vh - 2px);
+ height: calc(50vh - 2px - 1.1rem);
margin: 0;
resize: none;
width: calc(100vw - 22px);
diff --git a/src/index.html b/src/index.html
index c4ad1ee..3925226 100644
--- a/src/index.html
+++ b/src/index.html
@@ -40,7 +40,7 @@
-
diff --git a/src/js/functions.js b/src/js/functions.js
index 180d2a5..4990377 100644
--- a/src/js/functions.js
+++ b/src/js/functions.js
@@ -141,6 +141,23 @@ function setToken() {
config.set("TOKEN", document.querySelector('#input').value);
}
+function getTags() {
+ const text = document.querySelector("#tags").value;
+ let ret = [];
+ let tags = text.trim().split(" ");
+
+ for(let i = 0; i < tags.length; i++) {
+ tmp = tags[i].split(":");
+ if (tmp.length < 2) {
+ ret.push({"name":tmp[0]});
+ } else {
+ ret.push({"name":tmp[0], "versions": [tmp[1]]});
+ }
+ }
+ console.log(JSON.stringify(ret));
+ return ret;
+}
+
function post() {
const Config = require('electron-config');
const config = new Config();
@@ -159,25 +176,18 @@ function post() {
let markdown = fs.readFileSync(p, 'utf-8');
let title = filename.replace(/(\.md)+$/,"");
-
+
var options = {
"body": markdown,
"private": true,
- "tags": [
- {
- "name": "TsumiQiita",
- "versions": [
- "1.2.0"
- ]
- }
- ],
+ "tags": getTags(),
"title": title
};
//execution api
Qiita.Resources.Item.create_item(options).then(function(res){
console.log(res);
- if (parseInt(res.statusCode, 10) >= 400) {
+ if (res.message != undefined) {
document.querySelector('#ng-dialog').showModal();
} else {
document.querySelector('#ok-dialog').showModal();
diff --git a/src/package.json b/src/package.json
index 7d8680f..18fdc50 100644
--- a/src/package.json
+++ b/src/package.json
@@ -8,7 +8,9 @@
},
"scripts": {
"build-css": "node-sass scss/default-theme.scss css/style.css",
- "build-win": "electron-packager . TsumiQiita --out=../build --pratform=win32 --arch=ia32 --overwrite --asar",
+ "build-win": "electron-packager . TsumiQiita --out=../build --pratform=win32 --overwrite --asar",
+ "build-win32": "electron-packager . TsumiQiita --out=../build --pratform=win32 --arch=ia32 --overwrite --asar",
+ "build-win64": "electron-packager . TsumiQiita --out=../build --pratform=win32 --arch=x64 --overwrite --asar",
"build-mac": "electron-packager . TsumiQiita --out=../build --pratform=darwin --arch=x64 --overwrite --asar",
"build-linux": "electron-packager . TsumiQiita --out=../build --pratform=linux --arch=ia32 --overwrite --asar",
"build": "electron-packager . TsumiQiita --out=../build --overwrite --asar"