-
Notifications
You must be signed in to change notification settings - Fork 124
Cannot read style type of hyperlinksΒ #296
Description
Bug Report π
We get this error while trying to calculate the style of hyperlinks:
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.
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
- Go to any line with a link and click on the link.
- 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)

