From a69435f15adf77164ab19fb809b1b5c6d0bca3f1 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Thu, 3 Oct 2024 11:56:36 +0300 Subject: [PATCH 1/3] - fix min-height and height of html textarea --- assets/js/um-profile.js | 13 +++++++++++++ includes/core/um-filters-fields.php | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/assets/js/um-profile.js b/assets/js/um-profile.js index f3232353..f145bd8d 100644 --- a/assets/js/um-profile.js +++ b/assets/js/um-profile.js @@ -139,4 +139,17 @@ jQuery(document).ready(function() { jQuery( '.um-profile-nav a' ).on( 'touchend', function(e) { jQuery( e.currentTarget).trigger( "click" ); }); + + let textarea_iframe = jQuery('iframe.um-textarea-html-value, .mce-edit-area iframe'); + textarea_iframe.each(function() { + jQuery(this).onload = function() { + resizeIframe(iframe); + }; + }); }); + +function resizeIframe(obj, height) { + let dataHeight = obj.getAttribute('data-height'); + obj.style.minHeight = obj.contentWindow.document.documentElement.scrollHeight + 'px'; + obj.style.height = dataHeight + 'px'; +} diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php index 6d5d2bc9..582016e8 100644 --- a/includes/core/um-filters-fields.php +++ b/includes/core/um-filters-fields.php @@ -259,8 +259,10 @@ function um_profile_field_filter_hook__textarea( $value, $data ) { if ( ! $value ) { return ''; } + if ( ! empty( $data['html'] ) ) { - return ''; + $height = isset( $data['height'] ) && absint( $data['height'] ) > 0 ? absint( $data['height'] ) : ''; + return ''; } $description_key = UM()->profile()->get_show_bio_key( UM()->fields()->global_args ); From 19b7ef92b210557ab5403507fd0aac295f3a8f42 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Thu, 3 Oct 2024 12:23:11 +0300 Subject: [PATCH 2/3] - fix attrs in tags for html textarea --- includes/core/um-filters-fields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php index 582016e8..481b12b8 100644 --- a/includes/core/um-filters-fields.php +++ b/includes/core/um-filters-fields.php @@ -262,7 +262,7 @@ function um_profile_field_filter_hook__textarea( $value, $data ) { if ( ! empty( $data['html'] ) ) { $height = isset( $data['height'] ) && absint( $data['height'] ) > 0 ? absint( $data['height'] ) : ''; - return ''; + return ''; } $description_key = UM()->profile()->get_show_bio_key( UM()->fields()->global_args ); From ae1af55fde388c00699fd7ad7ab361a8f5ded6fe Mon Sep 17 00:00:00 2001 From: ashubawork Date: Thu, 3 Oct 2024 12:24:55 +0300 Subject: [PATCH 3/3] - remove wrong code --- assets/js/um-profile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/um-profile.js b/assets/js/um-profile.js index f145bd8d..3b78d19d 100644 --- a/assets/js/um-profile.js +++ b/assets/js/um-profile.js @@ -140,7 +140,7 @@ jQuery(document).ready(function() { jQuery( e.currentTarget).trigger( "click" ); }); - let textarea_iframe = jQuery('iframe.um-textarea-html-value, .mce-edit-area iframe'); + let textarea_iframe = jQuery('iframe.um-textarea-html-value'); textarea_iframe.each(function() { jQuery(this).onload = function() { resizeIframe(iframe);