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

Move readOnly back to QuillEditor (revert)? #2446

Open
EchoEllet opened this issue Jan 19, 2025 · 0 comments
Open

Move readOnly back to QuillEditor (revert)? #2446

EchoEllet opened this issue Jan 19, 2025 · 0 comments
Labels
feedback requested Seeking user input to improve features, resolve issues, or plan future updates.

Comments

@EchoEllet
Copy link
Collaborator

EchoEllet commented Jan 19, 2025

The PR #1843 moved the readOnly from the editor config to the controller as a breaking change, so to change it:

_controller.readOnly = true;

instead of:

QuillEditor.basic(
  config: const QuillEditorConfig(
    readOnly: true,
  ),
)

The setState is required:

IconButton(
  icon: Icon(_controller.readOnly ? Icons.edit : Icons.lock),
  tooltip: 'Toggle read-only',
  onPressed: () {
    setState(() {
      _controller.readOnly = !_controller.readOnly;
    });
  },
)
FlutterQuillReadOnly.mov

I figure that this approach might not be efficient enough, is a bit confusing, and can cause performance issues (need more consideration and investigation).

Since the QuillController now depends on readOnly (PRs after #1843 used it), we will need to store it as an internal property that will be set when the controller is connected to the QuillEditor (such code definitely needs tests), see related lines.

@EchoEllet EchoEllet added the feedback requested Seeking user input to improve features, resolve issues, or plan future updates. label Jan 19, 2025
@EchoEllet EchoEllet pinned this issue Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback requested Seeking user input to improve features, resolve issues, or plan future updates.
Projects
None yet
Development

No branches or pull requests

1 participant