File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -1812,10 +1812,28 @@ function pluginFormcreatorInitializeTag(fieldName, rand) {
1812
1812
* Initialize a textarea field
1813
1813
*/
1814
1814
function 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
+ }
1819
1837
}
1820
1838
1821
1839
/**
You can’t perform that action at this time.
0 commit comments