|
|
|
@ -97,13 +97,7 @@ class QuillRawEditorState extends EditorState |
|
|
|
|
String get pastePlainText => _pastePlainText; |
|
|
|
|
String _pastePlainText = ''; |
|
|
|
|
|
|
|
|
|
// Web - esp Safari Mac/iOS has security measures in place that restrict |
|
|
|
|
// cliboard status checks w/o direct user interaction. Initializing the |
|
|
|
|
// ClipboardStatusNotifier with a default value of unknown will cause the |
|
|
|
|
// clipboard status to be checked w/o user interaction which fails. Default |
|
|
|
|
// to pasteable for web. |
|
|
|
|
final ClipboardStatusNotifier _clipboardStatus = ClipboardStatusNotifier( |
|
|
|
|
value: kIsWeb ? ClipboardStatus.pasteable : ClipboardStatus.unknown); |
|
|
|
|
ClipboardStatusNotifier? _clipboardStatus; |
|
|
|
|
final LayerLink _toolbarLayerLink = LayerLink(); |
|
|
|
|
final LayerLink _startHandleLayerLink = LayerLink(); |
|
|
|
|
final LayerLink _endHandleLayerLink = LayerLink(); |
|
|
|
@ -325,7 +319,8 @@ class QuillRawEditorState extends EditorState |
|
|
|
|
/// Copied from [EditableTextState]. |
|
|
|
|
List<ContextMenuButtonItem> get contextMenuButtonItems { |
|
|
|
|
return EditableText.getEditableButtonItems( |
|
|
|
|
clipboardStatus: _clipboardStatus.value, |
|
|
|
|
clipboardStatus: |
|
|
|
|
(_clipboardStatus != null) ? _clipboardStatus!.value : null, |
|
|
|
|
onCopy: copyEnabled |
|
|
|
|
? () => copySelection(SelectionChangedCause.toolbar) |
|
|
|
|
: null, |
|
|
|
@ -528,6 +523,16 @@ class QuillRawEditorState extends EditorState |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!widget.configurations.disableClipboard) { |
|
|
|
|
// Web - esp Safari Mac/iOS has security measures in place that restrict |
|
|
|
|
// cliboard status checks w/o direct user interaction. Initializing the |
|
|
|
|
// ClipboardStatusNotifier with a default value of unknown will cause the |
|
|
|
|
// clipboard status to be checked w/o user interaction which fails. Default |
|
|
|
|
// to pasteable for web. |
|
|
|
|
_clipboardStatus = ClipboardStatusNotifier( |
|
|
|
|
value: kIsWeb ? ClipboardStatus.pasteable : ClipboardStatus.unknown); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (widget.configurations.scrollable) { |
|
|
|
|
/// Since [SingleChildScrollView] does not implement |
|
|
|
|
/// `computeDistanceToActualBaseline` it prevents the editor from |
|
|
|
@ -1122,8 +1127,9 @@ class QuillRawEditorState extends EditorState |
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
_clipboardStatus.addListener(_onChangedClipboardStatus); |
|
|
|
|
if (_clipboardStatus != null) { |
|
|
|
|
_clipboardStatus!.addListener(_onChangedClipboardStatus); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
controller.addListener(_didChangeTextEditingValueListener); |
|
|
|
|
|
|
|
|
@ -1277,9 +1283,11 @@ class QuillRawEditorState extends EditorState |
|
|
|
|
controller.removeListener(_didChangeTextEditingValueListener); |
|
|
|
|
widget.configurations.focusNode.removeListener(_handleFocusChanged); |
|
|
|
|
_cursorCont.dispose(); |
|
|
|
|
_clipboardStatus |
|
|
|
|
..removeListener(_onChangedClipboardStatus) |
|
|
|
|
..dispose(); |
|
|
|
|
if (_clipboardStatus != null) { |
|
|
|
|
_clipboardStatus! |
|
|
|
|
..removeListener(_onChangedClipboardStatus) |
|
|
|
|
..dispose(); |
|
|
|
|
} |
|
|
|
|
super.dispose(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|