mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(buffer) dialog
This commit is contained in:
parent
ec8cb4c19a
commit
1bf8fbc52b
5 changed files with 26 additions and 30 deletions
|
|
@ -1,5 +1,3 @@
|
|||
/* global CloudCmd */
|
||||
|
||||
'use strict';
|
||||
|
||||
const jonny = require('jonny');
|
||||
|
|
@ -7,39 +5,38 @@ const exec = require('execon');
|
|||
|
||||
const Storage = require('./storage');
|
||||
const DOM = require('./dom');
|
||||
const {Dialog} = DOM;
|
||||
|
||||
module.exports = new BufferProto(DOM, CloudCmd);
|
||||
module.exports = new BufferProto();
|
||||
|
||||
function BufferProto(DOM, CloudCmd) {
|
||||
const Info = DOM.CurrentInfo,
|
||||
CLASS = 'cut-file',
|
||||
COPY = 'copy',
|
||||
CUT = 'cut',
|
||||
TITLE = 'Buffer',
|
||||
|
||||
Buffer = {
|
||||
cut : callIfEnabled.bind(null, cut),
|
||||
copy : callIfEnabled.bind(null, copy),
|
||||
clear : callIfEnabled.bind(null, clear),
|
||||
paste : callIfEnabled.bind(null, paste)
|
||||
};
|
||||
function BufferProto() {
|
||||
const Info = DOM.CurrentInfo;
|
||||
const CLASS = 'cut-file';
|
||||
const COPY = 'copy';
|
||||
const CUT = 'cut';
|
||||
const TITLE = 'Buffer';
|
||||
|
||||
const Buffer = {
|
||||
cut : callIfEnabled.bind(null, cut),
|
||||
copy : callIfEnabled.bind(null, copy),
|
||||
clear : callIfEnabled.bind(null, clear),
|
||||
paste : callIfEnabled.bind(null, paste)
|
||||
};
|
||||
|
||||
function showMessage(msg) {
|
||||
Dialog.alert(TITLE, msg);
|
||||
DOM.Dialog.alert(TITLE, msg);
|
||||
}
|
||||
|
||||
function getNames() {
|
||||
var files = DOM.getActiveFiles(),
|
||||
names = DOM.getFilenames(files);
|
||||
const files = DOM.getActiveFiles();
|
||||
const names = DOM.getFilenames(files);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
function addCutClass() {
|
||||
var files = DOM.getActiveFiles();
|
||||
const files = DOM.getActiveFiles();
|
||||
|
||||
files.forEach(function(element) {
|
||||
files.forEach((element) => {
|
||||
element.classList.add(CLASS);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -570,3 +570,4 @@ function CloudCmdProto(Util, DOM, CloudFunc) {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ window.CloudCmd = (config) => {
|
|||
window.Util = require('../common/util');
|
||||
window.CloudFunc = require('../common/cloudfunc');
|
||||
window.DOM = require('./dom');
|
||||
window.CloudCmd = require('./client');
|
||||
|
||||
const Dialog = require('./dialog');
|
||||
|
||||
|
|
@ -20,8 +21,6 @@ window.CloudCmd = (config) => {
|
|||
htmlDialogs
|
||||
});
|
||||
|
||||
window.CloudCmd = require('./client');
|
||||
|
||||
require('./listeners');
|
||||
require('./key');
|
||||
require('./directory');
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function OperationProto(operation, data) {
|
|||
exec.series([
|
||||
DOM.loadSocket,
|
||||
(callback) => {
|
||||
if (config('progress'))
|
||||
if (CloudCmd.config('progress'))
|
||||
load((callback) => {
|
||||
create(CloudCmd.PREFIX, callback);
|
||||
});
|
||||
|
|
@ -59,7 +59,7 @@ function OperationProto(operation, data) {
|
|||
}
|
||||
|
||||
function authCheck(spawn, ok) {
|
||||
if (!config('auth'))
|
||||
if (!CloudCmd.config('auth'))
|
||||
return ok();
|
||||
|
||||
spawn.on('accept', ok);
|
||||
|
|
@ -415,9 +415,8 @@ function OperationProto(operation, data) {
|
|||
function ask(to) {
|
||||
ok = from !== to && to;
|
||||
|
||||
if (ok)
|
||||
if (!shouldAsk || !sameName)
|
||||
return go;
|
||||
if (ok && !shouldAsk || !sameName)
|
||||
return go();
|
||||
|
||||
const str = `"${ name }" already exist. Overwrite?`;
|
||||
const cancel = false;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "node bin/cloudcmd.js",
|
||||
"start:dev": "NODE_ENV=debug node bin/cloudcmd.js",
|
||||
"start:dev": "NODE_ENV=development node bin/cloudcmd.js",
|
||||
"security": "nsp check",
|
||||
"codestyle": "redrun lint spell",
|
||||
"lint": "redrun lint:*",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue