Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Cannot read style type of hyperlinksΒ #296

@d-e-v-esh

Description

@d-e-v-esh

Bug Report πŸ›

We get this error while trying to calculate the style of hyperlinks:

chrome_fzY8aTnY6q

As you can see in this line that we need the value editor.selection for currentStyleCalculated which will tell us the type of the current block. It works absolutely great for every single type of text except for hyperlinks.

This issue did not surface beforehand because it was inside a conditional statement which only allowed this calculation to take place if (editor && editor.selection) outputted a positive result, as well as the change in style-type was not 'real-time' so it was difficult to catch, see #283 for more details. That is why the style type got defaulted to the string 'Style' whenever this happened.

What appears here from some basic testing (logging !!editor.selection on console) is that calculating the style of hyperlinks itself is not creating the issue. The error comes up as soon as the pop-up appears.


3ytsK9qOzr

You can see here that the value is truthy at first but when the pop-up appears, it becomes falsy(here: null).

Expected Behavior

We should be able to calculate the style type of link. editor.selection should not be undefined when the pop-up menu appears. Also, we should be able to calculate the style of the block where the link is whether it is any of the headings or the paragraph.

Possible Solution

Seems like the problem might be being caused by how the pop-up is being rendered.

Steps to Reproduce

  1. Go to any line with a link and click on the link.
  2. You would get the above-mentioned error in the console.

Context (Environment)

Desktop

  • OS: Windows 10
  • Browser: Chrome
  • Version 88.0.4324.182 (Official Build) (64-bit)

Detailed Description

Possible Implementation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions