From 7fadc894cb04409e2385fa404732a4e51369509a Mon Sep 17 00:00:00 2001 From: EchoEllet Date: Wed, 25 Sep 2024 17:18:41 +0000 Subject: [PATCH] chore(version): update to version 10.8.0 --- CHANGELOG.md | 110 ++++++++++++++++++ CHANGELOG_DATA.json | 1 + dart_quill_delta/CHANGELOG.md | 110 ++++++++++++++++++ dart_quill_delta/pubspec.yaml | 2 +- .../Flutter/GeneratedPluginRegistrant.swift | 2 - .../flutter/generated_plugin_registrant.cc | 3 - .../windows/flutter/generated_plugins.cmake | 1 - flutter_quill_extensions/CHANGELOG.md | 110 ++++++++++++++++++ flutter_quill_extensions/pubspec.yaml | 2 +- flutter_quill_test/CHANGELOG.md | 110 ++++++++++++++++++ flutter_quill_test/pubspec.yaml | 2 +- pubspec.yaml | 2 +- 12 files changed, 445 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7a579c5e..ff9e817c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,116 @@ All notable changes to this project will be documented in this file. +## 10.8.0 + +> [!CAUTION] +> This release can be breaking change for `flutter_quill_extensions` users as it remove the built-in support for loading YouTube videos + +If you're using [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions) then this release, can be a breaking change for you if you load videos in the editor and expect YouTube videos to be supported, [youtube_player_flutter](https://pub.dev/packages/youtube_player_flutter) and [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) are no longer dependencies of the extensions package, which are used to support loading YouTube Iframe videos on non-web platforms, more details about the discussion and reasons in [#2286](https://github.com/singerdmx/flutter-quill/pull/2286) and [#2284](https://github.com/singerdmx/flutter-quill/issues/2284). + +We have added an experimental property that gives you more flexibility and control about the implementation you want to use for loading videos. + +> [!WARNING] +> It's likely to experience some common issues while implementing this feature, especially on desktop platforms as the support for [flutter_inappwebview_windows](https://pub.dev/packages/flutter_inappwebview_windows) and [flutter_inappwebview_macos](https://pub.dev/packages/flutter_inappwebview_macos) before 2 days. Some of the issues are in the Flutter Quill editor. + +If you want loading YouTube videos to be a feature again with the latest version of Flutter Quill, you can use an existing plugin or package, or implement your own solution. For example, you might use [`youtube_video_player`](https://pub.dev/packages/youtube_video_player) or [`youtube_player_flutter`](https://pub.dev/packages/youtube_player_flutter), which was previously used in [`flutter_quill_extensions`](https://pub.dev/packages/flutter_quill_extensions). + +Here’s an example setup using `youtube_player_flutter`: + +```shell +flutter pub add youtube_player_flutter +``` + +Example widget configuration: + +```dart +import 'package:flutter/material.dart'; +import 'package:youtube_player_flutter/youtube_player_flutter.dart'; + +class YoutubeVideoPlayer extends StatefulWidget { + const YoutubeVideoPlayer({required this.videoUrl, super.key}); + + final String videoUrl; + + @override + State createState() => _YoutubeVideoPlayerState(); +} + +class _YoutubeVideoPlayerState extends State { + late final YoutubePlayerController _youtubePlayerController; + @override + void initState() { + super.initState(); + _youtubePlayerController = YoutubePlayerController( + initialVideoId: YoutubePlayer.convertUrlToId(widget.videoUrl) ?? + (throw StateError('Expect a valid video URL')), + flags: const YoutubePlayerFlags( + autoPlay: true, + mute: true, + ), + ); + } + + @override + Widget build(BuildContext context) { + return YoutubePlayer( + controller: _youtubePlayerController, + showVideoProgressIndicator: true, + ); + } + + @override + void dispose() { + _youtubePlayerController.dispose(); + super.dispose(); + } +} + +``` + +Then, integrate it with `QuillEditorVideoEmbedConfigurations` + +```dart +FlutterQuillEmbeds.editorBuilders( + videoEmbedConfigurations: QuillEditorVideoEmbedConfigurations( + customVideoBuilder: (videoUrl, readOnly) { + // Example: Check for YouTube Video URL and return your + // YouTube video widget here. + bool isYouTubeUrl(String videoUrl) { + try { + final uri = Uri.parse(videoUrl); + return uri.host == 'www.youtube.com' || + uri.host == 'youtube.com' || + uri.host == 'youtu.be' || + uri.host == 'www.youtu.be'; + } catch (_) { + return false; + } + } + + if (isYouTubeUrl(videoUrl)) { + return YoutubeVideoPlayer( + videoUrl: videoUrl, + ); + } + + // Return null to fallback to the default logic + return null; + }, + ignoreYouTubeSupport: true, + ), +); +``` + +> [!NOTE] +> This example illustrates a basic approach, additional adjustments might be necessary to meet your specific needs. YouTube video support is no longer included in this project. Keep in mind that `customVideoBuilder` is experimental and can change without being considered as breaking change. More details in [breaking changes](https://github.com/singerdmx/flutter-quill#-breaking-changes) section. + +[`super_clipboard`](https://pub.dev/packages/super_clipboard) will also no longer a dependency of `flutter_quill_extensions` once [PR #2230](https://github.com/singerdmx/flutter-quill/pull/2230) is ready. + +We're looking forward to your feedback. + +**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.7...v10.8.0 + ## 10.7.7 This version is nearly identical to `10.7.6` with a build failure bug fix in [#2283](https://github.com/singerdmx/flutter-quill/pull/2283) related to unmerged change in [#2230](https://github.com/singerdmx/flutter-quill/pull/2230) diff --git a/CHANGELOG_DATA.json b/CHANGELOG_DATA.json index b5afddc49..335a2872b 100644 --- a/CHANGELOG_DATA.json +++ b/CHANGELOG_DATA.json @@ -1,4 +1,5 @@ { + "10.8.0": "> [!CAUTION]\r\n> This release can be breaking change for `flutter_quill_extensions` users as it remove the built-in support for loading YouTube videos\r\n\r\nIf you're using [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions) then this release, can be a breaking change for you if you load videos in the editor and expect YouTube videos to be supported, [youtube_player_flutter](https://pub.dev/packages/youtube_player_flutter) and [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) are no longer dependencies of the extensions package, which are used to support loading YouTube Iframe videos on non-web platforms, more details about the discussion and reasons in [#2286](https://github.com/singerdmx/flutter-quill/pull/2286) and [#2284](https://github.com/singerdmx/flutter-quill/issues/2284).\r\n\r\nWe have added an experimental property that gives you more flexibility and control about the implementation you want to use for loading videos.\r\n\r\n> [!WARNING]\r\n> It's likely to experience some common issues while implementing this feature, especially on desktop platforms as the support for [flutter_inappwebview_windows](https://pub.dev/packages/flutter_inappwebview_windows) and [flutter_inappwebview_macos](https://pub.dev/packages/flutter_inappwebview_macos) before 2 days. Some of the issues are in the Flutter Quill editor.\r\n\r\nIf you want loading YouTube videos to be a feature again with the latest version of Flutter Quill, you can use an existing plugin or package, or implement your own solution. For example, you might use [`youtube_video_player`](https://pub.dev/packages/youtube_video_player) or [`youtube_player_flutter`](https://pub.dev/packages/youtube_player_flutter), which was previously used in [`flutter_quill_extensions`](https://pub.dev/packages/flutter_quill_extensions).\r\n\r\nHere’s an example setup using `youtube_player_flutter`:\r\n\r\n```shell\r\nflutter pub add youtube_player_flutter\r\n```\r\n\r\nExample widget configuration:\r\n\r\n```dart\r\nimport 'package:flutter/material.dart';\r\nimport 'package:youtube_player_flutter/youtube_player_flutter.dart';\r\n\r\nclass YoutubeVideoPlayer extends StatefulWidget {\r\n const YoutubeVideoPlayer({required this.videoUrl, super.key});\r\n\r\n final String videoUrl;\r\n\r\n @override\r\n State createState() => _YoutubeVideoPlayerState();\r\n}\r\n\r\nclass _YoutubeVideoPlayerState extends State {\r\n late final YoutubePlayerController _youtubePlayerController;\r\n @override\r\n void initState() {\r\n super.initState();\r\n _youtubePlayerController = YoutubePlayerController(\r\n initialVideoId: YoutubePlayer.convertUrlToId(widget.videoUrl) ??\r\n (throw StateError('Expect a valid video URL')),\r\n flags: const YoutubePlayerFlags(\r\n autoPlay: true,\r\n mute: true,\r\n ),\r\n );\r\n }\r\n\r\n @override\r\n Widget build(BuildContext context) {\r\n return YoutubePlayer(\r\n controller: _youtubePlayerController,\r\n showVideoProgressIndicator: true,\r\n );\r\n }\r\n\r\n @override\r\n void dispose() {\r\n _youtubePlayerController.dispose();\r\n super.dispose();\r\n }\r\n}\r\n\r\n```\r\n\r\nThen, integrate it with `QuillEditorVideoEmbedConfigurations`\r\n\r\n```dart\r\nFlutterQuillEmbeds.editorBuilders(\r\n videoEmbedConfigurations: QuillEditorVideoEmbedConfigurations(\r\n customVideoBuilder: (videoUrl, readOnly) {\r\n // Example: Check for YouTube Video URL and return your\r\n // YouTube video widget here.\r\n bool isYouTubeUrl(String videoUrl) {\r\n try {\r\n final uri = Uri.parse(videoUrl);\r\n return uri.host == 'www.youtube.com' ||\r\n uri.host == 'youtube.com' ||\r\n uri.host == 'youtu.be' ||\r\n uri.host == 'www.youtu.be';\r\n } catch (_) {\r\n return false;\r\n }\r\n }\r\n\r\n if (isYouTubeUrl(videoUrl)) {\r\n return YoutubeVideoPlayer(\r\n videoUrl: videoUrl,\r\n );\r\n }\r\n\r\n // Return null to fallback to the default logic\r\n return null;\r\n },\r\n ignoreYouTubeSupport: true,\r\n ),\r\n);\r\n```\r\n\r\n> [!NOTE]\r\n> This example illustrates a basic approach, additional adjustments might be necessary to meet your specific needs. YouTube video support is no longer included in this project. Keep in mind that `customVideoBuilder` is experimental and can change without being considered as breaking change. More details in [breaking changes](https://github.com/singerdmx/flutter-quill#-breaking-changes) section.\r\n\r\n[`super_clipboard`](https://pub.dev/packages/super_clipboard) will also no longer a dependency of `flutter_quill_extensions` once [PR #2230](https://github.com/singerdmx/flutter-quill/pull/2230) is ready.\r\n\r\nWe're looking forward to your feedback.\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.7...v10.8.0", "10.7.7": "This version is nearly identical to `10.7.6` with a build failure bug fix in [#2283](https://github.com/singerdmx/flutter-quill/pull/2283) related to unmerged change in [#2230](https://github.com/singerdmx/flutter-quill/pull/2230)\r\n\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.6...v10.7.7", "10.7.6": "* Code Comments Typo fixes by @Luismi74 in https://github.com/singerdmx/flutter-quill/pull/2267\r\n* docs: add important note for contributors before introducing new features by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2269\r\n* docs(readme): add 'Breaking Changes' section by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2275\r\n* Fix: Resolved issue with broken IME composing rect in Windows desktop(re-implementation) by @agata in https://github.com/singerdmx/flutter-quill/pull/2282\r\n\r\n## New Contributors\r\n* @Luismi74 made their first contribution in https://github.com/singerdmx/flutter-quill/pull/2267\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.5...v10.7.6", "10.7.5": "* fix(ci): add flutter pub get step for quill_native_bridge by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2265\r\n* revert: \"Resolved issue with broken IME composing rect in Windows desktop\" by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2266\r\n\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.4...v10.7.5", diff --git a/dart_quill_delta/CHANGELOG.md b/dart_quill_delta/CHANGELOG.md index c7a579c5e..ff9e817c8 100644 --- a/dart_quill_delta/CHANGELOG.md +++ b/dart_quill_delta/CHANGELOG.md @@ -4,6 +4,116 @@ All notable changes to this project will be documented in this file. +## 10.8.0 + +> [!CAUTION] +> This release can be breaking change for `flutter_quill_extensions` users as it remove the built-in support for loading YouTube videos + +If you're using [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions) then this release, can be a breaking change for you if you load videos in the editor and expect YouTube videos to be supported, [youtube_player_flutter](https://pub.dev/packages/youtube_player_flutter) and [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) are no longer dependencies of the extensions package, which are used to support loading YouTube Iframe videos on non-web platforms, more details about the discussion and reasons in [#2286](https://github.com/singerdmx/flutter-quill/pull/2286) and [#2284](https://github.com/singerdmx/flutter-quill/issues/2284). + +We have added an experimental property that gives you more flexibility and control about the implementation you want to use for loading videos. + +> [!WARNING] +> It's likely to experience some common issues while implementing this feature, especially on desktop platforms as the support for [flutter_inappwebview_windows](https://pub.dev/packages/flutter_inappwebview_windows) and [flutter_inappwebview_macos](https://pub.dev/packages/flutter_inappwebview_macos) before 2 days. Some of the issues are in the Flutter Quill editor. + +If you want loading YouTube videos to be a feature again with the latest version of Flutter Quill, you can use an existing plugin or package, or implement your own solution. For example, you might use [`youtube_video_player`](https://pub.dev/packages/youtube_video_player) or [`youtube_player_flutter`](https://pub.dev/packages/youtube_player_flutter), which was previously used in [`flutter_quill_extensions`](https://pub.dev/packages/flutter_quill_extensions). + +Here’s an example setup using `youtube_player_flutter`: + +```shell +flutter pub add youtube_player_flutter +``` + +Example widget configuration: + +```dart +import 'package:flutter/material.dart'; +import 'package:youtube_player_flutter/youtube_player_flutter.dart'; + +class YoutubeVideoPlayer extends StatefulWidget { + const YoutubeVideoPlayer({required this.videoUrl, super.key}); + + final String videoUrl; + + @override + State createState() => _YoutubeVideoPlayerState(); +} + +class _YoutubeVideoPlayerState extends State { + late final YoutubePlayerController _youtubePlayerController; + @override + void initState() { + super.initState(); + _youtubePlayerController = YoutubePlayerController( + initialVideoId: YoutubePlayer.convertUrlToId(widget.videoUrl) ?? + (throw StateError('Expect a valid video URL')), + flags: const YoutubePlayerFlags( + autoPlay: true, + mute: true, + ), + ); + } + + @override + Widget build(BuildContext context) { + return YoutubePlayer( + controller: _youtubePlayerController, + showVideoProgressIndicator: true, + ); + } + + @override + void dispose() { + _youtubePlayerController.dispose(); + super.dispose(); + } +} + +``` + +Then, integrate it with `QuillEditorVideoEmbedConfigurations` + +```dart +FlutterQuillEmbeds.editorBuilders( + videoEmbedConfigurations: QuillEditorVideoEmbedConfigurations( + customVideoBuilder: (videoUrl, readOnly) { + // Example: Check for YouTube Video URL and return your + // YouTube video widget here. + bool isYouTubeUrl(String videoUrl) { + try { + final uri = Uri.parse(videoUrl); + return uri.host == 'www.youtube.com' || + uri.host == 'youtube.com' || + uri.host == 'youtu.be' || + uri.host == 'www.youtu.be'; + } catch (_) { + return false; + } + } + + if (isYouTubeUrl(videoUrl)) { + return YoutubeVideoPlayer( + videoUrl: videoUrl, + ); + } + + // Return null to fallback to the default logic + return null; + }, + ignoreYouTubeSupport: true, + ), +); +``` + +> [!NOTE] +> This example illustrates a basic approach, additional adjustments might be necessary to meet your specific needs. YouTube video support is no longer included in this project. Keep in mind that `customVideoBuilder` is experimental and can change without being considered as breaking change. More details in [breaking changes](https://github.com/singerdmx/flutter-quill#-breaking-changes) section. + +[`super_clipboard`](https://pub.dev/packages/super_clipboard) will also no longer a dependency of `flutter_quill_extensions` once [PR #2230](https://github.com/singerdmx/flutter-quill/pull/2230) is ready. + +We're looking forward to your feedback. + +**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.7...v10.8.0 + ## 10.7.7 This version is nearly identical to `10.7.6` with a build failure bug fix in [#2283](https://github.com/singerdmx/flutter-quill/pull/2283) related to unmerged change in [#2230](https://github.com/singerdmx/flutter-quill/pull/2230) diff --git a/dart_quill_delta/pubspec.yaml b/dart_quill_delta/pubspec.yaml index de594c1df..8d4072bfa 100644 --- a/dart_quill_delta/pubspec.yaml +++ b/dart_quill_delta/pubspec.yaml @@ -1,6 +1,6 @@ name: dart_quill_delta description: A port of quill-js-delta from typescript to dart -version: 10.7.7 +version: 10.8.0 homepage: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/ repository: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index eabf85a3e..bf1bbe800 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,7 +8,6 @@ import Foundation import desktop_drop import device_info_plus import file_selector_macos -import flutter_inappwebview_macos import gal import irondash_engine_context import path_provider_foundation @@ -22,7 +21,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) - InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin")) IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc index 8e3614f6f..084810413 100644 --- a/example/windows/flutter/generated_plugin_registrant.cc +++ b/example/windows/flutter/generated_plugin_registrant.cc @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -20,8 +19,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("DesktopDropPlugin")); FileSelectorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorWindows")); - FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi")); GalPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("GalPluginCApi")); IrondashEngineContextPluginCApiRegisterWithRegistrar( diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake index a10959609..f568d1445 100644 --- a/example/windows/flutter/generated_plugins.cmake +++ b/example/windows/flutter/generated_plugins.cmake @@ -5,7 +5,6 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_drop file_selector_windows - flutter_inappwebview_windows gal irondash_engine_context share_plus diff --git a/flutter_quill_extensions/CHANGELOG.md b/flutter_quill_extensions/CHANGELOG.md index c7a579c5e..ff9e817c8 100644 --- a/flutter_quill_extensions/CHANGELOG.md +++ b/flutter_quill_extensions/CHANGELOG.md @@ -4,6 +4,116 @@ All notable changes to this project will be documented in this file. +## 10.8.0 + +> [!CAUTION] +> This release can be breaking change for `flutter_quill_extensions` users as it remove the built-in support for loading YouTube videos + +If you're using [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions) then this release, can be a breaking change for you if you load videos in the editor and expect YouTube videos to be supported, [youtube_player_flutter](https://pub.dev/packages/youtube_player_flutter) and [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) are no longer dependencies of the extensions package, which are used to support loading YouTube Iframe videos on non-web platforms, more details about the discussion and reasons in [#2286](https://github.com/singerdmx/flutter-quill/pull/2286) and [#2284](https://github.com/singerdmx/flutter-quill/issues/2284). + +We have added an experimental property that gives you more flexibility and control about the implementation you want to use for loading videos. + +> [!WARNING] +> It's likely to experience some common issues while implementing this feature, especially on desktop platforms as the support for [flutter_inappwebview_windows](https://pub.dev/packages/flutter_inappwebview_windows) and [flutter_inappwebview_macos](https://pub.dev/packages/flutter_inappwebview_macos) before 2 days. Some of the issues are in the Flutter Quill editor. + +If you want loading YouTube videos to be a feature again with the latest version of Flutter Quill, you can use an existing plugin or package, or implement your own solution. For example, you might use [`youtube_video_player`](https://pub.dev/packages/youtube_video_player) or [`youtube_player_flutter`](https://pub.dev/packages/youtube_player_flutter), which was previously used in [`flutter_quill_extensions`](https://pub.dev/packages/flutter_quill_extensions). + +Here’s an example setup using `youtube_player_flutter`: + +```shell +flutter pub add youtube_player_flutter +``` + +Example widget configuration: + +```dart +import 'package:flutter/material.dart'; +import 'package:youtube_player_flutter/youtube_player_flutter.dart'; + +class YoutubeVideoPlayer extends StatefulWidget { + const YoutubeVideoPlayer({required this.videoUrl, super.key}); + + final String videoUrl; + + @override + State createState() => _YoutubeVideoPlayerState(); +} + +class _YoutubeVideoPlayerState extends State { + late final YoutubePlayerController _youtubePlayerController; + @override + void initState() { + super.initState(); + _youtubePlayerController = YoutubePlayerController( + initialVideoId: YoutubePlayer.convertUrlToId(widget.videoUrl) ?? + (throw StateError('Expect a valid video URL')), + flags: const YoutubePlayerFlags( + autoPlay: true, + mute: true, + ), + ); + } + + @override + Widget build(BuildContext context) { + return YoutubePlayer( + controller: _youtubePlayerController, + showVideoProgressIndicator: true, + ); + } + + @override + void dispose() { + _youtubePlayerController.dispose(); + super.dispose(); + } +} + +``` + +Then, integrate it with `QuillEditorVideoEmbedConfigurations` + +```dart +FlutterQuillEmbeds.editorBuilders( + videoEmbedConfigurations: QuillEditorVideoEmbedConfigurations( + customVideoBuilder: (videoUrl, readOnly) { + // Example: Check for YouTube Video URL and return your + // YouTube video widget here. + bool isYouTubeUrl(String videoUrl) { + try { + final uri = Uri.parse(videoUrl); + return uri.host == 'www.youtube.com' || + uri.host == 'youtube.com' || + uri.host == 'youtu.be' || + uri.host == 'www.youtu.be'; + } catch (_) { + return false; + } + } + + if (isYouTubeUrl(videoUrl)) { + return YoutubeVideoPlayer( + videoUrl: videoUrl, + ); + } + + // Return null to fallback to the default logic + return null; + }, + ignoreYouTubeSupport: true, + ), +); +``` + +> [!NOTE] +> This example illustrates a basic approach, additional adjustments might be necessary to meet your specific needs. YouTube video support is no longer included in this project. Keep in mind that `customVideoBuilder` is experimental and can change without being considered as breaking change. More details in [breaking changes](https://github.com/singerdmx/flutter-quill#-breaking-changes) section. + +[`super_clipboard`](https://pub.dev/packages/super_clipboard) will also no longer a dependency of `flutter_quill_extensions` once [PR #2230](https://github.com/singerdmx/flutter-quill/pull/2230) is ready. + +We're looking forward to your feedback. + +**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.7...v10.8.0 + ## 10.7.7 This version is nearly identical to `10.7.6` with a build failure bug fix in [#2283](https://github.com/singerdmx/flutter-quill/pull/2283) related to unmerged change in [#2230](https://github.com/singerdmx/flutter-quill/pull/2230) diff --git a/flutter_quill_extensions/pubspec.yaml b/flutter_quill_extensions/pubspec.yaml index 277f6dbf2..c502a0112 100644 --- a/flutter_quill_extensions/pubspec.yaml +++ b/flutter_quill_extensions/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill_extensions description: Embed extensions for flutter_quill including image, video, formula and etc. -version: 10.7.7 +version: 10.8.0 homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ diff --git a/flutter_quill_test/CHANGELOG.md b/flutter_quill_test/CHANGELOG.md index c7a579c5e..ff9e817c8 100644 --- a/flutter_quill_test/CHANGELOG.md +++ b/flutter_quill_test/CHANGELOG.md @@ -4,6 +4,116 @@ All notable changes to this project will be documented in this file. +## 10.8.0 + +> [!CAUTION] +> This release can be breaking change for `flutter_quill_extensions` users as it remove the built-in support for loading YouTube videos + +If you're using [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions) then this release, can be a breaking change for you if you load videos in the editor and expect YouTube videos to be supported, [youtube_player_flutter](https://pub.dev/packages/youtube_player_flutter) and [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) are no longer dependencies of the extensions package, which are used to support loading YouTube Iframe videos on non-web platforms, more details about the discussion and reasons in [#2286](https://github.com/singerdmx/flutter-quill/pull/2286) and [#2284](https://github.com/singerdmx/flutter-quill/issues/2284). + +We have added an experimental property that gives you more flexibility and control about the implementation you want to use for loading videos. + +> [!WARNING] +> It's likely to experience some common issues while implementing this feature, especially on desktop platforms as the support for [flutter_inappwebview_windows](https://pub.dev/packages/flutter_inappwebview_windows) and [flutter_inappwebview_macos](https://pub.dev/packages/flutter_inappwebview_macos) before 2 days. Some of the issues are in the Flutter Quill editor. + +If you want loading YouTube videos to be a feature again with the latest version of Flutter Quill, you can use an existing plugin or package, or implement your own solution. For example, you might use [`youtube_video_player`](https://pub.dev/packages/youtube_video_player) or [`youtube_player_flutter`](https://pub.dev/packages/youtube_player_flutter), which was previously used in [`flutter_quill_extensions`](https://pub.dev/packages/flutter_quill_extensions). + +Here’s an example setup using `youtube_player_flutter`: + +```shell +flutter pub add youtube_player_flutter +``` + +Example widget configuration: + +```dart +import 'package:flutter/material.dart'; +import 'package:youtube_player_flutter/youtube_player_flutter.dart'; + +class YoutubeVideoPlayer extends StatefulWidget { + const YoutubeVideoPlayer({required this.videoUrl, super.key}); + + final String videoUrl; + + @override + State createState() => _YoutubeVideoPlayerState(); +} + +class _YoutubeVideoPlayerState extends State { + late final YoutubePlayerController _youtubePlayerController; + @override + void initState() { + super.initState(); + _youtubePlayerController = YoutubePlayerController( + initialVideoId: YoutubePlayer.convertUrlToId(widget.videoUrl) ?? + (throw StateError('Expect a valid video URL')), + flags: const YoutubePlayerFlags( + autoPlay: true, + mute: true, + ), + ); + } + + @override + Widget build(BuildContext context) { + return YoutubePlayer( + controller: _youtubePlayerController, + showVideoProgressIndicator: true, + ); + } + + @override + void dispose() { + _youtubePlayerController.dispose(); + super.dispose(); + } +} + +``` + +Then, integrate it with `QuillEditorVideoEmbedConfigurations` + +```dart +FlutterQuillEmbeds.editorBuilders( + videoEmbedConfigurations: QuillEditorVideoEmbedConfigurations( + customVideoBuilder: (videoUrl, readOnly) { + // Example: Check for YouTube Video URL and return your + // YouTube video widget here. + bool isYouTubeUrl(String videoUrl) { + try { + final uri = Uri.parse(videoUrl); + return uri.host == 'www.youtube.com' || + uri.host == 'youtube.com' || + uri.host == 'youtu.be' || + uri.host == 'www.youtu.be'; + } catch (_) { + return false; + } + } + + if (isYouTubeUrl(videoUrl)) { + return YoutubeVideoPlayer( + videoUrl: videoUrl, + ); + } + + // Return null to fallback to the default logic + return null; + }, + ignoreYouTubeSupport: true, + ), +); +``` + +> [!NOTE] +> This example illustrates a basic approach, additional adjustments might be necessary to meet your specific needs. YouTube video support is no longer included in this project. Keep in mind that `customVideoBuilder` is experimental and can change without being considered as breaking change. More details in [breaking changes](https://github.com/singerdmx/flutter-quill#-breaking-changes) section. + +[`super_clipboard`](https://pub.dev/packages/super_clipboard) will also no longer a dependency of `flutter_quill_extensions` once [PR #2230](https://github.com/singerdmx/flutter-quill/pull/2230) is ready. + +We're looking forward to your feedback. + +**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.7...v10.8.0 + ## 10.7.7 This version is nearly identical to `10.7.6` with a build failure bug fix in [#2283](https://github.com/singerdmx/flutter-quill/pull/2283) related to unmerged change in [#2230](https://github.com/singerdmx/flutter-quill/pull/2230) diff --git a/flutter_quill_test/pubspec.yaml b/flutter_quill_test/pubspec.yaml index 2661a3b76..8247d0455 100644 --- a/flutter_quill_test/pubspec.yaml +++ b/flutter_quill_test/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill_test description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases. -version: 10.7.7 +version: 10.8.0 homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ diff --git a/pubspec.yaml b/pubspec.yaml index 9cc2b0626..3c3b941b9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: "A rich text editor built for Android, iOS, Web, and desktop platforms. It's the WYSIWYG editor and a Quill component for Flutter." -version: 10.7.7 +version: 10.8.0 homepage: https://github.com/singerdmx/flutter-quill/ repository: https://github.com/singerdmx/flutter-quill/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/