@datocms/astro 0.6.10 → 0.6.11
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@datocms/astro",
|
|
3
3
|
"description": "A set of components and utilities to work faster with DatoCMS in Astro projects.",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.11",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@0no-co/graphql.web": "^1.0.7",
|
|
49
|
-
"@datocms/content-link": "^0.3.
|
|
49
|
+
"@datocms/content-link": "^0.3.13",
|
|
50
50
|
"datocms-listen": "^1.0.1",
|
|
51
51
|
"datocms-structured-text-generic-html-renderer": "^5.0.0",
|
|
52
52
|
"datocms-structured-text-utils": "^5.1.6"
|
|
@@ -104,6 +104,7 @@ const enableClickToEditValue =
|
|
|
104
104
|
<script>
|
|
105
105
|
import { createController } from '@datocms/content-link';
|
|
106
106
|
import { navigate } from 'astro:transitions/client';
|
|
107
|
+
import type { ClickToEditOptions } from './ContentLink.astro';
|
|
107
108
|
|
|
108
109
|
class DatoCMSContentLink extends HTMLElement {
|
|
109
110
|
private controller: ReturnType<typeof createController> | null = null;
|
|
@@ -123,7 +124,7 @@ const enableClickToEditValue =
|
|
|
123
124
|
const stripStegaAttr = this.getAttribute('data-strip-stega');
|
|
124
125
|
|
|
125
126
|
const enableClickToEdit = enableClickToEditAttr
|
|
126
|
-
? JSON.parse(enableClickToEditAttr)
|
|
127
|
+
? (JSON.parse(enableClickToEditAttr) as boolean | ClickToEditOptions)
|
|
127
128
|
: undefined;
|
|
128
129
|
const stripStega = stripStegaAttr === 'true';
|
|
129
130
|
|
|
@@ -174,22 +175,19 @@ const enableClickToEditValue =
|
|
|
174
175
|
// Enable click-to-edit mode if requested via prop.
|
|
175
176
|
// Never enable when running inside an iframe (e.g. the DatoCMS Web Previews plugin),
|
|
176
177
|
// because the plugin already manages its own editing experience.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
178
|
+
if (
|
|
179
|
+
enableClickToEdit &&
|
|
180
|
+
window.self === window.top &&
|
|
181
|
+
(enableClickToEdit === true ||
|
|
182
|
+
!enableClickToEdit.hoverOnly ||
|
|
183
|
+
window.matchMedia('(hover: hover)').matches)
|
|
184
|
+
) {
|
|
185
|
+
this.controller.enableClickToEdit(
|
|
186
|
+
enableClickToEdit === true
|
|
187
|
+
? undefined
|
|
188
|
+
: { scrollToNearestTarget: enableClickToEdit.scrollToNearestTarget ?? false },
|
|
189
|
+
);
|
|
190
190
|
}
|
|
191
|
-
// Otherwise, click-to-edit overlays are not enabled by default.
|
|
192
|
-
// Users can press and hold Alt/Option key to temporarily enable click-to-edit mode
|
|
193
191
|
}
|
|
194
192
|
|
|
195
193
|
private cleanup() {
|