mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Koenig - Do not select embed card when auto-converting pasted URL
refs https://github.com/TryGhost/Ghost/issues/9724 - selecting the embed card as soon as it's created causes problems with the caption input grabbing focus which interferes with being able to continue typing - if content exists after the paste move the cursor to the beginning of the next section, otherwise create a blank paragraph and move the cursor into that
This commit is contained in:
parent
d1ea14ab8d
commit
7b09fedae2
1 changed files with 12 additions and 0 deletions
|
@ -807,7 +807,19 @@ export default Component.extend({
|
||||||
editor.run((postEditor) => {
|
editor.run((postEditor) => {
|
||||||
let payload = {url: text, linkOnError: true};
|
let payload = {url: text, linkOnError: true};
|
||||||
let card = postEditor.builder.createCardSection('embed', payload);
|
let card = postEditor.builder.createCardSection('embed', payload);
|
||||||
|
let nextSection = range.headSection.next;
|
||||||
|
|
||||||
postEditor.replaceSection(range.headSection, card);
|
postEditor.replaceSection(range.headSection, card);
|
||||||
|
|
||||||
|
// move caret to the next section, creating a blank one
|
||||||
|
// if none exists
|
||||||
|
if (nextSection) {
|
||||||
|
postEditor.setRange(nextSection.headPosition());
|
||||||
|
} else {
|
||||||
|
let newSection = postEditor.builder.createMarkupSection('p');
|
||||||
|
postEditor.insertSectionAtEnd(newSection);
|
||||||
|
postEditor.setRange(newSection.headPosition());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// ensure the pasted URL is still auto-linked when Shift is pressed
|
// ensure the pasted URL is still auto-linked when Shift is pressed
|
||||||
|
|
Loading…
Add table
Reference in a new issue