Edit File by line
/home/zeestwma/redstone.../wp-inclu...
File: block-editor.php
$supported_block_attributes = get_block_bindings_supported_attributes( $block_type );
[500] Fix | Delete
if ( ! empty( $supported_block_attributes ) ) {
[501] Fix | Delete
$editor_settings['__experimentalBlockBindingsSupportedAttributes'][ $block_type ] = $supported_block_attributes;
[502] Fix | Delete
}
[503] Fix | Delete
}
[504] Fix | Delete
[505] Fix | Delete
$global_styles = array();
[506] Fix | Delete
$presets = array(
[507] Fix | Delete
array(
[508] Fix | Delete
'css' => 'variables',
[509] Fix | Delete
'__unstableType' => 'presets',
[510] Fix | Delete
'isGlobalStyles' => true,
[511] Fix | Delete
),
[512] Fix | Delete
array(
[513] Fix | Delete
'css' => 'presets',
[514] Fix | Delete
'__unstableType' => 'presets',
[515] Fix | Delete
'isGlobalStyles' => true,
[516] Fix | Delete
),
[517] Fix | Delete
);
[518] Fix | Delete
foreach ( $presets as $preset_style ) {
[519] Fix | Delete
$actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) );
[520] Fix | Delete
if ( '' !== $actual_css ) {
[521] Fix | Delete
$preset_style['css'] = $actual_css;
[522] Fix | Delete
$global_styles[] = $preset_style;
[523] Fix | Delete
}
[524] Fix | Delete
}
[525] Fix | Delete
[526] Fix | Delete
if ( wp_theme_has_theme_json() ) {
[527] Fix | Delete
$block_classes = array(
[528] Fix | Delete
'css' => 'styles',
[529] Fix | Delete
'__unstableType' => 'theme',
[530] Fix | Delete
'isGlobalStyles' => true,
[531] Fix | Delete
);
[532] Fix | Delete
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
[533] Fix | Delete
if ( '' !== $actual_css ) {
[534] Fix | Delete
$block_classes['css'] = $actual_css;
[535] Fix | Delete
$global_styles[] = $block_classes;
[536] Fix | Delete
}
[537] Fix | Delete
[538] Fix | Delete
/*
[539] Fix | Delete
* Add the custom CSS as a separate stylesheet so any invalid CSS
[540] Fix | Delete
* entered by users does not break other global styles.
[541] Fix | Delete
*/
[542] Fix | Delete
$global_styles[] = array(
[543] Fix | Delete
'css' => wp_get_global_stylesheet( array( 'custom-css' ) ),
[544] Fix | Delete
'__unstableType' => 'user',
[545] Fix | Delete
'isGlobalStyles' => true,
[546] Fix | Delete
);
[547] Fix | Delete
} else {
[548] Fix | Delete
// If there is no `theme.json` file, ensure base layout styles are still available.
[549] Fix | Delete
$block_classes = array(
[550] Fix | Delete
'css' => 'base-layout-styles',
[551] Fix | Delete
'__unstableType' => 'base-layout',
[552] Fix | Delete
'isGlobalStyles' => true,
[553] Fix | Delete
);
[554] Fix | Delete
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
[555] Fix | Delete
if ( '' !== $actual_css ) {
[556] Fix | Delete
$block_classes['css'] = $actual_css;
[557] Fix | Delete
$global_styles[] = $block_classes;
[558] Fix | Delete
}
[559] Fix | Delete
}
[560] Fix | Delete
[561] Fix | Delete
$editor_settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );
[562] Fix | Delete
[563] Fix | Delete
$editor_settings['__experimentalFeatures'] = wp_get_global_settings();
[564] Fix | Delete
// These settings may need to be updated based on data coming from theme.json sources.
[565] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
[566] Fix | Delete
$colors_by_origin = $editor_settings['__experimentalFeatures']['color']['palette'];
[567] Fix | Delete
$editor_settings['colors'] = isset( $colors_by_origin['custom'] ) ?
[568] Fix | Delete
$colors_by_origin['custom'] : (
[569] Fix | Delete
isset( $colors_by_origin['theme'] ) ?
[570] Fix | Delete
$colors_by_origin['theme'] :
[571] Fix | Delete
$colors_by_origin['default']
[572] Fix | Delete
);
[573] Fix | Delete
}
[574] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) {
[575] Fix | Delete
$gradients_by_origin = $editor_settings['__experimentalFeatures']['color']['gradients'];
[576] Fix | Delete
$editor_settings['gradients'] = isset( $gradients_by_origin['custom'] ) ?
[577] Fix | Delete
$gradients_by_origin['custom'] : (
[578] Fix | Delete
isset( $gradients_by_origin['theme'] ) ?
[579] Fix | Delete
$gradients_by_origin['theme'] :
[580] Fix | Delete
$gradients_by_origin['default']
[581] Fix | Delete
);
[582] Fix | Delete
}
[583] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
[584] Fix | Delete
$font_sizes_by_origin = $editor_settings['__experimentalFeatures']['typography']['fontSizes'];
[585] Fix | Delete
$editor_settings['fontSizes'] = isset( $font_sizes_by_origin['custom'] ) ?
[586] Fix | Delete
$font_sizes_by_origin['custom'] : (
[587] Fix | Delete
isset( $font_sizes_by_origin['theme'] ) ?
[588] Fix | Delete
$font_sizes_by_origin['theme'] :
[589] Fix | Delete
$font_sizes_by_origin['default']
[590] Fix | Delete
);
[591] Fix | Delete
}
[592] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['custom'] ) ) {
[593] Fix | Delete
$editor_settings['disableCustomColors'] = ! $editor_settings['__experimentalFeatures']['color']['custom'];
[594] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['color']['custom'] );
[595] Fix | Delete
}
[596] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['customGradient'] ) ) {
[597] Fix | Delete
$editor_settings['disableCustomGradients'] = ! $editor_settings['__experimentalFeatures']['color']['customGradient'];
[598] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['color']['customGradient'] );
[599] Fix | Delete
}
[600] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ) ) {
[601] Fix | Delete
$editor_settings['disableCustomFontSizes'] = ! $editor_settings['__experimentalFeatures']['typography']['customFontSize'];
[602] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] );
[603] Fix | Delete
}
[604] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] ) ) {
[605] Fix | Delete
$editor_settings['enableCustomLineHeight'] = $editor_settings['__experimentalFeatures']['typography']['lineHeight'];
[606] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] );
[607] Fix | Delete
}
[608] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['units'] ) ) {
[609] Fix | Delete
$editor_settings['enableCustomUnits'] = $editor_settings['__experimentalFeatures']['spacing']['units'];
[610] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['spacing']['units'] );
[611] Fix | Delete
}
[612] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['padding'] ) ) {
[613] Fix | Delete
$editor_settings['enableCustomSpacing'] = $editor_settings['__experimentalFeatures']['spacing']['padding'];
[614] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['spacing']['padding'] );
[615] Fix | Delete
}
[616] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'] ) ) {
[617] Fix | Delete
$editor_settings['disableCustomSpacingSizes'] = ! $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'];
[618] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'] );
[619] Fix | Delete
}
[620] Fix | Delete
[621] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'] ) ) {
[622] Fix | Delete
$spacing_sizes_by_origin = $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'];
[623] Fix | Delete
$editor_settings['spacingSizes'] = isset( $spacing_sizes_by_origin['custom'] ) ?
[624] Fix | Delete
$spacing_sizes_by_origin['custom'] : (
[625] Fix | Delete
isset( $spacing_sizes_by_origin['theme'] ) ?
[626] Fix | Delete
$spacing_sizes_by_origin['theme'] :
[627] Fix | Delete
$spacing_sizes_by_origin['default']
[628] Fix | Delete
);
[629] Fix | Delete
}
[630] Fix | Delete
[631] Fix | Delete
$editor_settings['__unstableResolvedAssets'] = _wp_get_iframed_editor_assets();
[632] Fix | Delete
$editor_settings['__unstableIsBlockBasedTheme'] = wp_is_block_theme();
[633] Fix | Delete
$editor_settings['localAutosaveInterval'] = 15;
[634] Fix | Delete
$editor_settings['disableLayoutStyles'] = current_theme_supports( 'disable-layout-styles' );
[635] Fix | Delete
$editor_settings['__experimentalDiscussionSettings'] = array(
[636] Fix | Delete
'commentOrder' => get_option( 'comment_order' ),
[637] Fix | Delete
'commentsPerPage' => get_option( 'comments_per_page' ),
[638] Fix | Delete
'defaultCommentsPage' => get_option( 'default_comments_page' ),
[639] Fix | Delete
'pageComments' => get_option( 'page_comments' ),
[640] Fix | Delete
'threadComments' => get_option( 'thread_comments' ),
[641] Fix | Delete
'threadCommentsDepth' => get_option( 'thread_comments_depth' ),
[642] Fix | Delete
'defaultCommentStatus' => get_option( 'default_comment_status' ),
[643] Fix | Delete
'avatarURL' => get_avatar_url(
[644] Fix | Delete
'',
[645] Fix | Delete
array(
[646] Fix | Delete
'size' => 96,
[647] Fix | Delete
'force_default' => true,
[648] Fix | Delete
'default' => get_option( 'avatar_default' ),
[649] Fix | Delete
)
[650] Fix | Delete
),
[651] Fix | Delete
);
[652] Fix | Delete
[653] Fix | Delete
$post_content_block_attributes = wp_get_post_content_block_attributes();
[654] Fix | Delete
[655] Fix | Delete
if ( isset( $post_content_block_attributes ) ) {
[656] Fix | Delete
$editor_settings['postContentAttributes'] = $post_content_block_attributes;
[657] Fix | Delete
}
[658] Fix | Delete
[659] Fix | Delete
$editor_settings['canUpdateBlockBindings'] = current_user_can( 'edit_block_binding', $block_editor_context );
[660] Fix | Delete
[661] Fix | Delete
/**
[662] Fix | Delete
* Filters the settings to pass to the block editor for all editor type.
[663] Fix | Delete
*
[664] Fix | Delete
* @since 5.8.0
[665] Fix | Delete
*
[666] Fix | Delete
* @param array $editor_settings Default editor settings.
[667] Fix | Delete
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
[668] Fix | Delete
*/
[669] Fix | Delete
$editor_settings = apply_filters( 'block_editor_settings_all', $editor_settings, $block_editor_context );
[670] Fix | Delete
[671] Fix | Delete
if ( ! empty( $block_editor_context->post ) ) {
[672] Fix | Delete
$post = $block_editor_context->post;
[673] Fix | Delete
[674] Fix | Delete
/**
[675] Fix | Delete
* Filters the settings to pass to the block editor.
[676] Fix | Delete
*
[677] Fix | Delete
* @since 5.0.0
[678] Fix | Delete
* @deprecated 5.8.0 Use the {@see 'block_editor_settings_all'} filter instead.
[679] Fix | Delete
*
[680] Fix | Delete
* @param array $editor_settings Default editor settings.
[681] Fix | Delete
* @param WP_Post $post Post being edited.
[682] Fix | Delete
*/
[683] Fix | Delete
$editor_settings = apply_filters_deprecated( 'block_editor_settings', array( $editor_settings, $post ), '5.8.0', 'block_editor_settings_all' );
[684] Fix | Delete
}
[685] Fix | Delete
[686] Fix | Delete
return $editor_settings;
[687] Fix | Delete
}
[688] Fix | Delete
[689] Fix | Delete
/**
[690] Fix | Delete
* Preloads common data used with the block editor by specifying an array of
[691] Fix | Delete
* REST API paths that will be preloaded for a given block editor context.
[692] Fix | Delete
*
[693] Fix | Delete
* @since 5.8.0
[694] Fix | Delete
*
[695] Fix | Delete
* @global WP_Post $post Global post object.
[696] Fix | Delete
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
[697] Fix | Delete
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
[698] Fix | Delete
*
[699] Fix | Delete
* @param (string|string[])[] $preload_paths List of paths to preload.
[700] Fix | Delete
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
[701] Fix | Delete
*/
[702] Fix | Delete
function block_editor_rest_api_preload( array $preload_paths, $block_editor_context ) {
[703] Fix | Delete
global $post, $wp_scripts, $wp_styles;
[704] Fix | Delete
[705] Fix | Delete
/**
[706] Fix | Delete
* Filters the array of REST API paths that will be used to preloaded common data for the block editor.
[707] Fix | Delete
*
[708] Fix | Delete
* @since 5.8.0
[709] Fix | Delete
*
[710] Fix | Delete
* @param (string|string[])[] $preload_paths Array of paths to preload.
[711] Fix | Delete
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
[712] Fix | Delete
*/
[713] Fix | Delete
$preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context );
[714] Fix | Delete
[715] Fix | Delete
if ( ! empty( $block_editor_context->post ) ) {
[716] Fix | Delete
$selected_post = $block_editor_context->post;
[717] Fix | Delete
[718] Fix | Delete
/**
[719] Fix | Delete
* Filters the array of paths that will be preloaded.
[720] Fix | Delete
*
[721] Fix | Delete
* Preload common data by specifying an array of REST API paths that will be preloaded.
[722] Fix | Delete
*
[723] Fix | Delete
* @since 5.0.0
[724] Fix | Delete
* @deprecated 5.8.0 Use the {@see 'block_editor_rest_api_preload_paths'} filter instead.
[725] Fix | Delete
*
[726] Fix | Delete
* @param (string|string[])[] $preload_paths Array of paths to preload.
[727] Fix | Delete
* @param WP_Post $selected_post Post being edited.
[728] Fix | Delete
*/
[729] Fix | Delete
$preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_rest_api_preload_paths' );
[730] Fix | Delete
}
[731] Fix | Delete
[732] Fix | Delete
if ( empty( $preload_paths ) ) {
[733] Fix | Delete
return;
[734] Fix | Delete
}
[735] Fix | Delete
[736] Fix | Delete
/*
[737] Fix | Delete
* Ensure the global $post, $wp_scripts, and $wp_styles remain the same after
[738] Fix | Delete
* API data is preloaded.
[739] Fix | Delete
* Because API preloading can call the_content and other filters, plugins
[740] Fix | Delete
* can unexpectedly modify the global $post or enqueue assets which are not
[741] Fix | Delete
* intended for the block editor.
[742] Fix | Delete
*/
[743] Fix | Delete
$backup_global_post = ! empty( $post ) ? clone $post : $post;
[744] Fix | Delete
$backup_wp_scripts = ! empty( $wp_scripts ) ? clone $wp_scripts : $wp_scripts;
[745] Fix | Delete
$backup_wp_styles = ! empty( $wp_styles ) ? clone $wp_styles : $wp_styles;
[746] Fix | Delete
[747] Fix | Delete
foreach ( $preload_paths as &$path ) {
[748] Fix | Delete
if ( is_string( $path ) && ! str_starts_with( $path, '/' ) ) {
[749] Fix | Delete
$path = '/' . $path;
[750] Fix | Delete
continue;
[751] Fix | Delete
}
[752] Fix | Delete
[753] Fix | Delete
if ( is_array( $path ) && is_string( $path[0] ) && ! str_starts_with( $path[0], '/' ) ) {
[754] Fix | Delete
$path[0] = '/' . $path[0];
[755] Fix | Delete
}
[756] Fix | Delete
}
[757] Fix | Delete
[758] Fix | Delete
unset( $path );
[759] Fix | Delete
[760] Fix | Delete
$preload_data = array_reduce(
[761] Fix | Delete
$preload_paths,
[762] Fix | Delete
'rest_preload_api_request',
[763] Fix | Delete
array()
[764] Fix | Delete
);
[765] Fix | Delete
[766] Fix | Delete
// Restore the global $post, $wp_scripts, and $wp_styles as they were before API preloading.
[767] Fix | Delete
$post = $backup_global_post;
[768] Fix | Delete
$wp_scripts = $backup_wp_scripts;
[769] Fix | Delete
$wp_styles = $backup_wp_styles;
[770] Fix | Delete
[771] Fix | Delete
wp_add_inline_script(
[772] Fix | Delete
'wp-api-fetch',
[773] Fix | Delete
sprintf(
[774] Fix | Delete
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
[775] Fix | Delete
wp_json_encode( $preload_data, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
[776] Fix | Delete
),
[777] Fix | Delete
'after'
[778] Fix | Delete
);
[779] Fix | Delete
}
[780] Fix | Delete
[781] Fix | Delete
/**
[782] Fix | Delete
* Creates an array of theme styles to load into the block editor.
[783] Fix | Delete
*
[784] Fix | Delete
* @since 5.8.0
[785] Fix | Delete
*
[786] Fix | Delete
* @global array $editor_styles
[787] Fix | Delete
*
[788] Fix | Delete
* @return array An array of theme styles for the block editor.
[789] Fix | Delete
*/
[790] Fix | Delete
function get_block_editor_theme_styles() {
[791] Fix | Delete
global $editor_styles;
[792] Fix | Delete
[793] Fix | Delete
$styles = array();
[794] Fix | Delete
[795] Fix | Delete
if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
[796] Fix | Delete
foreach ( $editor_styles as $style ) {
[797] Fix | Delete
if ( preg_match( '~^(https?:)?//~', $style ) ) {
[798] Fix | Delete
$response = wp_remote_get( $style );
[799] Fix | Delete
if ( ! is_wp_error( $response ) ) {
[800] Fix | Delete
$styles[] = array(
[801] Fix | Delete
'css' => wp_remote_retrieve_body( $response ),
[802] Fix | Delete
'__unstableType' => 'theme',
[803] Fix | Delete
'isGlobalStyles' => false,
[804] Fix | Delete
);
[805] Fix | Delete
}
[806] Fix | Delete
} else {
[807] Fix | Delete
$file = get_theme_file_path( $style );
[808] Fix | Delete
if ( is_file( $file ) ) {
[809] Fix | Delete
$styles[] = array(
[810] Fix | Delete
'css' => file_get_contents( $file ),
[811] Fix | Delete
'baseURL' => get_theme_file_uri( $style ),
[812] Fix | Delete
'__unstableType' => 'theme',
[813] Fix | Delete
'isGlobalStyles' => false,
[814] Fix | Delete
);
[815] Fix | Delete
}
[816] Fix | Delete
}
[817] Fix | Delete
}
[818] Fix | Delete
}
[819] Fix | Delete
[820] Fix | Delete
return $styles;
[821] Fix | Delete
}
[822] Fix | Delete
[823] Fix | Delete
/**
[824] Fix | Delete
* Returns the classic theme supports settings for block editor.
[825] Fix | Delete
*
[826] Fix | Delete
* @since 6.2.0
[827] Fix | Delete
* @since 6.6.0 Add support for 'editor-spacing-sizes' theme support.
[828] Fix | Delete
*
[829] Fix | Delete
* @return array The classic theme supports settings.
[830] Fix | Delete
*/
[831] Fix | Delete
function get_classic_theme_supports_block_editor_settings() {
[832] Fix | Delete
$theme_settings = array(
[833] Fix | Delete
'disableCustomColors' => get_theme_support( 'disable-custom-colors' ),
[834] Fix | Delete
'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
[835] Fix | Delete
'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ),
[836] Fix | Delete
'disableLayoutStyles' => get_theme_support( 'disable-layout-styles' ),
[837] Fix | Delete
'enableCustomLineHeight' => get_theme_support( 'custom-line-height' ),
[838] Fix | Delete
'enableCustomSpacing' => get_theme_support( 'custom-spacing' ),
[839] Fix | Delete
'enableCustomUnits' => get_theme_support( 'custom-units' ),
[840] Fix | Delete
);
[841] Fix | Delete
[842] Fix | Delete
// Theme settings.
[843] Fix | Delete
$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
[844] Fix | Delete
if ( false !== $color_palette ) {
[845] Fix | Delete
$theme_settings['colors'] = $color_palette;
[846] Fix | Delete
}
[847] Fix | Delete
[848] Fix | Delete
$font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) );
[849] Fix | Delete
if ( false !== $font_sizes ) {
[850] Fix | Delete
$theme_settings['fontSizes'] = $font_sizes;
[851] Fix | Delete
}
[852] Fix | Delete
[853] Fix | Delete
$gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) );
[854] Fix | Delete
if ( false !== $gradient_presets ) {
[855] Fix | Delete
$theme_settings['gradients'] = $gradient_presets;
[856] Fix | Delete
}
[857] Fix | Delete
[858] Fix | Delete
$spacing_sizes = current( (array) get_theme_support( 'editor-spacing-sizes' ) );
[859] Fix | Delete
if ( false !== $spacing_sizes ) {
[860] Fix | Delete
$theme_settings['spacingSizes'] = $spacing_sizes;
[861] Fix | Delete
}
[862] Fix | Delete
[863] Fix | Delete
return $theme_settings;
[864] Fix | Delete
}
[865] Fix | Delete
[866] Fix | Delete
/**
[867] Fix | Delete
* Initialize site preview.
[868] Fix | Delete
*
[869] Fix | Delete
* This function sets IFRAME_REQUEST to true if the site preview parameter is set.
[870] Fix | Delete
*
[871] Fix | Delete
* @since 6.8.0
[872] Fix | Delete
*/
[873] Fix | Delete
function wp_initialize_site_preview_hooks() {
[874] Fix | Delete
if (
[875] Fix | Delete
! defined( 'IFRAME_REQUEST' ) &&
[876] Fix | Delete
isset( $_GET['wp_site_preview'] ) &&
[877] Fix | Delete
1 === (int) $_GET['wp_site_preview'] &&
[878] Fix | Delete
current_user_can( 'edit_theme_options' )
[879] Fix | Delete
) {
[880] Fix | Delete
define( 'IFRAME_REQUEST', true );
[881] Fix | Delete
}
[882] Fix | Delete
}
[883] Fix | Delete
[884] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function