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

[feature] : quill add magnifier #2026

Merged
merged 5 commits into from
Jul 17, 2024
Merged

[feature] : quill add magnifier #2026

merged 5 commits into from
Jul 17, 2024

Conversation

demoYang
Copy link
Contributor

@demoYang demoYang commented Jul 16, 2024

Description

Add magnifier. someone help me ?, i donot know how to pass all issue

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the package version in pubspec.yaml files.
  • All existing and new tests are passing.
  • I have run the commands in ./scripts/before_push.sh and it all passed successfully

Breaking Change

Does your PR require developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

@CatHood0 CatHood0 requested a review from EchoEllet July 16, 2024 16:45
}

/// Builds the handles by inserting them into the [context]'s overlay.
void showHandles() {
assert(_handles == null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about this change. It might be there for a reason. assert will be only invoked in development and removed in production.

Copy link
Collaborator

@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.

@demoYang Can you explain why this has been removed? I do plan on reverting the change, it shouldn't cause any issues at least for the release mode. Having an unknown error is better than unexpected behavior that is difficult to trace.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Reverted in #2338

Copy link
Collaborator

Choose a reason for hiding this comment

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

The assert was removed to workaround the assertion error, which is something we will avoid in future PRs.

@singerdmx
Copy link
Owner

❌ /home/runner/work/flutter-quill/flutter-quill/test/bug_fix_test.dart: 1742 - Disable context menu after selection for desktop platform 1742 - Disable context menu after selection for desktop platform PointerDeviceKind.touch (failed)
══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following StateError was thrown while handling a gesture:
Bad state: No element

When the exception was thrown, this was the stack:
#0 _Array.first (dart:core-patch/array.dart:51:5)
#1 RenderEditableTextLine.getLineBoundary (package:flutter_quill/src/widgets/quill/text_line.dart:912:28)
#2 RenderEditor.getLineAtOffset (package:flutter_quill/src/widgets/editor/editor.dart:1372:34)
#3 EditorTextSelectionOverlay._buildMagnifier (package:flutter_quill/src/widgets/others/text_selection.dart:471:41)
#4 EditorTextSelectionOverlay.showMagnifier (package:flutter_quill/src/widgets/others/text_selection.dart:403:7)
#5 QuillRawEditorState.showMagnifier (package:flutter_quill/src/widgets/raw_editor/raw_editor_state.dart:1801:24)
#6 _QuillEditorSelectionGestureDetectorBuilder.onSingleLongTapStart (package:flutter_quill/src/widgets/editor/editor.dart:567:13)
#7 _EditorTextSelectionGestureDetectorState._handleLongPressStart (package:flutter_quill/src/widgets/others/text_selection.dart:1033:36)

@CatHood0
Copy link
Collaborator

This is the part of the code that is throwing the error

Offset(lineBoxes.first.left, lineDy),

@demoYang
Copy link
Contributor Author

demoYang commented Jul 17, 2024

And i have a question : why not use TextSelectionGestureDetector replace EditorTextSelectionGestureDetector in quill,
TextSelectionGestureDetector have TapAndHorizontalDragGestureRecognizer that response tap and drag, so that cursor and magnifier can move when darg start

@singerdmx
Copy link
Owner

And i have a question : why not use TextSelectionGestureDetector replace EditorTextSelectionGestureDetector in quill, TextSelectionGestureDetector have TapAndHorizontalDragGestureRecognizer that response tap and drag, so that cursor and magnifier can move when darg start

EditorTextSelectionGestureDetector is probably in the old days.
You can give it a try with TextSelectionGestureDetector.

@singerdmx singerdmx merged commit af691e6 into singerdmx:master Jul 17, 2024
2 checks passed
@EchoEllet
Copy link
Collaborator

Can we separate this functionality into its own file/class?

@stepushchik
Copy link

_magnifierController.show(
  context: context,
  below: magnifierConfiguration.shouldDisplayHandlesInMagnifier
      ? null
      : _handles![0],
  builder: (_) => builtMagnifier,
);

Null check operator used on a null value in _showMagnifier(text_selection.dart:436): #2109

@CatHood0
Copy link
Collaborator

@stepushchik i'll solving this. The PR will be submitted as soon as possible

Comment on lines -1343 to -1346
if (!_hasFocus || textEditingValue.selection.isCollapsed) {
_selectionOverlay!.dispose();
_selectionOverlay = null;
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain this change?

  • Why _hasFocus has neglected?
  • textEditingValue.selection.isCollapsed removed from the check?
  • The _selectionOverlay.dispose() and _selectionOverlay = null; were removed?

Comment on lines +887 to +893
if (_selectionOverlay == null) {
_selectionOverlay = _createSelectionOverlay();
} else {
_selectionOverlay!.update(textEditingValue);
}
_selectionOverlay?.handlesVisible = _shouldShowSelectionHandles();
_selectionOverlay?.showHandles();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same for this change, if it's needed for this feature then shouldn't be hardcoded directly unless it's not related.

Comment on lines +842 to +845
if (lineBoxes.isEmpty) {
// Empty line, line box is empty
return TextRange.collapsed(position.offset);
}
Copy link
Collaborator

@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.

Why this change was introduced? Does it solve a problem that is introduced with this feature? If yes then it shouldn't affect users that don't use this feature.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@demoYang This issue is not solved.

);
}

void updateMagnifier(
Copy link
Collaborator

@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.

Can you explain the difference between updateMagnifier and _updateMagnifier? Is the private one is for internal use? More details are needed

EchoEllet added a commit that referenced this pull request Nov 9, 2024
* fix!: remove super_clipboard from flutter_quill_extensions and move it to quill_super_clipboard (#2322)

* chore!: remove the controller from the configuration class, remove the quill toolbar and editor provider widgets, and other minor breaking changes

* chore!: remove SimpleSpellCheckerService from flutter_quill_extensions

* chore!: remove experimental support for spell checking, remove the deprecated support for YouTube in flutter_quill_extensions, and other minor breaking changes

* chore(deps): remove equatable

* chore!: remove quill shared configuration and toolbar shared configuration

* chore!: remove QuillController.setContents()

* chore!: remove QuillController.editorFocusNode

* chore: remove outdated comments

* chore: always call setState() in _markNeedsBuild() in QuillRawEditorState even if dirty is already true (revert to old behavior)

* chore: extract code from _requestKeyboard() and add docs comment for _requireEditorCurrentState

* chore!: remove classes related to editor element options, minor docs updates in editor config, rename isOnTapOutsideEnabled to onTapOutsideEnabled

* chore!: rename 'Configurations' to 'Config'

* chore!: refactor build method of the embed block interface

* chore!: remove the experimental table support from flutter_quill_extensions

* chore!: remove old deprecated properties

* chore!: rename rawItemsMap to items for font family and font size options

* chore!: remove deprecated formula embed support from flutter_quill_extensions

* chore!: remove deprecated class SuperClipboardService, rename the directory models to config in flutter_quill_extensions

* chore: add commnet in imageProviderBuilder code docs comment in flutter_quill_extensions

* docs: fix typos in migration

* docs(readme): replace deprecated flutter_quill_internal.dart with internal.dart

* docs(readme): improve README

* docs(readme): add the GitHub flutter_quill code snippet back

* docs: add more details to the migration guide

* fix(ios): use the localized strings for 'open', 'copy', and 'remove'

* chore: rename the file quill_controller_configurations.dart to quill_controller_config.dart

* chore!: avoid storing quill editor config inside Document

* chore: restore search within embed objects feature (revert removal of editor config inside the QuillController)

* chore: add @experimental to some APIs

* docs: add emojis to the migration guide, add the migration guide link in README.md

* chore: removes quill controller web files, updates QuillControllerConfig.onClipboardPaste to allow overriding the default paste handling

* docs: fix typos in the migration guide

* chore: minor change in the migration guide

* docs: update link of QuillControllerConfig.onClipboardPaste in the migration guide

* chore: fix dart analysis issues

* chore: mark QuillEditorConfig.customLeadingBlockBuilder as experimental

* chore!: avoid exporting OptionalSize

* chore: rename _restoreToolbar to _restoreToolbarAfterMagnifier in text_selection.dart

* chore: annotate QuillEditorConfig.magnifierConfiguration as experimental

* chore: minor cleanup to magnifier feature

* chore: export missing class, fix #2333

* chore: fix dart analysis

* chore(release): temp changes to publish 11.0.0 (will revert changes of this commit)

* chore: add temp dependency_overrides to fix CI failure

* chore: temp changes to publish 11.0.0-dev.1

* ci(publish): temp change to fix CI failure

* chore: restore previous publish workflow (revert), update min version of flutter_quill in test and extensions packages, remove pubspec_overrides.yaml

* chore: revert CHANGELOG.md and publish.yml changes

* chore: revert a change in #2026 (see comment https://github.com/singerdmx/flutter-quill/pull/2026/files#r1679744497)

* chore: revert change of reverting the removal of _handles check introduced by #2026

* docs(migration): clarify the removal of the QuillToolbar widget

* docs(migration): improve removal of the QuillToolbar section

* docs: add the custom toolbar page link in: removal of the QuillToolbar

* docs: add important info at the top of the migration guide

* feat(toolbar): add the base button options feature back, supports flutter_quill_extensions's buttons too.

* chore: fix analysis warnings

* docs: add more details in the migration guide in the breaking behavior with code snippets

* chore: minor change to the 'Breaking behavior' section

* chore(deps): improve dependencies constraints for compatibility

- Fix #2341
- Fix #2347

* docs(migration): explain that QuillToolbar is not a visual widget like QuillSimpleToolbar

* docs: minor changes to README.md and migration guide

* feat: clipboard paste callbacks, partial fix to #2350

* docs: update outdated link in the migration guide

* chore: rename deltaToPaste() to getDeltaToPaste()

* docs: improve CHANGELOG.md format and quality, fixing #2211

* ci: pass the GitHub token to an action

* docs: fix format of CHANGELOG.md

* ci: use cider for CHANGELOG.md format validation

* ci: add a TODO to improve CHANGELOG.md validation

* chore: remove flutter_quill_extensions from publishing

* chore: publish flutter_quill_extensions and add 'insertVideo' in quill_en.arb

* chore(release): prepare to publish 11.0.0-dev.3

* ci: increase _expectedTranslationKeysLength due to 'insertVideo'

* ci: use a GitHub action to update the release notes

* chore(release): publish flutter_quill_extensions 11.0.0-dev.3

* chore(release): prepare to publish 11.0.0-dev.4

* ci: remove the release notes file creation

* chore(example): delete the current example to recreate

* chore: recreate the example (fix #2249), minor changes to flutter_quill_extensions

* docs(readme): update the screenshots of the example app

* docs(readme): update sample page link, remove 'breaking changes' from table of contents only

* feat: add the option to disable rich text paste feature, partial fix to #2350

* chore(release): prepare to publish 11.0.0-dev.5

* chore: regenerate translations to reflect #2358

* chore: ignore deprecations

* docs: fix a minor issue in the Contributing guide

* chore(example): add file read access for macOS

* feat(l10n): localize "insert video" for Khmer language

Source: #2358 (comment)

* chore: simplify PR template

* docs: update development notes

* docs(readme): use images from GitHub repo instead of relative path to load on pub.dev
@EchoEllet EchoEllet mentioned this pull request Nov 14, 2024
1 task
EchoEllet added a commit that referenced this pull request Dec 11, 2024
@EchoEllet EchoEllet mentioned this pull request Dec 11, 2024
8 tasks
EchoEllet added a commit that referenced this pull request Jan 7, 2025
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.

5 participants