Skip to content

Expose Rule type so that Document.setCustomRules can be used #2484

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

Merged
merged 1 commit into from
Feb 22, 2025

Conversation

tjarvstrand
Copy link
Contributor

Description

Exposes the Rule type through the public API. It's been around for a while and not seen a ton of changes. Document exposes the setCustomRules-method, but it is not strictly speaking callable through the public API since Rule and all its subtypes are only exposed through the internal API.

In our specific use case, we have a custom inline style that we would like to preserve the style of when typing in the middle of it. One option would be to expose the PreserveInlineStylesRule and make it more configurable. That would actually be more preferable for us but it seemed a lot more invasive, so I opted to try this route instead.

Type of Change

  • Feature: New functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Refactor: Code reorganization, no behavior change.
  • Breaking: Alters existing functionality and requires updates.
  • 🧪 Tests: New or modified tests
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Build/configuration changes.

@CatHood0 CatHood0 requested a review from singerdmx February 21, 2025 02:00
@tjarvstrand
Copy link
Contributor Author

tjarvstrand commented Feb 21, 2025

@CatHood0 Would you be open to also exposing the PreserveInlineStylesRule and make it parameterizable in terms of which keys it preserves?

@CatHood0 CatHood0 merged commit 693f4ac into singerdmx:master Feb 22, 2025
7 checks passed
@CatHood0
Copy link
Collaborator

CatHood0 commented Feb 23, 2025

@CatHood0 Would you be open to also exposing the PreserveInlineStylesRule and make it parameterizable in terms of which keys it preserves?

@tjarvstrand The problem of parameterizing a single Rule, could perhaps cause all the others to have to be changed.

If you can explain to me a little more what you will do, i'll be able to tell you if it will be viable or if you will have to change it.

@tjarvstrand
Copy link
Contributor Author

If you can explain to me a little more what you will do, i'll be able to tell you if it will be viable or if you will have to change it.

Sure thing. We are adding commenting functionality on top of flutter-quill. A user selects a section of text and adds a comment and then we'd like to highlight that part of the text to make it visible to other users that there's a comment there. We'd like this formatting to be "sticky", i.e. if you type inside a section of text that has a comment, the commented area should expand. Basically, we'd just need to add an additional attribute to the Attribute.inlineKeys used by the current PreserveInlineStylesRule.

CatHood0 pushed a commit to CatHood0/flutter-quill that referenced this pull request Mar 12, 2025
wangjinshan pushed a commit to wangjinshan/flutter-quill that referenced this pull request Apr 29, 2025
* master: (83 commits)
  Add copyWith methods to DefaultStyles, HorizontalSpacing, and VerticalSpacing (singerdmx#2550)
  docs: update migration guide to relfect singerdmx#2529
  chore(release): prepare to publish 11.4.0
  feat: allow to override link validation check, and accept mailto and other links by default (singerdmx#2525)
  chore(release): prepare to publish 11.3.0
  Fix selection in readOnly mode, Add magnifier via RawMagnifier widget (singerdmx#2529)
  Clarify platform support of QuillEditorConfig.onKeyPressed (singerdmx#2542)
  chore(release): prepare to publish 11.2.0
  feat: cache for toPlainText in Document to avoid unnecessary text computing (singerdmx#2482)
  chore(example): update deps
  chore(release): prepare to publish 11.1.2
  fix: QuillEditor doesn't respect the system keyboard brightness by default on iOS (singerdmx#2522)
  chore(release): prepare to publish flutter_quill_test
  chore(release): prepare to publish 11.1.1
  Chore: general improvements in flutter_quill_tests API (singerdmx#2512)
  Explicitly schedule frame on secondary click. (singerdmx#2507)
  chore(release): prepare to publish 11.1.0
  fix: unpredictable endless loop of '_handleFocusChanged' in the phase of page route changing when editor is set to readonly. (singerdmx#2488)
  feat: Enable BoxDecoration for DefaultTextBlockStyle of header Attribute (singerdmx#2438)
  Expose Rule type so that Document.setCustomRules can be used (singerdmx#2484)
  ...
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