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

XWIKI-17664: When adding an annotation the focus should be inside WYSIWYG by default #3694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,12 @@ XWiki.Annotation = Class.create({
onSuccess: function(response) {
// display the annotation creation form
this.fillCreateForm(this.createPanel, response.responseText);
// If the WYSIWYG editor used is CKEditor, we make sure its input gets focused as soon as it's loaded
// Note that this CKE config is easier than having to handle custom eventListeners.
// As of 17.0.0, this does not interfere with the inline editor, so this solution is okay.
if(typeof CKEDITOR !== 'undefined') {
CKEDITOR.config.startupFocus = true;
}
}.bind(this),

onFailure: function(response) {
Expand Down Expand Up @@ -1710,7 +1716,7 @@ XWiki.Annotation = Class.create({
if (!this.safeUpdate(this.createPanel, panelContent)) {
return;
}
// set the focus in the first element of type input
// set the focus in the first element of type input, useful when not using the WYSIWYG editor CKEditor.
this.createPanel.select('form').first().focusFirstElement();
// and add the button observers
this.createPanel.down('input[type=submit]').observe('click', this.onAnnotationAdd.bindAsEventListener(this));
Expand Down