Skip to content

Commit 66c4c5a

Browse files
committed
fix(convert): do not attach other attributes on spoiler head and tail
1 parent e537b89 commit 66c4c5a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/src/convert/to_bbcode.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ final AttrHandlerMap defaultBlockAttrHandlers = {
4747
),
4848
};
4949

50+
/// All embed types that can not have other attributes attached in the same operation.
51+
const embedExcludeStyleTypes = [BBCodeSpoilerV2Keys.headerType, BBCodeSpoilerV2Keys.tailType];
52+
5053
/// Default attribute handlers for embed nodes.
5154
///
5255
/// Embed is a kind of node that represent in another form (like image).
@@ -367,8 +370,10 @@ class DeltaToBBCode extends Converter<Delta, String> implements _NodeVisitor<Str
367370
// Use the temporary text to hold text attributes on current embed node.
368371
// Split embed text because `QuillText` does not allow line wraps.
369372
embedOut.toString().split('\n').map(QuillText.new).forEach((e) {
370-
for (final attr in embed.attrs()) {
371-
e.applyAttribute(attr);
373+
if (!embedExcludeStyleTypes.contains(embed.value.type)) {
374+
for (final attr in embed.attrs()) {
375+
e.applyAttribute(attr);
376+
}
372377
}
373378
_handleTextAttribute(defaultTextAttrHandlers, e, out, out.write);
374379
});

0 commit comments

Comments
 (0)