Skip to content

Commit

Permalink
[Super Editor] - Change all newline insertions to use EditRequests (R…
Browse files Browse the repository at this point in the history
…esolves #2497) (#2500)
  • Loading branch information
matthew-carroll committed Jan 11, 2025
1 parent 3a89307 commit 3795c2d
Show file tree
Hide file tree
Showing 54 changed files with 1,646 additions and 976 deletions.
9 changes: 9 additions & 0 deletions attributed_text/lib/src/attributed_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ class AttributedText {

late final String _textWithPlaceholders;

/// Returns the character or placeholder at offset zero.
Object get first => placeholders[0] ?? _text[0];

/// Returns the character or placeholder at the given [offset].
Object operator [](int offset) => placeholders[offset] ?? _text[offset];

/// Returns the character or placeholder at the end of this `AttributedText`.
Object get last => placeholders[length - 1] ?? _text[length - 1];

/// Returns a plain-text version of this `AttributedText`.
///
/// Plain text has no attributions or placeholder objects.
Expand Down
2 changes: 2 additions & 0 deletions super_editor/clones/quill/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
8 changes: 4 additions & 4 deletions super_editor/clones/quill/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ class _HomeScreenState extends State<HomeScreen> {
Editor.composerKey: _composer,
},
requestHandlers: [
(request) => request is ConvertTextBlockToFormatRequest //
(editor, request) => request is ConvertTextBlockToFormatRequest //
? ConvertTextBlockToFormatCommand(request.blockFormat)
: null,
(request) => request is ToggleInlineFormatRequest //
(editor, request) => request is ToggleInlineFormatRequest //
? ToggleInlineFormatCommand(request.inlineFormat)
: null,
(request) => request is ToggleTextBlockFormatRequest //
(editor, request) => request is ToggleTextBlockFormatRequest //
? ToggleTextBlockFormatCommand(request.blockFormat)
: null,
(request) => request is ClearSelectedStylesRequest //
(editor, request) => request is ClearSelectedStylesRequest //
? const ClearSelectedStylesCommand()
: null,
...defaultRequestHandlers,
Expand Down
6 changes: 4 additions & 2 deletions super_editor/clones/quill/lib/editor/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,11 @@ ExecutionInstruction enterToInsertNewlineInCodeBlock({
return ExecutionInstruction.continueExecution;
}

final didInsertNewline = editContext.commonOps.insertPlainText('\n');
editContext.editor.execute([
InsertNewlineAtCaretRequest(),
]);

return didInsertNewline ? ExecutionInstruction.haltExecution : ExecutionInstruction.continueExecution;
return ExecutionInstruction.haltExecution;
}

enum FeatherTextBlock {
Expand Down
4 changes: 2 additions & 2 deletions super_editor/clones/quill/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
url_launcher_macos: de10e46d8d8b9e3a7b8a133e8de92b104379f05e

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
4 changes: 4 additions & 0 deletions super_editor/clones/quill/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}

override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
}
119 changes: 70 additions & 49 deletions super_editor/clones/quill/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ packages:
source: hosted
version: "2.11.0"
attributed_text:
dependency: transitive
dependency: "direct overridden"
description:
name: attributed_text
sha256: "4bc7baf5133c2369bb82324ddd82c167a9d665dc8f610be378f0aa5f074317f9"
url: "https://pub.dev"
source: hosted
version: "0.3.2"
path: "../../../attributed_text"
relative: true
source: path
version: "0.4.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -57,14 +56,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
charcode:
dependency: transitive
description:
name: charcode
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
url: "https://pub.dev"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
Expand All @@ -77,10 +68,10 @@ packages:
dependency: "direct main"
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -163,6 +154,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.0.24"
flutter_test_runners:
dependency: transitive
description:
name: flutter_test_runners
sha256: cc575117ed66a79185a26995399d7048341517a1bd21188cb43753739627832d
url: "https://pub.dev"
source: hosted
version: "0.0.4"
flutter_web_plugins:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -196,10 +195,10 @@ packages:
dependency: transitive
description:
name: http
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.2.2"
http_multi_server:
dependency: transitive
description:
Expand Down Expand Up @@ -236,18 +235,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
version: "10.0.7"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.8"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -276,18 +275,18 @@ packages:
dependency: transitive
description:
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
markdown:
dependency: transitive
description:
name: markdown
sha256: "39caf989ccc72c63e87b961851a74257141938599ed2db45fbd9403fee0db423"
sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051
url: "https://pub.dev"
source: hosted
version: "5.0.0"
version: "7.2.2"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -412,7 +411,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
source_map_stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -449,10 +448,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
version: "1.12.0"
stream_channel:
dependency: transitive
description:
Expand All @@ -465,32 +464,46 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
super_editor:
dependency: "direct main"
description:
path: "../.."
relative: true
source: path
version: "0.3.0-dev.1"
version: "0.3.0-dev.12"
super_editor_markdown:
dependency: "direct main"
description:
path: "../../../super_editor_markdown"
relative: true
source: path
version: "0.1.5"
super_text_layout:
version: "0.1.6"
super_editor_quill:
dependency: "direct main"
description:
path: "../../../super_editor_quill"
relative: true
source: path
version: "0.1.0-dev.7"
super_keyboard:
dependency: transitive
description:
name: super_text_layout
sha256: "81241d2715190079743c693206381d79958b92366012e0a19a06a801844cda09"
name: super_keyboard
sha256: c8e303cd7bc1fc62732213f0f2660273a078be23eae7a4219d0ab3dd0b0ccb9a
url: "https://pub.dev"
source: hosted
version: "0.1.10"
version: "0.1.0"
super_text_layout:
dependency: transitive
description:
path: "../../../super_text_layout"
relative: true
source: path
version: "0.1.17"
term_glyph:
dependency: transitive
description:
Expand All @@ -503,23 +516,31 @@ packages:
dependency: transitive
description:
name: test
sha256: d11b55850c68c1f6c0cf00eabded4e66c4043feaf6c0d7ce4a36785137df6331
sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f"
url: "https://pub.dev"
source: hosted
version: "1.25.5"
version: "1.25.8"
test_api:
dependency: transitive
description:
name: test_api
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.dev"
source: hosted
version: "0.7.1"
version: "0.7.3"
test_core:
dependency: transitive
description:
name: test_core
sha256: "4d070a6bc36c1c4e89f20d353bfd71dc30cdf2bd0e14349090af360a029ab292"
sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d"
url: "https://pub.dev"
source: hosted
version: "0.6.5"
text_table:
dependency: transitive
description:
name: text_table
sha256: a42b35675be614274b884ee482d4bdf4bdf707bc65de18cb8f1ad288c1beb1f4
url: "https://pub.dev"
source: hosted
version: "0.6.2"
Expand All @@ -535,10 +556,10 @@ packages:
dependency: transitive
description:
name: url_launcher
sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3"
sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
version: "6.3.1"
url_launcher_android:
dependency: transitive
description:
Expand Down Expand Up @@ -599,10 +620,10 @@ packages:
dependency: transitive
description:
name: uuid
sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff
url: "https://pub.dev"
source: hosted
version: "4.4.0"
version: "4.5.1"
vector_math:
dependency: transitive
description:
Expand All @@ -615,10 +636,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
url: "https://pub.dev"
source: hosted
version: "14.2.1"
version: "14.3.0"
watcher:
dependency: transitive
description:
Expand Down Expand Up @@ -660,5 +681,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.3.0 <4.0.0"
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.19.0"
2 changes: 2 additions & 0 deletions super_editor/clones/quill/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ dependency_overrides:
path: ../../../super_editor_markdown
super_text_layout:
path: ../../../super_text_layout
attributed_text:
path: ../../../attributed_text

dev_dependencies:
flutter_test:
Expand Down
Loading

0 comments on commit 3795c2d

Please sign in to comment.