Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	package-lock.json
This commit is contained in:
zadam 2022-02-01 21:04:17 +01:00
commit 61aa029582
4 changed files with 21 additions and 1 deletions

View file

@ -497,6 +497,16 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
await this.renderOwnedAttributes(attributes, false);
}
focus() {
this.$editor.trigger('focus');
this.textEditor.model.change( writer => {
const positionAt = writer.createPositionAt(this.textEditor.model.document.getRoot(), 'end');
writer.setSelection(positionAt);
} );
}
entitiesReloadedEvent({loadResults}) {
if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
this.refresh();

View file

@ -186,7 +186,9 @@ export default class RibbonContainer extends NoteContextAwareWidget {
const activeChild = this.getActiveRibbonWidget();
if (activeChild && (refreshActiveTab || !wasAlreadyActive)) {
activeChild.handleEvent('noteSwitched', {noteContext: this.noteContext, notePath: this.notePath});
activeChild.handleEvent('noteSwitched', {noteContext: this.noteContext, notePath: this.notePath}).then(() => {
activeChild.focus?.();
});
}
} else {
this.lastActiveComponentId = null;

View file

@ -82,4 +82,8 @@ export default class OwnedAttributeListWidget extends NoteContextAwareWidget {
this.getTitle(this.note);
}
}
focus() {
this.attributeEditorWidget.focus();
}
}

View file

@ -310,6 +310,10 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget {
$attr.attr("data-attribute-id", result.attributeId);
}
focus() {
this.$widget.find(".promoted-attribute-input:first").focus();
}
entitiesReloadedEvent({loadResults}) {
if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
this.refresh();