|
|
@ -182,13 +182,7 @@ class QuillEditor extends StatefulWidget { |
|
|
|
this.onLaunchUrl, |
|
|
|
this.onLaunchUrl, |
|
|
|
this.embedBuilder = |
|
|
|
this.embedBuilder = |
|
|
|
kIsWeb ? _defaultEmbedBuilderWeb : _defaultEmbedBuilder}) |
|
|
|
kIsWeb ? _defaultEmbedBuilderWeb : _defaultEmbedBuilder}) |
|
|
|
: assert(controller != null), |
|
|
|
; |
|
|
|
assert(scrollController != null), |
|
|
|
|
|
|
|
assert(scrollable != null), |
|
|
|
|
|
|
|
assert(focusNode != null), |
|
|
|
|
|
|
|
assert(autoFocus != null), |
|
|
|
|
|
|
|
assert(readOnly != null), |
|
|
|
|
|
|
|
assert(embedBuilder != null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
factory QuillEditor.basic( |
|
|
|
factory QuillEditor.basic( |
|
|
|
{required QuillController controller, required bool readOnly}) { |
|
|
|
{required QuillController controller, required bool readOnly}) { |
|
|
@ -559,10 +553,7 @@ class RenderEditor extends RenderEditableContainerBox |
|
|
|
this._startHandleLayerLink, |
|
|
|
this._startHandleLayerLink, |
|
|
|
this._endHandleLayerLink, |
|
|
|
this._endHandleLayerLink, |
|
|
|
EdgeInsets floatingCursorAddedMargin) |
|
|
|
EdgeInsets floatingCursorAddedMargin) |
|
|
|
: assert(document != null), |
|
|
|
: |
|
|
|
assert(textDirection != null), |
|
|
|
|
|
|
|
assert(_hasFocus != null), |
|
|
|
|
|
|
|
assert(floatingCursorAddedMargin != null), |
|
|
|
|
|
|
|
super( |
|
|
|
super( |
|
|
|
children, |
|
|
|
children, |
|
|
|
document.root, |
|
|
|
document.root, |
|
|
@ -571,7 +562,6 @@ class RenderEditor extends RenderEditableContainerBox |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
setDocument(Document doc) { |
|
|
|
setDocument(Document doc) { |
|
|
|
assert(doc != null); |
|
|
|
|
|
|
|
if (document == doc) { |
|
|
|
if (document == doc) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -580,7 +570,6 @@ class RenderEditor extends RenderEditableContainerBox |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setHasFocus(bool h) { |
|
|
|
setHasFocus(bool h) { |
|
|
|
assert(h != null); |
|
|
|
|
|
|
|
if (_hasFocus == h) { |
|
|
|
if (_hasFocus == h) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -615,7 +604,6 @@ class RenderEditor extends RenderEditableContainerBox |
|
|
|
@override |
|
|
|
@override |
|
|
|
List<TextSelectionPoint> getEndpointsForSelection( |
|
|
|
List<TextSelectionPoint> getEndpointsForSelection( |
|
|
|
TextSelection textSelection) { |
|
|
|
TextSelection textSelection) { |
|
|
|
assert(constraints != null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (textSelection.isCollapsed) { |
|
|
|
if (textSelection.isCollapsed) { |
|
|
|
RenderEditableBox child = childAtPosition(textSelection.extent); |
|
|
|
RenderEditableBox child = childAtPosition(textSelection.extent); |
|
|
@ -686,11 +674,6 @@ class RenderEditor extends RenderEditableContainerBox |
|
|
|
Offset? to, |
|
|
|
Offset? to, |
|
|
|
SelectionChangedCause cause, |
|
|
|
SelectionChangedCause cause, |
|
|
|
) { |
|
|
|
) { |
|
|
|
assert(cause != null); |
|
|
|
|
|
|
|
assert(from != null); |
|
|
|
|
|
|
|
if (onSelectionChanged == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
TextPosition firstPosition = getPositionForOffset(from); |
|
|
|
TextPosition firstPosition = getPositionForOffset(from); |
|
|
|
TextSelection firstWord = selectWordAtPosition(firstPosition); |
|
|
|
TextSelection firstWord = selectWordAtPosition(firstPosition); |
|
|
|
TextSelection lastWord = |
|
|
|
TextSelection lastWord = |
|
|
@ -718,18 +701,12 @@ class RenderEditor extends RenderEditableContainerBox |
|
|
|
!focusingEmpty) { |
|
|
|
!focusingEmpty) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (onSelectionChanged != null) { |
|
|
|
|
|
|
|
onSelectionChanged(nextSelection, cause); |
|
|
|
onSelectionChanged(nextSelection, cause); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
selectWordEdge(SelectionChangedCause cause) { |
|
|
|
selectWordEdge(SelectionChangedCause cause) { |
|
|
|
assert(cause != null); |
|
|
|
|
|
|
|
assert(_lastTapDownPosition != null); |
|
|
|
assert(_lastTapDownPosition != null); |
|
|
|
if (onSelectionChanged == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
TextPosition position = getPositionForOffset(_lastTapDownPosition!); |
|
|
|
TextPosition position = getPositionForOffset(_lastTapDownPosition!); |
|
|
|
RenderEditableBox child = childAtPosition(position); |
|
|
|
RenderEditableBox child = childAtPosition(position); |
|
|
|
int nodeOffset = child.getContainer().getOffset(); |
|
|
|
int nodeOffset = child.getContainer().getOffset(); |
|
|
@ -763,11 +740,6 @@ class RenderEditor extends RenderEditableContainerBox |
|
|
|
Offset? to, |
|
|
|
Offset? to, |
|
|
|
SelectionChangedCause cause, |
|
|
|
SelectionChangedCause cause, |
|
|
|
) { |
|
|
|
) { |
|
|
|
assert(cause != null); |
|
|
|
|
|
|
|
assert(from != null); |
|
|
|
|
|
|
|
if (onSelectionChanged == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
TextPosition fromPosition = getPositionForOffset(from); |
|
|
|
TextPosition fromPosition = getPositionForOffset(from); |
|
|
|
TextPosition? toPosition = to == null ? null : getPositionForOffset(to); |
|
|
|
TextPosition? toPosition = to == null ? null : getPositionForOffset(to); |
|
|
|
|
|
|
|
|
|
|
@ -932,9 +904,7 @@ class RenderEditableContainerBox extends RenderBox |
|
|
|
|
|
|
|
|
|
|
|
RenderEditableContainerBox(List<RenderEditableBox>? children, this._container, |
|
|
|
RenderEditableContainerBox(List<RenderEditableBox>? children, this._container, |
|
|
|
this.textDirection, this._padding) |
|
|
|
this.textDirection, this._padding) |
|
|
|
: assert(_container != null), |
|
|
|
: |
|
|
|
assert(textDirection != null), |
|
|
|
|
|
|
|
assert(_padding != null), |
|
|
|
|
|
|
|
assert(_padding.isNonNegative) { |
|
|
|
assert(_padding.isNonNegative) { |
|
|
|
addAll(children); |
|
|
|
addAll(children); |
|
|
|
} |
|
|
|
} |
|
|
@ -944,7 +914,6 @@ class RenderEditableContainerBox extends RenderBox |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setContainer(containerNode.Container c) { |
|
|
|
setContainer(containerNode.Container c) { |
|
|
|
assert(c != null); |
|
|
|
|
|
|
|
if (_container == c) { |
|
|
|
if (_container == c) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -955,7 +924,6 @@ class RenderEditableContainerBox extends RenderBox |
|
|
|
EdgeInsetsGeometry getPadding() => _padding; |
|
|
|
EdgeInsetsGeometry getPadding() => _padding; |
|
|
|
|
|
|
|
|
|
|
|
setPadding(EdgeInsetsGeometry value) { |
|
|
|
setPadding(EdgeInsetsGeometry value) { |
|
|
|
assert(value != null); |
|
|
|
|
|
|
|
assert(value.isNonNegative); |
|
|
|
assert(value.isNonNegative); |
|
|
|
if (_padding == value) { |
|
|
|
if (_padding == value) { |
|
|
|
return; |
|
|
|
return; |
|
|
|