Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- **BREAKING**: Change the `options` parameter class type from `QuillToolbarToggleStyleButtonOptions` to `QuillToolbarClipboardButtonOptions` in `QuillToolbarClipboardButton`. To migrate, use `QuillToolbarClipboardButtonOptions` instead of `QuillToolbarToggleStyleButtonOptions` [#2433](https://github.com/singerdmx/flutter-quill/pull/2433).

## [11.0.0-dev.19] - 2025-01-10

### Added

- Croatian (hr) language translation.
- Croatian (hr) language translation [#2431](https://github.com/singerdmx/flutter-quill/pull/2431).

## [11.0.0-dev.18] - 2025-01-06

Expand Down
1 change: 1 addition & 0 deletions doc/migration/10_to_11.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ required for **custom toolbars**.
- Renames `QuillToolbarToggleCheckListButtonOptions.isShouldRequestKeyboard` to `QuillToolbarToggleCheckListButtonOptions.shouldRequestKeyboard`.
- Moved `onClipboardPaste` from `QuillControllerConfig` to `QuillClipboardConfig`. Added `clipboardConfig` property to `QuillControllerConfig`.
- Moved `onImagePaste` and `onGifPaste` from the editor's config (`QuillEditorConfig` or `QuillRawEditorConfig`) to the clipboard's config (`QuillClipboardConfig`), which is part of the controller's config (`QuillControllerConfig`).
- Changed the options type from `QuillToolbarToggleStyleButtonOptions` to `QuillToolbarClipboardButtonOptions` in `QuillToolbarClipboardButton`, use the new options class.

## 💥 Breaking behavior

Expand Down
9 changes: 7 additions & 2 deletions lib/src/toolbar/buttons/clipboard_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ class QuillToolbarClipboardButton extends QuillToolbarToggleStyleBaseButton {
QuillToolbarClipboardButton({
required super.controller,
required this.clipboardAction,
super.options = const QuillToolbarToggleStyleButtonOptions(),
QuillToolbarClipboardButtonOptions? options,

/// Shares common options between all buttons, prefer the [options]
/// over the [baseOptions].
super.baseOptions,
super.key,
});
}) : _options = options,
super(options: options ?? const QuillToolbarClipboardButtonOptions());

// TODO: This field will be used by the PR: https://github.com/singerdmx/flutter-quill/pull/2427
// ignore: unused_field
final QuillToolbarClipboardButtonOptions? _options;

final ClipboardAction clipboardAction;

Expand Down
29 changes: 29 additions & 0 deletions lib/src/toolbar/config/buttons/clipboard_button_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// @docImport '../../buttons/clipboard_button.dart';

@experimental
library;

import 'package:meta/meta.dart';
import 'toggle_style_options.dart';

@experimental
class QuillToolbarClipboardButtonOptions
extends QuillToolbarToggleStyleButtonOptions {
const QuillToolbarClipboardButtonOptions({
super.iconData,
super.afterButtonPressed,
super.childBuilder,
super.iconTheme,
super.tooltip,
super.iconSize,
super.iconButtonFactor,
this.enableClipboardPaste,
});

/// Determines if the paste button is enabled. The button is disabled and cannot be clicked if set to `false`.
///
/// Defaults to [ClipboardMonitor] in case of `null`, which checks if the clipboard has content to paste every second and only then enables the button, indicating to the user that they can paste something.
///
/// Set it to `true` to enable it even if the clipboard has no content to paste, which will do nothing on a press.
final bool? enableClipboardPaste;
}
32 changes: 15 additions & 17 deletions lib/src/toolbar/config/simple_toolbar_button_options.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:flutter/foundation.dart' show immutable;
import 'package:meta/meta.dart';

import 'base_button_options.dart';
import 'buttons/clear_format_options.dart';
import 'buttons/clipboard_button_options.dart';
import 'buttons/color_options.dart';
import 'buttons/custom_button_options.dart';
import 'buttons/font_family_options.dart';
Expand All @@ -21,6 +22,7 @@ import 'buttons/toggle_style_options.dart';
export '../buttons/search/search_dialog.dart';
export 'base_button_options.dart';
export 'buttons/clear_format_options.dart';
export 'buttons/clipboard_button_options.dart';
export 'buttons/color_options.dart';
export 'buttons/custom_button_options.dart';
export 'buttons/font_family_options.dart';
Expand Down Expand Up @@ -76,9 +78,12 @@ class QuillSimpleToolbarButtonOptions {
this.linkStyle = const QuillToolbarLinkStyleButtonOptions(),
this.linkStyle2 = const QuillToolbarLinkStyleButton2Options(),
this.customButtons = const QuillToolbarCustomButtonOptions(),
this.clipboardCut = const QuillToolbarToggleStyleButtonOptions(),
this.clipboardCopy = const QuillToolbarToggleStyleButtonOptions(),
this.clipboardPaste = const QuillToolbarToggleStyleButtonOptions(),
@experimental
this.clipboardCut = const QuillToolbarClipboardButtonOptions(),
@experimental
this.clipboardCopy = const QuillToolbarClipboardButtonOptions(),
@experimental
this.clipboardPaste = const QuillToolbarClipboardButtonOptions(),
});

/// The base options that will apply to all buttons,
Expand Down Expand Up @@ -109,26 +114,19 @@ class QuillSimpleToolbarButtonOptions {
final QuillToolbarColorButtonOptions backgroundColor;
final QuillToolbarClearFormatButtonOptions clearFormat;

/// The reason we call this buttons in the end because this is responsible
/// for all the alignment buttons and not just one, you still
/// can customize the icons and tooltips
/// and you have child builder
final QuillToolbarSelectAlignmentButtonOptions selectAlignmentButtons;

final QuillToolbarSearchButtonOptions search;

final QuillToolbarToggleStyleButtonOptions clipboardCut;
final QuillToolbarToggleStyleButtonOptions clipboardCopy;
final QuillToolbarToggleStyleButtonOptions clipboardPaste;
@experimental
final QuillToolbarClipboardButtonOptions clipboardCut;
@experimental
final QuillToolbarClipboardButtonOptions clipboardCopy;
@experimental
final QuillToolbarClipboardButtonOptions clipboardPaste;

/// The reason we call this buttons in the end because this is responsible
/// for all the header style buttons and not just one, you still
/// can customize it and you also have child builder
final QuillToolbarSelectHeaderStyleButtonsOptions selectHeaderStyleButtons;

/// The reason we call this buttons in the end because this is responsible
/// for all the header style buttons and not just one, you still
/// can customize it and you also have child builder
final QuillToolbarSelectHeaderStyleDropdownButtonOptions
selectHeaderStyleDropdownButton;

Expand Down
Loading