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

Inline anchors turn to regular link on subsequent edits with the span rendered #12

Open
zerolab opened this issue Mar 24, 2023 · 4 comments

Comments

@zerolab
Copy link

zerolab commented Mar 24, 2023

Scenario:

  1. Select a bit of text in a paragraph and add an anchor. The editor shows the correct icon.
  2. Save and view the page. The selected text is wrapped correctly in a span
  3. Go to edit the page. The selected text is now a regular Wagtail link and will render as such after save
@jams2
Copy link

jams2 commented Mar 24, 2023

@zerolab I am unable to reproduce this on Wagtail 3.0 (no particular reason for that version, it was installed in my test project) or 4.2. Does your project have custom link handlers or other custom rich text processing? Perhaps there is a conflict.

@zerolab
Copy link
Author

zerolab commented Mar 24, 2023

No custom link handlers or rich text processing. Will dig more

@dest81
Copy link

dest81 commented Mar 24, 2023

@zerolab I can reproduce bug. If I use custom list of features and put anchor-identifier after link:

WAGTAILADMIN_RICH_TEXT_EDITORS = {
    "default": {
        "WIDGET": "wagtail.admin.rich_text.DraftailRichTextArea",
        "OPTIONS": {
            "features": [
                "bold",
                .......
                "link",
                "document-link",
                "anchor-identifier",
                ....
            ]
        },
    }
}

if anchor-identifier is placed before link works as expected.
In default config it works well because anchor-identifier feature is inserted as first element of the list:

@hooks.register("register_rich_text_features")
def register_rich_text_anchor_identifier_feature(features):
    features.default_features.insert(0, "anchor-identifier")

@zerolab
Copy link
Author

zerolab commented Mar 24, 2023

ooh, nice catch @dest81
can confirm our features definition had "anchor-identifier" after "link".

Perhaps this is a documentation issue then?

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

No branches or pull requests

3 participants