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

Add additional information to selection #1952

Closed
1 task done
DavidHajum opened this issue Jun 26, 2024 · 3 comments
Closed
1 task done

Add additional information to selection #1952

DavidHajum opened this issue Jun 26, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@DavidHajum
Copy link

Is there an existing issue for this?

The question

I currently set my selection as a link like this:

quillController.formatSelection(LinkAttribute('https://www.test.de/user/$value'));

If applied to the text @123, this would result in this output:

<p><a href="https://www.test.de/user/123 " target="_blank">@123 </a></p>

I would now like to add additional classes, for example to also store an ID or an avatarUrl.

I tried this code

quillController.formatSelection(Attribute('id', AttributeScope.inline, asd));

but it always gives me the error

Unable to apply Style to leaf: {Attribute{key: link, scope: AttributeScope.inline, value: https://www.test.de/user/123 }, Attribute{key: id, scope: AttributeScope.ignore, value: asd}} 'package:flutter_quill/src/models/documents/nodes/leaf.dart': Failed assertion: line 31 pos 12: 'value.isInline || value.isIgnored || value.isEmpty'

Any help would be appreciated.

@DavidHajum DavidHajum added the help wanted Extra attention is needed label Jun 26, 2024
@CatHood0
Copy link
Collaborator

CatHood0 commented Jun 27, 2024

Which version are you using?

This is such as an issue that i had with an old version (9.3.13).

This happen because leaf just validate the attributes into the package (harcoded), and the custom attributes, aren't taked as a valid Attribute. But, this is solved at the current version.

@DavidHajum
Copy link
Author

Thank you very much for your answer.

I updated the package and the error is gone now, but the output still has not changed.

Instead of

<p><a href="https://www.test.de/user/123 " target="_blank">@123 </a></p>

I would expect something like this:

<p><a href="https://www.test.de/user/123" target="_blank" id="asd">@123 </a></p>

Or is my code completely wrong here?

@CatHood0
Copy link
Collaborator

CatHood0 commented Jun 27, 2024

This is happening since you're not configure the vsc_quill_delta_to_html package. This package is used at this one, but, is limited on the documentation. I suggest use manually the package, or just passing your custom ConverterOptions and read the offical docs to render you custom attributes.

Here is vsc_quill_delta_to_html

vsc_quill_delta_to_html just apply the common attributes from Quill, but, the custom ones need to be implemented by the users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants