diff --git a/includes/Classifai/Features/AudioTranscriptsGeneration.php b/includes/Classifai/Features/AudioTranscriptsGeneration.php index 13a4b6d54..bc9c4ba99 100644 --- a/includes/Classifai/Features/AudioTranscriptsGeneration.php +++ b/includes/Classifai/Features/AudioTranscriptsGeneration.php @@ -140,10 +140,10 @@ public function rest_endpoint_callback( WP_REST_Request $request ) { */ public function enqueue_admin_assets() { wp_enqueue_script( - 'classifai-media-script', - CLASSIFAI_PLUGIN_URL . 'dist/media.js', - array_merge( get_asset_info( 'media', 'dependencies' ), array( 'jquery', 'media-editor', 'lodash' ) ), - get_asset_info( 'media', 'version' ), + 'classifai-plugin-media-processing-js', + CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-media-processing.js', + array_merge( get_asset_info( 'classifai-plugin-media-processing', 'dependencies' ), array( 'jquery', 'media-editor', 'lodash' ) ), + get_asset_info( 'classifai-plugin-media-processing', 'version' ), true ); } diff --git a/includes/Classifai/Features/ImageTextExtraction.php b/includes/Classifai/Features/ImageTextExtraction.php index 7e0a40673..c896b7379 100644 --- a/includes/Classifai/Features/ImageTextExtraction.php +++ b/includes/Classifai/Features/ImageTextExtraction.php @@ -216,10 +216,10 @@ public function add_ocr_data_to_api_response() { */ public function enqueue_editor_assets() { wp_enqueue_script( - 'editor-ocr', - CLASSIFAI_PLUGIN_URL . 'dist/editor-ocr.js', - array_merge( get_asset_info( 'editor-ocr', 'dependencies' ), array( 'lodash' ) ), - get_asset_info( 'editor-ocr', 'version' ), + 'classifai-plugin-editor-ocr-js', + CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-editor-ocr.js', + array_merge( get_asset_info( 'classifai-plugin-editor-ocr', 'dependencies' ), array( 'lodash' ) ), + get_asset_info( 'classifai-plugin-editor-ocr', 'version' ), true ); } diff --git a/includes/Classifai/Services/ImageProcessing.php b/includes/Classifai/Services/ImageProcessing.php index b83e9f88d..981f22f19 100644 --- a/includes/Classifai/Services/ImageProcessing.php +++ b/includes/Classifai/Services/ImageProcessing.php @@ -67,16 +67,16 @@ public static function get_service_providers(): array { */ public function enqueue_media_scripts() { wp_enqueue_script( - 'classifai-media-script', - CLASSIFAI_PLUGIN_URL . 'dist/media.js', - array_merge( get_asset_info( 'media', 'dependencies' ), array( 'jquery', 'media-editor', 'lodash' ) ), - get_asset_info( 'media', 'version' ), + 'classifai-plugin-media-processing-js', + CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-media-processing.js', + array_merge( get_asset_info( 'classifai-plugin-media-processing', 'dependencies' ), array( 'jquery', 'media-editor', 'lodash' ) ), + get_asset_info( 'classifai-plugin-media-processing', 'version' ), true ); $feature = new DescriptiveTextGenerator(); wp_add_inline_script( - 'classifai-media-script', + 'classifai-plugin-media-processing-js', 'const classifaiMediaVars = ' . wp_json_encode( array( 'enabledAltTextFields' => $feature->get_alt_text_settings() ? $feature->get_alt_text_settings() : array(), diff --git a/src/js/editor-ocr.js b/src/js/features/media-processing/editor-ocr.js similarity index 100% rename from src/js/editor-ocr.js rename to src/js/features/media-processing/editor-ocr.js diff --git a/src/js/media.js b/src/js/features/media-processing/media-upload.js similarity index 99% rename from src/js/media.js rename to src/js/features/media-processing/media-upload.js index d45c25733..4a0ec1a6c 100644 --- a/src/js/media.js +++ b/src/js/features/media-processing/media-upload.js @@ -1,6 +1,6 @@ /* global ClassifAI */ -import { handleClick } from './helpers'; +import { handleClick } from '../../helpers'; import { __ } from '@wordpress/i18n'; ( function( $ ) { // eslint-disable-line diff --git a/webpack.config.js b/webpack.config.js index c5c0a3621..c6f367e99 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,8 +8,6 @@ module.exports = { path: path.resolve( __dirname, 'dist' ), }, entry: { - 'editor-ocr': [ './src/js/editor-ocr.js' ], - media: [ './src/js/media.js' ], admin: [ './src/js/admin.js' ], 'recommended-content-block': [ './includes/Classifai/Blocks/recommended-content-block/index.js', @@ -18,6 +16,8 @@ module.exports = { './includes/Classifai/Blocks/recommended-content-block/frontend.js', ], + 'classifai-plugin-media-processing': [ './src/js/features/media-processing/media-upload.js' ], + 'classifai-plugin-editor-ocr': [ './src/js/features/media-processing/editor-ocr.js' ], 'classifai-plugin-commands': [ './src/js/features/commands.js' ], 'classifai-plugin-classification': './src/js/features/classification/index.js', 'classifai-plugin-classification-previewer': './src/js/features/classification/previewer.js',