You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+5
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
5
5
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
7
+
## 4.0.0 - 2024-11-13
8
+
### Breaking Changes
9
+
- Changed the attribute name for tracking preview blocks from `preview-block-id` to `data-preview-block-id`. Update your template code accordingly.
10
+
-`craft.previewMate.previewBlock` twig variable now returns the HTML attribute with `data-` prefixed to match the new `data-preview-block-id` attribute.
11
+
7
12
## 3.0.2 - 2024-11-13
8
13
### Updated
9
14
-`craft.previewMate.previewBlock` twig variable now uses `Craft::$app->request->isPreview` internally to check if the current request is a preview request.
Preview blocks will be tracked in live preview when adding the `preview-block-id` attribute to the entry's HTML element.
25
+
Preview blocks will be tracked in live preview by adding `data-preview-block-id` attribute to the entry's HTML element.
26
26
27
27
```twig
28
28
{# option 1 (recommended) - only rendered in live preview #}
@@ -31,10 +31,10 @@ Preview blocks will be tracked in live preview when adding the `preview-block-id
31
31
or
32
32
```twig
33
33
{# option 2 - manually set the preview block id #}
34
-
preview-block-id="{{ entry.id }}"
34
+
data-preview-block-id="{{ entry.id }}"
35
35
```
36
36
37
-
That element will now be tracked in the live preview. Clicking on it in the preview will scroll you to the element in the editor. Hovering over it will highlight both the editor and preview elements.
37
+
Clicking a preview block will now scroll to and highlight the editor block.
38
38
39
39
## Usage example
40
40
@@ -50,14 +50,14 @@ That element will now be tracked in the live preview. Clicking on it in the prev
50
50
{% endfor %}
51
51
```
52
52
53
-
It's recommended to add styles for preview blocks using `preview-block-id`.
54
-
The hovering style will only be toggled during live preview.
53
+
It's recommended to add styles for preview blocks using `data-preview-block-id`.
54
+
Adding the following styles will highlight the preview block on hover.
55
55
56
56
```css
57
-
[preview-block-id] {
57
+
[data-preview-block-id] {
58
58
position: relative;
59
59
}
60
-
[preview-block-id]::after {
60
+
[data-preview-block-id]::after {
61
61
content: '';
62
62
position: absolute;
63
63
top: 0;
@@ -69,7 +69,7 @@ The hovering style will only be toggled during live preview.
0 commit comments