mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #1319 from LucasXu0/image_selection_area
update image node selection style and fix the context menu display problem
This commit is contained in:
commit
39254b7f17
@ -34,6 +34,8 @@ class ImageNodeWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _ImageNodeWidgetState extends State<ImageNodeWidget>
|
class _ImageNodeWidgetState extends State<ImageNodeWidget>
|
||||||
with SelectableMixin {
|
with SelectableMixin {
|
||||||
|
RenderBox get _renderBox => context.findRenderObject() as RenderBox;
|
||||||
|
|
||||||
final _imageKey = GlobalKey();
|
final _imageKey = GlobalKey();
|
||||||
|
|
||||||
double? _imageWidth;
|
double? _imageWidth;
|
||||||
@ -76,6 +78,12 @@ class _ImageNodeWidgetState extends State<ImageNodeWidget>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get shouldCursorBlink => false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
CursorStyle get cursorStyle => CursorStyle.borderLine;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Position start() {
|
Position start() {
|
||||||
return Position(path: widget.node.path, offset: 0);
|
return Position(path: widget.node.path, offset: 0);
|
||||||
@ -93,7 +101,8 @@ class _ImageNodeWidgetState extends State<ImageNodeWidget>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Rect? getCursorRectInPosition(Position position) {
|
Rect? getCursorRectInPosition(Position position) {
|
||||||
return null;
|
final size = _renderBox.size;
|
||||||
|
return Rect.fromLTWH(-size.width / 2.0, 0, size.width, size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -508,6 +508,11 @@ class _AppFlowySelectionState extends State<AppFlowySelection>
|
|||||||
void _showContextMenu(TapDownDetails details) {
|
void _showContextMenu(TapDownDetails details) {
|
||||||
_clearContextMenu();
|
_clearContextMenu();
|
||||||
|
|
||||||
|
// For now, only support the text node.
|
||||||
|
if (!currentSelectedNodes.every((element) => element is TextNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final baseOffset =
|
final baseOffset =
|
||||||
editorState.renderBox?.localToGlobal(Offset.zero) ?? Offset.zero;
|
editorState.renderBox?.localToGlobal(Offset.zero) ?? Offset.zero;
|
||||||
final offset = details.globalPosition + const Offset(10, 10) - baseOffset;
|
final offset = details.globalPosition + const Offset(10, 10) - baseOffset;
|
||||||
|
Loading…
Reference in New Issue
Block a user