File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1812,10 +1812,28 @@ function pluginFormcreatorInitializeTag(fieldName, rand) {
18121812 * Initialize a textarea field
18131813 */
18141814function pluginFormcreatorInitializeTextarea ( fieldName , rand ) {
1815- var field = $ ( '[name="' + fieldName + '"]' ) ;
1816- field . on ( "change" , function ( e ) {
1817- plugin_formcreator . showFields ( $ ( field [ 0 ] . form ) ) ;
1818- } ) ;
1815+ if ( tinyMCE . majorVersion < 5 ) {
1816+ var field = $ ( '[name="' + fieldName + '"]' ) ;
1817+ field . on ( "change" , function ( e ) {
1818+ plugin_formcreator . showFields ( $ ( field [ 0 ] . form ) ) ;
1819+ } ) ;
1820+ } else {
1821+ var i = 0 ;
1822+ var e ;
1823+ while ( e = tinymce . get ( i ++ ) ) {
1824+ var field = $ ( '[name="' + fieldName + '"]' ) ;
1825+ var form = field [ 0 ] . form ;
1826+ if ( e . formElement != form ) {
1827+ continue ;
1828+ }
1829+ // https://stackoverflow.com/a/63342064
1830+ e . on ( 'input NodeChange' , function ( e ) {
1831+ tinyMCE . triggerSave ( ) ;
1832+ plugin_formcreator . showFields ( $ ( form ) ) ;
1833+ } ) ;
1834+ return ;
1835+ }
1836+ }
18191837}
18201838
18211839/**
You can’t perform that action at this time.
0 commit comments