mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 11:02:27 +08:00
feat(admonitions): allow changing admonition type
This commit is contained in:
parent
fb7e310224
commit
504879b11c
@ -162,6 +162,10 @@ export default class AdmonitionCommand extends Command {
|
|||||||
quote = writer.createElement( 'aside', { type });
|
quote = writer.createElement( 'aside', { type });
|
||||||
|
|
||||||
writer.wrap( groupRange, quote );
|
writer.wrap( groupRange, quote );
|
||||||
|
} else if (quote.is("element")) {
|
||||||
|
this.editor.model.change((writer) => {
|
||||||
|
writer.setAttribute("type", type, quote as Element);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
quotesToMerge.push( quote );
|
quotesToMerge.push( quote );
|
||||||
|
@ -70,7 +70,8 @@ export default class AdmonitionEditing extends Plugin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
editor.conversion.for("downcast").elementToElement( {
|
editor.conversion.for("downcast")
|
||||||
|
.elementToElement( {
|
||||||
model: 'aside',
|
model: 'aside',
|
||||||
view: (modelElement, { writer }) => {
|
view: (modelElement, { writer }) => {
|
||||||
return writer.createContainerElement(
|
return writer.createContainerElement(
|
||||||
@ -79,6 +80,13 @@ export default class AdmonitionEditing extends Plugin {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.attributeToAttribute({
|
||||||
|
model: "type",
|
||||||
|
view: (value) => ({
|
||||||
|
key: "class",
|
||||||
|
value: [ "admonition", value as string ]
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// Postfixer which cleans incorrect model states connected with block quotes.
|
// Postfixer which cleans incorrect model states connected with block quotes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user