Fixes for flutter web (#234)

* Fix for Attribute object comparison

* Fix for "Unexpected null value" error on web

Clipboard is now supported on web, via a permission request through the browser

Co-authored-by: George Johnson <george@indiespring.com>
pull/236/head
George 4 years ago committed by GitHub
parent d4e4b0d507
commit 95359f66b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/src/models/documents/attribute.dart
  2. 12
      lib/src/widgets/raw_editor.dart

@ -193,7 +193,7 @@ class Attribute<T> {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if (identical(this, other)) return true; if (identical(this, other)) return true;
if (other is! Attribute<T>) return false; if (other is! Attribute) return false;
final typedOther = other; final typedOther = other;
return key == typedOther.key && return key == typedOther.key &&
scope == typedOther.scope && scope == typedOther.scope &&

@ -126,8 +126,7 @@ class RawEditorState extends EditorState
DefaultStyles? _styles; DefaultStyles? _styles;
final ClipboardStatusNotifier? _clipboardStatus = final ClipboardStatusNotifier _clipboardStatus = ClipboardStatusNotifier();
kIsWeb ? null : ClipboardStatusNotifier();
final LayerLink _toolbarLayerLink = LayerLink(); final LayerLink _toolbarLayerLink = LayerLink();
final LayerLink _startHandleLayerLink = LayerLink(); final LayerLink _startHandleLayerLink = LayerLink();
final LayerLink _endHandleLayerLink = LayerLink(); final LayerLink _endHandleLayerLink = LayerLink();
@ -318,7 +317,7 @@ class RawEditorState extends EditorState
void initState() { void initState() {
super.initState(); super.initState();
_clipboardStatus?.addListener(_onChangedClipboardStatus); _clipboardStatus.addListener(_onChangedClipboardStatus);
widget.controller.addListener(() { widget.controller.addListener(() {
_didChangeTextEditingValue(widget.controller.ignoreFocusOnTextChange); _didChangeTextEditingValue(widget.controller.ignoreFocusOnTextChange);
@ -438,8 +437,9 @@ class RawEditorState extends EditorState
widget.focusNode.removeListener(_handleFocusChanged); widget.focusNode.removeListener(_handleFocusChanged);
_focusAttachment!.detach(); _focusAttachment!.detach();
_cursorCont.dispose(); _cursorCont.dispose();
_clipboardStatus?.removeListener(_onChangedClipboardStatus); _clipboardStatus
_clipboardStatus?.dispose(); ..removeListener(_onChangedClipboardStatus)
..dispose();
super.dispose(); super.dispose();
} }
@ -518,7 +518,7 @@ class RawEditorState extends EditorState
this, this,
DragStartBehavior.start, DragStartBehavior.start,
null, null,
_clipboardStatus!, _clipboardStatus,
); );
_selectionOverlay!.handlesVisible = _shouldShowSelectionHandles(); _selectionOverlay!.handlesVisible = _shouldShowSelectionHandles();
_selectionOverlay!.showHandles(); _selectionOverlay!.showHandles();

Loading…
Cancel
Save