Added blank paragraph insertion when selecting unsplash/gif image

refs https://github.com/TryGhost/Team/issues/1225

- provides a more obvious continuation point after selecting an image
- added `scrollIntoView` option to `addParagraphAfterCard()` because for large images the cursor in the new paragraph could be pushed out of the visible area
This commit is contained in:
Kevin Ansfield 2021-11-30 15:05:41 +00:00
parent 8e66f6ead5
commit e419e4e99f
2 changed files with 6 additions and 4 deletions

View File

@ -252,10 +252,8 @@ export default Component.extend({
// create undo snapshot when selecting an image
this.editor.run(() => {
saveCard(payload, false);
this.addParagraphAfterCard({scrollIntoView: true});
});
this.deselectCard();
this.selectCard();
this.scrollToCard();
},
closeImageSelector(reselectParagraph = true) {

View File

@ -680,7 +680,7 @@ export default Component.extend({
}
},
addParagraphAfterCard(card) {
addParagraphAfterCard(card, {scrollIntoView = false}) {
let editor = this.editor;
let section = this.getSectionFromCard(card);
let collection = section.parent.sections;
@ -700,6 +700,10 @@ export default Component.extend({
postEditor.setRange(newPara.tailPosition());
});
if (scrollIntoView) {
run.schedule('afterRender', this, this._scrollCursorIntoView);
}
},
openSelectorComponent(componentName, range) {