Skip to content

Commit 61c7c51

Browse files
committed
feat(posts): implement canSave
not able to test this code yet, as post editor is not implemented
1 parent cf00ebf commit 61c7c51

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/views/Posts.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,15 @@ export default {
500500
}
501501
return true
502502
}
503-
const canSave = () => true
503+
const canSave = () => {
504+
var text = v.posting.post.body_html
505+
const imgSrcRegex = /<img[^>]+src="((http:\/\/|https:\/\/|\/)[^">]+)"/g
506+
const stripTagsRegex = /(<([^>]+)>)/ig
507+
const images = imgSrcRegex.exec(text)
508+
text = text.replace(stripTagsRegex, '')
509+
text = text.trim()
510+
return text.length || images
511+
}
504512
const canMove = () => {
505513
if (!$auth.loggedIn) return false
506514
if (v.bannedFromBoard) return false

0 commit comments

Comments
 (0)