@dev.smartpricing/message-composer-layer 4.1.1 → 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,7 +8,11 @@ import type {
|
|
|
8
8
|
GenerateTextWidgetType,
|
|
9
9
|
RefineTextResponse,
|
|
10
10
|
} from '@dev.smartpricing/message-composer-utils/types'
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
convertToWhatsappMarkdown,
|
|
13
|
+
getTipTapExtensions,
|
|
14
|
+
sanitizeContent,
|
|
15
|
+
} from '@dev.smartpricing/message-composer-utils/utils'
|
|
12
16
|
import EmojiPickerButton from '../Common/EmojiPickerButton.vue'
|
|
13
17
|
import DynamicDataSlideover from '../DynamicDataSlideover.vue'
|
|
14
18
|
import EditorLinkPopover from './EditorLinkPopover.vue'
|
|
@@ -350,6 +354,16 @@ function isEmpty() {
|
|
|
350
354
|
return getHtml() === '' || editor.value?.isEmpty
|
|
351
355
|
}
|
|
352
356
|
|
|
357
|
+
function sanitizeEditor() {
|
|
358
|
+
const val = toValue(text)
|
|
359
|
+
if (!val) return
|
|
360
|
+
const clean = sanitizeContent(val, getTipTapExtensions({ preset: props.preset }))
|
|
361
|
+
|
|
362
|
+
if (clean !== val) {
|
|
363
|
+
text.value = clean
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
353
367
|
defineExpose({
|
|
354
368
|
editor,
|
|
355
369
|
setFocus,
|
|
@@ -372,6 +386,8 @@ defineExpose({
|
|
|
372
386
|
:on-update="handleUpdate as any"
|
|
373
387
|
:mention="false"
|
|
374
388
|
:on-blur="handleBlur"
|
|
389
|
+
enable-content-check
|
|
390
|
+
:onContentError="sanitizeEditor"
|
|
375
391
|
:placeholder="$t('editor.placeholder.insert_text')"
|
|
376
392
|
:data-testid="richTextEditorTestIds.editor"
|
|
377
393
|
>
|
|
@@ -6,7 +6,10 @@ import type {
|
|
|
6
6
|
} from '@dev.smartpricing/message-composer-utils/types'
|
|
7
7
|
import { generateHTML } from '@tiptap/vue-3'
|
|
8
8
|
import { computed } from 'vue'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
generateWhatsappHtml,
|
|
11
|
+
getTipTapExtensions,
|
|
12
|
+
} from '@dev.smartpricing/message-composer-utils/utils'
|
|
10
13
|
import { useResolvedParametersQuery } from '~/queries/compilation'
|
|
11
14
|
|
|
12
15
|
defineOptions({
|
|
@@ -38,10 +41,10 @@ function replaceMentionsWithValues(html: string): string {
|
|
|
38
41
|
|
|
39
42
|
const bodyHtml = computed(() => {
|
|
40
43
|
if (!props.message.body.body.content) return ''
|
|
41
|
-
const html =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
44
|
+
const html = generateWhatsappHtml(props.message.body.body.content).replaceAll(
|
|
45
|
+
'<p></p>',
|
|
46
|
+
'<p> </p>',
|
|
47
|
+
)
|
|
45
48
|
return replaceMentionsWithValues(html)
|
|
46
49
|
})
|
|
47
50
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev.smartpricing/message-composer-layer",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"vue-router": "^5.0.7",
|
|
39
39
|
"vue3-emoji-picker": "^1.1.8",
|
|
40
40
|
"zod": "^4.4.3",
|
|
41
|
-
"@dev.smartpricing/message-composer-utils": "4.1.
|
|
41
|
+
"@dev.smartpricing/message-composer-utils": "4.1.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@nuxt/eslint": "^1.15.2",
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "nuxt build",
|
|
56
|
-
"dev": "nuxt dev",
|
|
57
56
|
"lint": "eslint app/ --fix",
|
|
58
57
|
"format": "prettier --write app/",
|
|
59
58
|
"typecheck": "nuxt typecheck",
|