mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
When inserting an image from the + or / menus and the post is empty then replace the current post with the image, if the post is not empty then insert the image in the following post.
This commit is contained in:
parent
fd857d2493
commit
4cd7e67e5c
@ -198,9 +198,14 @@ export default function (editor, toolbar) {
|
||||
order: 2,
|
||||
cardMenu: true,
|
||||
onClick: (editor) => {
|
||||
editor.run((postEditor) => {
|
||||
editor.run((postEditor, section) => {
|
||||
let card = postEditor.builder.createCardSection('card-image', {pos: 'top'});
|
||||
postEditor.insertSection(card);
|
||||
console.log(editor.range.headSection.text.length);
|
||||
if (section || editor.range.headSection.text.length) {
|
||||
postEditor.insertSection(card);
|
||||
} else {
|
||||
postEditor.replaceSection(section || editor.range.headSection, card);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user