Skip to content

Commit

Permalink
Editable elements are a repaint boundary (#396)
Browse files Browse the repository at this point in the history
* EditableTextLine is a repaint boundary

* Repaint editor when floating cursor changes
  • Loading branch information
amantoux authored Aug 16, 2024
1 parent e395141 commit 7b21eef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/fleather/lib/src/rendering/editable_text_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ class RenderEditableTextBlock extends RenderEditableContainerBox

// End RenderEditableBox implementation

@override
bool isRepaintBoundary = true;

@override
void detach() {
_painter?.dispose();
Expand Down
3 changes: 3 additions & 0 deletions packages/fleather/lib/src/rendering/editable_text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ class RenderEditableTextLine extends RenderEditableBox {

bool _attachedToCursorController = false;

@override
bool isRepaintBoundary = true;

@override
void attach(covariant PipelineOwner owner) {
super.attach(owner);
Expand Down
1 change: 1 addition & 0 deletions packages/fleather/lib/src/rendering/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ class RenderEditor extends RenderEditableContainerBox
_floatingCursorRect = null;
_cursorController.setFloatingCursorTextPosition(null);
}
markNeedsPaint();
}

void _paintFloatingCursor(PaintingContext context, Offset offset) {
Expand Down
3 changes: 3 additions & 0 deletions packages/fleather/lib/src/rendering/embed_proxy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import 'editable_box.dart';
class RenderEmbedProxy extends RenderProxyBox implements RenderContentProxyBox {
RenderEmbedProxy({RenderBox? child}) : super(child);

@override
bool isRepaintBoundary = true;

@override
List<TextBox> getBoxesForSelection(TextSelection selection) {
if (selection.isCollapsed) {
Expand Down

0 comments on commit 7b21eef

Please sign in to comment.