From c846b98501dc17464818a56ce731405a0fd355ee Mon Sep 17 00:00:00 2001 From: shylinux Date: Thu, 29 Jun 2023 21:23:53 +0800 Subject: [PATCH] opt portal --- frame.js | 4 ++-- panel/header.js | 2 +- panel/search.js | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frame.js b/frame.js index 04de5280..f91395ed 100644 --- a/frame.js +++ b/frame.js @@ -117,7 +117,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { var action = can.page.SelectOne(can, field, html.DIV_ACTION) var output = can.page.SelectOne(can, field, html.DIV_OUTPUT) var status = can.page.SelectOne(can, field, html.DIV_STATUS) - can.base.isIn(meta.index, web.WIKI_PORTAL) && can.onappend.style(can, html.OUTPUT, field) + can.user.mod.isCmd && can.base.isIn(meta.index, web.WIKI_PORTAL) && can.onappend.style(can, html.OUTPUT, field) var sub = Volcanos(meta.name, {_root: can._root||can, _follow: can.core.Keys(can._follow, meta.name), _target: field, _legend: legend, _option: option, _action: action, _output: output, _status: status, _history: [], Status: function(key, value) { if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key } @@ -450,7 +450,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { var defer = [], content_height, content_width; function layout(type, list, height, width) { var _width = width, _height = height; can.core.List(list, function(item) { if (can.base.isArray(item)) { return } if (can.base.isObject(item)) { var meta = item; item = item._index } var target = ui[item]; if (!can.page.isDisplay(target)) { return } - if (item == html.CONTENT) { return defer.push(function() { can.page.style(can, target, html.HEIGHT, content_height = height, html.WIDTH, content_width = width) }) } + if (item == html.CONTENT || item == "main") { return defer.push(function() { can.page.style(can, target, html.HEIGHT, content_height = height, html.WIDTH, content_width = width) }) } if (type == FLOW) { var h = calc(item, target.offsetHeight, height) if (can.base.isObject(meta) && meta.layout) { meta.layout(h, width) } can.page.style(can, target, html.WIDTH, width), height -= h diff --git a/panel/header.js b/panel/header.js index 8cfce1c8..588b29d1 100644 --- a/panel/header.js +++ b/panel/header.js @@ -19,7 +19,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { // window.parent == window? can.onlayout.background(can, can.onexport.background(can)): can.page.style(can, document.body, html.BACKGROUND_COLOR, "transparent") }, _search: function(can, msg, target) { - can._search = can.onappend.input(can, {type: html.TEXT, icon: "bi bi-search", name: mdb.SEARCH, onkeydown: function(event) { can.onkeymap.input(event, can) + can._search = can.onappend.input(can, {type: html.TEXT, icon: "bi bi-search", name: mdb.SEARCH, value: can.misc.Search(can, "_search"), onkeydown: function(event) { can.onkeymap.input(event, can) event.key == lang.ENTER && can.onengine.signal(can, chat.ONOPENSEARCH, can.request(event, {type: mdb.FOREACH, word: event.target.value||""})) }}, "", target, [chat.TITLE]) can.onimport.menu(can, mdb.SEARCH, function() { can.onengine.signal(can, chat.ONOPENSEARCH, can.request(event, {type: mdb.FOREACH, word: can._search.value||""})) }) diff --git a/panel/search.js b/panel/search.js index e9566e91..50c9a46d 100644 --- a/panel/search.js +++ b/panel/search.js @@ -30,6 +30,7 @@ Volcanos(chat.ONACTION, {_init: function(can) { can.onmotion.hidden(can) }, list } if (event.ctrlKey) { return event.key == "0"? can.onaction.clear(event, can): can.onkeymap.selectCtrlN(event, can, can.ui.content, [html.TBODY, html.TR], function(target) { target.firstChild.click() }) } event.key.length == 1 && can.onmotion.delayOnce(can, function() { can.onmotion.tableFilter(can, can.ui.content, event.target.value) }, 100, can._delay_filter = can._delay_filter||[]) }})) + var key = can.misc.Search(can, "_search"); key && can.onmotion.delay(can, function() { can.onaction.onopensearch(can, can.request({}), "*", key) }, 1000) }, onopensearch: function(can, msg, type, word) { can.onimport.select(can, msg, [type||mdb.FOREACH, word||""]) }, close: function(event, can) { can.onmotion.hidden(can) },