From 2d4276f0f8f5ad75e203d4d3867a3476504a4aaf Mon Sep 17 00:00:00 2001 From: Yuuki Takahashi <20282867+yktakaha4@users.noreply.github.com> Date: Wed, 24 Jun 2020 00:18:05 +0900 Subject: [PATCH 1/3] fix filename --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 973675f..11c8c1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: dist/plugin.zip - asset_name: ${{ github.event.repository.name }} + asset_name: ${{ github.event.repository.name }}.zip tag: ${{ github.ref }} overwrite: true From 50e788918f448595048cd5d09d9deae8e6cc066a Mon Sep 17 00:00:00 2001 From: Yuuki Takahashi <20282867+yktakaha4@users.noreply.github.com> Date: Wed, 24 Jun 2020 00:37:12 +0900 Subject: [PATCH 2/3] =?UTF-8?q?update=20=E3=82=AB=E3=82=B9=E3=82=BF?= =?UTF-8?q?=E3=83=9E=E3=82=A4=E3=82=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 33 +++++++++++++++++++++++++++++++++ package.json | 4 +++- plugin/css/config.css | 2 +- plugin/css/desktop.css | 10 ---------- plugin/css/mobile.css | 10 ---------- plugin/html/config.html | 14 +++++++------- plugin/image/icon.png | Bin 110 -> 5013 bytes plugin/manifest.json | 4 ++-- src/config.js | 9 ++++----- src/desktop.js | 2 ++ 10 files changed, 52 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1f2d1fe..422d054 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1406,6 +1406,16 @@ "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", "dev": true }, + "clipboard": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz", + "integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==", + "requires": { + "good-listener": "^1.2.2", + "select": "^1.1.2", + "tiny-emitter": "^2.0.0" + } + }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -1882,6 +1892,11 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "delegate": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", + "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==" + }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -3157,6 +3172,14 @@ } } }, + "good-listener": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", + "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", + "requires": { + "delegate": "^3.1.2" + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -6451,6 +6474,11 @@ "ajv-keywords": "^3.1.0" } }, + "select": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", + "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=" + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -7389,6 +7417,11 @@ "setimmediate": "^1.0.4" } }, + "tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", diff --git a/package.json b/package.json index 76b49a2..cb0aec5 100644 --- a/package.json +++ b/package.json @@ -24,5 +24,7 @@ "webpack": "^4.43.0", "webpack-cli": "^3.3.12" }, - "dependencies": {} + "dependencies": { + "clipboard": "^2.0.6" + } } diff --git a/plugin/css/config.css b/plugin/css/config.css index 36bb4c5..e33e971 100644 --- a/plugin/css/config.css +++ b/plugin/css/config.css @@ -4,4 +4,4 @@ .kintoneplugin-input-text { width: 20em; -} \ No newline at end of file +} diff --git a/plugin/css/desktop.css b/plugin/css/desktop.css index 661fa70..e69de29 100644 --- a/plugin/css/desktop.css +++ b/plugin/css/desktop.css @@ -1,10 +0,0 @@ -.plugin-space-heading { - font-size: 1.5rem; - margin: 0.8rem; -} -.plugin-space-message { - display: inline-block; - font-size: 1.2em; - margin: 0.8rem; - margin-top: 0; -} diff --git a/plugin/css/mobile.css b/plugin/css/mobile.css index 661fa70..e69de29 100644 --- a/plugin/css/mobile.css +++ b/plugin/css/mobile.css @@ -1,10 +0,0 @@ -.plugin-space-heading { - font-size: 1.5rem; - margin: 0.8rem; -} -.plugin-space-message { - display: inline-block; - font-size: 1.2em; - margin: 0.8rem; - margin-top: 0; -} diff --git a/plugin/html/config.html b/plugin/html/config.html index e4a4219..06d041f 100644 --- a/plugin/html/config.html +++ b/plugin/html/config.html @@ -1,16 +1,16 @@
-

Settings for kintone-sample-plugin

-

This message is displayed on the app page after the app has been updated.

+

設定画面

+

プラグインの設定画面です

-

- - + +

