Skip to content

Move readOnly back to QuillEditor (revert)? #2446

Closed as not planned
Closed as not planned
@EchoEllet

Description

@EchoEllet

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feedback requestedSeeking user input to improve features, resolve issues, or plan future updates.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions