@designcrowd/library.brand-page 5.12.8-shape-3 → 5.12.9
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-C6yHS_uc.js → CreatedOnBrandCrowd-de-de-BSa_oMUS.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-71jFnX4a.js → CreatedOnBrandCrowd-en-us-CrDm6Zsd.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BWQ3wBEd.js → CreatedOnBrandCrowd-es-es-D_osPiN2.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-Ckd8_eBU.js → CreatedOnBrandCrowd-fr-fr-B6KRVAx0.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DU_TBU5B.js → CreatedOnBrandCrowd-pt-pt-DflhU2ts.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-MeXQe36m.js → CreatedOnDcom-de-de-CMxzzUpC.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-i2V8pHQC.js → CreatedOnDcom-en-us-Cgau0pJ6.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-R881IuIY.js → CreatedOnDcom-es-es-7mE5DRiG.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-Cj4S6RmF.js → CreatedOnDcom-fr-fr-D2Q_bKeL.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-9VaIe9-M.js → CreatedOnDcom-pt-pt-CdsDaHLJ.js} +1 -1
- package/lib/src/brand-page/components/background-shape/BackgroundShape.mixin.d.ts +1 -3
- package/lib/src/brand-page/components/background-shape/BackgroundShape.mixin.js +8 -49
- package/lib/src/brand-page/components/media/Shape.mixin.d.ts +2 -3
- package/lib/src/brand-page/components/media/Shape.mixin.js +11 -44
- package/lib/src/brand-page/utils/svg.util.d.ts +0 -1
- package/lib/src/brand-page/utils/svg.util.js +0 -3
- package/lib/src/brand-page-maker/utils/url.util.js +1 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +43 -40
- package/lib/src/css/library.brand-page-brandPage.min.css +43 -40
- package/lib/src/css/library.brand-page-designCom.min.css +43 -40
- package/lib/src/css/library.brand-page-preview.min.css +43 -40
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-Bpr4nnTY.js → lib-C0TzGTrm.js} +11586 -11602
- package/package.json +1 -1
- package/src/brand-page/components/background-shape/BackgroundShape.mixin.ts +12 -64
- package/src/brand-page/components/background-shape/BackgroundShape.vue +12 -2
- package/src/brand-page/components/media/Shape.mixin.ts +17 -56
- package/src/brand-page/components/media/Shape.vue +7 -0
- package/src/brand-page/utils/svg.util.ts +0 -4
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +7 -1
- package/src/brand-page-maker/utils/url.util.test.ts +6 -0
- package/src/brand-page-maker/utils/url.util.ts +1 -1
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ import axios from 'axios';
|
|
|
6
6
|
import { applyColorToSvgString } from '../../utils/svg-color.util';
|
|
7
7
|
import { isURL } from '../../../utils/validator.util';
|
|
8
8
|
import { PROXY_SHAPE_URL_REGEX } from '../../../brand-page/constants';
|
|
9
|
-
import { getRegexToMatchAttributeInSvgTag } from '../../../brand-page/utils/svg.util';
|
|
10
9
|
|
|
11
10
|
const SUPPORTED_SHAPE_HOSTS = [
|
|
12
11
|
'https://bc-user-uploads.brandcrowd.com/public',
|
|
@@ -22,7 +21,7 @@ export default defineComponent({
|
|
|
22
21
|
},
|
|
23
22
|
},
|
|
24
23
|
data() {
|
|
25
|
-
return { svgData: '',
|
|
24
|
+
return { svgData: '', originalSvgData: '' };
|
|
26
25
|
},
|
|
27
26
|
computed: {
|
|
28
27
|
useObjectElement(): boolean {
|
|
@@ -40,12 +39,15 @@ export default defineComponent({
|
|
|
40
39
|
);
|
|
41
40
|
},
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
svgAttributes(): string {
|
|
43
|
+
const attributes: string[] = [];
|
|
44
|
+
|
|
45
|
+
if (this.isFullBackground) {
|
|
46
|
+
attributes.push('preserveAspectRatio="xMidYMid slice"');
|
|
47
|
+
attributes.push('style="width: 100%; height: 100%;"');
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
return
|
|
50
|
+
return attributes.join(' ');
|
|
49
51
|
},
|
|
50
52
|
},
|
|
51
53
|
watch: {
|
|
@@ -72,49 +74,6 @@ export default defineComponent({
|
|
|
72
74
|
);
|
|
73
75
|
},
|
|
74
76
|
|
|
75
|
-
applySvgAttributes(svgData: string): string {
|
|
76
|
-
const attributes: string[] = [];
|
|
77
|
-
|
|
78
|
-
if (this.isFullBackground) {
|
|
79
|
-
const widthRegex = getRegexToMatchAttributeInSvgTag('width');
|
|
80
|
-
|
|
81
|
-
if (svgData.match(widthRegex)) {
|
|
82
|
-
svgData = svgData.replace(widthRegex, `$1width="100%"`);
|
|
83
|
-
} else {
|
|
84
|
-
attributes.push(`width="100%"`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const heightRegex = getRegexToMatchAttributeInSvgTag('height');
|
|
88
|
-
|
|
89
|
-
if (svgData.match(heightRegex)) {
|
|
90
|
-
svgData = svgData.replace(heightRegex, `$1height="100%"`);
|
|
91
|
-
} else {
|
|
92
|
-
attributes.push(`height="100%"`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const preserveAspectRatioRegex = getRegexToMatchAttributeInSvgTag(
|
|
96
|
-
'preserveAspectRatio',
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
if (svgData.match(preserveAspectRatioRegex)) {
|
|
100
|
-
svgData = svgData.replace(
|
|
101
|
-
preserveAspectRatioRegex,
|
|
102
|
-
`$1preserveAspectRatio="xMidYMid slice"`,
|
|
103
|
-
);
|
|
104
|
-
} else {
|
|
105
|
-
attributes.push(`preserveAspectRatio="xMidYMid slice"`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const svgAttributes = attributes.join(' ');
|
|
110
|
-
|
|
111
|
-
if (svgAttributes) {
|
|
112
|
-
svgData = svgData.replace('<svg ', `<svg ${svgAttributes} `);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return svgData;
|
|
116
|
-
},
|
|
117
|
-
|
|
118
77
|
async render() {
|
|
119
78
|
if (this.useObjectElement) {
|
|
120
79
|
return;
|
|
@@ -137,23 +96,12 @@ export default defineComponent({
|
|
|
137
96
|
this.originalSvgData,
|
|
138
97
|
this.viewModel.style.color,
|
|
139
98
|
);
|
|
140
|
-
} else {
|
|
141
|
-
this.svgData = this.originalSvgData;
|
|
142
99
|
}
|
|
143
100
|
|
|
144
|
-
this.svgData = this.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const oldSvgDataObjectUrl = this.svgDataObjectUrl;
|
|
149
|
-
|
|
150
|
-
// Create an Object URL
|
|
151
|
-
this.svgDataObjectUrl = URL.createObjectURL(blob);
|
|
152
|
-
|
|
153
|
-
if (oldSvgDataObjectUrl) {
|
|
154
|
-
// clean up previous Object URL
|
|
155
|
-
URL.revokeObjectURL(oldSvgDataObjectUrl);
|
|
156
|
-
}
|
|
101
|
+
this.svgData = this.svgData.replace(
|
|
102
|
+
'<svg ',
|
|
103
|
+
`<svg ${this.svgAttributes} `,
|
|
104
|
+
);
|
|
157
105
|
},
|
|
158
106
|
},
|
|
159
107
|
});
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="c-shape-background">
|
|
3
|
-
<div
|
|
4
|
-
|
|
3
|
+
<div
|
|
4
|
+
v-if="useObjectElement"
|
|
5
|
+
:style="backgroundShapesStyle"
|
|
6
|
+
class="c-shape c-shape-object"
|
|
7
|
+
>
|
|
8
|
+
<object class="tw-w-full tw-h-full" :data="viewModel.name" />
|
|
5
9
|
</div>
|
|
10
|
+
<div
|
|
11
|
+
v-else
|
|
12
|
+
:style="backgroundShapesStyle"
|
|
13
|
+
class="c-shape"
|
|
14
|
+
v-html="svgData"
|
|
15
|
+
/>
|
|
6
16
|
</div>
|
|
7
17
|
</template>
|
|
8
18
|
<script>
|
|
@@ -5,7 +5,6 @@ import ComponentCommonMixin from '../mixins/component-common.mixin';
|
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { applyColorReplacementsToSvgString } from '../../utils/svg-color.util';
|
|
7
7
|
import { PROXY_SHAPE_URL_REGEX } from '../../../brand-page/constants';
|
|
8
|
-
import { getRegexToMatchAttributeInSvgTag } from '../../../brand-page/utils/svg.util';
|
|
9
8
|
|
|
10
9
|
export default defineComponent({
|
|
11
10
|
mixins: [ComponentCommonMixin],
|
|
@@ -35,7 +34,7 @@ export default defineComponent({
|
|
|
35
34
|
},
|
|
36
35
|
},
|
|
37
36
|
data() {
|
|
38
|
-
return { svgData: '',
|
|
37
|
+
return { svgData: '', originalSvgData: '' };
|
|
39
38
|
},
|
|
40
39
|
computed: {
|
|
41
40
|
useObjectElement(): boolean {
|
|
@@ -54,10 +53,6 @@ export default defineComponent({
|
|
|
54
53
|
},
|
|
55
54
|
|
|
56
55
|
objectUrl() {
|
|
57
|
-
if (!this.useObjectElement) {
|
|
58
|
-
return this.svgDataObjectUrl;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
56
|
let dimensionQuery = ``;
|
|
62
57
|
|
|
63
58
|
if (this.size) {
|
|
@@ -68,17 +63,21 @@ export default defineComponent({
|
|
|
68
63
|
|
|
69
64
|
return `${this.imageUrl}${dimensionQuery}`;
|
|
70
65
|
},
|
|
66
|
+
|
|
67
|
+
svgAttributes(): string {
|
|
68
|
+
const attributes: string[] = [];
|
|
69
|
+
|
|
70
|
+
if (this.size) {
|
|
71
|
+
attributes.push(`height=${this.size} width=${this.size}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return attributes.join(' ');
|
|
75
|
+
},
|
|
71
76
|
},
|
|
72
77
|
watch: {
|
|
73
78
|
colorReplacements: {
|
|
74
|
-
handler(
|
|
75
|
-
|
|
76
|
-
newVal &&
|
|
77
|
-
oldVal &&
|
|
78
|
-
JSON.stringify(newVal) !== JSON.stringify(oldVal)
|
|
79
|
-
) {
|
|
80
|
-
this.renderAsInnerHtml();
|
|
81
|
-
}
|
|
79
|
+
handler() {
|
|
80
|
+
this.renderAsInnerHtml();
|
|
82
81
|
},
|
|
83
82
|
deep: true,
|
|
84
83
|
},
|
|
@@ -121,35 +120,6 @@ export default defineComponent({
|
|
|
121
120
|
}
|
|
122
121
|
},
|
|
123
122
|
methods: {
|
|
124
|
-
applySvgAttributes(svgData: string): string {
|
|
125
|
-
const attributes: string[] = [];
|
|
126
|
-
|
|
127
|
-
if (this.size) {
|
|
128
|
-
const widthRegex = getRegexToMatchAttributeInSvgTag('width');
|
|
129
|
-
|
|
130
|
-
if (svgData.match(widthRegex)) {
|
|
131
|
-
svgData = svgData.replace(widthRegex, `$1width="${this.size}"`);
|
|
132
|
-
} else {
|
|
133
|
-
attributes.push(`width="${this.size}"`);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const heightRegex = getRegexToMatchAttributeInSvgTag('height');
|
|
137
|
-
|
|
138
|
-
if (svgData.match(heightRegex)) {
|
|
139
|
-
svgData = svgData.replace(heightRegex, `$1height="${this.size}"`);
|
|
140
|
-
} else {
|
|
141
|
-
attributes.push(`height="${this.size}"`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const svgAttributes = attributes.join(' ');
|
|
146
|
-
|
|
147
|
-
if (svgAttributes) {
|
|
148
|
-
svgData = svgData.replace('<svg ', `<svg ${svgAttributes} `);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return svgData;
|
|
152
|
-
},
|
|
153
123
|
async renderAsInnerHtml() {
|
|
154
124
|
if (!this.originalSvgData) {
|
|
155
125
|
return;
|
|
@@ -160,19 +130,10 @@ export default defineComponent({
|
|
|
160
130
|
this.colorReplacements,
|
|
161
131
|
);
|
|
162
132
|
|
|
163
|
-
this.svgData = this.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const oldSvgDataObjectUrl = this.svgDataObjectUrl;
|
|
168
|
-
|
|
169
|
-
// Create an Object URL
|
|
170
|
-
this.svgDataObjectUrl = URL.createObjectURL(blob);
|
|
171
|
-
|
|
172
|
-
if (oldSvgDataObjectUrl) {
|
|
173
|
-
// clean up previous Object URL
|
|
174
|
-
URL.revokeObjectURL(oldSvgDataObjectUrl);
|
|
175
|
-
}
|
|
133
|
+
this.svgData = this.svgData.replace(
|
|
134
|
+
'<svg ',
|
|
135
|
+
`<svg ${this.svgAttributes} `,
|
|
136
|
+
);
|
|
176
137
|
},
|
|
177
138
|
},
|
|
178
139
|
});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="imgClasses">
|
|
3
3
|
<div
|
|
4
|
+
v-if="useObjectElement"
|
|
4
5
|
class="c-shape c-shape-object"
|
|
5
6
|
:class="{ 'tw-flex tw-justify-center tw-items-center': size }"
|
|
6
7
|
>
|
|
7
8
|
<object :style="objectStyle" :data="objectUrl" />
|
|
8
9
|
</div>
|
|
10
|
+
<div
|
|
11
|
+
v-else
|
|
12
|
+
class="c-shape"
|
|
13
|
+
:class="{ 'tw-flex tw-justify-center tw-items-center': size }"
|
|
14
|
+
v-html="svgData"
|
|
15
|
+
/>
|
|
9
16
|
</div>
|
|
10
17
|
</template>
|
|
11
18
|
<script>
|
|
@@ -24,7 +24,3 @@ export const setSvgCssStyle = (svgData: string, cssStyle: string): string => {
|
|
|
24
24
|
export const appendSvgIdSuffix = (svgData: string, svgIdSuffix: string) => {
|
|
25
25
|
return svgData.replace(/(SVGID(?:_\d+)+)/g, `$1_${svgIdSuffix}`);
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
export const getRegexToMatchAttributeInSvgTag = (attribute: string) => {
|
|
29
|
-
return new RegExp(`(<svg\\b[^>]*?)${attribute}="[^"]*"`, 'i');
|
|
30
|
-
};
|
|
@@ -1083,6 +1083,12 @@ const onClickHyperlink = (href?: string, text?: string) => {
|
|
|
1083
1083
|
font-family: 'Lato' !important;
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
+
::v-deep .ProseMirror a s,
|
|
1087
|
+
::v-deep .ProseMirror a strike,
|
|
1088
|
+
::v-deep .ProseMirror a [data-strike] {
|
|
1089
|
+
text-decoration: line-through !important;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1086
1092
|
::v-deep .ProseMirror a,
|
|
1087
1093
|
::v-deep .ProseMirror a * {
|
|
1088
1094
|
color: #0097d7 !important;
|
|
@@ -1157,7 +1163,7 @@ const onClickHyperlink = (href?: string, text?: string) => {
|
|
|
1157
1163
|
transform: translateX(-50%);
|
|
1158
1164
|
}
|
|
1159
1165
|
.hyperlink-popup {
|
|
1160
|
-
z-index:
|
|
1166
|
+
z-index: 10000 !important;
|
|
1161
1167
|
}
|
|
1162
1168
|
}
|
|
1163
1169
|
|
|
@@ -22,6 +22,12 @@ describe('url-util', () => {
|
|
|
22
22
|
'https://m.youtube.com/embed/L53gjP-TtGE&rel=0',
|
|
23
23
|
'http://www.youtube.com/embed/L53gjP-TtGE&rel=0',
|
|
24
24
|
'https://www.youtube.com/embed/L53gjP-TtGE&rel=0',
|
|
25
|
+
'http://youtube.com/shorts/L53gjP-TtGE',
|
|
26
|
+
'https://youtube.com/shorts/L53gjP-TtGE',
|
|
27
|
+
'http://www.youtube.com/shorts/L53gjP-TtGE',
|
|
28
|
+
'https://www.youtube.com/shorts/L53gjP-TtGE',
|
|
29
|
+
'http://m.youtube.com/shorts/L53gjP-TtGE',
|
|
30
|
+
'https://m.youtube.com/shorts/L53gjP-TtGE',
|
|
25
31
|
])('youtubeUrlRe should return match when given a url', (url) => {
|
|
26
32
|
// Arrange
|
|
27
33
|
const expected = 'L53gjP-TtGE';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const YOUTUBE_URL_RE =
|
|
2
|
-
/(?:https?:\/\/)?(?:www|m)?\.?(?:youtube|youtu)\.(?:com|be)\/(?!channel\/|c\/|user\/|u\/)(?:embed\/|watch)?(?:\?.*v=)?([^&]+).*/i;
|
|
2
|
+
/(?:https?:\/\/)?(?:www|m)?\.?(?:youtube|youtu)\.(?:com|be)\/(?!channel\/|c\/|user\/|u\/)(?:embed\/|watch|shorts\/)?(?:\?.*v=)?([^&]+).*/i;
|
|
3
3
|
|
|
4
4
|
export const DOMAIN_NAME_RE = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/;
|
|
5
5
|
|