mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 19:02:23 +08:00
fix(editor): should directly return the sub-action content if it exists (#10778)
This commit is contained in:
@@ -240,11 +240,11 @@ function renderActions(
|
|||||||
return actions
|
return actions
|
||||||
.map(action => {
|
.map(action => {
|
||||||
let content: TemplateResult | null = null;
|
let content: TemplateResult | null = null;
|
||||||
if ('content' in action && action.content) {
|
if ('content' in action) {
|
||||||
if (typeof action.content === 'function') {
|
if (typeof action.content === 'function') {
|
||||||
content = action.content(context);
|
content = action.content(context);
|
||||||
} else {
|
} else {
|
||||||
content = action.content;
|
content = action.content ?? null;
|
||||||
}
|
}
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
@@ -254,12 +254,21 @@ function renderActions(
|
|||||||
|
|
||||||
if (!combined.length) return content;
|
if (!combined.length) return content;
|
||||||
|
|
||||||
const ordered = orderBy(combined, ['score', 'id'], ['asc', 'asc']);
|
const ordered = orderBy(combined, ['id', 'score'], ['asc', 'asc']);
|
||||||
|
|
||||||
return repeat(
|
return repeat(
|
||||||
ordered,
|
ordered,
|
||||||
b => b.id,
|
a => a.id,
|
||||||
b => render(b, context)
|
a => {
|
||||||
|
if ('content' in a) {
|
||||||
|
if (typeof a.content === 'function') {
|
||||||
|
return a.content(context);
|
||||||
|
} else {
|
||||||
|
return a.content ?? null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return render(a, context);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user