feat(admonitions): indicate with a checkmark the active type

This commit is contained in:
Elian Doran
2025-03-13 22:47:21 +02:00
parent a3354d4d10
commit 5c9fe3adcd
2 changed files with 14 additions and 5 deletions

View File

@@ -78,13 +78,18 @@ export default class AdmonitionCommand extends Command {
*/
private _getValue(): AdmonitionType | false {
const selection = this.editor.model.document.selection;
const firstBlock = first( selection.getSelectedBlocks() );
if (!firstBlock) {
return false;
}
// In the current implementation, the block quote must be an immediate parent of a block element.
// TODO: Read correct quote.
const result = !!( firstBlock && findQuote( firstBlock ) );
return result ? "note" : false;
// In the current implementation, the admonition must be an immediate parent of a block element.
const firstQuote = findQuote( firstBlock );
if (firstQuote?.is("element")) {
return firstQuote.getAttribute("type") as string;
}
return false;
}
/**