Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hide edit tags when on timeline preview #284

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @contentstack/security-admin
* @contentstack/security-admin
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Alternatively, if you want to include the package directly in your website HTML

```html
<script type='module' integrity='sha384-lCmcVfWM6NvgMmsDlPZYYJ9MwFk9oDU3WhsJ3KmUJPWa7iKvIuYl+XzTl+cOCuim' crossorigin="anonymous">
import ContentstackLivePreview from 'https://esm.sh/@contentstack/[email protected].4';
import ContentstackLivePreview from 'https://esm.sh/@contentstack/[email protected].5';

ContentstackLivePreview.init({
stackDetails: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/live-preview-utils",
"version": "2.0.4",
"version": "2.0.5",
"description": "Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.",
"type": "module",
"types": "dist/legacy/index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/live-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ export default class LivePreview {
}
window.addEventListener("message", this.resolveIncomingMessage);
window.addEventListener("scroll", this.updateTooltipPosition);
// extract search params and check if preview_timestamp set
const urlParams = new URLSearchParams(window.location.search);
const previewTimestamp = urlParams.get("preview_timestamp");
// render the hover outline only when edit button enable
if (this.config.editButton.enable) {
if (this.config.editButton.enable && !previewTimestamp) {
window.addEventListener("mouseover", this.addEditStyleOnHover);
}

Expand Down
Loading