1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01: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:
Ryan McCarvill 2017-04-25 02:02:20 +12:00 committed by Kevin Ansfield
parent 1f3b79e289
commit 097f37ea02
4 changed files with 11 additions and 13 deletions

View file

@ -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();
});
}
},

View file

@ -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() {

View file

@ -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');

View file

@ -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);
}
});
});
},