Skip to content

Commit af6757c

Browse files
feat: focus on Post Title on new imports
1 parent 1acc4a8 commit af6757c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

includes/views/js/import-metabox-edit.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
const $closeButton = $('<button>', {
220220
type: 'button',
221221
class: 'button button-primary',
222-
text: '✕'
222+
text: '✕',
223223
});
224224

225225
$message.append($closeButton);
@@ -856,7 +856,9 @@
856856
});
857857

858858
// Tagify for normal mix content field.
859-
const mixContent = $('.fz-input-tagify[name="feedzy_meta_data[import_post_content]"]:not(.fz-tagify-image)').tagify({
859+
const mixContent = $(
860+
'.fz-input-tagify[name="feedzy_meta_data[import_post_content]"]:not(.fz-tagify-image)'
861+
).tagify({
860862
mode: 'mix',
861863
editTags: false,
862864
templates: {
@@ -1121,7 +1123,7 @@
11211123
class: 'button button-secondary',
11221124
click: () => {
11231125
window.location.href = window.feedzy.pages.logs;
1124-
}
1126+
},
11251127
},
11261128
{
11271129
text: feedzy.i10n.okButton,
@@ -1496,6 +1498,8 @@
14961498
$(
14971499
'input[name="feedzy_meta_data[fallback_image_option]"]:checked'
14981500
).trigger('change');
1501+
1502+
initNewPostActions();
14991503
}
15001504
})(jQuery, feedzy);
15011505

@@ -1519,3 +1523,14 @@ function initRemoveFallbackImageBtn() {
15191523
feedzy.i10n.action_btn_text_1;
15201524
});
15211525
}
1526+
1527+
function initNewPostActions() {
1528+
// Focus on the post title field when creating a new post.
1529+
if (window.location.href.indexOf('post-new.php') > -1) {
1530+
const postTitle = document.querySelector('#post_title');
1531+
if (postTitle) {
1532+
postTitle.focus();
1533+
postTitle.select();
1534+
}
1535+
}
1536+
}

0 commit comments

Comments
 (0)