mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
Card creation and deletion bugs. (#664)
closes https://github.com/TryGhost/Ghost/issues/8312 - all new cards created now enter in selected mode and if enabled edit mode. - if deleting cards places the cursor in an empty section the '+' menu is placed AFTER the card is deleted which ensures it's placed in the correct location
This commit is contained in:
parent
f2784ea372
commit
88209e8227
@ -42,6 +42,10 @@ export default Component.extend({
|
||||
didReceiveAttrs() {
|
||||
if (!this.get('isEditing')) {
|
||||
this.set('preview', formatMarkdown([this.get('payload').markdown]));
|
||||
} else {
|
||||
run.next(() => {
|
||||
this.$('textarea').focus();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -363,18 +363,19 @@ export default Component.extend({
|
||||
if (forwards && section.next) {
|
||||
range = section.next.toRange();
|
||||
range.tail.offset = 0;
|
||||
editor.selectRange(range);
|
||||
} else if (section.prev) {
|
||||
range = section.prev.toRange();
|
||||
range.head.offset = range.tail.offset;
|
||||
editor.selectRange(range);
|
||||
} else if (section.next) {
|
||||
range = section.next.toRange();
|
||||
range.tail.offset = 0;
|
||||
editor.selectRange(range);
|
||||
} else {
|
||||
card.env.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
card.env.remove();
|
||||
editor.selectRange(range);
|
||||
});
|
||||
},
|
||||
stopEditingCard() {
|
||||
|
@ -12,7 +12,7 @@ export default Component.extend({
|
||||
this._super(...arguments);
|
||||
let card = this.get('card');
|
||||
if (card.newlyCreated) {
|
||||
run.schedule('afterRender', this, () => {
|
||||
run.next(() => {
|
||||
if (card.card.launchMode === 'edit') {
|
||||
this.send('startEdit');
|
||||
this.send('selectCard');
|
||||
|
@ -73,10 +73,9 @@ export default Component.extend({
|
||||
let $editor = $(this.get('containerSelector'));
|
||||
|
||||
input.blur(() => {
|
||||
// nasty hack - give the tool time to execute before removing this from the dom.
|
||||
window.setTimeout(() => {
|
||||
run.later(() => {
|
||||
this.send('closeMenuKeepButton');
|
||||
}, 200);
|
||||
}, 100);
|
||||
});
|
||||
|
||||
editor.cursorDidChange(() => {
|
||||
@ -107,13 +106,7 @@ export default Component.extend({
|
||||
run.schedule('afterRender', this,
|
||||
() => {
|
||||
let button = this.$('.gh-cardmenu-button');
|
||||
|
||||
button.css('top', offset.top + $editor.scrollTop() - editorOffset.top - 2);
|
||||
if (currentNode.tagName.toLowerCase() === 'li') {
|
||||
// button.css('left', this.$(currentNode.parentNode).position().left + $editor.scrollLeft());
|
||||
} else {
|
||||
// button.css('left', offset.left + $editor.scrollLeft() - 50);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user