Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upkeep/scripts: Reorganize JS #804

Merged
merged 29 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
51deca8
Merge branch 'develop' of github.com:10up/classifai into develop
Sidsector9 Jun 28, 2024
a4f125c
Merge branch 'develop' of github.com:10up/classifai into develop
Sidsector9 Jul 30, 2024
066630e
Merge branch 'develop' of github.com:10up/classifai into develop
Sidsector9 Aug 20, 2024
018dff0
Merge branch 'develop' of github.com:10up/classifai into develop
Sidsector9 Sep 5, 2024
bba2004
Merge branch 'develop' of github.com:10up/classifai into develop
Sidsector9 Sep 19, 2024
bdcc3bf
move text to speech out as a separate plugin
Sidsector9 Sep 19, 2024
ca7566f
move classification out as a separate plugin
Sidsector9 Sep 19, 2024
a385f73
move content resizing out as a separate plugin
Sidsector9 Sep 19, 2024
731fd1f
move title generation out as a separate plugin
Sidsector9 Sep 19, 2024
02a55ef
fix gutenberg plugin names
Sidsector9 Sep 19, 2024
40f464e
move exerpt generation out as a separate plugin
Sidsector9 Sep 19, 2024
76967bd
move title and exerpt generation (classic) out as a separate plugin
Sidsector9 Sep 19, 2024
dce784f
move image generation out as a separate plugin
Sidsector9 Sep 19, 2024
803ff9e
move text to speech (frontend) out as a separate plugin
Sidsector9 Sep 20, 2024
6669139
move .scss files to feature directories
Sidsector9 Sep 20, 2024
c922609
fix title & excerpt generation implementation
Sidsector9 Sep 20, 2024
1252d14
move commands out to plugins
Sidsector9 Sep 20, 2024
07b442f
move previewer out to plugins
Sidsector9 Sep 20, 2024
4e90772
rename directory from plugins to features
Sidsector9 Sep 20, 2024
6c723ba
fix linting errors
Sidsector9 Sep 20, 2024
f0d7329
improve linting script
Sidsector9 Sep 20, 2024
11891b3
fix e2e tests
Sidsector9 Sep 20, 2024
0f2bf9e
move extend media block script out to features
Sidsector9 Sep 21, 2024
322a97e
move ocr and media-upload related features to features director
Sidsector9 Sep 21, 2024
03a34e5
fix webpack.config.js
Sidsector9 Sep 21, 2024
76a372e
ignore webpack config in eslintrc
Sidsector9 Sep 21, 2024
00376be
fix styling issues
Sidsector9 Sep 26, 2024
b4bfea6
add missing ClassifAI icon
Sidsector9 Sep 26, 2024
4a50fe0
eslint fixes
Sidsector9 Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move previewer out to plugins
  • Loading branch information
Sidsector9 committed Sep 20, 2024

Verified

