mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 07:45:51 +01:00
feat(admonitions): indicate with a checkmark the active type
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user