Replace pasteboard with super_cliboard

pull/1566/head
Ellet 1 year ago
parent 2cb886bcd1
commit daa597f1b6
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 14
      README.md
  2. 2
      example/android/app/build.gradle
  3. 16
      example/android/app/src/main/AndroidManifest.xml
  4. 2
      example/android/build.gradle
  5. 2
      example/android/gradle/wrapper/gradle-wrapper.properties
  6. 12
      example/linux/flutter/generated_plugin_registrant.cc
  7. 3
      example/linux/flutter/generated_plugins.cmake
  8. 6
      example/macos/Flutter/GeneratedPluginRegistrant.swift
  9. 16
      example/macos/Podfile.lock
  10. 9
      example/windows/flutter/generated_plugin_registrant.cc
  11. 3
      example/windows/flutter/generated_plugins.cmake
  12. 12
      lib/src/widgets/raw_editor/raw_editor_state.dart
  13. 2
      pubspec.yaml

@ -94,17 +94,27 @@ dependencies:
> Your input and insights are valuable in shaping a stable and reliable version for all our users. Thank you for being part of the open-source community!
>
Compatible versions:
<!-- Compatible versions:
| flutter_quill | flutter_quill_extensions | flutter_quill_test |
|-------------------------|--------------------------|-------------------------|
| 8.6.x | 0.7.x | 0.0.5 |
| 8.5.x | 0.6.x | 0.0.5 |
These versions are tested and well-supported, you shouldn't get a build failure
These versions are tested and well-supported, you shouldn't get a build failure -->
## Usage
Before using the package, we must inform you the package use the following plugins:
```
url_launcher
flutter_keyboard_visibility
device_info_plus
super_clipboard
```
All of them doesn't require any platform spesefic setup, except [super_clipboard](https://pub.dev/packages/super_clipboard) which needs some setup on Android only, it's optional but to support copying images and pasting them into editor then you must setup it, open the page in pub.dev and read the `README.md` to get the instructions.
First, you need to instantiate a controller
```dart

@ -24,7 +24,7 @@ if (flutterVersionName == null) {
android {
namespace "com.example.example"
compileSdk flutter.compileSdkVersion
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {

@ -1,10 +1,11 @@
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
@ -43,7 +44,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- For `image_cropper` plugin -->
<!-- For `image_cropper` plugin https://pub.dev/packages/image_cropper -->
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
@ -54,5 +55,12 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<!-- For `super_clipboard` plugin https://pub.dev/packages/super_clipboard -->
<provider
android:name="com.superlist.super_native_extensions.DataProvider"
android:authorities="com.example.example.SuperClipboardDataProvider"
android:exported="true"
android:grantUriPermissions="true" />
</application>
</manifest>

@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath 'com.android.tools.build:gradle:8.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip

@ -8,7 +8,8 @@
#include <desktop_drop/desktop_drop_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <pasteboard/pasteboard_plugin.h>
#include <irondash_engine_context/irondash_engine_context_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
@ -18,9 +19,12 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) pasteboard_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin");
pasteboard_plugin_register_with_registrar(pasteboard_registrar);
g_autoptr(FlPluginRegistrar) irondash_engine_context_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "IrondashEngineContextPlugin");
irondash_engine_context_plugin_register_with_registrar(irondash_engine_context_registrar);
g_autoptr(FlPluginRegistrar) super_native_extensions_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SuperNativeExtensionsPlugin");
super_native_extensions_plugin_register_with_registrar(super_native_extensions_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

@ -5,7 +5,8 @@
list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
file_selector_linux
pasteboard
irondash_engine_context
super_native_extensions
url_launcher_linux
)

@ -9,10 +9,11 @@ import desktop_drop
import device_info_plus
import file_selector_macos
import gal
import pasteboard
import irondash_engine_context
import path_provider_foundation
import share_plus
import sqflite
import super_native_extensions
import url_launcher_macos
import video_player_avfoundation
@ -21,10 +22,11 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin"))
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
}

@ -12,7 +12,7 @@ PODS:
- gal (1.0.0):
- Flutter
- FlutterMacOS
- pasteboard (0.0.1):
- irondash_engine_context (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
@ -22,6 +22,8 @@ PODS:
- sqflite (0.0.2):
- FlutterMacOS
- FMDB (>= 2.7.5)
- super_native_extensions (0.0.1):
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
- video_player_avfoundation (0.0.1):
@ -34,10 +36,11 @@ DEPENDENCIES:
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- gal (from `Flutter/ephemeral/.symlinks/plugins/gal/darwin`)
- pasteboard (from `Flutter/ephemeral/.symlinks/plugins/pasteboard/macos`)
- irondash_engine_context (from `Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
- super_native_extensions (from `Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`)
@ -56,14 +59,16 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral
gal:
:path: Flutter/ephemeral/.symlinks/plugins/gal/darwin
pasteboard:
:path: Flutter/ephemeral/.symlinks/plugins/pasteboard/macos
irondash_engine_context:
:path: Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
share_plus:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
super_native_extensions:
:path: Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
video_player_avfoundation:
@ -76,10 +81,11 @@ SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
pasteboard: 9b69dba6fedbb04866be632205d532fe2f6b1d99
irondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
super_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
video_player_avfoundation: e9e6f9cae7d7a6d9b43519b0aab382bca60fcfd1

@ -9,8 +9,9 @@
#include <desktop_drop/desktop_drop_plugin.h>
#include <file_selector_windows/file_selector_windows.h>
#include <gal/gal_plugin_c_api.h>
#include <pasteboard/pasteboard_plugin.h>
#include <irondash_engine_context/irondash_engine_context_plugin_c_api.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <super_native_extensions/super_native_extensions_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
@ -20,10 +21,12 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FileSelectorWindows"));
GalPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GalPluginCApi"));
PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin"));
IrondashEngineContextPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi"));
SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
SuperNativeExtensionsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}

@ -6,8 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
file_selector_windows
gal
pasteboard
irondash_engine_context
share_plus
super_native_extensions
url_launcher_windows
)

@ -18,7 +18,7 @@ import 'package:flutter/services.dart'
TextInputControl;
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'
show KeyboardVisibilityController;
import 'package:pasteboard/pasteboard.dart' show Pasteboard;
import 'package:super_clipboard/super_clipboard.dart';
import '../../models/documents/attribute.dart';
import '../../models/documents/document.dart';
@ -1381,13 +1381,14 @@ class QuillRawEditorState extends EditorState
final onImagePaste = widget.configurations.onImagePaste;
if (onImagePaste != null) {
final image = await Pasteboard.image;
if (image == null) {
final reader = await ClipboardReader.readClipboard();
if (!reader.canProvide(Formats.png)) {
return;
}
reader.getFile(Formats.png, (value) async {
final image = value;
final imageUrl = await onImagePaste(image);
final imageUrl = await onImagePaste(await image.readAll());
if (imageUrl == null) {
return;
}
@ -1398,6 +1399,7 @@ class QuillRawEditorState extends EditorState
BlockEmbed.image(imageUrl),
null,
);
});
}
}

@ -56,7 +56,7 @@ dependencies:
url_launcher: ^6.1.14
flutter_keyboard_visibility: ^5.4.1
device_info_plus: ^9.1.0
pasteboard: ^0.2.0
super_clipboard: ^0.7.3
dev_dependencies:
flutter_lints: ^3.0.1

Loading…
Cancel
Save