Skip to content

Commit

Permalink
4+
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellet committed Dec 6, 2023
1 parent d7ef182 commit c5c8083
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 479 deletions.
1 change: 0 additions & 1 deletion lib/src/models/config/editor/configurations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter/material.dart'
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart' show experimental;

import '../../../widgets/editor/editor.dart';
import '../../../widgets/editor/editor_builder.dart';
import '../../../widgets/others/controller.dart';
import '../../../widgets/others/default_styles.dart';
Expand Down
27 changes: 0 additions & 27 deletions lib/src/widgets/editor/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import '../../models/config/raw_editor/configurations.dart';
import '../../models/documents/document.dart';
import '../../models/documents/nodes/container.dart' as container_node;
import '../../models/documents/nodes/leaf.dart';
import '../../models/structs/offset_value.dart';
import '../../utils/platform.dart';
import '../others/box.dart';
import '../others/cursor.dart';
Expand All @@ -26,32 +25,6 @@ import '../raw_editor/raw_editor.dart';
import '../utils/provider.dart';
import 'editor_builder.dart';

/// Base interface for the editor state which defines contract used by
/// various mixins.
abstract class EditorState extends State<QuillRawEditor>
implements TextSelectionDelegate {
ScrollController get scrollController;

RenderEditor get renderEditor;

EditorTextSelectionOverlay? get selectionOverlay;

List<OffsetValue> get pasteStyleAndEmbed;

String get pastePlainText;

/// Controls the floating cursor animation when it is released.
/// The floating cursor is animated to merge with the regular cursor.
AnimationController get floatingCursorResetController;

/// Returns true if the editor has been marked as needing to be rebuilt.
bool get dirty;

bool showToolbar();

void requestKeyboard();
}

/// Base interface for editable render objects.
abstract class RenderAbstractEditor implements TextLayoutMetrics {
TextSelection selectWordAtPosition(TextPosition position);
Expand Down
1 change: 1 addition & 0 deletions lib/src/widgets/others/delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import '../../models/documents/attribute.dart';
import '../../models/documents/nodes/leaf.dart';
import '../../utils/platform.dart';
import '../editor/editor.dart';
import '../raw_editor/raw_editor.dart';
import 'embeds.dart';
import 'text_selection.dart';

Expand Down
38 changes: 37 additions & 1 deletion lib/src/widgets/raw_editor/raw_editor.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import 'package:flutter/widgets.dart'
show BuildContext, State, StatefulWidget, Widget;
show
AnimationController,
BuildContext,
ScrollController,
State,
StatefulWidget,
TextSelectionDelegate,
Widget;
import 'package:meta/meta.dart' show immutable;

import '../../models/config/raw_editor/configurations.dart';
import '../../models/structs/offset_value.dart';
import '../editor/editor.dart';
import '../others/text_selection.dart';
import 'raw_editor_state.dart';

class QuillRawEditor extends StatefulWidget {
Expand Down Expand Up @@ -49,3 +59,29 @@ class QuillEditorGlyphHeights {
final double startGlyphHeight;
final double endGlyphHeight;
}

/// Base interface for the editor state which defines contract used by
/// various mixins.
abstract class EditorState extends State<QuillRawEditor>
implements TextSelectionDelegate {
ScrollController get scrollController;

RenderEditor get renderEditor;

EditorTextSelectionOverlay? get selectionOverlay;

List<OffsetValue> get pasteStyleAndEmbed;

String get pastePlainText;

/// Controls the floating cursor animation when it is released.
/// The floating cursor is animated to merge with the regular cursor.
AnimationController get floatingCursorResetController;

/// Returns true if the editor has been marked as needing to be rebuilt.
bool get dirty;

bool showToolbar();

void requestKeyboard();
}
160 changes: 0 additions & 160 deletions lib/src/widgets/raw_editor/raw_editor_context_menu_items.dart

This file was deleted.

7 changes: 3 additions & 4 deletions lib/src/widgets/raw_editor/raw_editor_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ class QuillRawEditorState extends EditorState
.call(content);
}

/// Returns the [ContextMenuButtonItem]s representing the buttons in this
/// platform's default selection menu for [QuillRawEditor].
///
/// Copied from [EditableTextState].
// List<ContextMenuButtonItem> get contextMenuButtonItems {
// return EditableText.getEditableButtonItems(
// clipboardStatus: _clipboardStatus.value,
Expand Down Expand Up @@ -297,6 +293,9 @@ class QuillRawEditorState extends EditorState
}
}

/// Returns the [ContextMenuButtonItem]s representing the buttons in this
/// platform's default selection menu for [QuillRawEditor].
/// Copied from [EditableTextState].
List<ContextMenuButtonItem> get contextMenuButtonItems {
return EditableText.getEditableButtonItems(
clipboardStatus: _clipboardStatus.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../../models/documents/nodes/embeddable.dart';
import '../../models/documents/nodes/leaf.dart';
import '../../models/documents/style.dart';
import '../../utils/delta.dart';
import '../editor/editor.dart';
import 'raw_editor.dart';

mixin RawEditorStateSelectionDelegateMixin on EditorState
implements TextSelectionDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter/services.dart';
import '../../models/documents/document.dart';
import '../../utils/delta.dart';
import '../editor/editor.dart';
import 'raw_editor.dart';

mixin RawEditorStateTextInputClientMixin on EditorState
implements TextInputClient {
Expand Down
1 change: 0 additions & 1 deletion lib/src/widgets/toolbar/base_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export 'buttons/link_style2_button.dart';
export 'buttons/link_style_button.dart';
export 'buttons/quill_icon_button.dart';
export 'buttons/search/search_button.dart';
export 'buttons/select_alignment_old_buttons.dart';
export 'buttons/select_header_style_buttons.dart';
export 'buttons/toggle_check_list_button.dart';
export 'buttons/toggle_style_button.dart';
Expand Down
Loading

0 comments on commit c5c8083

Please sign in to comment.