Upgrade to 6.0.1

pull/950/head
X Code 3 years ago
parent 22200b8812
commit d966db1394
  1. 10
      CHANGELOG.md
  2. 4
      README.md
  3. 4
      example/lib/pages/home_page.dart
  4. 4
      example/lib/pages/read_only_page.dart
  5. 10
      lib/src/widgets/delegate.dart
  6. 3
      lib/src/widgets/editor.dart
  7. 22
      lib/src/widgets/raw_editor.dart
  8. 3
      lib/src/widgets/text_selection.dart
  9. 2
      pubspec.yaml

@ -1,5 +1,13 @@
# [6.0.1]
* Changed translation country code (zh_HK -> zh_hk) to lower case, which is required for i18n_extension used in flutter_quill.
* Add localization in example's main to demonstrate translation.
* Issue [Windows] selection's copy / paste tool bar not shown #861: add selection's copy / paste toolbar, escape to hide toolbar, mouse right click to show toolbar, ctrl-Y / ctrl-Z to undo / redo.
* Image and video displayed in Windows platform caused screen flickering while selecting text, a sample_data_nomedia.json asset is added for Desktop to demonstrate the added features.
* Known issue: keyboard action sometimes causes exception mentioned in Flutter's issue #106475 ([Windows] Keyboard shortcuts stop working after modifier key repeat flutter/flutter#106475).
* Know issue: user needs to click the editor to get focus before toolbar is able to display.
# [6.0.0] BREAKING CHANGE # [6.0.0] BREAKING CHANGE
* Removed embed (image, video & forumla) blocks from the package to reduce app size. * Removed embed (image, video & formula) blocks from the package to reduce app size.
These blocks have been moved to the package `flutter_quill_extensions`, migrate by filling the `embedBuilders` and `embedButtons` parameters as follows: These blocks have been moved to the package `flutter_quill_extensions`, migrate by filling the `embedBuilders` and `embedButtons` parameters as follows:

