Update logic

pull/1372/head
Phạm Hoàng Sang 2 years ago
parent 14b6f12f39
commit 41076a9b2a
  1. 6
      lib/src/models/documents/document.dart

@ -160,12 +160,12 @@ class Document {
// Bug: When the caret is in the middle of the paragraph // Bug: When the caret is in the middle of the paragraph
// and at the end of the format string, it will display the wrong state // and at the end of the format string, it will display the wrong state
// of the format button // of the format button
final isNotLinkStyle = final isLinkStyle =
res.node?.style.attributes[Attribute.link.key]?.value == false; res.node?.style.attributes[Attribute.link.key]?.value == true;
// In this case, we have an exception, this is a link. // In this case, we have an exception, this is a link.
// When node is a link we will not -1 // When node is a link we will not -1
return (res.node as Line).collectStyle( return (res.node as Line).collectStyle(
len == 0 && res.node != null && isNotLinkStyle len == 0 && res.node != null && !isLinkStyle
? res.offset - 1 ? res.offset - 1
: res.offset, : res.offset,
len); len);

Loading…
Cancel
Save