@designcrowd/library.brand-page 6.0.6-json-prereq-5 → 6.0.6-json-prereq-6
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.
- package/lib/src/{CreatedOnBrandCrowd-de-de-CZmzW2kQ.js → CreatedOnBrandCrowd-de-de-DwDGgsOX.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-D2tXzTdS.js → CreatedOnBrandCrowd-en-us-BlggichW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BDXmktFP.js → CreatedOnBrandCrowd-es-es-3Rikujvn.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-BniZQPhE.js → CreatedOnBrandCrowd-fr-ca-Xr3RDKuy.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-BniZQPhE.js → CreatedOnBrandCrowd-fr-fr-Xr3RDKuy.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-mngAiD6i.js → CreatedOnBrandCrowd-pt-br-BvWREclI.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-mngAiD6i.js → CreatedOnBrandCrowd-pt-pt-BvWREclI.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-Bacn6DYk.js → CreatedOnDcom-de-de-C9NLGl1Q.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-CtQMBrOW.js → CreatedOnDcom-en-us-BD9JNz8i.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-ndMBMTWL.js → CreatedOnDcom-es-es-xLNmYxXL.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-dQuX1eXb.js → CreatedOnDcom-fr-ca-CqEWAxjs.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-74uI3jen.js → CreatedOnDcom-fr-fr-BvBl-ljV.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-BAr2KEUU.js → CreatedOnDcom-pt-br-D8BDaORl.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-CIOnL7w9.js → CreatedOnDcom-pt-pt-DJQecXvW.js} +1 -1
- package/lib/src/brand-page-maker/validators/field.validator.js +10 -7
- package/lib/src/css/library.brand-page-brandCrowd.min.css +36 -36
- package/lib/src/css/library.brand-page-brandPage.min.css +36 -36
- package/lib/src/css/library.brand-page-designCom.min.css +36 -36
- package/lib/src/css/library.brand-page-preview.min.css +36 -36
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-CfYQhXJl.js → lib-D9IAQIwh.js} +858 -860
- package/package.json +1 -1
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +4 -7
- package/src/brand-page-maker/validators/field.validator.test.ts +15 -10
- package/src/brand-page-maker/validators/field.validator.ts +10 -7
package/package.json
CHANGED
|
@@ -669,18 +669,15 @@ const urlValidationSettings = computed(() => {
|
|
|
669
669
|
};
|
|
670
670
|
});
|
|
671
671
|
|
|
672
|
-
// BP-5859: the hyperlink display text is inserted into the RTE, so it
|
|
673
|
-
//
|
|
674
|
-
//
|
|
672
|
+
// BP-5859: the hyperlink display text is inserted into the RTE, so it shares
|
|
673
|
+
// the RTE max-char limit. We don't block adding the link; instead we surface an
|
|
674
|
+
// error below the display-text field (the over-limit text is still truncated to
|
|
675
|
+
// the limit on insert, matching the RTE's own behaviour).
|
|
675
676
|
const isDisplayTextTooLong = computed(
|
|
676
677
|
() => markedText.value.length > props.maxLength,
|
|
677
678
|
);
|
|
678
679
|
|
|
679
680
|
const isAddLinkButtonDisabled = computed(() => {
|
|
680
|
-
if (isDisplayTextTooLong.value) {
|
|
681
|
-
return true;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
681
|
if (selectedLinkType.value === HYPERLINK_TYPE.url) {
|
|
685
682
|
const urlValue = hyperlinkUrlValue.value;
|
|
686
683
|
// Check if URL is invalid OR doesn't have https protocol
|
|
@@ -2,11 +2,12 @@ import { describe, it, expect } from 'vitest';
|
|
|
2
2
|
import { validatorDict } from './field.validator';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* BP-5857 — the `title`
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* BP-5857 — the `title` validator must preserve pre-JSON (staging) semantics.
|
|
6
|
+
* An RTE field's value used to be inline HTML: an empty editor was "<p></p>",
|
|
7
|
+
* a non-empty string, so the required check always PASSED for RTE fields — it
|
|
8
|
+
* only failed for genuinely empty PLAIN inputs. RTE fields are now Tiptap JSON
|
|
9
|
+
* docs, so any doc must likewise count as "present" (valid); a plain string is
|
|
10
|
+
* still required to be non-empty.
|
|
10
11
|
*/
|
|
11
12
|
describe('field.validator — title (nonEmptyString)', () => {
|
|
12
13
|
const titleValidator = validatorDict.title;
|
|
@@ -23,22 +24,26 @@ describe('field.validator — title (nonEmptyString)', () => {
|
|
|
23
24
|
],
|
|
24
25
|
});
|
|
25
26
|
|
|
26
|
-
it('accepts a non-empty
|
|
27
|
+
it('accepts a non-empty plain string', () => {
|
|
27
28
|
expect(titleValidator.validate('title', 'Payments').isValid).toBe(true);
|
|
28
29
|
});
|
|
29
30
|
|
|
30
|
-
it('rejects an empty string', () => {
|
|
31
|
+
it('rejects an empty plain string (required still enforced for plain inputs)', () => {
|
|
31
32
|
expect(titleValidator.validate('title', '').isValid).toBe(false);
|
|
32
33
|
});
|
|
33
34
|
|
|
34
|
-
it('accepts
|
|
35
|
+
it('accepts legacy empty RTE HTML "<p></p>" (non-empty string — staging parity)', () => {
|
|
36
|
+
expect(titleValidator.validate('title', '<p></p>').isValid).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('accepts a Tiptap JSON doc with visible text', () => {
|
|
35
40
|
expect(titleValidator.validate('title', jsonDoc('Payments')).isValid).toBe(
|
|
36
41
|
true,
|
|
37
42
|
);
|
|
38
43
|
});
|
|
39
44
|
|
|
40
|
-
it('
|
|
41
|
-
expect(titleValidator.validate('title', jsonDoc('')).isValid).toBe(
|
|
45
|
+
it('accepts an empty Tiptap JSON doc (RTE parity — empty editor is "present")', () => {
|
|
46
|
+
expect(titleValidator.validate('title', jsonDoc('')).isValid).toBe(true);
|
|
42
47
|
});
|
|
43
48
|
|
|
44
49
|
it('rejects null/undefined without throwing', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isURL, isEmail, isTel } from '@utils/validator.util';
|
|
2
2
|
import type { ItemFieldType, Validator } from '@brand-page-maker/models';
|
|
3
|
-
import { YOUTUBE_URL_RE,
|
|
3
|
+
import { YOUTUBE_URL_RE, isTiptapDocument } from '@brand-page-maker/utils';
|
|
4
4
|
import { validatorTr } from '@src/composables/useTranslate';
|
|
5
5
|
|
|
6
6
|
const addressValueValidator: Validator = {
|
|
@@ -76,12 +76,15 @@ export const dummyValidator: Validator = {
|
|
|
76
76
|
|
|
77
77
|
const nonEmptyStringValidator: Validator = {
|
|
78
78
|
validate: (name, value: any) => {
|
|
79
|
-
// BP-5787/BP-5857:
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
|
|
79
|
+
// BP-5787/BP-5857: match legacy (pre-JSON) validation semantics.
|
|
80
|
+
// An RTE field's stored value used to be inline HTML — an empty editor was
|
|
81
|
+
// "<p></p>", a NON-empty string, so the required check always passed for RTE
|
|
82
|
+
// fields (it only ever failed for genuinely empty PLAIN inputs). Now RTE
|
|
83
|
+
// fields are Tiptap JSON docs; treat any doc as "present" so behaviour
|
|
84
|
+
// stays identical. A plain string is still required to be non-empty.
|
|
85
|
+
const isValid = isTiptapDocument(value)
|
|
86
|
+
? true
|
|
87
|
+
: typeof value === 'string' && value.length > 0;
|
|
85
88
|
|
|
86
89
|
return {
|
|
87
90
|
isValid,
|