diff --git a/plugin/image/icon.png b/plugin/image/icon.png index aed0c9ff2f3e8d37a86014c7d02dddc3ce3021df..59f8ef26d67217a6b528497bb7a92ae6d76c06a2 100644 GIT binary patch literal 5013 zcmZ`-2RK~Y_CJQGA&4lWjS?+}A&4?MF?x@hC}S{sH+m;Z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A3>h_?u~tMrrDts}%5@ z<@5rD5^1jUCN*lhk814S$JofEBjab>wmr@|80}i}zKiysY7xL`tuaTf9}lMDY?*#q zb4`co_cKLpTFwk!+&@yNiY4Y!T`hSz7DeQ8de~xSVIk`xo*`vBYrfh1E5u9_Yz@1O6hs2(S(lS4Eq#hm5a8n54(I!z?<`Fda6mtRluIc0V{67&O1{gc;R;#>wR2ee%1 zU((B+co1QQ3^!bR-9VYsCtZND(sF{4Q3?gciO`N=*yyzrn8Ygn4f-Rp4FBqfIyO2C_ b8+37nq^u=-c9HP%Um2jPtff?~U>W`|5dy#3 literal 110 zcmeAS@N?(olHy`uVBq!ia0vp^79h;X3?wIctc(RxYymzYuJ6ErCoaJrD8gCb5n0T@ yz;^_M8K-LVNdpD>JY5_^B&H@ONU%CfGB7Y6U|?Kno=^sqVeoYIb6Mw<&;$TN`x&SJ diff --git a/plugin/manifest.json b/plugin/manifest.json index aecb335..90561e2 100644 --- a/plugin/manifest.json +++ b/plugin/manifest.json @@ -3,10 +3,10 @@ "version": 1, "type": "APP", "name": { - "en": "kintone-plugin-template" + "en": "kintone-clipboard-plugin" }, "description": { - "en": "kintone-plugin-template" + "en": "kintone-clipboard-plugin" }, "icon": "image/icon.png", "desktop": { diff --git a/src/config.js b/src/config.js index 73b1966..b6b9ece 100644 --- a/src/config.js +++ b/src/config.js @@ -3,18 +3,17 @@ jQuery.noConflict(); (function($, PLUGIN_ID) { const $form = $('.js-submit-settings'); const $cancelButton = $('.js-cancel-button'); - const $message = $('.js-text-message'); + const $selector = $('.js-text-selector'); const config = kintone.plugin.app.getConfig(PLUGIN_ID); - if (config.message) { - $message.val(config.message); + if (config.selector) { + $selector.val(config.selector); } $form.on('submit', function(e) { e.preventDefault(); kintone.plugin.app.setConfig({ - message: $message.val(), + selector: $selector.val(), }, function() { - alert('The plug-in settings have been saved. Please update the app!'); window.location.href = '../../flow?app=' + kintone.app.getId(); }); }); diff --git a/src/desktop.js b/src/desktop.js index 20bbb2b..faad8f7 100644 --- a/src/desktop.js +++ b/src/desktop.js @@ -1,3 +1,5 @@ +const ClipboardJS = require('clipboard'); + jQuery.noConflict(); (function($, PLUGIN_ID) { From f538f35af0849be0890c8bc9f7a73a36f8414e79 Mon Sep 17 00:00:00 2001 From: Yuuki Takahashi <20282867+yktakaha4@users.noreply.github.com> Date: Wed, 24 Jun 2020 01:52:37 +0900 Subject: [PATCH 3/3] =?UTF-8?q?update=20=E3=83=87=E3=82=B9=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=83=83=E3=83=97=E7=89=88=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/css/common.css | 18 ++++++++++++++++++ plugin/manifest.json | 8 ++++---- src/desktop.js | 35 +++++++++++++++++++++-------------- src/mobile.js | 18 +----------------- 4 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 plugin/css/common.css diff --git a/plugin/css/common.css b/plugin/css/common.css new file mode 100644 index 0000000..9515e41 --- /dev/null +++ b/plugin/css/common.css @@ -0,0 +1,18 @@ +.po-clip-target:hover { + cursor: copy; +} + +.po-clip-target.copied { + cursor: inherit; + animation: copied 1s; +} + +@keyframes copied { + 0% { + background-color: rgba(0, 255, 0, 0.25); + } + + 100% { + background-color: inherit; + } +} diff --git a/plugin/manifest.json b/plugin/manifest.json index 90561e2..2f839ed 100644 --- a/plugin/manifest.json +++ b/plugin/manifest.json @@ -11,16 +11,16 @@ "icon": "image/icon.png", "desktop": { "js": ["https://js.cybozu.com/jquery/3.3.1/jquery.min.js", "js/desktop.js"], - "css": ["css/51-modern-default.min.css", "css/desktop.css"] + "css": ["css/51-modern-default.min.css", "css/common.css", "css/desktop.css"] }, "mobile": { "js": ["https://js.cybozu.com/jquery/3.3.1/jquery.min.js", "js/mobile.js"], - "css": ["css/mobile.css"] + "css": ["css/common.css", "css/mobile.css"] }, "config": { "html": "html/config.html", "js": ["https://js.cybozu.com/jquery/3.3.1/jquery.min.js", "js/config.js"], - "css": ["css/51-modern-default.min.css", "css/config.css"], - "required_params": ["message"] + "css": ["css/51-modern-default.min.css", "css/common.css", "css/config.css"], + "required_params": ["selector"] } } diff --git a/src/desktop.js b/src/desktop.js index faad8f7..bd027f5 100644 --- a/src/desktop.js +++ b/src/desktop.js @@ -3,21 +3,28 @@ const ClipboardJS = require('clipboard'); jQuery.noConflict(); (function($, PLUGIN_ID) { - kintone.events.on('app.record.index.show', function() { - const config = kintone.plugin.app.getConfig(PLUGIN_ID); + const main = () => { + setTimeout(() => { + const className = 'po-clip-target'; + const {selector} = kintone.plugin.app.getConfig(PLUGIN_ID); - const spaceElement = kintone.app.getHeaderSpaceElement(); - const fragment = document.createDocumentFragment(); - const headingEl = document.createElement('h3'); - const messageEl = document.createElement('p'); + for (const element of document.querySelectorAll(selector)) { + if (!element.classList.contains(className)) { + element.classList.add(className); + element.addEventListener('click', () => element.classList.add('copied')); + element.addEventListener('animationend', () => element.classList.remove('copied')); - messageEl.classList.add('plugin-space-message'); - messageEl.textContent = config.message; - headingEl.classList.add('plugin-space-heading'); - headingEl.textContent = 'Hello kintone plugin desktop!'; + new ClipboardJS(element, { + text: (trigger) => trigger.innerText, + }); + } + } + }, 0); + }; - fragment.appendChild(headingEl); - fragment.appendChild(messageEl); - spaceElement.appendChild(fragment); - }); + kintone.events.on('app.record.index.show', main); + kintone.events.on('app.record.index.edit.submit.success', main); + kintone.events.on('app.record.detail.show', main); + kintone.events.on('app.record.create.show', main); + kintone.events.on('app.record.edit.show', main); })(jQuery, kintone.$PLUGIN_ID); diff --git a/src/mobile.js b/src/mobile.js index 282ca00..990c072 100644 --- a/src/mobile.js +++ b/src/mobile.js @@ -1,21 +1,5 @@ jQuery.noConflict(); -(function($, PLUGIN_ID) { - kintone.events.on('mobile.app.record.index.show', function() { - const config = kintone.plugin.app.getConfig(PLUGIN_ID); +(function(_$, _PLUGIN_ID) { - const spaceElement = kintone.mobile.app.getHeaderSpaceElement(); - const fragment = document.createDocumentFragment(); - const headingEl = document.createElement('h3'); - const messageEl = document.createElement('p'); - - messageEl.classList.add('plugin-space-message'); - messageEl.textContent = config.message; - headingEl.classList.add('plugin-space-heading'); - headingEl.textContent = 'Hello kintone plugin mobile!'; - - fragment.appendChild(headingEl); - fragment.appendChild(messageEl); - spaceElement.appendChild(fragment); - }); })(jQuery, kintone.$PLUGIN_ID);