Skip to content

Commit

Permalink
move image generation out as a separate plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Sep 19, 2024
1 parent 76967bd commit dce784f
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 25 deletions.
34 changes: 17 additions & 17 deletions includes/Classifai/Features/ImageGeneration.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,26 +186,26 @@ public function enqueue_admin_scripts( string $hook_suffix = '' ) {
wp_enqueue_media();

wp_enqueue_style(
'classifai-image-processing-style',
CLASSIFAI_PLUGIN_URL . 'dist/media-modal.css',
'classifai-plugin-image-generation-media-modal-css',
CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-image-generation-media-modal.css',
[],
get_asset_info( 'media-modal', 'version' ),
get_asset_info( 'classifai-plugin-image-generation-media-modal', 'version' ),
'all'
);

wp_enqueue_script(
'classifai-generate-images',
CLASSIFAI_PLUGIN_URL . 'dist/media-modal.js',
array_merge( get_asset_info( 'media-modal', 'dependencies' ), array( 'jquery', 'wp-api' ) ),
get_asset_info( 'media-modal', 'version' ),
'classifai-plugin-image-generation-media-modal-js',
CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-image-generation-media-modal.js',
array_merge( get_asset_info( 'classifai-plugin-image-generation-media-modal', 'dependencies' ), array( 'jquery', 'wp-api' ) ),
get_asset_info( 'classifai-plugin-image-generation-media-modal', 'version' ),
true
);

wp_enqueue_script(
'classifai-inserter-media-category',
CLASSIFAI_PLUGIN_URL . 'dist/inserter-media-category.js',
get_asset_info( 'inserter-media-category', 'dependencies' ),
get_asset_info( 'inserter-media-category', 'version' ),
'classifai-plugin-inserter-media-category-js',
CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-inserter-media-category.js',
get_asset_info( 'classifai-plugin-inserter-media-category', 'dependencies' ),
get_asset_info( 'classifai-plugin-inserter-media-category', 'version' ),
true
);

Expand Down Expand Up @@ -237,7 +237,7 @@ public function enqueue_admin_scripts( string $hook_suffix = '' ) {
);

wp_localize_script(
'classifai-generate-images',
'classifai-plugin-image-generation-media-modal-js',
'classifaiDalleData',
[
'endpoint' => 'classifai/v1/generate-image',
Expand All @@ -253,15 +253,15 @@ public function enqueue_admin_scripts( string $hook_suffix = '' ) {

if ( 'classifai-generate-image' === $action ) {
wp_enqueue_script(
'classifai-generate-images-media-upload',
CLASSIFAI_PLUGIN_URL . 'dist/generate-image-media-upload.js',
array_merge( get_asset_info( 'generate-image-media-upload', 'dependencies' ), array( 'jquery' ) ),
get_asset_info( 'classifai-generate-images-media-upload', 'version' ),
'classifai-plugin-image-generation-generate-image-media-upload-js',
CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-image-generation-generate-image-media-upload.js',
array_merge( get_asset_info( 'classifai-plugin-image-generation-generate-image-media-upload', 'dependencies' ), array( 'jquery' ) ),
get_asset_info( 'classifai-plugin-image-generation-generate-image-media-upload', 'version' ),
true
);

wp_localize_script(
'classifai-generate-images-media-upload',
'classifai-plugin-image-generation-generate-image-media-upload-js',
'classifaiGenerateImages',
[
'upload_url' => esc_url( admin_url( 'upload.php' ) ),
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint object-shorthand: 0 */

import Prompt from './views/prompt';
import '../../scss/media-modal.scss';
import '../../../../scss/media-modal.scss';

const currentMediaSelectFrame = wp.media.view.MediaFrame.Select;
const currentPostFrame = wp.media.view.MediaFrame.Post;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 3 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ module.exports = {
'recommended-content-block-frontend': [
'./includes/Classifai/Blocks/recommended-content-block/frontend.js',
],
'media-modal': [ './src/js/media-modal/index.js' ],
'inserter-media-category': [
'./src/js/gutenberg-plugins/inserter-media-category.js',
],
commands: [ './src/js/gutenberg-plugins/commands.js' ],
'generate-image-media-upload': [
'./src/js/media-modal/views/generate-image-media-upload.js',
],
'extend-image-blocks': './src/js/extend-image-block-generate-image.js',

'classifai-plugin-classification': './src/js/plugins/classification/index.js',
Expand All @@ -38,6 +31,9 @@ module.exports = {
'classifai-plugin-classic-title-generation': './src/js/plugins/title-generation/classic/index.js',
'classifai-plugin-excerpt-generation': './src/js/plugins/excerpt-generation/index.js',
'classifai-plugin-classic-excerpt-generation': './src/js/plugins/excerpt-generation/classic/index.js',
'classifai-plugin-inserter-media-category': './src/js/plugins/image-generation/inserter-media-category.js',
'classifai-plugin-image-generation-media-modal': './src/js/plugins/image-generation/media-modal/index.js',
'classifai-plugin-image-generation-generate-image-media-upload': './src/js/plugins/image-generation/media-modal/views/generate-image-media-upload.js',
},
module: {
rules: [
Expand Down

0 comments on commit dce784f

Please sign in to comment.