@contentstorage/core 0.3.37 → 0.3.38

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 currentKeys = htmlElem.getAttribute('data-contentstorage-keys');
4
- let storedKeys = [];
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
@@ -18,6 +18,7 @@ async function isLiveEditorMode() {
18
18
  }
19
19
  }
20
20
  isLiveEditorMode().then(async (isLiveMode) => {
21
+ console.log('isLiveMode', isLiveMode);
21
22
  if (!isLiveMode) {
22
23
  return;
23
24
  }
@@ -70,6 +70,7 @@ export function getText(contentKey, variables) {
70
70
  }
71
71
  if (typeof current === 'string') {
72
72
  if (!variables || Object.keys(variables).length === 0) {
73
+ console.log('isInContentstorageIframe', isInContentstorageIframe);
73
74
  if (isInContentstorageIframe) {
74
75
  setKeyToHtmlTag(contentKey);
75
76
  }
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.37",
5
+ "version": "0.3.38",
6
6
  "type": "module",
7
7
  "description": "Fetch content from contentstorage and generate TypeScript types",
8
8
  "module": "dist/index.js",