1
0
forked from x/volcanos
This commit is contained in:
shaoying 2020-11-08 09:07:19 +08:00
parent 69c092bde6
commit ffa089bb9b
3 changed files with 21 additions and 8 deletions

View File

@ -167,12 +167,12 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
{name: "contexts", help: "上下文", index: "web.wiki.word", args: ["src/main.shy"]}, {name: "contexts", help: "上下文", index: "web.wiki.word", args: ["src/main.shy"]},
]}, ]},
"cli": {name: "命令 cli", action: [ "cli": {name: "命令 cli", action: [
{name: "bash", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/zsh/bash.shy"]}, {name: "bash", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/bash.shy"]},
{name: "zsh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/zsh/zsh.shy"]},
{name: "ssh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/base/ssh/ssh.shy"]},
{name: "tmux", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/tmux/tmux.shy"]}, {name: "tmux", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/tmux/tmux.shy"]},
{name: "git", help: "代码库", index: "web.wiki.word", args: ["usr/icebergs/misc/git/git.shy"]}, {name: "git", help: "代码库", index: "web.wiki.word", args: ["usr/icebergs/misc/git/git.shy"]},
{name: "vim", help: "编辑器", index: "web.wiki.word", args: ["usr/icebergs/misc/vim/vim.shy"]}, {name: "vim", help: "编辑器", index: "web.wiki.word", args: ["usr/icebergs/misc/vim/vim.shy"]},
{name: "ssh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/base/ssh/ssh.shy"]},
{name: "zsh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/zsh.shy"]},
]}, ]},
"web": {name: "网页 web", action: [ "web": {name: "网页 web", action: [
{name: "HTML5", help: "浏览器", index: "web.wiki.word", args: ["usr/icebergs/misc/chrome/chrome.shy"]}, {name: "HTML5", help: "浏览器", index: "web.wiki.word", args: ["usr/icebergs/misc/chrome/chrome.shy"]},

View File

@ -1,10 +1,17 @@
Volcanos("onimport", {help: "导入数据", list: [], Volcanos("onimport", {help: "导入数据", list: [],
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "" _init: function(can, msg, list, cb, target) { can._output.innerHTML = ""
if (msg.Option("_display") == "table") { if (msg.Option("_display") == "table") {
can.onappend.table(can, msg, can._target, "table") can.onappend.table(can, msg, can._target, "table", function(value, key) {
return {text: [value, "td"], click: function(event) {
can.sup.onaction.change(event, can.sup, key, value, function(msg) {
can.run(event)
})
}}
})
return typeof cb == "function" && cb(msg) return typeof cb == "function" && cb(msg)
} }
can.ui = can.page.Append(can, can._output, [{view: "content"}, {view: "display"}]) can.ui = can.page.Append(can, can._output, [{view: "content"}, {view: "display"}])
can.dir_root = msg.Option("dir_root")
can.onappend._init(can, {name: "draw", help: "绘图", inputs: [ can.onappend._init(can, {name: "draw", help: "绘图", inputs: [
{type: "text", name: "path", value: "hi.svg"}, {type: "text", name: "path", value: "hi.svg"},
@ -78,7 +85,7 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
}) })
return tree.height = height return tree.height = height
}, },
_draw: function(can, tree, x, y) { var sub = can.sub, name = tree.name || can.Option("path") || "." _draw: function(can, tree, x, y) { var sub = can.sub, name = tree.name || can.Option("name") || "."
tree.view = sub.onimport.draw({}, sub, { tree.view = sub.onimport.draw({}, sub, {
shape: "text", point: [{x: x, y: y+tree.height*30/2}], style: {inner: name, "text-anchor": "start", "stroke-width": 1, fill: "yellow"}, shape: "text", point: [{x: x, y: y+tree.height*30/2}], style: {inner: name, "text-anchor": "start", "stroke-width": 1, fill: "yellow"},
}) })
@ -96,7 +103,7 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
if (tree.name.endsWith("go") || if (tree.name.endsWith("go") ||
tree.name.endsWith("c") || tree.name.endsWith("c") ||
tree.name.endsWith("h")) { tree.name.endsWith("h")) {
can.run(event, [can.Option("path"), tree.file], function(msg) { can.run(event, [can.Option("name"), tree.file], function(msg) {
msg.Table(function(value) { tree.tags = true msg.Table(function(value) { tree.tags = true
tree.list.push({type: "tags", file: value.file, line: value.line, name: value.name, last: tree, list: []}) tree.list.push({type: "tags", file: value.file, line: value.line, name: value.name, last: tree, list: []})
}) })
@ -108,7 +115,7 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
return return
} }
can.onaction._show(can, [can.Option("path"), tree.file, tree.line], { can.onaction._show(can, [can.dir_root, tree.file, tree.line], {
position: "fixed", width: 800, height: 600, position: "fixed", width: 800, height: 600,
left: event.x-(event.x>600? 400: 100), left: event.x-(event.x>600? 400: 100),
top: event.y-(event.y>600? 400: 0), top: event.y-(event.y>600? 400: 0),

View File

@ -1,7 +1,13 @@
Volcanos("onimport", {help: "导入数据", list: [], Volcanos("onimport", {help: "导入数据", list: [],
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "" _init: function(can, msg, list, cb, target) { can._output.innerHTML = ""
if (msg.Option("_display") == "table") { if (msg.Option("_display") == "table") {
can.onappend.table(can, msg, can._target, "table") can.onappend.table(can, msg, can._target, "table", function(value, key) {
return {text: [value, "td"], click: function(event) {
can.sup.onaction.change(event, can.sup, key, value, function(msg) {
can.run(event)
})
}}
})
return typeof cb == "function" && cb(msg) return typeof cb == "function" && cb(msg)
} }
can.ui = can.page.Append(can, can._output, [{view: "content"}, {view: "display"}]) can.ui = can.page.Append(can, can._output, [{view: "content"}, {view: "display"}])