webfashionist / RichText

WYSIWYG editor developed as jQuery plugin
GNU Affero General Public License v3.0
112 stars 62 forks source link

Malformed conditional is setting cursor on unrelated images. #123

Closed michaelthornberry closed 4 months ago

michaelthornberry commented 4 months ago

Describe the problem

Line 1027, there is a check as such:

if ($target.prop("tagName") === "IMG" && $target.parents("#" + editorID)) {

Since $target.parents("#" + editorID) returns a valid jQuery result, the following code is executed even though the .length of that query may be 0.

What did you expect?

The conditional should check the length of the result:

if ($target.prop("tagName") === "IMG" && $target.parents("#" + editorID).length) {

What version and browser are you using?

Version: 1.1.0 Browser and version: Chrome 126.0.6478.114

Bug report checklist

webfashionist commented 4 months ago

Hi @michaelthornberry

thank you for your report! The issue has been fixed with ed1c663

michaelthornberry commented 4 months ago

thank you for your report! The issue has been fixed with [ed1c663]

Thanks!