Skip to content

Commit

Permalink
quill update part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jan 10, 2024
1 parent 88db187 commit cfe31db
Show file tree
Hide file tree
Showing 16 changed files with 507 additions and 443 deletions.
10 changes: 7 additions & 3 deletions example/lib/pages/components/quill_editor_demo.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
// import 'package:flutter_quill/flutter_quill.dart';
import 'package:zds_flutter/zds_flutter.dart';

///Example for htmlEditor
Expand Down Expand Up @@ -45,9 +47,11 @@ class _QuillEditorDemoState extends State<QuillEditorDemo> {
children: [
Expanded(
child: QuillEditor.basic(
padding: const EdgeInsets.all(16),
controller: controller,
readOnly: true,
configurations: QuillEditorConfigurations(
padding: const EdgeInsets.all(16),
controller: controller,
readOnly: true,
),
),
),
],
Expand Down
9 changes: 6 additions & 3 deletions example/lib/pages/quill_editor_demo.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:zds_flutter/zds_flutter.dart';

///Example for htmlEditor
Expand Down Expand Up @@ -67,10 +68,12 @@ class _QuillEditorDemoState extends State<QuillEditorDemo> {
children: [
Expanded(
child: QuillEditor.basic(
padding: const EdgeInsets.all(16),
controller: controller,
configurations: QuillEditorConfigurations(
padding: const EdgeInsets.all(16),
controller: controller,
readOnly: true,
),
focusNode: FocusNode(canRequestFocus: false),
readOnly: true,
),
),
],
Expand Down
12 changes: 8 additions & 4 deletions example/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
#include "generated_plugin_registrant.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) {
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);
Expand Down
3 changes: 2 additions & 1 deletion example/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
pasteboard
irondash_engine_context
super_native_extensions
url_launcher_linux
)

