Skip to content

Migrate jQuery code to native JavaScript - #11

Merged
2ndkauboy merged 7 commits into
developfrom
feature/remove-jquery-for-classic-editor
Jul 29, 2025
Merged

Migrate jQuery code to native JavaScript#11
2ndkauboy merged 7 commits into
developfrom
feature/remove-jquery-for-classic-editor

Conversation

@2ndkauboy

Copy link
Copy Markdown
Owner

No description provided.

This change will migrate the code for the Classic Editor from jQuery to
native JavaScript. Since the `URLSearchParams` object converts arrays
with a single to a scalar type, the PHP code needed to be updated as
well.
@2ndkauboy 2ndkauboy self-assigned this Feb 12, 2025
Comment thread js/unique-title-checker.js Outdated
function ( data ) {
jQuery( '#unique-title-message' ).remove();
document.addEventListener( "DOMContentLoaded", function () {
document.getElementById( "title" ).addEventListener( "blur", function () {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Wrap these into multiple lines (PHPCS)

post_id: document.getElementById( "post_ID" ).value,
post_type: document.getElementById( "post_type" ).value,
post_title: title
} );

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Wrap these in multiple lines as well.

Comment thread js/unique-title-checker.js Outdated
);
}
}
if (data.status === "error" || !unique_title_checker.only_unique_error) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Add "globals" to get rid of the warnings.

Comment on lines +35 to +37
`<div id="unique-title-message" class="${ data.status }">
<p>${ data.message }</p>
</div>`

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Maybe wrap in multiple lines.

@2ndkauboy

Copy link
Copy Markdown
Owner Author

Maybe also fix #10

@2ndkauboy
2ndkauboy force-pushed the feature/remove-jquery-for-classic-editor branch from 910f739 to 3a9b273 Compare July 29, 2025 14:27
@2ndkauboy
2ndkauboy merged commit 318b63c into develop Jul 29, 2025
1 check passed
@2ndkauboy
2ndkauboy deleted the feature/remove-jquery-for-classic-editor branch July 29, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant