Skip to content

Commit f987f50

Browse files
authored
Merge branch 'superlistapp:main' into feature/allow-scrolling-within-super-text-field
2 parents 5da89b3 + 9bf2d84 commit f987f50

File tree

162 files changed

+4083
-1902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+4083
-1902
lines changed

super_editor/clones/quill/lib/app.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ This is a code block.
122122
/// current block. This is especially important for a code block, in which pressing
123123
/// Enter inserts a newline inside the code block - it doesn't insert a new paragraph
124124
/// below the code block.
125-
class _AlwaysTrailingParagraphReaction implements EditReaction {
125+
class _AlwaysTrailingParagraphReaction extends EditReaction {
126126
@override
127-
void react(EditContext editorContext, RequestDispatcher requestDispatcher, List<EditEvent> changeList) {
127+
void modifyContent(EditContext editorContext, RequestDispatcher requestDispatcher, List<EditEvent> changeList) {
128128
final document = editorContext.find<MutableDocument>(Editor.documentKey);
129-
final lastNode = document.nodes.lastOrNull;
129+
final lastNode = document.lastOrNull;
130130

131131
if (lastNode != null &&
132132
lastNode is ParagraphNode &&
@@ -140,7 +140,7 @@ class _AlwaysTrailingParagraphReaction implements EditReaction {
140140
// We need to insert a trailing empty paragraph.
141141
requestDispatcher.execute([
142142
InsertNodeAtIndexRequest(
143-
nodeIndex: document.nodes.length,
143+
nodeIndex: document.nodeCount,
144144
newNode: ParagraphNode(
145145
id: Editor.createNodeId(),
146146
text: AttributedText(""),

super_editor/clones/quill/lib/deltas/deltas_display.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:dart_quill_delta/dart_quill_delta.dart';
2-
import 'package:feather/infrastructure/super_editor_extensions.dart';
32
import 'package:flutter/material.dart';
43
import 'package:material_symbols_icons/material_symbols_icons.dart';
54
import 'package:super_editor/super_editor.dart';

super_editor/clones/quill/lib/editor/editor.dart

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,6 @@ class FeatherEditor extends StatefulWidget {
2828
class _FeatherEditorState extends State<FeatherEditor> {
2929
final _editorFocusNode = FocusNode();
3030

31-
late MutableDocument _document;
32-
late MutableDocumentComposer _composer;
33-
34-
@override
35-
void initState() {
36-
super.initState();
37-
38-
_document = widget.editor.context.find<MutableDocument>(Editor.documentKey);
39-
_composer = widget.editor.context.find<MutableDocumentComposer>(Editor.composerKey);
40-
}
41-
42-
@override
43-
void didUpdateWidget(FeatherEditor oldWidget) {
44-
super.didUpdateWidget(oldWidget);
45-
46-
if (widget.editor != oldWidget.editor) {
47-
_document = widget.editor.context.find<MutableDocument>(Editor.documentKey);
48-
_composer = widget.editor.context.find<MutableDocumentComposer>(Editor.composerKey);
49-
}
50-
}
51-
5231
@override
5332
void dispose() {
5433
_editorFocusNode.dispose();
@@ -90,8 +69,6 @@ class _FeatherEditorState extends State<FeatherEditor> {
9069
child: SuperEditor(
9170
focusNode: _editorFocusNode,
9271
editor: widget.editor,
93-
document: _document,
94-
composer: _composer,
9572
stylesheet: featherStylesheet,
9673
componentBuilders: const [
9774
FeatherBlockquoteComponentBuilder(),
@@ -126,7 +103,7 @@ class ClearSelectedStylesRequest implements EditRequest {
126103
const ClearSelectedStylesRequest();
127104
}
128105

129-
class ClearSelectedStylesCommand implements EditCommand {
106+
class ClearSelectedStylesCommand extends EditCommand {
130107
const ClearSelectedStylesCommand();
131108

132109
@override
@@ -181,7 +158,7 @@ class ClearTextAttributionsRequest implements EditRequest {
181158
int get hashCode => documentRange.hashCode;
182159
}
183160

184-
class ClearTextAttributionsCommand implements EditCommand {
161+
class ClearTextAttributionsCommand extends EditCommand {
185162
const ClearTextAttributionsCommand(this.documentRange);
186163

187164
final DocumentRange documentRange;
@@ -288,7 +265,7 @@ class ToggleInlineFormatRequest implements EditRequest {
288265
int get hashCode => inlineFormat.hashCode;
289266
}
290267

291-
class ToggleInlineFormatCommand implements EditCommand {
268+
class ToggleInlineFormatCommand extends EditCommand {
292269
const ToggleInlineFormatCommand(this.inlineFormat);
293270

294271
final Attribution inlineFormat;

super_editor/clones/quill/lib/editor/toolbar.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'package:feather/infrastructure/popovers/color_selector.dart';
44
import 'package:feather/editor/editor.dart';
55
import 'package:feather/infrastructure/popovers/icon_selector.dart';
66
import 'package:feather/infrastructure/popovers/text_item_selector.dart';
7-
import 'package:feather/infrastructure/super_editor_extensions.dart';
87
import 'package:feather/theme.dart';
98
import 'package:flutter/material.dart';
109
import 'package:material_symbols_icons/material_symbols_icons.dart';
@@ -185,7 +184,7 @@ class _FormattingToolbarState extends State<FormattingToolbar> {
185184
]);
186185

187186
// Clear the field and hide the URL bar
188-
_urlController!.clear();
187+
_urlController!.clearTextAndSelection();
189188
_urlFocusNode.unfocus(disposition: UnfocusDisposition.previouslyFocusedChild);
190189
_linkPopoverController.close();
191190
setState(() {});
@@ -220,7 +219,7 @@ class _FormattingToolbarState extends State<FormattingToolbar> {
220219
}
221220

222221
// Clear the field and hide the URL bar
223-
_imageController!.clear();
222+
_imageController!.clearTextAndSelection();
224223
_imageFocusNode.unfocus(disposition: UnfocusDisposition.previouslyFocusedChild);
225224
_imagePopoverController.close();
226225
setState(() {});
@@ -535,7 +534,7 @@ class _FormattingToolbarState extends State<FormattingToolbar> {
535534
onPressed: () {
536535
setState(() {
537536
_urlFocusNode.unfocus();
538-
_urlController!.clear();
537+
_urlController!.clearTextAndSelection();
539538
});
540539
},
541540
),
@@ -605,7 +604,7 @@ class _FormattingToolbarState extends State<FormattingToolbar> {
605604
onPressed: () {
606605
setState(() {
607606
_imageFocusNode.unfocus();
608-
_imageController!.clear();
607+
_imageController!.clearTextAndSelection();
609608
});
610609
},
611610
),

super_editor/clones/quill/lib/infrastructure/super_editor_extensions.dart

Lines changed: 0 additions & 7 deletions
This file was deleted.

super_editor/example/lib/demos/components/demo_text_with_hint.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ class _TextWithHintDemoState extends State<TextWithHintDemo> {
7171
Widget build(BuildContext context) {
7272
return SuperEditor(
7373
editor: _docEditor,
74-
document: _doc,
75-
composer: _composer,
7674
stylesheet: Stylesheet(
7775
documentPadding: const EdgeInsets.symmetric(vertical: 56, horizontal: 24),
7876
rules: defaultStylesheet.rules,

super_editor/example/lib/demos/components/demo_unselectable_hr.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ class _UnselectableHrDemoState extends State<UnselectableHrDemo> {
5252
Widget build(BuildContext context) {
5353
return SuperEditor(
5454
editor: _docEditor,
55-
document: _doc,
56-
composer: _composer,
5755
stylesheet: defaultStylesheet.copyWith(
5856
documentPadding: const EdgeInsets.symmetric(vertical: 56, horizontal: 24),
5957
),

super_editor/example/lib/demos/demo_animated_task_height.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ class _AnimatedTaskHeightDemoState extends State<AnimatedTaskHeightDemo> {
5252
print("Building the entire demo");
5353
return SuperEditor(
5454
editor: _docEditor,
55-
document: _doc,
56-
composer: _composer,
5755
stylesheet: defaultStylesheet.copyWith(
5856
documentPadding: const EdgeInsets.symmetric(vertical: 56, horizontal: 24),
5957
),

super_editor/example/lib/demos/demo_app_shortcuts.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ class _AppShortcutsDemoState extends State<AppShortcutsDemo> {
5252
child: Column(
5353
children: [
5454
Expanded(
55-
child: SuperEditor(
56-
editor: _editor,
57-
document: _doc,
58-
composer: _composer,
59-
),
55+
child: SuperEditor(editor: _editor),
6056
),
6157
const TextField(
6258
decoration: InputDecoration(

super_editor/example/lib/demos/demo_document_loses_focus.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class _LoseFocusDemoState extends State<LoseFocusDemo> {
4141
),
4242
child: SuperEditor(
4343
editor: _docEditor,
44-
document: _doc,
45-
composer: _composer,
4644
inputSource: TextInputSource.ime,
4745
stylesheet: defaultStylesheet.copyWith(
4846
documentPadding: const EdgeInsets.symmetric(vertical: 56, horizontal: 24),

0 commit comments

Comments
 (0)