Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move members of magnifier feature into a separate files when possible (not final yet) #2251

Closed
wants to merge 2 commits into from

Conversation

EchoEllet
Copy link
Collaborator

@EchoEllet EchoEllet commented Sep 19, 2024

Description

Cleanup #2026 by extracting the new methods, members, and checks to separate files when possible

Not for merge yet, I'm uncertain about some of the changes made, waiting response from the contributor, also the new TODOs introduced in this PR need to be cleaned up before merging.

This PR does separate anything related to the magnifier feature in one manageable place in a simple way. Still need more improvements.

Even after the cleanup, the new code is still not qualified enough as I'm unable to understand some of the changes made. There might be inconsistency issues.

Related Issues

Type of Change

  • New feature: Adds new functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Code refactor: Code restructuring that does not affect behavior.
  • Breaking change: Alters existing functionality and requires updates.
  • 🧪 Tests: Adds new tests or modifies existing tests.
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Changes to build or deploy processes.

@@ -1114,8 +1116,7 @@ class QuillRawEditorState extends EditorState
? null
: (context) =>
widget.configurations.contextMenuBuilder!(context, this),
magnifierConfiguration: widget.configurations.magnifierConfiguration ??
TextMagnifier.adaptiveMagnifierConfiguration,
magnifierConfiguration: _magnifierConfiguration,
Copy link
Collaborator Author

@EchoEllet EchoEllet Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expression:

widget.configurations.magnifierConfiguration ??
          TextMagnifier.adaptiveMagnifierConfiguration

has been extracted into _magnifierConfiguration (quill_raw_editor_state_magnifier_ext.dart).

The name is not quite descriptive and needs to be changed or at least documented.

if (_selectionOverlay == null) return;
_selectionOverlay?.hideMagnifier();
}
void hideMagnifier() => _hideMagnifier();
Copy link
Collaborator Author

@EchoEllet EchoEllet Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _hideMagnifier is in the new file quill_raw_editor_state_magnifier_ext.dart. I would generally introduce this in a different way but since I'm not sure why it's done this way, I had to extract the implementation of those three methods into a private method that can be accessed only from this file. The main goal is to clean up the code, in general, this change needs to be improved as well, should be documented in a clear way.

Same for showMagnifier and updateMagnifier.

Comment on lines +383 to +386
// TODO: Are those specific to the magnifier? Is this a feature specific to the native Android
// and iOS apps (outside of the browser)? If yes, need to use isAndroidApp
// and isIosApp, if no, use isAndroid and isIos for clarity

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be addressed.

Comment on lines -98 to -103
void showMagnifier(Offset positionToShow);

void updateMagnifier(Offset positionToShow);

void hideMagnifier();

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why those methods added here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably bad design to be here

Copy link
Collaborator Author

@EchoEllet EchoEllet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to address those comments before process further.

@EchoEllet
Copy link
Collaborator Author

Haven't tested the changes yet.

@EchoEllet
Copy link
Collaborator Author

I have extracted some parts of this PR into release/v11. Closing this PR as I don't see it as a good time investment.

@EchoEllet EchoEllet closed this Oct 27, 2024
@EchoEllet EchoEllet deleted the chore/magnifier-cleanup branch October 27, 2024 13:19
@EchoEllet EchoEllet mentioned this pull request Dec 11, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants