mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 21:37:34 -07:00
Refactor
This commit is contained in:
parent
bb77b48efd
commit
26df2c2dfa
6 changed files with 27 additions and 54 deletions
|
@ -84,6 +84,26 @@ export default (opts: Opts = {}) => ({
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
reply(viaKeyboard = false) {
|
||||||
|
(this as any).apis.post({
|
||||||
|
reply: this.appearNote,
|
||||||
|
animation: !viaKeyboard,
|
||||||
|
cb: () => {
|
||||||
|
this.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
renote(viaKeyboard = false) {
|
||||||
|
(this as any).apis.post({
|
||||||
|
renote: this.appearNote,
|
||||||
|
animation: !viaKeyboard,
|
||||||
|
cb: () => {
|
||||||
|
this.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
renoteDirectly() {
|
renoteDirectly() {
|
||||||
(this as any).api('notes/create', {
|
(this as any).api('notes/create', {
|
||||||
renoteId: this.appearNote.id
|
renoteId: this.appearNote.id
|
||||||
|
|
|
@ -6,13 +6,17 @@ export default (os: OS) => opts => {
|
||||||
const o = opts || {};
|
const o = opts || {};
|
||||||
if (o.renote) {
|
if (o.renote) {
|
||||||
const vm = os.new(RenoteFormWindow, {
|
const vm = os.new(RenoteFormWindow, {
|
||||||
note: o.renote
|
note: o.renote,
|
||||||
|
animation: o.animation == null ? true : o.animation
|
||||||
});
|
});
|
||||||
|
if (opts.cb) vm.$once('closed', opts.cb);
|
||||||
document.body.appendChild(vm.$el);
|
document.body.appendChild(vm.$el);
|
||||||
} else {
|
} else {
|
||||||
const vm = os.new(PostFormWindow, {
|
const vm = os.new(PostFormWindow, {
|
||||||
reply: o.reply
|
reply: o.reply,
|
||||||
|
animation: o.animation == null ? true : o.animation
|
||||||
});
|
});
|
||||||
|
if (opts.cb) vm.$once('closed', opts.cb);
|
||||||
document.body.appendChild(vm.$el);
|
document.body.appendChild(vm.$el);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,22 +82,6 @@ export default Vue.extend({
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
reply(viaKeyboard = false) {
|
|
||||||
(this as any).os.new(MkPostFormWindow, {
|
|
||||||
reply: this.appearNote,
|
|
||||||
animation: !viaKeyboard
|
|
||||||
}).$once('closed', this.focus);
|
|
||||||
},
|
|
||||||
|
|
||||||
renote(viaKeyboard = false) {
|
|
||||||
(this as any).os.new(MkRenoteFormWindow, {
|
|
||||||
note: this.appearNote,
|
|
||||||
animation: !viaKeyboard
|
|
||||||
}).$once('closed', this.focus);
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -98,22 +98,6 @@ export default Vue.extend({
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
reply(viaKeyboard = false) {
|
|
||||||
(this as any).os.new(MkPostFormWindow, {
|
|
||||||
reply: this.appearNote,
|
|
||||||
animation: !viaKeyboard
|
|
||||||
}).$once('closed', this.focus);
|
|
||||||
},
|
|
||||||
|
|
||||||
renote(viaKeyboard = false) {
|
|
||||||
(this as any).os.new(MkRenoteFormWindow, {
|
|
||||||
note: this.appearNote,
|
|
||||||
animation: !viaKeyboard
|
|
||||||
}).$once('closed', this.focus);
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -18,6 +18,7 @@ export default (os) => (opts) => {
|
||||||
}).$mount();
|
}).$mount();
|
||||||
vm.$once('cancel', recover);
|
vm.$once('cancel', recover);
|
||||||
vm.$once('posted', recover);
|
vm.$once('posted', recover);
|
||||||
|
if (opts.cb) vm.$once('closed', opts.cb);
|
||||||
document.body.appendChild(vm.$el);
|
document.body.appendChild(vm.$el);
|
||||||
(vm as any).focus();
|
(vm as any).focus();
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,26 +89,6 @@ export default Vue.extend({
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
showContent: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
reply() {
|
|
||||||
(this as any).apis.post({
|
|
||||||
reply: this.appearNote
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
renote() {
|
|
||||||
(this as any).apis.post({
|
|
||||||
renote: this.appearNote
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue