About a week ago, some sort of update has broken my web extension, bbCode for Web Extensions (bbCodeWebEx).
While doing something like adding tags to a piece of text still works just fine in compose mode (though it serves no purpose there, because you cannot add tags directly), in HTML editing mode, it is not picking up the selected text.
Specifically, if I highlight a text, and right click to add a tag, this line of code is supposed to, and has until about a week ago, get the value of the selected text:
let currentSelection = window.getSelection().toString().trim();
Gives me the selected text in the compose window, and on other websites, but it gives me <empty string> in the HTML editing window.
Anyone know what might be causing this or if there might be a work around?
Also, am I the only one who thinks that chasing Google’s regular changes that brake stuff is a major PITA?
Google Blogger (Blogspot.com) has an editor that has a WYSIWYG mode, and a mode in which one can edit the HTML code directly.
They updated both earlier this year, and in the past week, some update to their HTML editor appears to have broken window.getSelection.
I continues to work in their WYSIWYG mode, so a recent update on their HTML mode broke something.
I am looking for one of two things:
A good work around, I am looking at using clickedElement.selectionStart among other things.
What exactly Google did to break the page, which I cannot determine.
Since I have not ported this extension to Chrome, I cannot determine if the problem is Goggle is not playing nice with WebExtensions, or if Google is not playing nice with Firefox.
Something interesting digging through the console log, while let currentSelection = window.getSelection().toString().trim();
gives no output, let currentSelection = window.getSelection();
gives the following output:
And this does read the selected text in the HTML edit window.
I don’t quite get the notation (I’m a lousy programmer), so I’m not sure how this works, and if there would be a drop in to replace window.getSelection in my extension.