mirror of
https://github.com/paricafe/misskey.git
synced 2025-02-17 14:47:29 -06:00
update counts immediately
This commit is contained in:
parent
afec66841d
commit
ec500ccdae
2 changed files with 20 additions and 8 deletions
|
@ -293,7 +293,7 @@ function saveToHistory() {
|
||||||
textHistory.value.push(text.value);
|
textHistory.value.push(text.value);
|
||||||
currentHistoryIndex.value = textHistory.value.length - 1;
|
currentHistoryIndex.value = textHistory.value.length - 1;
|
||||||
lastSaveTime = now;
|
lastSaveTime = now;
|
||||||
|
|
||||||
if (textHistory.value.length > 50) {
|
if (textHistory.value.length > 50) {
|
||||||
textHistory.value = textHistory.value.slice(-50);
|
textHistory.value = textHistory.value.slice(-50);
|
||||||
currentHistoryIndex.value = textHistory.value.length - 1;
|
currentHistoryIndex.value = textHistory.value.length - 1;
|
||||||
|
@ -637,12 +637,12 @@ function clear() {
|
||||||
function onKeydown(ev: KeyboardEvent) {
|
function onKeydown(ev: KeyboardEvent) {
|
||||||
if (ev.key === 'Enter' && (ev.ctrlKey || ev.metaKey) && canPost.value) post();
|
if (ev.key === 'Enter' && (ev.ctrlKey || ev.metaKey) && canPost.value) post();
|
||||||
|
|
||||||
if (enableUndoClearPostForm.value && !ev.ctrlKey && !ev.metaKey && !ev.altKey &&
|
if (enableUndoClearPostForm.value && !ev.ctrlKey && !ev.metaKey && !ev.altKey &&
|
||||||
!justEndedComposition.value && !ev.isComposing &&
|
!justEndedComposition.value && !ev.isComposing &&
|
||||||
!['Shift', 'Alt', 'Control', 'Meta', 'CapsLock', 'Tab'].includes(ev.key)) {
|
!['Shift', 'Alt', 'Control', 'Meta', 'CapsLock', 'Tab'].includes(ev.key)) {
|
||||||
saveToHistory();
|
saveToHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// justEndedComposition.value is for Safari, which keyDown occurs after compositionend.
|
// justEndedComposition.value is for Safari, which keyDown occurs after compositionend.
|
||||||
// ev.isComposing is for another browsers.
|
// ev.isComposing is for another browsers.
|
||||||
if (ev.key === 'Escape' && !justEndedComposition.value && !ev.isComposing) emit('esc');
|
if (ev.key === 'Escape' && !justEndedComposition.value && !ev.isComposing) emit('esc');
|
||||||
|
@ -714,7 +714,7 @@ async function onPaste(ev: ClipboardEvent) {
|
||||||
upload(file, `${fileName}.txt`);
|
upload(file, `${fileName}.txt`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
|
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,7 +916,16 @@ async function post(ev?: MouseEvent) {
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
deleteDraft();
|
deleteDraft();
|
||||||
|
if (props.reply) {
|
||||||
|
props.reply.repliesCount = (props.reply.repliesCount || 0) + 1;
|
||||||
|
}
|
||||||
|
if (props.quote) {
|
||||||
|
props.renote.renoteCount = (props.renote.renoteCount || 0) + 1;
|
||||||
|
}
|
||||||
emit('posted');
|
emit('posted');
|
||||||
|
if (postAccount.value != null ? postAccount.value.id : null) {
|
||||||
|
postAccount.value = null;
|
||||||
|
}
|
||||||
if (postData.text && postData.text !== '') {
|
if (postData.text && postData.text !== '') {
|
||||||
const hashtags_ = mfm.parse(postData.text).map(x => x.type === 'hashtag' && x.props.hashtag).filter(x => x) as string[];
|
const hashtags_ = mfm.parse(postData.text).map(x => x.type === 'hashtag' && x.props.hashtag).filter(x => x) as string[];
|
||||||
const history = JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]') as string[];
|
const history = JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]') as string[];
|
||||||
|
@ -1016,7 +1025,7 @@ async function insertEmoji(ev: MouseEvent) {
|
||||||
const textBefore = text.value.substring(0, pos);
|
const textBefore = text.value.substring(0, pos);
|
||||||
const textAfter = text.value.substring(posEnd);
|
const textAfter = text.value.substring(posEnd);
|
||||||
|
|
||||||
const processedEmoji = defaultStore.state.emojiAutoSpacing
|
const processedEmoji = defaultStore.state.emojiAutoSpacing
|
||||||
? addSpacing(textBefore, emoji)
|
? addSpacing(textBefore, emoji)
|
||||||
: emoji + ' ';
|
: emoji + ' ';
|
||||||
|
|
||||||
|
|
|
@ -459,7 +459,7 @@ export function getNoteMenu(props: {
|
||||||
action: edit,
|
action: edit,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appearNote.userId === $i.id) {
|
if (appearNote.userId === $i.id) {
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
icon: 'ti ti-edit',
|
icon: 'ti ti-edit',
|
||||||
|
@ -576,6 +576,7 @@ export function getRenoteMenu(props: {
|
||||||
channelId: appearNote.channelId,
|
channelId: appearNote.channelId,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
|
appearNote.renoteCount = (appearNote.renoteCount || 0) + 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -624,6 +625,7 @@ export function getRenoteMenu(props: {
|
||||||
renoteId: appearNote.id,
|
renoteId: appearNote.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
|
appearNote.renoteCount = (appearNote.renoteCount || 0) + 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -665,6 +667,7 @@ export function getRenoteMenu(props: {
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.tsx.renotedToX({ name: channel.name }));
|
os.toast(i18n.tsx.renotedToX({ name: channel.name }));
|
||||||
|
appearNote.renoteCount = (appearNote.renoteCount || 0) + 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -684,4 +687,4 @@ export function getRenoteMenu(props: {
|
||||||
return {
|
return {
|
||||||
menu: renoteItems,
|
menu: renoteItems,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue