feature(cloudcmd) clear storage -> copy path (#173)

This commit is contained in:
coderaiser 2018-05-14 18:26:18 +03:00
parent dc781a04c0
commit 0cb953af85
9 changed files with 16 additions and 12 deletions

View file

@ -9,6 +9,8 @@ const getRange = require('./get-range');
const getIndex = currify(require('./get-index')); const getIndex = currify(require('./get-index'));
const {writeText} = require('@cloudcmd/clipboard');
const uploadFiles = require('../dom/upload-files'); const uploadFiles = require('../dom/upload-files');
const { const {
@ -52,7 +54,6 @@ const execAll = currify((funcs, event) => {
}); });
const Info = DOM.CurrentInfo; const Info = DOM.CurrentInfo;
const Storage = DOM.Storage;
const Events = DOM.Events; const Events = DOM.Events;
const EventsFiles = { const EventsFiles = {
mousedown: exec.with(execIfNotUL, setCurrentFileByEvent), mousedown: exec.with(execIfNotUL, setCurrentFileByEvent),
@ -187,7 +188,6 @@ function decodePath(path){
.replace('%%', '%25%') .replace('%%', '%25%')
.replace(NBSP_REG, SPACE) || '/'; .replace(NBSP_REG, SPACE) || '/';
} }
function onPathElementClick(panel, event) { function onPathElementClick(panel, event) {
event.preventDefault(); event.preventDefault();
@ -196,8 +196,8 @@ function onPathElementClick(panel, event) {
const attr = element.getAttribute('data-name'); const attr = element.getAttribute('data-name');
const noCurrent = isNoCurrent(panel); const noCurrent = isNoCurrent(panel);
if (attr === 'js-clear-storage') if (attr === 'js-copy-path')
return Storage.clear(); return copyPath(element);
if (attr === 'js-refresh') if (attr === 'js-refresh')
return CloudCmd.refresh({ return CloudCmd.refresh({
@ -218,6 +218,12 @@ function onPathElementClick(panel, event) {
}); });
} }
function copyPath(el) {
writeText(el.parentElement.title)
.then(CloudCmd.log)
.catch(CloudCmd.log);
}
function execIfNotUL(callback, event) { function execIfNotUL(callback, event) {
const {target} = event; const {target} = event;
const {tagName} = target; const {tagName} = target;

View file

@ -98,7 +98,7 @@
content : '\e814 '; content : '\e814 ';
} }
.icon-clear::before { .icon-copy-to-clipboard::before {
font-family : 'Fontello'; font-family : 'Fontello';
content : '\e815 '; content : '\e815 ';
} }

Binary file not shown.

View file

@ -1,7 +1,7 @@
<?xml version="1.0" standalone="no"?> <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2017 by original authors @ fontello.com</metadata> <metadata>Copyright (C) 2018 by original authors @ fontello.com</metadata>
<defs> <defs>
<font id="fontello" horiz-adv-x="1000" > <font id="fontello" horiz-adv-x="1000" >
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" /> <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
@ -48,7 +48,7 @@
<glyph glyph-name="resize-full" unicode="&#xe814;" d="M421 261q0-7-5-13l-185-185 80-81q10-10 10-25t-10-25-25-11h-250q-15 0-25 11t-11 25v250q0 15 11 25t25 11 25-11l80-80 186 185q5 6 12 6t13-6l64-63q5-6 5-13z m436 482v-250q0-15-10-25t-26-11-25 11l-80 80-185-185q-6-6-13-6t-13 6l-64 64q-5 5-5 12t5 13l186 185-81 81q-10 10-10 25t10 25 25 11h250q15 0 26-11t10-25z" horiz-adv-x="857.1" /> <glyph glyph-name="resize-full" unicode="&#xe814;" d="M421 261q0-7-5-13l-185-185 80-81q10-10 10-25t-10-25-25-11h-250q-15 0-25 11t-11 25v250q0 15 11 25t25 11 25-11l80-80 186 185q5 6 12 6t13-6l64-63q5-6 5-13z m436 482v-250q0-15-10-25t-26-11-25 11l-80 80-185-185q-6-6-13-6t-13 6l-64 64q-5 5-5 12t5 13l186 185-81 81q-10 10-10 25t10 25 25 11h250q15 0 26-11t10-25z" horiz-adv-x="857.1" />
<glyph glyph-name="eraser" unicode="&#xe815;" d="M500 64l188 215h-429l-188-215h429z m565 601q9-19 6-40t-17-36l-500-572q-22-24-54-24h-429q-21 0-38 11t-27 31q-8 19-5 40t17 36l500 572q21 24 53 24h429q21 0 39-11t26-31z" horiz-adv-x="1071.4" /> <glyph glyph-name="clipboard" unicode="&#xe815;" d="M630 750q28 0 49-21t21-49l0-760q0-30-21-50t-49-20l-560 0q-28 0-49 20t-21 50l0 760q0 28 21 49t49 21l60-150 440 0z m-100-100l-360 0-44 100 108 0 36 100 160 0 36-100 110 0z" horiz-adv-x="700" />
<glyph glyph-name="arrows-ccw" unicode="&#xe816;" d="M186 140l116 116 0-292-276 16 88 86q-116 122-114 290t120 288q100 100 240 116l4-102q-100-16-172-88-88-88-90-213t84-217z m332 598l276-16-88-86q116-122 114-290t-120-288q-96-98-240-118l-2 104q98 16 170 88 88 88 90 213t-84 217l-114-116z" horiz-adv-x="820" /> <glyph glyph-name="arrows-ccw" unicode="&#xe816;" d="M186 140l116 116 0-292-276 16 88 86q-116 122-114 290t120 288q100 100 240 116l4-102q-100-16-172-88-88-88-90-213t84-217z m332 598l276-16-88-86q116-122 114-290t-120-288q-96-98-240-118l-2 104q98 16 170 88 88 88 90 213t-84 217l-114-116z" horiz-adv-x="820" />
@ -59,8 +59,6 @@
<glyph glyph-name="upload" unicode="&#xe819;" d="M714 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m143 0q0 14-10 25t-26 10-25-10-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-38t-38-16h-821q-23 0-38 16t-16 38v179q0 22 16 38t38 15h238q12-31 39-51t62-20h143q34 0 61 20t40 51h238q22 0 38-15t16-38z m-182 361q-9-22-33-22h-143v-250q0-15-10-25t-25-11h-143q-15 0-25 11t-11 25v250h-143q-23 0-33 22-9 22 8 39l250 250q10 10 25 10t25-10l250-250q18-17 8-39z" horiz-adv-x="928.6" /> <glyph glyph-name="upload" unicode="&#xe819;" d="M714 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m143 0q0 14-10 25t-26 10-25-10-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-38t-38-16h-821q-23 0-38 16t-16 38v179q0 22 16 38t38 15h238q12-31 39-51t62-20h143q34 0 61 20t40 51h238q22 0 38-15t16-38z m-182 361q-9-22-33-22h-143v-250q0-15-10-25t-25-11h-143q-15 0-25 11t-11 25v250h-143q-23 0-33 22-9 22 8 39l250 250q10 10 25 10t25-10l250-250q18-17 8-39z" horiz-adv-x="928.6" />
<glyph glyph-name="logout" unicode="&#xe81a;" d="M502 0l0 100 98 0 0-100q0-40-29-70t-71-30l-400 0q-40 0-70 30t-30 70l0 700q0 42 30 71t70 29l400 0q42 0 71-29t29-71l0-150-98 0 0 150-402 0 0-700 402 0z m398 326l-198-196 0 120-450 0 0 150 450 0 0 120z" horiz-adv-x="900" /> <glyph glyph-name="logout" unicode="&#xe81a;" d="M502 0l0 100 98 0 0-100q0-40-29-70t-71-30l-400 0q-40 0-70 30t-30 70l0 700q0 42 30 71t70 29l400 0q42 0 71-29t29-71l0-150-98 0 0 150-402 0 0-700 402 0z m398 326l-198-196 0 120-450 0 0 150 450 0 0 120z" horiz-adv-x="900" />
<glyph glyph-name="terminal-1" unicode="&#xe81b;" d="M1360 849v-1000h-1360v1000h1360z m-838-600h318v77h-318v-77z m-362 77l317 135v96l-317 134v-99l209-84-209-83v-99z" horiz-adv-x="1360" />
</font> </font>
</defs> </defs>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -56,8 +56,8 @@ const JSON_FILES = {
let Expect = let Expect =
'<div data-name="js-path" class="reduce-text" title="/etc/X11/">' + '<div data-name="js-path" class="reduce-text" title="/etc/X11/">' +
'<span data-name="js-clear-storage" class="path-icon icon-clear" ' + '<span data-name="js-copy-path" class="path-icon icon-copy-to-clipboard"' +
'title="clear storage (Ctrl+D)">' + ' title="copy path (Ctrl+P)">' +
'</span>' + '</span>' +
'<a data-name="js-refresh" href="/fs/etc/X11/" ' + '<a data-name="js-refresh" href="/fs/etc/X11/" ' +
'class="path-icon icon-refresh" title="refresh (Ctrl+R)"></a>' + 'class="path-icon icon-refresh" title="refresh (Ctrl+R)"></a>' +

View file

@ -1 +1 @@
<div data-name="js-path" class="reduce-text" title="{{ fullPath }}"><span data-name="js-clear-storage" class="path-icon icon-clear" title="clear storage (Ctrl+D)"></span><a data-name="js-refresh" href="{{ link }}" class="path-icon icon-refresh" title="refresh (Ctrl+R)"></a><span data-name="js-links" class=links>{{ path }}</span></div> <div data-name="js-path" class="reduce-text" title="{{ fullPath }}"><span data-name="js-copy-path" class="path-icon icon-copy-to-clipboard" title="copy path (Ctrl+P)"></span><a data-name="js-refresh" href="{{ link }}" class="path-icon icon-refresh" title="refresh (Ctrl+R)"></a><span data-name="js-links" class=links>{{ path }}</span></div>