show separate counters for text limit and CW limit
This commit is contained in:
parent
c5d9bde43f
commit
726013057d
|
@ -65,7 +65,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<MkInfo v-if="hasNotSpecifiedMentions" warn :class="$style.hasNotSpecifiedMentions">{{ i18n.ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ i18n.ts.add }}</button></MkInfo>
|
<MkInfo v-if="hasNotSpecifiedMentions" warn :class="$style.hasNotSpecifiedMentions">{{ i18n.ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ i18n.ts.add }}</button></MkInfo>
|
||||||
<input v-show="useCw" ref="cwInputEl" v-model="cw" :class="$style.cw" :placeholder="i18n.ts.annotation" @keydown="onKeydown">
|
<div v-show="useCw" :class="$style.cwFrame">
|
||||||
|
<input ref="cwInputEl" v-model="cw" :class="$style.cw" :placeholder="i18n.ts.annotation" @keydown="onKeydown">
|
||||||
|
<div v-if="maxCwLength - cwLength < 100" :class="['_acrylic', $style.textCount, { [$style.textOver]: cwLength > maxCwLength }]">{{ maxCwLength - cwLength }}</div>
|
||||||
|
</div>
|
||||||
<div :class="[$style.textOuter, { [$style.withCw]: useCw }]">
|
<div :class="[$style.textOuter, { [$style.withCw]: useCw }]">
|
||||||
<div v-if="channel" :class="$style.colorBar" :style="{ background: channel.color }"></div>
|
<div v-if="channel" :class="$style.colorBar" :style="{ background: channel.color }"></div>
|
||||||
<textarea ref="textareaEl" v-model="text" :class="[$style.text]" :disabled="posting || posted" :readonly="textAreaReadOnly" :placeholder="placeholder" data-cy-post-form-text dir="auto" @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd"/>
|
<textarea ref="textareaEl" v-model="text" :class="[$style.text]" :disabled="posting || posted" :readonly="textAreaReadOnly" :placeholder="placeholder" data-cy-post-form-text dir="auto" @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd"/>
|
||||||
|
@ -247,13 +250,16 @@ const submitText = computed((): string => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const textLength = computed((): number => {
|
const textLength = computed((): number => {
|
||||||
return (text.value + imeText.value).length + (cw.value?.length ?? 0);
|
return (text.value + imeText.value).length;
|
||||||
});
|
});
|
||||||
|
|
||||||
const maxTextLength = computed((): number => {
|
const maxTextLength = computed((): number => {
|
||||||
return instance ? instance.maxNoteTextLength : 1000;
|
return instance ? instance.maxNoteTextLength : 1000;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const cwLength = computed(() => cw.value?.length ?? 0);
|
||||||
|
const maxCwLength = computed(() => instance.maxCwLength);
|
||||||
|
|
||||||
const canPost = computed((): boolean => {
|
const canPost = computed((): boolean => {
|
||||||
return !props.mock && !posting.value && !posted.value &&
|
return !props.mock && !posting.value && !posted.value &&
|
||||||
(
|
(
|
||||||
|
@ -264,6 +270,7 @@ const canPost = computed((): boolean => {
|
||||||
quoteId.value != null
|
quoteId.value != null
|
||||||
) &&
|
) &&
|
||||||
(textLength.value <= maxTextLength.value) &&
|
(textLength.value <= maxTextLength.value) &&
|
||||||
|
(cwLength.value <= maxCwLength.value) &&
|
||||||
(!poll.value || poll.value.choices.length >= 2);
|
(!poll.value || poll.value.choices.length >= 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1324,10 +1331,13 @@ html[data-color-scheme=light] .preview {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cw {
|
.cwFrame {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
border-bottom: solid 0.5px var(--divider);
|
border-bottom: solid 0.5px var(--divider);
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hashtags {
|
.hashtags {
|
||||||
|
|
Loading…
Reference in New Issue