This commit was signed with the committer’s verified signature.
maehr Moritz Mähr
commit 07b442f0219fad0dc3bfa07464dc32f657500dbb
22 changes: 11 additions & 11 deletions includes/Classifai/Features/Classification.php
Original file line number Diff line number Diff line change
@@ -303,18 +303,18 @@ public function rest_after_insert( \WP_Post $post ) {
*/
public function enqueue_admin_assets() {
wp_enqueue_script(
'classifai-language-processing-script',
CLASSIFAI_PLUGIN_URL . 'dist/language-processing.js',
get_asset_info( 'language-processing', 'dependencies' ),
get_asset_info( 'language-processing', 'version' ),
'classifai-plugin-classification-previewer-js',
CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-classification-previewer.js',
get_asset_info( 'classifai-plugin-classification-previewer', 'dependencies' ),
get_asset_info( 'classifai-plugin-classification-previewer', 'version' ),
true
);

wp_enqueue_style(
'classifai-language-processing-style',
CLASSIFAI_PLUGIN_URL . 'dist/language-processing.css',
'classifai-plugin-classification-previewer-css',
CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-classification-previewer.css',
array(),
get_asset_info( 'language-processing', 'version' ),
get_asset_info( 'classifai-plugin-classification-previewer', 'version' ),
'all'
);
}
@@ -326,10 +326,10 @@ public function enqueue_editor_assets() {
global $post;

wp_enqueue_script(
'classifai-editor',
CLASSIFAI_PLUGIN_URL . 'dist/editor.js',
get_asset_info( 'editor', 'dependencies' ),
get_asset_info( 'editor', 'version' ),
'classifai-plugin-classification-ibm-watson-js',
CLASSIFAI_PLUGIN_URL . 'dist/classifai-plugin-classification-ibm-watson.js',
get_asset_info( 'classifai-plugin-classification-ibm-watson', 'dependencies' ),
get_asset_info( 'classifai-plugin-classification-ibm-watson', 'version' ),
true
);

18 changes: 0 additions & 18 deletions includes/Classifai/Features/ContentResizing.php
Original file line number Diff line number Diff line change
@@ -85,7 +85,6 @@ static function () {
*/
public function feature_setup() {
add_action( 'enqueue_block_assets', [ $this, 'enqueue_editor_assets' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
}

/**
@@ -205,23 +204,6 @@ public function enqueue_editor_assets() {
);
}

/**
* Enqueue the admin scripts.
*
* @param string $hook_suffix The current admin page.
*/
public function enqueue_admin_assets( string $hook_suffix ) {
// Load asset in new post and edit post screens.
if ( 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix ) {
wp_enqueue_style(
'classifai-language-processing-style',
CLASSIFAI_PLUGIN_URL . 'dist/language-processing.css',
[],
get_asset_info( 'language-processing', 'version' ),
);
}
}

/**
* Get the description for the enable field.
*
7 changes: 0 additions & 7 deletions includes/Classifai/Features/ExcerptGeneration.php
Original file line number Diff line number Diff line change
@@ -251,13 +251,6 @@ public function enqueue_admin_assets( string $hook_suffix ) {
);
}
}

wp_enqueue_style(
'classifai-language-processing-style',
CLASSIFAI_PLUGIN_URL . 'dist/language-processing.css',
[],
get_asset_info( 'language-processing', 'version' ),
);
Comment on lines -254 to -260
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the language processing CSS file contains some CSS of the excerpt generation model. Removing this minor break spacing above the button.

image

}
}

7 changes: 0 additions & 7 deletions includes/Classifai/Features/TitleGeneration.php
Original file line number Diff line number Diff line change
@@ -256,13 +256,6 @@ public function enqueue_admin_assets( string $hook_suffix ) {
);
}
}

wp_enqueue_style(
'classifai-language-processing-style',
CLASSIFAI_PLUGIN_URL . 'dist/language-processing.css',
[],
get_asset_info( 'language-processing', 'version' ),
);
Comment on lines -259 to -265
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the language processing CSS file contains some CSS of the time generation model. Removing this minor break style of the title generation model. Need to move those CSS to classifai-plugin-classic-title-generation.css.

image

}
}

File renamed without changes.
3 changes: 1 addition & 2 deletions src/js/plugins/classification/index.js
Original file line number Diff line number Diff line change
@@ -7,11 +7,10 @@ import { registerPlugin } from '@wordpress/plugins';
/**
* Internal dependencies.
*/
import { ClassifaiEditorSettingPanel } from '../slot-fill';
import { ClassificationToggle } from './classification-toggle';
import { ClassificationButton } from './classification-button';

const { classifaiPostData } = window;
const { classifaiPostData, ClassifaiEditorSettingPanel } = window;

const ClassificationPlugin = () => {
const postType = useSelect( ( select ) =>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Choices from 'choices.js';
import '../scss/language-processing.scss';
import './previewer.scss';

( () => {
let featureStatuses = {};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../node_modules/choices.js/public/assets/styles/choices.min.css';
@import '../../../../node_modules/choices.js/public/assets/styles/choices.min.css';

@keyframes loading-rotation {
0% {
2 changes: 1 addition & 1 deletion src/js/plugins/slot-fill/index.js
Original file line number Diff line number Diff line change
@@ -29,6 +29,6 @@ registerPlugin(
}
);

export const ClassifaiEditorSettingPanel = ( { children } ) => {
window.ClassifaiEditorSettingPanel = ( { children } ) => {
return <Fill name="classifai-editor-setting-panel">{ children }</Fill>;
};
3 changes: 2 additions & 1 deletion src/js/plugins/text-to-speech/index.js
Original file line number Diff line number Diff line change
@@ -11,9 +11,10 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies.
*/
import { ClassifaiEditorSettingPanel } from '../slot-fill';
import { store as postAudioStore } from './store';

const { ClassifaiEditorSettingPanel } = window;

/**
* ClassifAI Text to Audio component.
*/
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -8,11 +8,9 @@ module.exports = {
path: path.resolve( __dirname, 'dist' ),
},
entry: {
editor: [ './src/js/editor.js' ],
'editor-ocr': [ './src/js/editor-ocr.js' ],
media: [ './src/js/media.js' ],
admin: [ './src/js/admin.js' ],
'language-processing': [ './src/js/language-processing.js' ],
'recommended-content-block': [
'./includes/Classifai/Blocks/recommended-content-block/index.js',
],
@@ -23,6 +21,8 @@ module.exports = {

'classifai-plugin-commands': [ './src/js/plugins/commands.js' ],
'classifai-plugin-classification': './src/js/plugins/classification/index.js',
'classifai-plugin-classification-previewer': './src/js/plugins/classification/previewer.js',
'classifai-plugin-classification-ibm-watson': './src/js/plugins/classification/ibm-watson.js',
'classifai-plugin-fill': './src/js/plugins/slot-fill/index.js',
'classifai-plugin-text-to-speech': './src/js/plugins/text-to-speech/index.js',
'classifai-plugin-text-to-speech-frontend': './src/js/plugins/text-to-speech/frontend/index.js',