@contentstorage/core 0.3.37 → 0.3.39
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.
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
const htmlElem = document.documentElement;
|
|
2
2
|
export const setKeyToHtmlTag = (contentKey) => {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
try {
|
|
6
|
-
storedKeys = JSON.parse(currentKeys || '');
|
|
7
|
-
if (!Array.isArray(storedKeys)) {
|
|
8
|
-
storedKeys = [];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
console.error('Could not parse data-contentstorage-keys:', e);
|
|
13
|
-
storedKeys = [];
|
|
14
|
-
}
|
|
15
|
-
if (!storedKeys.includes(contentKey)) {
|
|
16
|
-
storedKeys.push(contentKey);
|
|
17
|
-
}
|
|
18
|
-
htmlElem.setAttribute('data-contentstorage-keys', JSON.stringify(storedKeys));
|
|
3
|
+
const dataKey = `data-contentstorage-key-${contentKey}`;
|
|
4
|
+
htmlElem.setAttribute(dataKey, 'true');
|
|
19
5
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { populateTextWithVariables } from '../helpers/populateTextWithVariables.js';
|
|
2
|
-
import { isInContentstorageIframe } from '../index.js';
|
|
3
|
-
import { setKeyToHtmlTag } from '../helpers/setKeyToHtmlTag.js';
|
|
4
2
|
export let activeContent = null;
|
|
5
3
|
export let appConfig = null;
|
|
6
4
|
/**
|
|
@@ -70,9 +68,6 @@ export function getText(contentKey, variables) {
|
|
|
70
68
|
}
|
|
71
69
|
if (typeof current === 'string') {
|
|
72
70
|
if (!variables || Object.keys(variables).length === 0) {
|
|
73
|
-
if (isInContentstorageIframe) {
|
|
74
|
-
setKeyToHtmlTag(contentKey);
|
|
75
|
-
}
|
|
76
71
|
return {
|
|
77
72
|
contentKey,
|
|
78
73
|
text: current,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@contentstorage/core",
|
|
3
3
|
"author": "Kaido Hussar <kaidohus@gmail.com>",
|
|
4
4
|
"homepage": "https://contentstorage.app",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.39",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Fetch content from contentstorage and generate TypeScript types",
|
|
8
8
|
"module": "dist/index.js",
|