GetmeUK / ContentTools

A JS library for building WYSIWYG editors for HTML content.
http://getcontenttools.com
MIT License
3.95k stars 393 forks source link

Wrong condition order in Paragraph tool #516

Open magiksd opened 5 years ago

magiksd commented 5 years ago

Hello, while reading how tools are made in CT, I noticed that the method "canApply" in the Paragraph tool could possibly throw an error if the element is undefined.

That's because the "element" variable is used before being tested if defined, so the call to "element.isFixed()" will throw an error if "element" is undefined.

You should write instead :

return element != undefined and not element.isFixed();
anthonyjb commented 5 years ago

@magiksd thank you! :+1: