Skip to content

fix(text-editor): link popup breaks in browsers without URL.canParse - #11099

Open
MichaelUray wants to merge 1 commit into
hcengineering:developfrom
MichaelUray:fix/link-popup-url-parse
Open

MichaelUray wants to merge 1 commit into
hcengineering:developfrom
MichaelUray:fix/link-popup-url-parse

Conversation

@MichaelUray

Copy link
Copy Markdown
Contributor

Fixes #8849

Problem and change

URL.canParse is only available since Chrome 120 / Safari 17. On older browsers the reactive canSave check in LinkPopup threw a TypeError, so the link dialog could neither be saved nor closed. Reference URL parsing in the reference extension used the same API.

Add a small canParseUrl helper based on try { new URL() } catch and use it in LinkPopup and the reference extension, with a unit test.

Tests

url.test.ts. Manual: select text → Link → enter a URL → Save, also after delete URL.canParse in the console (simulating an older browser).

URL.canParse is only available since Chrome 120 / Safari 17. On older browsers the reactive canSave check in LinkPopup threw a TypeError, so the link dialog could neither be saved nor closed. Reference URL parsing in the reference extension used the same API.

Add a small canParseUrl helper based on try { new URL() } catch and use it in LinkPopup and the reference extension, with a unit test.

Fixes hcengineering#8849

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

Dialog for adding a link to the chat does not close

1 participant