@pushwoosh/dumb-components 1.0.52 → 1.0.54
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.
|
@@ -94,14 +94,11 @@ export function stringifyDc(dc) {
|
|
|
94
94
|
} = dc;
|
|
95
95
|
return `{${tagName}|${modifier}${defaultValue ? `|${defaultValue}` : ''}}`;
|
|
96
96
|
}
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
// It will not match strings like '{tag|modifier|default}' if there is no '}' after the last '|'.
|
|
103
|
-
// This regex is used to split the string into parts, where the parts are either text or dynamic content.
|
|
104
|
-
const DynamicContentRegex = /(\{(?=[^}]*\|)[^}]*?})/;
|
|
97
|
+
// Regular expression to match dynamic content tags in the format "{tagName|modifier|defaultValue}"
|
|
98
|
+
// The regex captures the entire tag, including the curly braces and pipe characters
|
|
99
|
+
// It uses a positive lookahead to ensure that there is at least one pipe character in the tag
|
|
100
|
+
// This allows for the presence of a default value, but does not require it
|
|
101
|
+
const DynamicContentRegex = /(\{(?=[^}]*\|).*?})/;
|
|
105
102
|
/**
|
|
106
103
|
* Converts a string to Slate editor content, parsing dynamic content tags
|
|
107
104
|
* @param value - The input string to convert
|
|
@@ -152,8 +149,8 @@ export function content2string(state) {
|
|
|
152
149
|
export function validateContent(value) {
|
|
153
150
|
for (const el of value) {
|
|
154
151
|
if (isElement(el)) {
|
|
155
|
-
if (el.type === 'dc') {
|
|
156
|
-
return
|
|
152
|
+
if (el.type === 'dc' && !el.dc.tagName) {
|
|
153
|
+
return false;
|
|
157
154
|
}
|
|
158
155
|
if (!validateContent(el.children)) {
|
|
159
156
|
return false;
|