mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-04 01:30:14 +08:00
@@ -2609,6 +2609,10 @@ class EditableTextState extends State<EditableText>
|
|||||||
selection.baseOffset,
|
selection.baseOffset,
|
||||||
selection.extentOffset,
|
selection.extentOffset,
|
||||||
);
|
);
|
||||||
|
final TextEditingValue collapsedTextEditingValue = textEditingValue
|
||||||
|
.copyWith(selection: .collapsed(offset: lastSelectionIndex));
|
||||||
|
final newValue = collapsedTextEditingValue.replaced(selection, text);
|
||||||
|
|
||||||
// bggRGjQaUbCoE _pasteText
|
// bggRGjQaUbCoE _pasteText
|
||||||
widget.controller.syncRichText(
|
widget.controller.syncRichText(
|
||||||
selection.isCollapsed
|
selection.isCollapsed
|
||||||
@@ -2616,22 +2620,18 @@ class EditableTextState extends State<EditableText>
|
|||||||
oldText: textEditingValue.text,
|
oldText: textEditingValue.text,
|
||||||
textInserted: text,
|
textInserted: text,
|
||||||
insertionOffset: selection.baseOffset,
|
insertionOffset: selection.baseOffset,
|
||||||
selection: TextSelection.collapsed(offset: lastSelectionIndex),
|
selection: newValue.selection,
|
||||||
composing: TextRange.empty,
|
composing: newValue.composing,
|
||||||
)
|
)
|
||||||
: TextEditingDeltaReplacement(
|
: TextEditingDeltaReplacement(
|
||||||
oldText: textEditingValue.text,
|
oldText: textEditingValue.text,
|
||||||
replacementText: text,
|
replacementText: text,
|
||||||
replacedRange: selection,
|
replacedRange: selection,
|
||||||
selection: TextSelection.collapsed(offset: lastSelectionIndex),
|
selection: newValue.selection,
|
||||||
composing: TextRange.empty,
|
composing: newValue.composing,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final newValue = TextEditingValue(
|
|
||||||
text: widget.controller.plainText,
|
|
||||||
selection: widget.controller.newSelection,
|
|
||||||
composing: TextRange.empty,
|
|
||||||
);
|
|
||||||
userUpdateTextEditingValue(newValue, cause);
|
userUpdateTextEditingValue(newValue, cause);
|
||||||
if (cause == SelectionChangedCause.toolbar) {
|
if (cause == SelectionChangedCause.toolbar) {
|
||||||
// Schedule a call to bringIntoView() after renderEditable updates.
|
// Schedule a call to bringIntoView() after renderEditable updates.
|
||||||
@@ -5530,33 +5530,29 @@ class EditableTextState extends State<EditableText>
|
|||||||
|
|
||||||
void _replaceText(ReplaceTextIntent intent) {
|
void _replaceText(ReplaceTextIntent intent) {
|
||||||
final TextEditingValue oldValue = _value;
|
final TextEditingValue oldValue = _value;
|
||||||
|
final TextEditingValue newValue = intent.currentTextEditingValue.replaced(
|
||||||
|
intent.replacementRange,
|
||||||
|
intent.replacementText,
|
||||||
|
);
|
||||||
|
|
||||||
// bggRGjQaUbCoE _replaceText
|
// bggRGjQaUbCoE _replaceText
|
||||||
widget.controller.syncRichText(
|
widget.controller.syncRichText(
|
||||||
intent.replacementText.isEmpty
|
intent.replacementText.isEmpty
|
||||||
? TextEditingDeltaDeletion(
|
? TextEditingDeltaDeletion(
|
||||||
oldText: oldValue.text,
|
oldText: oldValue.text,
|
||||||
deletedRange: intent.replacementRange,
|
deletedRange: intent.replacementRange,
|
||||||
selection: TextSelection.collapsed(
|
selection: newValue.selection,
|
||||||
offset: intent.replacementRange.start,
|
composing: newValue.composing,
|
||||||
),
|
|
||||||
composing: TextRange.empty,
|
|
||||||
)
|
)
|
||||||
: TextEditingDeltaReplacement(
|
: TextEditingDeltaReplacement(
|
||||||
oldText: oldValue.text,
|
oldText: oldValue.text,
|
||||||
replacementText: intent.replacementText,
|
replacementText: intent.replacementText,
|
||||||
replacedRange: intent.replacementRange,
|
replacedRange: intent.replacementRange,
|
||||||
selection: TextSelection.collapsed(
|
selection: newValue.selection,
|
||||||
offset: intent.replacementRange.start,
|
composing: newValue.composing,
|
||||||
),
|
|
||||||
composing: TextRange.empty,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final newValue = TextEditingValue(
|
|
||||||
text: widget.controller.plainText,
|
|
||||||
selection: widget.controller.newSelection,
|
|
||||||
composing: TextRange.empty,
|
|
||||||
);
|
|
||||||
userUpdateTextEditingValue(newValue, intent.cause);
|
userUpdateTextEditingValue(newValue, intent.cause);
|
||||||
|
|
||||||
// If there's no change in text and selection (e.g. when selecting and
|
// If there's no change in text and selection (e.g. when selecting and
|
||||||
|
|||||||
Reference in New Issue
Block a user