pull/2067/head
CatHood0 9 months ago
parent 2b49d6ca27
commit adaed80de9
  1. 10
      lib/src/document/nodes/line.dart
  2. 4
      lib/src/editor_toolbar_controller_shared/copy_cut_service/copy_cut_service.dart
  3. 2
      lib/src/editor_toolbar_controller_shared/copy_cut_service/default_copy_cut_service.dart

@ -522,15 +522,15 @@ base class Line extends QuillContainer<Leaf?> {
final text = node.toPlainText();
if (text == Embed.kObjectReplacementCharacter) {
final embed = node.value as Embeddable;
final provider = CopyCutServiceProvider.instance;
// By default getCopyCutAction just return the same operation
// returning Embed.kObjectReplacementCharacter for the buffer
final provider = CopyCutServiceProvider.instance;
// By default getCopyCutAction just return the same operation
// returning Embed.kObjectReplacementCharacter for the buffer
final action = provider.getCopyCutAction(embed.type);
final data = action?.call(embed.data);
if(data is String && data != Embed.kObjectReplacementCharacter){
if (data is String && data != Embed.kObjectReplacementCharacter) {
buffer.write(data);
return remaining;
} else{
} else {
buffer.write(action?.call(data));
}
return remaining - node.length;

@ -6,8 +6,8 @@ typedef CopyCutAction = Object? Function(dynamic data);
/// For copy or cut actions from a Line (just for embeddable blocks)
@immutable
abstract class CopyCutService {
/// Get the CopyCutAction by the type
/// of the embeddable (this type is decided by
/// Get the CopyCutAction by the type
/// of the embeddable (this type is decided by
/// the property type of that class)
CopyCutAction? getCopyCutAction(String type);
}

@ -4,7 +4,7 @@ import 'copy_cut_service.dart';
/// Default implementation for [CopyCutService]
///
/// This implementation always return the default embed character
/// replacemenet ([\uFFFC]) to work with the embeds from the internal
/// replacemenet ([\uFFFC]) to work with the embeds from the internal
/// flutter quill plugins
class DefaultCopyCutService extends CopyCutService {
@override

Loading…
Cancel
Save