Uses the 'he' library to decode HTML entities form composer's content.

Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
pull/597/head
Cyrille Bollu 2019-10-04 09:59:52 +02:00
rodzic 5303d2692b
commit a1d2489332
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -35,6 +35,7 @@
"nextcloud-auth": "0.0.3",
"tributejs": "^3.7.3",
"twemoji": "^12.0.1",
"he": "^1.2.0",
"uuid": "^3.3.3",
"v-tooltip": "^3.0.0-alpha.11",
"vue": "^2.6.10",

Wyświetl plik

@ -392,6 +392,7 @@ import Avatar from 'nextcloud-vue/dist/Components/Avatar'
import PopoverMenu from 'nextcloud-vue/dist/Components/PopoverMenu'
import EmojiPicker from 'vue-emoji-picker'
import VueTribute from 'vue-tribute'
import he from 'he'
import CurrentUserMixin from './../mixins/currentUserMixin'
import FocusOnCreate from '../directives/focusOnCreate'
import axios from 'nextcloud-axios'
@ -757,8 +758,9 @@ export default {
}
} while (match)
// Remove all html tags but <br>
let content = element.innerHTML.replace(/<(?!br\s*\/?)[^>]+>/gi, '').replace(/<br\s*\/?>/gi, '\n').trim()
// Remove all html tags but </div> (wich we turn in newlines) and decode the remaining html entities
let content = contentHtml.replace(/<(?!\/div)[^>]+>/gi, '').replace(/<\/div>/gi, '\n').trim()
content = he.decode(content)
let data = {
content: content,