插件、模板排序;说明支持显示空白字符

This commit is contained in:
John Smith
2026-05-01 00:20:50 +08:00
parent aeb9eb87a2
commit fb77e0390c
4 changed files with 13 additions and 11 deletions

View File

@@ -118,17 +118,19 @@ class TemplatesHandler(api.base.ApiHandler):
self.write({'templates': templates})
def _get_templates(self):
template_ids = []
entries = []
try:
with os.scandir(TEMPLATE_PATH) as it:
for entry in it:
if entry.is_dir() and os.path.isfile(os.path.join(entry.path, 'template.json')):
template_ids.append(entry.name)
entries.append((-entry.stat().st_mtime, entry.name))
except OSError:
logger.exception('Failed to discover templates:')
return []
if not template_ids:
if not entries:
return []
entries.sort()
template_ids = [entry[1] for entry in entries]
templates = []
for template_id in template_ids:

View File

@@ -193,7 +193,8 @@ export default {
display: flex;
flex-flow: row nowrap;
gap: 1em;
max-height: 300px;
max-height: 200px;
overflow-y: auto;
}
.thumbnail {
@@ -204,15 +205,12 @@ export default {
.description {
flex: auto;
overflow-y: auto;
text-wrap: wrap;
word-wrap: break-word;
white-space: pre-wrap;
}
@media only screen and (max-width: 992px) {
.description-line {
flex-wrap: wrap;
max-height: unset;
}
.thumbnail {

View File

@@ -168,6 +168,7 @@ export default {
margin-block-end: 1em;
flex: auto;
overflow-y: auto;
white-space: pre-wrap;
}
.operations {

View File

@@ -47,15 +47,16 @@ def shut_down():
def _discover_plugin_ids():
res = []
entries = []
try:
with os.scandir(PLUGINS_PATH) as it:
for entry in it:
if entry.is_dir() and os.path.isfile(os.path.join(entry.path, 'plugin.json')):
res.append(entry.name)
entries.append((-entry.stat().st_mtime, entry.name))
except OSError:
logger.exception('Failed to discover plugins:')
return res
entries.sort()
return [entry[1] for entry in entries]
def _create_plugin(plugin_id):