mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
add monaco
This commit is contained in:
parent
183f0a02d9
commit
ffd0ee57d0
5
const.js
5
const.js
@ -217,8 +217,7 @@ var chat = {
|
|||||||
"local/team/plan.js",
|
"local/team/plan.js",
|
||||||
"local/mall/goods.js",
|
"local/mall/goods.js",
|
||||||
].map(function(p) { return "/volcanos/plugin/"+p }).concat([
|
].map(function(p) { return "/volcanos/plugin/"+p }).concat([
|
||||||
// https://icons.getbootstrap.com/
|
"/require/modules/bootstrap-icons/font/bootstrap-icons.min.css", // https://icons.getbootstrap.com/
|
||||||
"/require/modules/bootstrap-icons/font/bootstrap-icons.min.css",
|
|
||||||
]),
|
]),
|
||||||
PLUGIN_LOCAL: "/volcanos/plugin/local/",
|
PLUGIN_LOCAL: "/volcanos/plugin/local/",
|
||||||
PLUGIN_STORY: "/volcanos/plugin/story/",
|
PLUGIN_STORY: "/volcanos/plugin/story/",
|
||||||
@ -293,7 +292,7 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 32, ACTION_MARGIN: 200,
|
|||||||
NOTICE: "notice", DANGER: "danger",
|
NOTICE: "notice", DANGER: "danger",
|
||||||
|
|
||||||
SIZE: "size", OPACITY: "opacity", VISIBLE: "visible",
|
SIZE: "size", OPACITY: "opacity", VISIBLE: "visible",
|
||||||
CLASS: "class", LIGHT: "light", DARK: "dark",
|
CLASS: "class", DARK: "dark", LIGHT: "light", WHITE: "white", BLACK: "black",
|
||||||
FILTER: "filter", TOGGLE: "toggle", EXPAND: "expand", SPEED: "speed", HOVER: "hover", HOVER_SELECT: "hover,select",
|
FILTER: "filter", TOGGLE: "toggle", EXPAND: "expand", SPEED: "speed", HOVER: "hover", HOVER_SELECT: "hover,select",
|
||||||
NOT_HIDE: ":not(.hide)",
|
NOT_HIDE: ":not(.hide)",
|
||||||
|
|
||||||
|
47
frame.js
47
frame.js
@ -11,9 +11,21 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
|||||||
can.core.CallFunc([sub.onaction, chat._INIT], {can: sub, cb: next, target: sub._target}), delete(sub._history), delete(sub._conf.feature)
|
can.core.CallFunc([sub.onaction, chat._INIT], {can: sub, cb: next, target: sub._target}), delete(sub._history), delete(sub._conf.feature)
|
||||||
}, target)
|
}, target)
|
||||||
}, function() { can.onlayout._init(can, target), can.onmotion._init(can, target), can.onkeymap._init(can, target)
|
}, function() { can.onlayout._init(can, target), can.onmotion._init(can, target), can.onkeymap._init(can, target)
|
||||||
can.onengine.signal(can, chat.ONMAIN, can.request()), can.base.isFunc(cb) && cb(can)
|
can.onengine.signal(can, chat.ONMAIN, can.request()), can.base.isFunc(cb) && cb(can), can.onengine._config(can)
|
||||||
}), can._path = location.href
|
}), can._path = location.href
|
||||||
},
|
},
|
||||||
|
_config: function(can) { can.require(["/require/src/conf.js"], function() {}, function(can, name, sub) {
|
||||||
|
name == chat.ONIMPORT && can.core.Item(sub.list, function(path, meta) {
|
||||||
|
can.require([path], function() {}, function(can, name, sub) {
|
||||||
|
name == chat.ONPLUGIN && can.core.Item(sub, function(key, cmd) {
|
||||||
|
if (sub.hasOwnProperty(key) && can.base.isFunc(cmd)) {
|
||||||
|
cmd.meta._path = sub._path, can.base.Copy(cmd.meta, meta)
|
||||||
|
can.onengine.plugin(can, can.core.Keys(ice.CAN, key), cmd)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}) },
|
||||||
_search: function(event, can, msg, panel, cmds, cb) {
|
_search: function(event, can, msg, panel, cmds, cb) {
|
||||||
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split(nfs.PT), function(value) { fun && (sub = mod, mod = fun, fun = mod[value], key = value) })
|
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split(nfs.PT), function(value) { fun && (sub = mod, mod = fun, fun = mod[value], key = value) })
|
||||||
if (!sub || !mod || !fun) { can.misc.Warn(ice.ErrNotFound, cmds); return can.base.isFunc(cb) && cb(msg.Echo(ice.ErrWarn, ice.ErrNotFound, cmds)) }
|
if (!sub || !mod || !fun) { can.misc.Warn(ice.ErrNotFound, cmds); return can.base.isFunc(cb) && cb(msg.Echo(ice.ErrWarn, ice.ErrNotFound, cmds)) }
|
||||||
@ -42,13 +54,13 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
|||||||
_engine: function(event, can, msg, panel, cmds, cb) { return false },
|
_engine: function(event, can, msg, panel, cmds, cb) { return false },
|
||||||
_plugin: function(event, can, msg, panel, cmds, cb) {
|
_plugin: function(event, can, msg, panel, cmds, cb) {
|
||||||
if (cmds[0] == ctx.ACTION && cmds[1] == ice.RUN) { var p = can.onengine.plugin(can, cmds[2])
|
if (cmds[0] == ctx.ACTION && cmds[1] == ice.RUN) { var p = can.onengine.plugin(can, cmds[2])
|
||||||
if (p) { return can.core.CallFunc(p, {can: p.can||panel, sub: msg._can, msg: msg, arg: cmds.slice(3), cmds: cmds.slice(3), cb: cb}), true }
|
if (p) { return can.core.CallFunc(p, {can: p.can||panel, sub: msg._can, msg: msg, arg: cmds.slice(3), cmds: cmds.slice(3), cb: cb, meta: p.meta}), true }
|
||||||
}
|
}
|
||||||
var p = can.onengine.plugin(can, cmds[0]), n = 1; if (!p) { return false }
|
var p = can.onengine.plugin(can, cmds[0]), n = 1; if (!p) { return false }
|
||||||
var func = p, _can = p.can||panel, _sup = _can
|
var func = p, _can = p.can||panel, _sup = _can
|
||||||
if (p.meta && p.meta[cmds[2]] && cmds[1] == ctx.ACTION) { n = 3, func = p.meta[cmds[2]], _can = msg._can } else if (p.meta && p.meta[cmds[1]]) { n = 2, func = p.meta[cmds[2]], _can = msg._can }
|
if (p.meta && p.meta[cmds[2]] && cmds[1] == ctx.ACTION) { n = 3, func = p.meta[cmds[2]], _can = msg._can } else if (p.meta && p.meta[cmds[1]]) { n = 2, func = p.meta[cmds[2]], _can = msg._can }
|
||||||
if (cmds[n] == ctx.ACTION && cmds[n+1] == mdb.INPUTS) { return true }
|
if (cmds[n] == ctx.ACTION && cmds[n+1] == mdb.INPUTS) { return true }
|
||||||
return can.core.CallFunc(func, {sup: _sup, can: _can, sub: msg._can, msg: msg, arg: cmds.slice(n), cmds: cmds.slice(n), cb: cb}), true
|
return can.core.CallFunc(func, {sup: _sup, can: _can, sub: msg._can, msg: msg, arg: cmds.slice(n), cmds: cmds.slice(n), cb: cb, meta: p.meta}), true
|
||||||
},
|
},
|
||||||
plugin: shy(function(can, name, command) { var _name = can.base.trimPrefix(name, "can.")
|
plugin: shy(function(can, name, command) { var _name = can.base.trimPrefix(name, "can.")
|
||||||
if (can.base.isUndefined(name) || !can.base.isString(name) || name == _name) { return }
|
if (can.base.isUndefined(name) || !can.base.isString(name) || name == _name) { return }
|
||||||
@ -230,16 +242,18 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
|||||||
if (sub.onimport && can.base.isArray(sub.onimport.list) && sub.onimport.list.length > 0) {
|
if (sub.onimport && can.base.isArray(sub.onimport.list) && sub.onimport.list.length > 0) {
|
||||||
can.onmotion.clear(can, can._option), can.onappend._option(can, {inputs: can.page.inputs(can, sub.onimport.list, html.TEXT) })
|
can.onmotion.clear(can, can._option), can.onappend._option(can, {inputs: can.page.inputs(can, sub.onimport.list, html.TEXT) })
|
||||||
}
|
}
|
||||||
can.core.CallFunc([sub, chat.ONIMPORT, chat._INIT], {can: sub, msg: msg, cb: function(msg) {
|
can.page.requireModules(can, can.Conf("modules"), function() {
|
||||||
if (action !== false) { can.onkeymap._build(sub)
|
can.core.CallFunc([sub, chat.ONIMPORT, chat._INIT], {can: sub, msg: msg, cb: function(msg) {
|
||||||
can.onmotion.clear(can, can._action), sub.onappend._action(sub, can.Conf(ice.MSG_ACTION)||msg.Option(ice.MSG_ACTION), action||can._action)
|
if (action !== false) { can.onkeymap._build(sub)
|
||||||
sub.onappend._status(sub, sub.onexport&&sub.onexport.list||msg.Option(ice.MSG_STATUS)), can.user.isMobile || sub.onappend.tools(sub, msg)
|
can.onmotion.clear(can, can._action), sub.onappend._action(sub, can.Conf(ice.MSG_ACTION)||msg.Option(ice.MSG_ACTION), action||can._action)
|
||||||
}
|
sub.onappend._status(sub, sub.onexport&&sub.onexport.list||msg.Option(ice.MSG_STATUS)), can.user.isMobile || sub.onappend.tools(sub, msg)
|
||||||
can.onappend.style(sub, sub.Conf(ctx.STYLE)), can.onmotion.story.auto(can, can._output)
|
}
|
||||||
if (can.onimport.size) { if (can.isFullMode() || can.isCmdMode()) { can.ConfHeight(can.page.height()), can.ConfWidth(can.page.width()) }
|
can.onappend.style(sub, sub.Conf(ctx.STYLE)), can.onmotion.story.auto(can, can._output)
|
||||||
can.onimport.size(can, can.ConfHeight(), can.ConfWidth(), can.Conf("_auto"), can.Mode()), can.onexport.output(sub, msg)
|
if (can.onimport.size) { if (can.isFullMode() || can.isCmdMode()) { can.ConfHeight(can.page.height()), can.ConfWidth(can.page.width()) }
|
||||||
} can.base.isFunc(cb) && cb(msg)
|
can.onimport.size(can, can.ConfHeight(), can.ConfWidth(), can.Conf("_auto"), can.Mode()), can.onexport.output(sub, msg)
|
||||||
}, target: output})
|
} can.base.isFunc(cb) && cb(msg)
|
||||||
|
}, target: output})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
_status: function(can, list, status) { status = status||can._status, can.onmotion.clear(can, status)
|
_status: function(can, list, status) { status = status||can._status, can.onmotion.clear(can, status)
|
||||||
@ -254,7 +268,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
|||||||
field: function(can, type, item, target) { type = type||html.STORY, item = item||{}
|
field: function(can, type, item, target) { type = type||html.STORY, item = item||{}
|
||||||
var name = can.core.Split(item.nick||item.name||"").pop()||""; can.base.isIn(name, "server", "client", "studio") && (name = (item.index||"").split(".").slice(-2).join(".")), name = can.core.Keys(item.space, name)
|
var name = can.core.Split(item.nick||item.name||"").pop()||""; can.base.isIn(name, "server", "client", "studio") && (name = (item.index||"").split(".").slice(-2).join(".")), name = can.core.Keys(item.space, name)
|
||||||
var title = item.help && item.help != name && !can.user.isEnglish(can)? name+"("+can.core.Split(item.help)[0]+")": name
|
var title = item.help && item.help != name && !can.user.isEnglish(can)? name+"("+can.core.Split(item.help)[0]+")": name
|
||||||
return can.page.Append(can, target||can._output, [{view: [type, html.FIELDSET], list: [{type: html.LEGEND, list: [{icon: item.icon}, {text: title}]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS]}])
|
return can.page.Append(can, target||can._output, [{view: [type, html.FIELDSET], list: [{type: html.LEGEND, list: [item.icon && {icon: item.icon}, {text: title}]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS]}])
|
||||||
},
|
},
|
||||||
input: function(can, item, value, target, style) { if ([html.BR, html.HR].indexOf(item.type) > -1) { return can.page.Append(can, target, [item]) }
|
input: function(can, item, value, target, style) { if ([html.BR, html.HR].indexOf(item.type) > -1) { return can.page.Append(can, target, [item]) }
|
||||||
var icon = [], _item = can.base.Copy({className: "", type: "", name: ""}, item), input = can.page.input(can, _item, value)
|
var icon = [], _item = can.base.Copy({className: "", type: "", name: ""}, item), input = can.page.input(can, _item, value)
|
||||||
@ -344,7 +358,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
|||||||
target.scrollHeight > target.offsetHeight && can.page.style(can, vbar, html.HEIGHT, height, html.RIGHT, -target.scrollLeft, html.VISIBILITY, html.VISIBLE,
|
target.scrollHeight > target.offsetHeight && can.page.style(can, vbar, html.HEIGHT, height, html.RIGHT, -target.scrollLeft, html.VISIBILITY, html.VISIBLE,
|
||||||
html.TOP, target.scrollTop+target.scrollTop/(target.scrollHeight-target.offsetHeight)*(target.offsetHeight-height),
|
html.TOP, target.scrollTop+target.scrollTop/(target.scrollHeight-target.offsetHeight)*(target.offsetHeight-height),
|
||||||
)
|
)
|
||||||
vbar.innerHTML = `${target.scrollTop}+${target.offsetHeight}/${target.scrollHeight}`
|
vbar.innerHTML = `${parseInt(target.scrollTop)}+${target.offsetHeight}/${target.scrollHeight}`
|
||||||
var width = can.base.Min(target.offsetWidth*target.offsetWidth/target.scrollWidth, target.offsetWidth/4)
|
var width = can.base.Min(target.offsetWidth*target.offsetWidth/target.scrollWidth, target.offsetWidth/4)
|
||||||
target.scrollWidth > target.offsetWidth && can.page.style(can, hbar, html.WIDTH, width, html.BOTTOM, -target.scrollTop, html.VISIBILITY, html.VISIBLE,
|
target.scrollWidth > target.offsetWidth && can.page.style(can, hbar, html.WIDTH, width, html.BOTTOM, -target.scrollTop, html.VISIBILITY, html.VISIBLE,
|
||||||
html.LEFT, target.scrollLeft+target.scrollLeft/(target.scrollWidth-target.offsetWidth)*(target.offsetWidth-width),
|
html.LEFT, target.scrollLeft+target.scrollLeft/(target.scrollWidth-target.offsetWidth)*(target.offsetWidth-width),
|
||||||
@ -604,6 +618,7 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
|||||||
}
|
}
|
||||||
can.onimport.size(can, height, width, true)
|
can.onimport.size(can, height, width, true)
|
||||||
can.onmotion.move(can, can._target, {left: can.page.width()-width, top: can.page.height()/4})
|
can.onmotion.move(can, can._target, {left: can.page.width()-width, top: can.page.height()/4})
|
||||||
|
can.onmotion.resize(can, can._target, function(height, width) { can.onimport.size(can, height, width, true) })
|
||||||
},
|
},
|
||||||
clear: function(can, target) { return can.page.Modify(can, target||can._output, ""), target },
|
clear: function(can, target) { return can.page.Modify(can, target||can._output, ""), target },
|
||||||
cache: function(can, next) { var list = can.base.getValid(can.base.Obj(can.core.List(arguments).slice(2)), [can._output])
|
cache: function(can, next) { var list = can.base.getValid(can.base.Obj(can.core.List(arguments).slice(2)), [can._output])
|
||||||
@ -667,7 +682,7 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
|||||||
can.core.Timer({interval: 1, length: height/6}, function(timer, interval, index, list) {
|
can.core.Timer({interval: 1, length: height/6}, function(timer, interval, index, list) {
|
||||||
can.page.style(can, target, html.HEIGHT, begin += height/list.length)
|
can.page.style(can, target, html.HEIGHT, begin += height/list.length)
|
||||||
}, function() {
|
}, function() {
|
||||||
can.page.style(can, target, html.HEIGHT, height)
|
can.page.style(can, target, html.HEIGHT, "")
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
slideDown: function(can, target) {
|
slideDown: function(can, target) {
|
||||||
|
10
index.css
10
index.css
@ -36,8 +36,9 @@ body {
|
|||||||
--code-comment:green; --code-keyword:royalblue; --code-package:blue;
|
--code-comment:green; --code-keyword:royalblue; --code-package:blue;
|
||||||
--code-datatype:lavender; --code-function:lightgreen;
|
--code-datatype:lavender; --code-function:lightgreen;
|
||||||
--code-constant:gray; --code-string:orange; --code-object:silver;
|
--code-constant:gray; --code-string:orange; --code-object:silver;
|
||||||
--svg-stroke-width:2;
|
--svg-stroke-width:1;
|
||||||
}
|
}
|
||||||
|
body.windows { --code-font-family:courier new; }
|
||||||
/* element */
|
/* element */
|
||||||
* { tab-size:4; box-sizing:border-box; padding:0; border:0; margin:0; }
|
* { tab-size:4; box-sizing:border-box; padding:0; border:0; margin:0; }
|
||||||
legend { padding:0 20px; }
|
legend { padding:0 20px; }
|
||||||
@ -69,7 +70,7 @@ hr, td.hr { border-bottom:var(--plugin-border-color) dashed 1px; margin:5px; }
|
|||||||
ol, ul { margin-left:40px; }
|
ol, ul { margin-left:40px; }
|
||||||
a { color:var(--body-fg-color); font-style:italic; }
|
a { color:var(--body-fg-color); font-style:italic; }
|
||||||
p { margin:20px 0; }
|
p { margin:20px 0; }
|
||||||
kbd { padding:0 5px; }
|
kbd { padding:0 5px; font-family:var(--code-font-family); }
|
||||||
img, iframe { margin-bottom:-3px; }
|
img, iframe { margin-bottom:-3px; }
|
||||||
iframe { height:420px; width:100%; }
|
iframe { height:420px; width:100%; }
|
||||||
/* fieldset */
|
/* fieldset */
|
||||||
@ -241,7 +242,7 @@ div.content>div.toggle.project { top:20%; left:0; height:80px; width:unset; padd
|
|||||||
div.content>div.toggle.profile { top:20%; right:0; height:80px; padding-top:25px; transform:scale(1, 3); border:none; }
|
div.content>div.toggle.profile { top:20%; right:0; height:80px; padding-top:25px; transform:scale(1, 3); border:none; }
|
||||||
div.content>div.toggle.display { left:20%; bottom:0; width:80px; text-align:center; transform:scale(3, 1); border:none; }
|
div.content>div.toggle.display { left:20%; bottom:0; width:80px; text-align:center; transform:scale(3, 1); border:none; }
|
||||||
div.project:not(.toggle) { border-right:var(--box-border); width:230px; flex:0 0 230px; }
|
div.project:not(.toggle) { border-right:var(--box-border); width:230px; flex:0 0 230px; }
|
||||||
div.profile:not(.toggle) { border-left:var(--box-border); min-width:230px; }
|
div.profile:not(.toggle) { border-left:var(--box-border); width:50%; }
|
||||||
div.display:not(.toggle) { border-top:var(--box-border); }
|
div.display:not(.toggle) { border-top:var(--box-border); }
|
||||||
/* table card */
|
/* table card */
|
||||||
div.output.card>div.item.stop { color:var(--disable-fg-color); }
|
div.output.card>div.item.stop { color:var(--disable-fg-color); }
|
||||||
@ -269,7 +270,7 @@ fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-inde
|
|||||||
fieldset.plug { position:absolute; bottom:0; right:0; }
|
fieldset.plug { position:absolute; bottom:0; right:0; }
|
||||||
div.output { position:relative; }
|
div.output { position:relative; }
|
||||||
div.layout.flex>* { float:left; clear:none; }
|
div.layout.flex>* { float:left; clear:none; }
|
||||||
div.output.flex { display:flex; }
|
div.output.flex { display:flex; overflow:hidden; }
|
||||||
div.output>div.code { position:sticky; left:0; }
|
div.output>div.code { position:sticky; left:0; }
|
||||||
fieldset>div.status>legend {
|
fieldset>div.status>legend {
|
||||||
border-radius:0; border-bottom-left-radius:10px; border-bottom-right-radius:10px; box-shadow:var(--box-shadow);
|
border-radius:0; border-bottom-left-radius:10px; border-bottom-right-radius:10px; box-shadow:var(--box-shadow);
|
||||||
@ -589,5 +590,4 @@ body {
|
|||||||
--ui-gold-8: #ad6800;
|
--ui-gold-8: #ad6800;
|
||||||
--ui-gold-9: #874d00;
|
--ui-gold-9: #874d00;
|
||||||
--ui-gold-10: #613400;
|
--ui-gold-10: #613400;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ Volcanos("page", {
|
|||||||
case html.BUTTON: item.value = item.value||item.name||mdb.LIST; break
|
case html.BUTTON: item.value = item.value||item.name||mdb.LIST; break
|
||||||
} return input
|
} return input
|
||||||
},
|
},
|
||||||
requireModules: function(can, libs, cb, cbs) {
|
requireModules: function(can, libs, cb, cbs) { if (!libs || libs.length == 0) { return cb && cb() }
|
||||||
for (var i = 0; i < libs.length; i++) { if (libs[i].indexOf(nfs.PS) == 0 || libs[i].indexOf(ice.HTTP) == 0) { continue }
|
for (var i = 0; i < libs.length; i++) { if (libs[i].indexOf(nfs.PS) == 0 || libs[i].indexOf(ice.HTTP) == 0) { continue }
|
||||||
if (libs[i].indexOf(nfs._CSS) == -1 && libs[i].indexOf(nfs._JS) == -1) { libs[i] = libs[i]+"/lib/"+libs[i]+nfs._JS }
|
if (libs[i].indexOf(nfs._CSS) == -1 && libs[i].indexOf(nfs._JS) == -1) { libs[i] = libs[i]+"/lib/"+libs[i]+nfs._JS }
|
||||||
libs[i] = "/require/modules/"+libs[i]
|
libs[i] = "/require/modules/"+libs[i]
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.current = msg.TableDetail(), can.sup.onimport.size(can.sup, can.sup.ConfHeight(), can.sup.ConfWidth(), true)
|
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.db.current = msg.TableDetail()
|
||||||
can.target = can.page.Appends(can, can._output, [{type: html.IFRAME, src: can.current.link, height: can.ConfHeight(), width: can.ConfWidth(), style: {border: 0}}])._target
|
can.ui.target = can.page.Appends(can, can._output, [{type: html.IFRAME, src: can.db.current.link, height: can.ConfHeight()-1, width: can.ConfWidth()}])._target
|
||||||
can.onimport.layout(can)
|
|
||||||
},
|
},
|
||||||
layout: function(can) { var item = can.current; can.sup.onexport.title(can, item.name||item.link.split(mdb.QS)[0])
|
layout: function(can) {
|
||||||
can.page.style(can, can.target, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
var item = can.db.current; can.sup.onexport.title(can, item.name||item.link.split(mdb.QS)[0])
|
||||||
|
can.page.style(can, can.ui.target, html.HEIGHT, can.ConfHeight()-1, html.WIDTH, can.ConfWidth())
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONACTION, {open: function(event, can) { can.user.open(can.current.link) }})
|
Volcanos(chat.ONACTION, {open: function(event, can) { can.user.open(can.db.current.link) }})
|
||||||
|
@ -13,20 +13,18 @@ fieldset.inner>div.output>div.project div.zone>div.item span.icon { font-size:22
|
|||||||
fieldset.inner>div.output>div.project div.zone:hover>div.item span.icon { display:block; }
|
fieldset.inner>div.output>div.project div.zone:hover>div.item span.icon { display:block; }
|
||||||
fieldset.inner>div.output>div.project div.zone div.action { width:100%; }
|
fieldset.inner>div.output>div.project div.zone div.action { width:100%; }
|
||||||
fieldset.inner>div.output>div.project div.zone div.action>div.item { padding-right:0; width:100%; }
|
fieldset.inner>div.output>div.project div.zone div.action>div.item { padding-right:0; width:100%; }
|
||||||
fieldset.inner>div.output>div.project div.zone div.action>div.item>i { position:absolute; padding:5px; }
|
fieldset.inner>div.output>div.project div.zone div.action>div.item>i { position:absolute; padding:4px; }
|
||||||
fieldset.inner>div.output>div.project div.zone div.action>div.item>input { padding-left:25px; width:100%; }
|
fieldset.inner>div.output>div.project div.zone div.action>div.item>input { padding-left:25px; width:100%; }
|
||||||
fieldset.inner>div.output>div.project div.zone div.action>div.item>span.delete { font-size:20px; }
|
fieldset.inner>div.output>div.project div.zone div.action>div.item>span.delete { font-size:20px; }
|
||||||
fieldset.inner>div.output>div.project { box-shadow:var(--box-shadow); }
|
fieldset.inner>div.output>div.project { box-shadow:var(--box-shadow); }
|
||||||
fieldset.inner>div.output>div.layout>div.display { box-shadow:var(--box-shadow); }
|
fieldset.inner>div.output>div.layout>div.display { box-shadow:var(--box-shadow); }
|
||||||
fieldset.inner>div.output>div.layout>div.layout>div.profile { box-shadow:var(--box-shadow); }
|
fieldset.inner>div.output>div.layout>div.layout>div.profile { box-shadow:var(--box-shadow); }
|
||||||
fieldset.inner>div.output>div.project * { font-family:var(--code-font-family); font-size:var(--code-font-size); }
|
fieldset.inner>div.output>div.layout>div.tabs { font-size:var(--code-font-size); display:none; }
|
||||||
fieldset.inner>div.output>div.layout>div.tabs { font-family:var(--code-font-family); font-size:var(--code-font-size); display:none; }
|
|
||||||
fieldset.inner>div.output>div.layout>div.tabs>div.tabs { padding-right:0; box-shadow:var(--box-shadow); margin-left:5px; }
|
fieldset.inner>div.output>div.layout>div.tabs>div.tabs { padding-right:0; box-shadow:var(--box-shadow); margin-left:5px; }
|
||||||
fieldset.inner>div.output>div.layout>div.tabs>div.tabs:hover { background-color:var(--output-bg-color); border-top-left-radius:10px; border-top-right-radius:10px; }
|
fieldset.inner>div.output>div.layout>div.tabs>div.tabs:hover { background-color:var(--output-bg-color); border-top-left-radius:10px; border-top-right-radius:10px; }
|
||||||
fieldset.inner>div.output>div.layout>div.tabs>div.tabs.select { background-color:var(--output-bg-color); border-top-left-radius:10px; border-top-right-radius:10px; border-bottom:lightgray solid 2px; }
|
fieldset.inner>div.output>div.layout>div.tabs>div.tabs.select { background-color:var(--output-bg-color); border-top-left-radius:10px; border-top-right-radius:10px; border-bottom:lightgray solid 2px; }
|
||||||
fieldset.inner>div.output>div.layout>div.path { font-family:var(--code-font-family); font-size:var(--code-font-size); display:none; }
|
fieldset.inner>div.output>div.layout>div.path { font-size:var(--code-font-size); display:none; }
|
||||||
fieldset.inner>div.output>div.layout>div.layout>iframe.profile { border-left:var(--box-border); }
|
fieldset.inner>div.output>div.layout>div.layout>iframe.profile { border-left:var(--box-border); }
|
||||||
fieldset.inner>div.output>div.layout>div.layout>div.content * { font-family:var(--code-font-family); font-size:var(--code-font-size); }
|
|
||||||
fieldset.inner>div.output>div.layout>div.layout>div.profile h1 { text-align:left; padding:10px 0; border-bottom:var(--box-border); margin:20px 0; }
|
fieldset.inner>div.output>div.layout>div.layout>div.profile h1 { text-align:left; padding:10px 0; border-bottom:var(--box-border); margin:20px 0; }
|
||||||
fieldset.inner>div.output>div.layout>div.layout>div.profile h2 { padding:10px 0; border-bottom:var(--box-border); margin:20px 0; }
|
fieldset.inner>div.output>div.layout>div.layout>div.profile h2 { padding:10px 0; border-bottom:var(--box-border); margin:20px 0; }
|
||||||
fieldset.inner>div.output>div.layout>div.layout>div.profile pre>code { padding-left:10px; border-left:var(--code-border-color) solid 5px; display:block; }
|
fieldset.inner>div.output>div.layout>div.layout>div.profile pre>code { padding-left:10px; border-left:var(--code-border-color) solid 5px; display:block; }
|
||||||
@ -65,3 +63,8 @@ tr.line>td.line { user-select:none; }
|
|||||||
tr.line>td.line { text-align:right; padding:0 10px; position:sticky; left:0; }
|
tr.line>td.line { text-align:right; padding:0 10px; position:sticky; left:0; }
|
||||||
tr.line>td.text { white-space:pre; line-height:20px; padding-left:10px; width:100%; }
|
tr.line>td.text { white-space:pre; line-height:20px; padding-left:10px; width:100%; }
|
||||||
tr.line:hover { background-color:var(--hover-bg-color); }
|
tr.line:hover { background-color:var(--hover-bg-color); }
|
||||||
|
|
||||||
|
fieldset.inner:not(.monaco)>div.output>div.layout>div.layout>div.content * { font-family:var(--code-font-family); font-size:var(--code-font-size); }
|
||||||
|
body:not(.windows) fieldset.inner>div.output>div.project * { font-family:var(--code-font-family); font-size:var(--code-font-size); }
|
||||||
|
body:not(.windows) fieldset.inner>div.output>div.layout>div.tabs { font-family:var(--code-font-family); font-size:var(--code-font-size); }
|
||||||
|
body:not(.windows) fieldset.inner>div.output>div.layout>div.path { font-family:var(--code-font-family); font-size:var(--code-font-size); }
|
||||||
|
@ -330,6 +330,9 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { var key = can.onexport.
|
|||||||
} var content = can.ui.content; if (content._root) { can.onmotion.cache(can, function() { return key }, content) }
|
} var content = can.ui.content; if (content._root) { can.onmotion.cache(can, function() { return key }, content) }
|
||||||
if (can.onexport.parse(can) == nfs.SVG) { msg.Option(ctx.INDEX, web.WIKI_DRAW+mdb.FS+path+file) }
|
if (can.onexport.parse(can) == nfs.SVG) { msg.Option(ctx.INDEX, web.WIKI_DRAW+mdb.FS+path+file) }
|
||||||
if (msg.Option(ctx.INDEX)) { return can.onsyntax._index(can, msg, function(target) { can.ui.content = target, cb(msg._content = content._root? (target._root = content._root): target) }, content._root? content: can.ui._profile.parentNode) }
|
if (msg.Option(ctx.INDEX)) { return can.onsyntax._index(can, msg, function(target) { can.ui.content = target, cb(msg._content = content._root? (target._root = content._root): target) }, content._root? content: can.ui._profile.parentNode) }
|
||||||
|
can.onsyntax._split(can, msg, content, cb, key)
|
||||||
|
},
|
||||||
|
_split: function(can, msg, content, cb, key) {
|
||||||
function show(p) {
|
function show(p) {
|
||||||
p && p.include && can.core.List(p.include, function(from) {
|
p && p.include && can.core.List(p.include, function(from) {
|
||||||
p.keyword = p.keyword||{}, can.core.Item(can.onsyntax[from].keyword, function(key, value) { p.keyword[key] = p.keyword[key] || value })
|
p.keyword = p.keyword||{}, can.core.Item(can.onsyntax[from].keyword, function(key, value) { p.keyword[key] = p.keyword[key] || value })
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) {
|
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) {
|
||||||
can.require(["inner.js"], function(can) { can.onimport._last_init(can, msg, function() {
|
can.require(["/plugin/local/code/inner.js"], function(can) { can.onimport._last_init(can, msg, function() {
|
||||||
can.onengine.listen(can, "tabview.line.select", function(msg) { can.onaction._selectLine(can) })
|
can.onengine.listen(can, "tabview.line.select", function(msg) { can.onaction._selectLine(can) })
|
||||||
can.db.undo = [], can.db.redo = [], can.onimport._input(can), can.base.isFunc(cb) && cb(msg)
|
can.db.undo = [], can.db.redo = [], can.onimport._input(can), cb && cb(msg)
|
||||||
}) }, function(can, mod, sub) { mod == chat.ONIMPORT && (can[mod]._last_init = sub._init) })
|
}) })
|
||||||
},
|
},
|
||||||
_input: function(can) { var ui = can.page.Append(can, can.ui.content.parentNode, [
|
_input: function(can) { var ui = can.page.Append(can, can.ui.content.parentNode, [
|
||||||
{view: [code.CURRENT, html.INPUT], spellcheck: false, onkeydown: function(event) { can.onimport._value(can); if (event.metaKey) { return }
|
{view: [code.CURRENT, html.INPUT], spellcheck: false, onkeydown: function(event) { can.onimport._value(can); if (event.metaKey) { return }
|
||||||
|
41
plugin/story/editor.css
Normal file
41
plugin/story/editor.css
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
fieldset.can.tinymce div.tox-tinymce,
|
||||||
|
fieldset.can.tinymce div.tox:not(.tox-tinymce-inline) .tox-editor-header {
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
fieldset.can.tinymce div.tox-promotion { display:none; }
|
||||||
|
fieldset.can.tinymce div.tox div.tox-sidebar-wrap div.tox-edit-area iframe {
|
||||||
|
background-color:var(--output-bg-color);
|
||||||
|
}
|
||||||
|
div.tox .tox-collection--list .tox-collection__item--active,
|
||||||
|
div.tox .tox-collection--list .tox-collection__item--active:not(.tox-collection__item--state-disabled),
|
||||||
|
fieldset.can.tinymce div.tox .tox-mbtn:hover:not(:disabled):not(.tox-mbtn--active),
|
||||||
|
fieldset.can.tinymce div.tox .tox-mbtn:focus:not(:disabled),
|
||||||
|
fieldset.can.tinymce div.tox .tox-mbtn--active,
|
||||||
|
fieldset.can.tinymce div.tox .tox-tbtn:hover {
|
||||||
|
background-color:var(--hover-bg-color);
|
||||||
|
color:var(--hover-fg-color);
|
||||||
|
}
|
||||||
|
div.tox .tox-menu,
|
||||||
|
div.tox .tox-collection__item,
|
||||||
|
fieldset.can.tinymce div.tox .tox-editor-header,
|
||||||
|
fieldset.can.tinymce div.tox .tox-menubar,
|
||||||
|
fieldset.can.tinymce div.tox .tox-toolbar,
|
||||||
|
fieldset.can.tinymce div.tox .tox-toolbar-overlord,
|
||||||
|
fieldset.can.tinymce div.tox .tox-toolbar__overflow,
|
||||||
|
fieldset.can.tinymce div.tox .tox-toolbar__primary,
|
||||||
|
fieldset.can.tinymce div.tox .tox-statusbar,
|
||||||
|
fieldset.can.tinymce div.tox .tox-statusbar__path-item,
|
||||||
|
fieldset.can.tinymce div.tox .tox-statusbar__wordcount,
|
||||||
|
fieldset.can.tinymce div.tox .tox-statusbar a,
|
||||||
|
fieldset.can.tinymce div.tox :not(svg):not(rect) {
|
||||||
|
background-color:var(--plugin-bg-color);
|
||||||
|
color:var(--plugin-fg-color);
|
||||||
|
}
|
||||||
|
fieldset.can.tinymce div.tox .tox-tbtn svg,
|
||||||
|
fieldset.can.tinymce div.tox .tox-tbtn:disabled svg,
|
||||||
|
fieldset.can.tinymce div.tox .tox-tbtn:disabled:hover svg,
|
||||||
|
fieldset.can.tinymce div.tox .tox-tbtn--disabled svg,
|
||||||
|
fieldset.can.tinymce div.tox .tox-tbtn--disabled:hover svg,
|
||||||
|
fieldset.can.tinymce div.tox .tox-statusbar__branding svg {
|
||||||
|
fill:var(--plugin-fg-color);
|
||||||
|
}
|
61
plugin/story/editor.js
Normal file
61
plugin/story/editor.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg, cb) { can.page.requireModules(can, can.Conf("modules"), function() {
|
||||||
|
var target = can.page.Appends(can, can._output, [{type: html.TEXTAREA}])._target
|
||||||
|
can.page.style(can, can._output, html.MAX_HEIGHT, "")
|
||||||
|
tinymce.init({target: target, height: can.ConfHeight(), // menubar: false,
|
||||||
|
content_style: "body#tinymce { background:transparent; color:silver; }",
|
||||||
|
toolbar: [
|
||||||
|
[
|
||||||
|
"code undo redo cut copy paste",
|
||||||
|
"backcolor forecolor bold italic underline strikethrough subscript superscript",
|
||||||
|
"alignleft aligncenter alignright alignjustify outdent indent",
|
||||||
|
"bullist numlist table image media link charmap",
|
||||||
|
"blockquote removeformat hr pagebreak anchor insertdatetime",
|
||||||
|
"fullscreen wordcount preview print help",
|
||||||
|
].join("|"),
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
"code",
|
||||||
|
"lists",
|
||||||
|
"advlist",
|
||||||
|
"table",
|
||||||
|
"image",
|
||||||
|
"media",
|
||||||
|
"link",
|
||||||
|
"insertdatetime",
|
||||||
|
"charmap",
|
||||||
|
"anchor",
|
||||||
|
"pagebreak",
|
||||||
|
|
||||||
|
"fullscreen",
|
||||||
|
"wordcount",
|
||||||
|
"preview",
|
||||||
|
"help",
|
||||||
|
|
||||||
|
"save",
|
||||||
|
// "autosave",
|
||||||
|
"codesample",
|
||||||
|
"directionality",
|
||||||
|
"emoticons",
|
||||||
|
"importcss",
|
||||||
|
"font_size",
|
||||||
|
"autolink",
|
||||||
|
"nonbreaking",
|
||||||
|
"searchreplace",
|
||||||
|
"visualblocks",
|
||||||
|
"visualchars",
|
||||||
|
].join(" ")
|
||||||
|
}).then(function(list) { can.ui.editor = list[0], can.ui.editor.setContent(msg.Result()), cb && cb(msg) })
|
||||||
|
}) },
|
||||||
|
content: function(can, text) { return can.ui.editor.setContent(text) },
|
||||||
|
}, [""])
|
||||||
|
Volcanos(chat.ONEXPORT, {
|
||||||
|
content: function(can) { return can.ui.editor.getContent() },
|
||||||
|
})
|
||||||
|
Volcanos(chat.ONPLUGIN, {
|
||||||
|
tinymce: shy("富文本", {
|
||||||
|
save: shy(function(can, msg) { can.user.toast(can, msg.Option(nfs.CONTENT)) }),
|
||||||
|
}, [nfs.PATH, ice.LIST, nfs.SAVE], function(can, msg, meta) {
|
||||||
|
msg.Display(meta._path)
|
||||||
|
}),
|
||||||
|
})
|
6
plugin/story/monaco.css
Normal file
6
plugin/story/monaco.css
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fieldset.monaco .monaco-editor,
|
||||||
|
fieldset.monaco .monaco-editor .margin,
|
||||||
|
fieldset.monaco .monaco-editor-background,
|
||||||
|
fieldset.monaco .monaco-diff-editor {
|
||||||
|
background-color:var(--output-bg-color);
|
||||||
|
}
|
35
plugin/story/monaco.js
Normal file
35
plugin/story/monaco.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg, cb) { var toast = can.user.toastProcess(can)
|
||||||
|
can.page.requireModules(can, ["monaco-editor/min/vs/loader.js"], function() {
|
||||||
|
require.config({paths: {vs: "/require/modules/monaco-editor/min/vs"}})
|
||||||
|
require(["vs/editor/editor.main"], function () {
|
||||||
|
can.require(["/plugin/local/code/vimer.js"], function(can) {
|
||||||
|
can.onimport._last_init(can, msg, function(msg) {
|
||||||
|
can.onappend.style(can, "monaco")
|
||||||
|
cb && cb(msg), toast.close()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_theme: function(can) {
|
||||||
|
if (can.base.isIn(can.getHeaderTheme(), html.LIGHT, html.WHITE)) {
|
||||||
|
monaco.editor.setTheme("vs")
|
||||||
|
} else {
|
||||||
|
monaco.editor.setTheme("vs-dark")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}, [""])
|
||||||
|
Volcanos(chat.ONSYNTAX, {
|
||||||
|
_split: function(can, msg, target) { can.onimport._theme(can)
|
||||||
|
can.onengine.listen(can, chat.ONTHEMECHANGE, function() { can.onimport._theme(can) })
|
||||||
|
can.ui.editor = monaco.editor.create(target, {value: msg.Result(), language: "javascript", automaticLayout: true})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos(chat.ONPLUGIN, {
|
||||||
|
monaco: shy("编辑器", {
|
||||||
|
save: shy(function(can, msg) { can.user.toast(can, msg.Option(nfs.CONTENT)) }),
|
||||||
|
}, [nfs.PATH, nfs.FILE, nfs.LINE, ice.LIST, nfs.SAVE], function(can, msg, meta) {
|
||||||
|
msg.Display(meta._path)
|
||||||
|
}),
|
||||||
|
})
|
7
proto.js
7
proto.js
@ -22,8 +22,10 @@ var Volcanos = shy({
|
|||||||
}
|
}
|
||||||
can = kit.proto(can||{}, kit.proto({_name: name, _path: _can_name, _load: function(name, cbs) { var cache = meta.cache[name]||[]
|
can = kit.proto(can||{}, kit.proto({_name: name, _path: _can_name, _load: function(name, cbs) { var cache = meta.cache[name]||[]
|
||||||
for (list.reverse(); list.length > 0; list) { var sub = list.pop(); sub != can && cache.push(sub), sub._path = sub._path||name } meta.cache[name] = cache
|
for (list.reverse(); list.length > 0; list) { var sub = list.pop(); sub != can && cache.push(sub), sub._path = sub._path||name } meta.cache[name] = cache
|
||||||
cache.forEach(function(sub) { var name = sub._name; if (typeof cbs == code.FUNCTION && cbs(can, name, sub)) { return }
|
cache.forEach(function(sub) { var name = sub._name
|
||||||
can[name] = can[name]||{}; for (var k in sub) { can[name].hasOwnProperty(k) || sub.hasOwnProperty(k) && (can[name][k] = sub[k]) }
|
if (typeof cbs == code.FUNCTION && cbs(can, name, sub)) { return }
|
||||||
|
can[name] = can[name]||{}, name == chat.ONIMPORT && (can[name]._last_init = sub._init)
|
||||||
|
for (var k in sub) { can[name].hasOwnProperty(k) || sub.hasOwnProperty(k) && (can[name][k] = sub[k]) }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
require: function(libs, cb, cbs) {
|
require: function(libs, cb, cbs) {
|
||||||
@ -38,6 +40,7 @@ var Volcanos = shy({
|
|||||||
var name = (libs[0].indexOf(web.HTTP) == 0 || libs[0].indexOf("?pod=") > -1? libs[0]: libs[0].split(ice.QS)[0]).toLowerCase()
|
var name = (libs[0].indexOf(web.HTTP) == 0 || libs[0].indexOf("?pod=") > -1? libs[0]: libs[0].split(ice.QS)[0]).toLowerCase()
|
||||||
function next() { can._load(name, cbs), can.require(libs.slice(1), cb, cbs) }
|
function next() { can._load(name, cbs), can.require(libs.slice(1), cb, cbs) }
|
||||||
if (meta.cache[name] || name == "") { return next() }
|
if (meta.cache[name] || name == "") { return next() }
|
||||||
|
if (name.indexOf("/plugin/") == 0) { name = "/volcanos"+name }
|
||||||
if (name.indexOf("/volcanos/") == 0 && meta.volcano) { name = meta.volcano+name }
|
if (name.indexOf("/volcanos/") == 0 && meta.volcano) { name = meta.volcano+name }
|
||||||
if (name.indexOf("/require/") == 0 && meta.iceberg) { name = meta.iceberg+name }
|
if (name.indexOf("/require/") == 0 && meta.iceberg) { name = meta.iceberg+name }
|
||||||
meta._load(name, next)
|
meta._load(name, next)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user