Render a choice's whole list item inside its pick box
This commit is contained in:
Vendored
+9
-2
@@ -191,10 +191,14 @@ function item(body, opts) {
|
||||
li.className = "choice";
|
||||
li.append(picker);
|
||||
}
|
||||
const target = picker ?? li;
|
||||
const first = picker ? [] : [body[0]];
|
||||
const rest = body.slice(1);
|
||||
if (rest.every((l) => !startsBlockLine(l)) && !rest.includes("")) {
|
||||
li.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts));
|
||||
if (picker && rest.length > 0) {
|
||||
target.append(h("br"));
|
||||
}
|
||||
target.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts));
|
||||
return li;
|
||||
}
|
||||
const head = first;
|
||||
@@ -203,7 +207,10 @@ function item(body, opts) {
|
||||
head.push(body[k].trim());
|
||||
k++;
|
||||
}
|
||||
li.append(...joinLines(head, opts), ...blocks(body.slice(k), opts));
|
||||
if (picker && head.length > 0) {
|
||||
target.append(h("br"));
|
||||
}
|
||||
target.append(...joinLines(head, opts), ...blocks(body.slice(k), opts));
|
||||
return li;
|
||||
}
|
||||
function startsBlockLine(line) {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user