mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-04-06 01:25:38 +00:00
esoolved comments @tirokk
This commit is contained in:
parent
063479610e
commit
77f45c1508
@ -10,7 +10,7 @@
|
|||||||
/>
|
/>
|
||||||
</hc-teaser-image>
|
</hc-teaser-image>
|
||||||
<ds-input model="title" class="post-title" placeholder="Title" name="title" autofocus />
|
<ds-input model="title" class="post-title" placeholder="Title" name="title" autofocus />
|
||||||
<small class="smallTag">{{ form.title.length }}/64</small>
|
<small class="smallTag">{{ form.title.length }}/{{formSchema.title.max }}</small>
|
||||||
<no-ssr>
|
<no-ssr>
|
||||||
<hc-editor
|
<hc-editor
|
||||||
:users="users"
|
:users="users"
|
||||||
@ -18,7 +18,7 @@
|
|||||||
:value="form.content"
|
:value="form.content"
|
||||||
@input="updateEditorContent"
|
@input="updateEditorContent"
|
||||||
/>
|
/>
|
||||||
<small class="smallTag">{{ form.contentLength }}/2000</small>
|
<small class="smallTag">{{ form.contentLength }}/{{content_max }}</small>
|
||||||
</no-ssr>
|
</no-ssr>
|
||||||
<ds-space margin-bottom="xxx-large" />
|
<ds-space margin-bottom="xxx-large" />
|
||||||
<hc-categories-select
|
<hc-categories-select
|
||||||
@ -97,13 +97,26 @@ export default {
|
|||||||
},
|
},
|
||||||
formSchema: {
|
formSchema: {
|
||||||
title: { required: true, min: 3, max: 64 },
|
title: { required: true, min: 3, max: 64 },
|
||||||
content: { required: true, min: 3, max: 2007 },
|
content: [
|
||||||
|
/*{
|
||||||
|
validator(rule, value, callback, source, options) {
|
||||||
|
var errors = []
|
||||||
|
if (source.password !== value) {
|
||||||
|
errors.push(new Error(passwordMismatchMessage))
|
||||||
|
}
|
||||||
|
callback(errors)
|
||||||
|
},
|
||||||
|
},*/
|
||||||
|
{ required: true, }
|
||||||
|
],
|
||||||
},
|
},
|
||||||
id: null,
|
id: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
slug: null,
|
slug: null,
|
||||||
users: [],
|
users: [],
|
||||||
|
content_min: 3,
|
||||||
|
content_max: 2000,
|
||||||
|
|
||||||
hashtags: [],
|
hashtags: [],
|
||||||
}
|
}
|
||||||
@ -179,12 +192,18 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateEditorContent(value) {
|
updateEditorContent(value) {
|
||||||
var n = 0
|
// disable form
|
||||||
this.$refs.contributionForm.update('content', value)
|
|
||||||
this.disabled = true
|
this.disabled = true
|
||||||
n = value.replace(/<\/?[^>]+(>|$)/gm, '').length
|
// TODO: Do smth????? what is happening
|
||||||
this.form.contentLength = n
|
this.$refs.contributionForm.update('content', value)
|
||||||
if (n > this.formSchema.content.min && this.formSchema.content.max > n) {
|
// filter HTML out of content value
|
||||||
|
const str = value.replace(/<\/?[^>]+(>|$)/gm, '')
|
||||||
|
// Set counter length of text
|
||||||
|
this.form.contentLength = str.length
|
||||||
|
//Enable save button if requirements are met
|
||||||
|
if ( str.length >= this.content_min &&
|
||||||
|
str.length <= this.content_max)
|
||||||
|
{
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user