@ -85,11 +85,11 @@ _controller = QuillController(
For web development, use `flutter config --enable-web` for flutter or use [ReactQuill] for React. For web development, use `flutter config --enable-web` for flutter or use [ReactQuill] for React.
It is required to provide `EmbedBuilder`, e.g. [defaultEmbedBuildersWeb](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/universal_ui/universal_ui.dart#L99). It is required to provide `EmbedBuilder`, e.g. [defaultEmbedBuildersWeb](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/universal_ui/universal_ui.dart#L99).
Also it is required to provide `webImagePickImpl`, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L237). Also it is required to provide `webImagePickImpl`, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L240).
## Desktop ## Desktop
It is required to provide `filePickImpl` for toolbar image button, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L217). It is required to provide `filePickImpl` for toolbar image button, e.g. [Sample Page](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart#L220).
## Configuration ## Configuration

@ -34,7 +34,9 @@ class _HomePageState extends State<HomePage> {
Future<void> _loadFromAssets() async { Future<void> _loadFromAssets() async {
try { try {
final result = await rootBundle.loadString(isDesktop() ? 'assets/sample_data_nomedia.json' : 'assets/sample_data.json'); final result = await rootBundle.loadString(isDesktop()
? 'assets/sample_data_nomedia.json'
: 'assets/sample_data.json');
final doc = Document.fromJson(jsonDecode(result)); final doc = Document.fromJson(jsonDecode(result));
setState(() { setState(() {
_controller = QuillController( _controller = QuillController(

@ -20,7 +20,9 @@ class _ReadOnlyPageState extends State<ReadOnlyPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DemoScaffold( return DemoScaffold(
documentFilename: isDesktop() ? 'assets/sample_data_nomedia.json' : 'sample_data_nomedia.json', documentFilename: isDesktop()
? 'assets/sample_data_nomedia.json'
: 'sample_data_nomedia.json',
builder: _buildContent, builder: _buildContent,
showToolbar: _edit == true, showToolbar: _edit == true,
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(

@ -112,7 +112,9 @@ class EditorTextSelectionGestureDetectorBuilder {
// For backwards-compatibility, we treat a null kind the same as touch. // For backwards-compatibility, we treat a null kind the same as touch.
final kind = details.kind; final kind = details.kind;
shouldShowSelectionToolbar = kind == null || shouldShowSelectionToolbar = kind == null ||
kind == PointerDeviceKind.mouse || // this is added to enable word selection by mouse double tap kind ==
PointerDeviceKind
.mouse || // this is added to enable word selection by mouse double tap
kind == PointerDeviceKind.touch || kind == PointerDeviceKind.touch ||
kind == PointerDeviceKind.stylus; kind == PointerDeviceKind.stylus;
} }
@ -182,7 +184,8 @@ class EditorTextSelectionGestureDetectorBuilder {
/// onSingleTapUp for mouse right click /// onSingleTapUp for mouse right click
@protected @protected
void onSecondarySingleTapUp(TapUpDetails details) { // added to show toolbar by right click void onSecondarySingleTapUp(TapUpDetails details) {
// added to show toolbar by right click
if (shouldShowSelectionToolbar) { if (shouldShowSelectionToolbar) {
editor!.showToolbar(); editor!.showToolbar();
} }
@ -321,7 +324,8 @@ class EditorTextSelectionGestureDetectorBuilder {
@protected @protected
void onDragSelectionEnd(DragEndDetails details) { void onDragSelectionEnd(DragEndDetails details) {
renderEditor!.handleDragEnd(details); renderEditor!.handleDragEnd(details);
if (isDesktop()) { // added to show selection copy/paste toolbar after drag to select if (isDesktop()) {
// added to show selection copy/paste toolbar after drag to select
if (delegate.selectionEnabled) { if (delegate.selectionEnabled) {
if (shouldShowSelectionToolbar) { if (shouldShowSelectionToolbar) {
editor!.showToolbar(); editor!.showToolbar();

@ -640,7 +640,8 @@ class _QuillEditorSelectionGestureDetectorBuilder
try { try {
if (delegate.selectionEnabled && !_isPositionSelected(details)) { if (delegate.selectionEnabled && !_isPositionSelected(details)) {
final _platform = Theme.of(_state.context).platform; final _platform = Theme.of(_state.context).platform;
if (isAppleOS(_platform) || isDesktop()) { // added isDesktop() to enable extend selection in Windows platform if (isAppleOS(_platform) || isDesktop()) {
// added isDesktop() to enable extend selection in Windows platform
switch (details.kind) { switch (details.kind) {
case PointerDeviceKind.mouse: case PointerDeviceKind.mouse:
case PointerDeviceKind.stylus: case PointerDeviceKind.stylus:

@ -363,10 +363,14 @@ class RawEditorState extends EditorState
return QuillStyles( return QuillStyles(
data: _styles!, data: _styles!,
child: Shortcuts( child: Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ // shortcuts added for Windows platform shortcuts: <LogicalKeySet, Intent>{
LogicalKeySet(LogicalKeyboardKey.escape): HideSelectionToolbarIntent(), // shortcuts added for Windows platform
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyZ): const UndoTextIntent(SelectionChangedCause.keyboard), LogicalKeySet(LogicalKeyboardKey.escape):
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyY): const RedoTextIntent(SelectionChangedCause.keyboard), HideSelectionToolbarIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyZ):
const UndoTextIntent(SelectionChangedCause.keyboard),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyY):
const RedoTextIntent(SelectionChangedCause.keyboard),
}, },
child: Actions( child: Actions(
actions: _actions, actions: _actions,
@ -1180,7 +1184,8 @@ class RawEditorState extends EditorState
PasteTextIntent: _makeOverridable(CallbackAction<PasteTextIntent>( PasteTextIntent: _makeOverridable(CallbackAction<PasteTextIntent>(
onInvoke: (intent) => pasteText(intent.cause))), onInvoke: (intent) => pasteText(intent.cause))),
HideSelectionToolbarIntent: _makeOverridable(_HideSelectionToolbarAction(this)), HideSelectionToolbarIntent:
_makeOverridable(_HideSelectionToolbarAction(this)),
UndoTextIntent: _makeOverridable(_UndoKeyboardAction(this)), UndoTextIntent: _makeOverridable(_UndoKeyboardAction(this)),
RedoTextIntent: _makeOverridable(_RedoKeyboardAction(this)), RedoTextIntent: _makeOverridable(_RedoKeyboardAction(this)),
}; };
@ -1885,7 +1890,8 @@ class HideSelectionToolbarIntent extends Intent {
const HideSelectionToolbarIntent(); const HideSelectionToolbarIntent();
} }
class _HideSelectionToolbarAction extends ContextAction<HideSelectionToolbarIntent> { class _HideSelectionToolbarAction
extends ContextAction<HideSelectionToolbarIntent> {
_HideSelectionToolbarAction(this.state); _HideSelectionToolbarAction(this.state);
final RawEditorState state; final RawEditorState state;
@ -1896,8 +1902,7 @@ class _HideSelectionToolbarAction extends ContextAction<HideSelectionToolbarInte
} }
@override @override
bool get isActionEnabled => bool get isActionEnabled => state.textEditingValue.selection.isValid;
state.textEditingValue.selection.isValid;
} }
class _UndoKeyboardAction extends ContextAction<UndoTextIntent> { class _UndoKeyboardAction extends ContextAction<UndoTextIntent> {
@ -1931,4 +1936,3 @@ class _RedoKeyboardAction extends ContextAction<RedoTextIntent> {
@override @override
bool get isActionEnabled => true; bool get isActionEnabled => true;
} }

@ -736,10 +736,13 @@ class EditorTextSelectionGestureDetector extends StatefulWidget {
/// onTapDown for mouse right click /// onTapDown for mouse right click
final GestureTapDownCallback? onSecondaryTapDown; final GestureTapDownCallback? onSecondaryTapDown;
/// onTapUp for mouse right click /// onTapUp for mouse right click
final GestureTapUpCallback? onSecondarySingleTapUp; final GestureTapUpCallback? onSecondarySingleTapUp;
/// onTapCancel for mouse right click /// onTapCancel for mouse right click
final GestureTapCancelCallback? onSecondarySingleTapCancel; final GestureTapCancelCallback? onSecondarySingleTapCancel;
/// onDoubleTap for mouse right click /// onDoubleTap for mouse right click
final GestureTapDownCallback? onSecondaryDoubleTapDown; final GestureTapDownCallback? onSecondaryDoubleTapDown;

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us)
version: 6.0.0 version: 6.0.1
#author: bulletjournal #author: bulletjournal
homepage: https://bulletjournal.us/home/index.html homepage: https://bulletjournal.us/home/index.html
repository: https://github.com/singerdmx/flutter-quill repository: https://github.com/singerdmx/flutter-quill

Loading…
Cancel
Save