@designcrowd/library.brand-page 5.10.6-ml-1 → 5.10.6-ml-2

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.
@@ -2,9 +2,8 @@ import { defineComponent } from 'vue';
2
2
  import ComponentCommonMixin from '../mixins/component-common.mixin';
3
3
  import { isURL } from '../../../utils/validator.util';
4
4
  import { ALIGN_CENTERED, ALIGN_LEFT_ALIGNED, ALIGN_RIGHT_ALIGNED, BIG_IMAGE, ALIGN_LEFT_BIG_IMAGE, ALIGN_RIGHT_FULL_IMAGE, ALIGN_LEFT_FULL_IMAGE, ALIGN_CARD_CENTER_IMAGE, ALIGN_CARD_LEFT_IMAGE, } from '../../constants';
5
- import { getRenderText } from '../../utils';
5
+ import { getRenderText, escapeContentText } from '../../utils';
6
6
  import { hasRTEContent } from '../../../brand-page-maker/utils';
7
- import { escapeContentText } from '../../../shared/content-settings/utils';
8
7
  export default defineComponent({
9
8
  mixins: [ComponentCommonMixin],
10
9
  props: {
@@ -1,4 +1,4 @@
1
- import { escapeContentText } from '../../shared/content-settings/utils';
1
+ import { escapeContentText } from '../../brand-page/utils';
2
2
  import { DEFAULT_PERSONALISATION_MAPPING, PERSONALISATION_MAPPINGS, TEXT_MEDIA_CONTENT_TYPES, } from '../../brand-page-maker/constants/personalisation.constant';
3
3
  import { BRAND_PAGE_TYPES, ShapeAspectRatioCategory } from '../models';
4
4
  import { getColorReplacementsFromSvgString, getColorReplacementsFromSvgStringServer, } from './svg-color.util';
@@ -1 +1,3 @@
1
1
  export declare const getRenderText: (text: string) => string;
2
+ export declare const escapeContentText: (text: string | undefined) => string | undefined;
3
+ export declare const unescapeContentText: (text: string) => string;
@@ -2,3 +2,14 @@ import { ESCAPED_NEWLINE_CHARACTER } from '../../constants/ui';
2
2
  export const getRenderText = (text) => {
3
3
  return text.replace(new RegExp(`(${ESCAPED_NEWLINE_CHARACTER}|\\n)`, 'g'), '<br/>');
4
4
  };
5
+ export const escapeContentText = (text) => {
6
+ if (!text) {
7
+ return text;
8
+ }
9
+ return text
10
+ .replace(/(<([^>]+)>)/gi, '')
11
+ .replace(/(\r\n|\r|\n)/g, ESCAPED_NEWLINE_CHARACTER);
12
+ };
13
+ export const unescapeContentText = (text) => {
14
+ return text.replace(new RegExp(`${ESCAPED_NEWLINE_CHARACTER}`, 'g'), '\n');
15
+ };