From 67adb199babd85e14e79fde601c50dc2a083d7d3 Mon Sep 17 00:00:00 2001 From: Ellet Date: Thu, 7 Dec 2023 23:17:20 +0300 Subject: [PATCH] Improves the new logic of pasting HTML contents into the Editor --- CHANGELOG.md | 4 ++++ lib/src/widgets/raw_editor/raw_editor_state.dart | 12 +----------- version.dart | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d629a3..0b30a16d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## 9.0.0-dev-9 +* Improves the new logic of pasting HTML contents into the Editor +* Update `README.md` and the doc + ## 9.0.0-dev-8 * Better support for pasting HTML contents from external websites to the editor * The experimental support of converting the HTML from `quill_html_converter` is now built-in in the `flutter_quill` and removed from there (Breaking change for `quill_html_converter`) diff --git a/lib/src/widgets/raw_editor/raw_editor_state.dart b/lib/src/widgets/raw_editor/raw_editor_state.dart index 3a9dfd60..c09189f5 100644 --- a/lib/src/widgets/raw_editor/raw_editor_state.dart +++ b/lib/src/widgets/raw_editor/raw_editor_state.dart @@ -237,17 +237,7 @@ class QuillRawEditorState extends EditorState deltaFromCliboard = QuillController.fromHtml(html); } if (deltaFromCliboard != null) { - // final index = selection.baseOffset; - // final length = selection.extentOffset - index; - - final list = controller.document.toDelta().toList() - ..insertAll(controller.document.toDelta().toList().length - 1, - deltaFromCliboard.toList()); - - final delta = controller.document.toDelta(); - for (final operation in list) { - delta.push(operation); - } + final delta = controller.document.toDelta().compose(deltaFromCliboard); controller ..updateDocument( diff --git a/version.dart b/version.dart index 27a78c10..9cac290f 100644 --- a/version.dart +++ b/version.dart @@ -1 +1 @@ -const version = '9.0.0-dev-8'; +const version = '9.0.0-dev-9';