Expand Down
6 changes: 4 additions & 2 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import device_info_plus
import file_selector_macos
import flutter_image_compress_macos
import flutter_inappwebview_macos
import irondash_engine_context
import package_info_plus
import pasteboard
import path_provider_foundation
import shared_preferences_foundation
import sqflite
import super_native_extensions
import url_launcher_macos
import video_compress
import video_player_avfoundation
Expand All @@ -24,11 +25,12 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
VideoCompressPlugin.register(with: registry.registrar(forPlugin: "VideoCompressPlugin"))
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
Expand Down
28 changes: 22 additions & 6 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ PODS:
- FlutterMacOS
- flutter_image_compress_macos (1.0.0):
- FlutterMacOS
- flutter_inappwebview_macos (0.0.1):
- FlutterMacOS
- OrderedSet (~> 5.0)
- FlutterMacOS (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- package_info_plus (0.0.1):
- irondash_engine_context (0.0.1):
- FlutterMacOS
- pasteboard (0.0.1):
- OrderedSet (5.0.0)
- package_info_plus (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
Expand All @@ -22,6 +26,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_compress (0.3.0):
Expand All @@ -36,12 +42,14 @@ DEPENDENCIES:
- device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
- flutter_image_compress_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos`)
- flutter_inappwebview_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- irondash_engine_context (from `Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- pasteboard (from `Flutter/ephemeral/.symlinks/plugins/pasteboard/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- 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_compress (from `Flutter/ephemeral/.symlinks/plugins/video_compress/macos`)
- video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`)
Expand All @@ -50,6 +58,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- FMDB
- OrderedSet

EXTERNAL SOURCES:
device_info_plus:
Expand All @@ -58,18 +67,22 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos
flutter_image_compress_macos:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos
flutter_inappwebview_macos:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos
FlutterMacOS:
:path: Flutter/ephemeral
irondash_engine_context:
:path: Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
pasteboard:
:path: Flutter/ephemeral/.symlinks/plugins/pasteboard/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
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_compress:
Expand All @@ -83,13 +96,16 @@ SPEC CHECKSUMS:
device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f
file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9
flutter_image_compress_macos: c26c3c13ea0f28ae6dea4e139b3292e7729f99f1
flutter_inappwebview_macos: 9600c9df9fdb346aaa8933812009f8d94304203d
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
irondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
pasteboard: 9b69dba6fedbb04866be632205d532fe2f6b1d99
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
super_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
video_compress: c896234f100791b5fef7f049afa38f6d2ef7b42f
video_player_avfoundation: e9e6f9cae7d7a6d9b43519b0aab382bca60fcfd1
Expand Down
1 change: 1 addition & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
shared_preferences: ^2.2.2
zds_flutter:
path: ../
flutter_quill: ^9.2.2

flutter:
uses-material-design: true
Expand Down
9 changes: 6 additions & 3 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
#include "generated_plugin_registrant.h"

#include <file_selector_windows/file_selector_windows.h>
#include <pasteboard/pasteboard_plugin.h>
#include <irondash_engine_context/irondash_engine_context_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.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) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin"));
IrondashEngineContextPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
SuperNativeExtensionsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
3 changes: 2 additions & 1 deletion example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
pasteboard
irondash_engine_context
permission_handler_windows
super_native_extensions
url_launcher_windows
)

Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/organisms/quill_editor/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/quill_delta.dart';

import '../../../../zds_flutter.dart';

Expand Down
1 change: 1 addition & 0 deletions lib/src/components/organisms/quill_editor/quill_delta.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// ignore_for_file: avoid_dynamic_calls
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/quill_delta.dart';
import 'package:vsc_quill_delta_to_html/vsc_quill_delta_to_html.dart';
import 'html_parser.dart';

Expand Down
22 changes: 13 additions & 9 deletions lib/src/components/organisms/quill_editor/quill_editor.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';

import '../../../../zds_flutter.dart';
import 'quill_toolbar.dart';

/// A custom widget for the Quill editor.
Expand Down Expand Up @@ -76,16 +78,18 @@ class ZdsQuillEditor extends StatelessWidget {
Widget build(BuildContext context) {
// Base editor configuration
final editor = QuillEditor.basic(
controller: controller,
readOnly: readOnly,
keyboardAppearance: keyboardAppearance,
embedBuilders: embedBuilders,
padding: padding,
autoFocus: autoFocus,
expands: expands,
configurations: QuillEditorConfigurations(
controller: controller,
readOnly: readOnly,
keyboardAppearance: keyboardAppearance ?? Brightness.light,
embedBuilders: embedBuilders,
padding: padding,
autoFocus: autoFocus,
expands: expands,
placeholder: placeholder,
editorKey: editorKey,
),
focusNode: readOnly ? FocusNode(canRequestFocus: false) : focusNode,
placeholder: placeholder,
editorKey: editorKey,
);

// If readOnly, return just editor
Expand Down
45 changes: 30 additions & 15 deletions lib/src/components/organisms/quill_editor/quill_editor_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_quill/flutter_quill.dart' as quill;
import 'package:flutter_quill/quill_delta.dart';

import '../../../../zds_flutter.dart';
import 'quill_toolbar.dart';
Expand Down Expand Up @@ -286,7 +287,7 @@ class _ZdsQuillEditorState extends State<ZdsQuillEditorPage> with FrameCallbackM

/// Sets the editor's content from a plain text source.
Future<void> _setText(String initialText) async {
await initialText.toDelta().then((quill.Delta delta) {
await initialText.toDelta().then((Delta delta) {
_quillController.document = quill.Document.fromDelta(delta);
});
}
Expand Down Expand Up @@ -337,14 +338,20 @@ class _ZdsQuillEditorState extends State<ZdsQuillEditorPage> with FrameCallbackM
onPressed: null,
child: ClipRRect(
borderRadius: BorderRadius.circular(30),
child: quill.ClearFormatButton(
icon: Icons.format_clear,
iconSize: 30,
controller: _quillController,
iconTheme: quill.QuillIconTheme(
iconSelectedColor: Theme.of(context).colorScheme.onSecondary,
iconUnselectedFillColor: Colors.transparent,
child: quill.QuillToolbarClearFormatButton(
options: quill.QuillToolbarClearFormatButtonOptions(
iconData: Icons.format_clear,
iconSize: 30,
iconTheme: quill.QuillIconTheme(
iconButtonSelectedData: quill.IconButtonData(
color: Theme.of(context).colorScheme.onSecondary,
),
iconButtonUnselectedData: const quill.IconButtonData(
color: Colors.transparent,
),
),
),
controller: _quillController,
),
),
),
Expand Down Expand Up @@ -537,16 +544,24 @@ class _HistoryButtonState extends State<_HistoryButton> {
widget.controller.changes.listen((quill.DocChange event) async {
_setIconColor();
});

return quill.QuillIconButton(
highlightElevation: 0,
hoverElevation: 0,
size: widget.iconSize * kIconButtonFactor,
icon: Icon(widget.icon, size: widget.iconSize, color: _iconColor),
fillColor: Colors.transparent,
return quill.QuillToolbarIconButton(
onPressed: _changeHistory,
icon: Icon(
widget.icon,
size: widget.iconSize * kIconButtonFactor,
color: _iconColor,
),
isSelected: false,
iconTheme: const quill.QuillIconTheme(),
afterPressed: widget.afterPressed,
);
// return quill.QuillToolbarHistoryButton(controller: controller, isUndo: isUndo)

// return quill.QuillIconButton(
// highlightElevation: 0,
// hoverElevation: 0,
// fillColor: Colors.transparent,
// );
}

void _setIconColor() {
Expand Down
Loading

0 comments on commit cfe31db

Please sign in to comment.