Use post character limit setting received from server
This commit is contained in:
parent
901d788d49
commit
8213306f9b
2 changed files with 8 additions and 4 deletions
|
@ -8,6 +8,7 @@ export interface InstanceInfo {
|
||||||
description: string;
|
description: string;
|
||||||
registrations: boolean;
|
registrations: boolean;
|
||||||
login_message: string;
|
login_message: string;
|
||||||
|
post_character_limit: number;
|
||||||
blockchain_explorer_url: string | null;
|
blockchain_explorer_url: string | null;
|
||||||
blockchain_contract_address: string | null;
|
blockchain_contract_address: string | null;
|
||||||
ipfs_gateway_url: string | null;
|
ipfs_gateway_url: string | null;
|
||||||
|
|
|
@ -99,13 +99,12 @@ import {
|
||||||
import { User } from "@/api/users"
|
import { User } from "@/api/users"
|
||||||
import Avatar from "@/components/Avatar.vue"
|
import Avatar from "@/components/Avatar.vue"
|
||||||
import VisibilityIcon from "@/components/VisibilityIcon.vue"
|
import VisibilityIcon from "@/components/VisibilityIcon.vue"
|
||||||
|
import { useInstanceInfo } from "@/store/instance"
|
||||||
import { useCurrentUser } from "@/store/user"
|
import { useCurrentUser } from "@/store/user"
|
||||||
import { setupAutoResize } from "@/utils/autoresize"
|
import { setupAutoResize } from "@/utils/autoresize"
|
||||||
import { renderMarkdownLite } from "@/utils/markdown"
|
import { renderMarkdownLite } from "@/utils/markdown"
|
||||||
import { fileToDataUrl, dataUrlToBase64 } from "@/utils/upload"
|
import { fileToDataUrl, dataUrlToBase64 } from "@/utils/upload"
|
||||||
|
|
||||||
const POST_CHARACTER_LIMIT = 2000
|
|
||||||
|
|
||||||
@Options({
|
@Options({
|
||||||
components: {
|
components: {
|
||||||
Avatar,
|
Avatar,
|
||||||
|
@ -132,7 +131,8 @@ export default class PostEditor extends Vue {
|
||||||
|
|
||||||
private store = setup(() => {
|
private store = setup(() => {
|
||||||
const { currentUser, ensureAuthToken } = useCurrentUser()
|
const { currentUser, ensureAuthToken } = useCurrentUser()
|
||||||
return { currentUser, ensureAuthToken }
|
const { instance } = useInstanceInfo()
|
||||||
|
return { currentUser, ensureAuthToken, instance }
|
||||||
})
|
})
|
||||||
|
|
||||||
get author(): User | null {
|
get author(): User | null {
|
||||||
|
@ -175,7 +175,10 @@ export default class PostEditor extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
get characterCounter(): number {
|
get characterCounter(): number {
|
||||||
return (POST_CHARACTER_LIMIT - this.content.length)
|
if (!this.store.instance) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return (this.store.instance.post_character_limit - this.content.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
async publish() {
|
async publish() {
|
||||||
|
|
Loading…
Reference in a new issue