yii-starter-kit / yii2-starter-kit

Yii2 Starter Kit
http://yii2-starter-kit.terentev.net
Other
1.41k stars 646 forks source link

Redactor - Error: Uncaught TypeError: $(...).closest(...).size is not a function - Solution #684

Open AngelDios opened 5 years ago

AngelDios commented 5 years ago

Hello, I came across this problem with Redactorwhich was presented to me after updating composer.json, reviewing by the inspector I came across the error: Uncaught TypeError: $(...).closest(...).size is not a function,

image

After reviewing I saw that the error was presented in the line 1463 of the redactor. js

image

generated by the update that was made of the jquery (version 3.x), searching the web I found the solution to the problem, I want to know if it is a feasible solution or has to be corrected in another way.

Solution:

original

line 1463: if ($(e.target).closest('.redactor-editor, .redactor-toolbar, .redactor-dropdown').size() !== 0) line 6913: if ($current.closest(element).size() > 0)

modified line 1463: if ($(e.target).closest('.redactor-editor, .redactor-toolbar, .redactor-dropdown').length !== 0) line 6913: if ($current.closest(element).length > 0)

Reference: stackoverflow

P.D: I'm still waiting to solve this case