diff --git a/frame.js b/frame.js index 973d8c5c..3f54351c 100644 --- a/frame.js +++ b/frame.js @@ -332,10 +332,12 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, }) }, plugin: function(can, meta, cb, target) { meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd) - meta.inputs && meta.inputs.length > 0? can.onappend._plugin(can, {meta: meta.meta, list: meta.list}, meta, cb, target): + var res = {}; function cbs(sub, meta, skip) { res.__proto__ = sub, cb(sub, meta, skip) } + meta.inputs && meta.inputs.length > 0? can.onappend._plugin(can, {meta: meta.meta, list: meta.list}, meta, cbs, target): can.run({}, [ctx.ACTION, ctx.COMMAND, meta.index], function(msg) { msg.Table(function(value) { - can.onappend._plugin(can, value, meta, cb, target) + can.onappend._plugin(can, value, meta, cbs, target) }) }, true) + return res }, _plugin: function(can, value, meta, cb, target) { meta.feature = meta.feature||can.base.Obj(value.meta, {}) diff --git a/page/index.css b/page/index.css index aa2ea18b..0e54a833 100644 --- a/page/index.css +++ b/page/index.css @@ -32,9 +32,10 @@ div.story { } div.story[data-type=spark] { background-color:#2169a9a6; color:white; - box-shadow: 4px 4px 10px 1px #626bd0; + box-shadow:4px 4px 10px 1px #626bd0; padding:4px 10px; margin:10px 0px; border-left:solid 4px blue; + font-family:monospace; white-space:pre; cursor:copy; } diff --git a/plugin/local/chat/trans.js b/plugin/local/chat/trans.js new file mode 100644 index 00000000..fd754d64 --- /dev/null +++ b/plugin/local/chat/trans.js @@ -0,0 +1,34 @@ +Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { + can.onmotion.clear(can) + can.from = can.onimport._plugin(can, nfs.DIR, html.LEFT, "from", "to") + can.to = can.onimport._plugin(can, nfs.DIR, html.RIGHT, "to", "from") + can.onimport._plugin(can, nfs.TRASH, html.LEFT, "from") + can.onimport._plugin(can, nfs.TRASH, html.RIGHT, "to") + }, + _plugin: function(can, index, pos, from, to) { + return can.onappend.plugin(can, {type: chat.STORY, index: index}, function(sub) { + can.page.Modify(can, sub._target, {style: {float: pos, clear: pos}}) + sub.Conf(html.WIDTH, can.Conf(html.WIDTH)/2) + sub._legend.innerHTML = can.Option(from)+ice.SP+index + can.page.Modify(can, sub._output, {style: {"max-width": can.Conf(html.WIDTH)/2}}) + + sub.run = function(event, cmds, cb) { + if (can.onaction[cmds[1]]) { return can.onaction[cmds[1]](can, from, to, event, cmds, cb) } + + var msg = sub.request(event, {_pod: can.Option(from)}) + can.run(event, can.misc.Concat([ctx.ACTION, ice.RUN, index], cmds), cb, true) + } + }) + }, +}) +Volcanos("onaction", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { + }, + send: function(can, from, to, event, cmds, cb) { var _from = can[from], _to = can[to] + var path = can.request(event).Option(nfs.PATH) + var msg = can.request(event, {_handle: ice.TRUE, + from: can.Option(from), from_path: path, + to: can.Option(to), to_path: _to.Option(nfs.PATH)+path.split(ice.PS).pop(), + }) + can.run(event, cmds, function() { _to.Update() }, true) + }, +}) diff --git a/proto.js b/proto.js index fba2aa65..6e1fa6e9 100644 --- a/proto.js +++ b/proto.js @@ -84,6 +84,7 @@ var ssh = { } var nfs = { PATH: "path", FILE: "file", LINE: "line", + TRASH: "trash", DIR: "dir", CAT: "cat", DIR_ROOT: "dir_root", } @@ -134,6 +135,7 @@ var html = { INPUT: "input", INPUT_ARGS: ".args", TEXT: "text", TEXTAREA: "textarea", SELECT: "select", BUTTON: "button", FORM: "form", FILE: "file", SPACE: "space", CLICK: "click", + SCROLL: "scroll", HEIGHT: "height", WIDTH: "width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom", TABLE: "table", TR: "tr", TH: "th", TD: "td", BR: "br", DIV: "div", IMG: "img", CODE: "code", SPAN: "span", VIDEO: "video",