Skip to content
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
4 changes: 1 addition & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ fileignoreconfig:
- filecontent
- filename: README.md
checksum: 568289bbe7c088967493db246dbf29e465382648ac574c1b1236be57d5662a38
- filename: CHANGELOG.md
checksum: 8e2495db48ed58704b0883b052c5d44b9f1a96cff7556235f924d16a47442688
- filename: src/visualBuilder/components/__test__/fieldToolbar.test.tsx
checksum: 3badd6a142456b6a361569e6fc546349a38ac6b366bef7fd5255d1e93220444e
- filename: src/visualBuilder/components/Collab/ThreadPopup/__test__/CommentTextArea.test.tsx
checksum: d0ef271ee5381d9feab06bda6e7e89bd0a882fee87495627bd811c1f0a5459c7
- filename: package-lock.json
checksum: fd06363871d0ee16ebfb5d9d0cc479e0922a615bb76584b80bb6933ee6c3e237
- filename: CHANGELOG.md
checksum: 8522880c11ce1518b18b8760a0f5a9cdcdd2d330575f50ba6ab403b7f8f7e74f
checksum: 873106e25dafe0355c55724936cfe0ecc9d0192a2a82c98eddaf5648f23d5ee7
version: "1.0"
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Changelog

## [v4.0.0](https://github.com/contentstack/live-preview-sdk/compare/v4.1.0...v4.0.0)
## [v4.0.1](https://github.com/contentstack/live-preview-sdk/compare/v4.0.0...v4.0.1)

> 20 August 2025
> 22 August 2025

### Fixes

- fix(preview): add util function to allow operations in preview share (Zuhair Ahmed - [fb70cdf](https://github.com/contentstack/live-preview-sdk/commit/fb70cdf8f238a0f54bbf85cacd84a09688d54b9e))

## [v4.0.0](https://github.com/contentstack/live-preview-sdk/compare/v3.4.0...v4.0.0)

> 22 August 2025

### New Features

Expand All @@ -12,6 +20,7 @@

### General Changes

- 21st august 2025 release (Sahil Chalke - [#495](https://github.com/contentstack/live-preview-sdk/pull/495))
- Live preview outside iframe (Mridul Sharma - [#492](https://github.com/contentstack/live-preview-sdk/pull/492))

### New Features
Expand All @@ -29,7 +38,9 @@
### Chores And Housekeeping

- chore: replace ifs with switch (Faraaz Biyabani - [5e216ea](https://github.com/contentstack/live-preview-sdk/commit/5e216ea01311dceee09405e1265190267745afc0))
- chore: updated the changelog.md (SahilCs15 - [fab45bf](https://github.com/contentstack/live-preview-sdk/commit/fab45bf178e31340ae72577a2f3038449970f3e1))
- chore: updated version (Mridul Sharma - [ede97b9](https://github.com/contentstack/live-preview-sdk/commit/ede97b983727e69c5d44d8d9879d18592a47548a))
- chore: updated the .talismanrc (SahilCs15 - [4686298](https://github.com/contentstack/live-preview-sdk/commit/4686298249bb51900fc2b703653be939a8ebc0a4))
- chore: update tooltip message (Faraaz Biyabani - [c23798e](https://github.com/contentstack/live-preview-sdk/commit/c23798e0467c0a6318047ee2e4fdfeef4f74a5fd))
- chore: remove sequential from unit tests (Faraaz Biyabani - [07f3c96](https://github.com/contentstack/live-preview-sdk/commit/07f3c964950db86a2537988d53ad1b78af3f1860))

Expand Down
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-b6G+ggU20rGxqCqsgaS6zludFgj5N11xsuXhMEIARMuQY2PtyDS04TU0H5goP+32' crossorigin="anonymous">
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@4.0.0';
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@4.0.1';

ContentstackLivePreview.init({
stackDetails: {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "4.0.0",
"version": "4.0.1",
"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
10 changes: 10 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@ export function isOpenInBuilder(): boolean {
}
return false;
}


export function isOpenInPreviewShare(): boolean {
if (hasWindow()) {
const urlParams = new URLSearchParams(window.location.search);
const previewShare = urlParams.get("preview_share");
return !!previewShare;
}
return false;
}
1 change: 1 addition & 0 deletions src/visualBuilder/__test__/hover/fields/date.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ vi.mock("../../../../utils/index.ts", () => {
return {
__esModule: true,
isOpenInBuilder: vi.fn().mockReturnValue(true),
isOpenInPreviewShare: vi.fn().mockReturnValue(false),
isOpeningInTimeline: vi.fn().mockReturnValue(false),
hasWindow: vi.fn().mockReturnValue(true),
addLivePreviewQueryTags: vi.fn(),
Expand Down
7 changes: 5 additions & 2 deletions src/visualBuilder/components/VisualBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import {
VisualBuilderGlobalStyles,
} from "../visualBuilder.style";
import React from "preact/compat";
import { isOpenInBuilder } from "../../utils";
import { isOpenInBuilder , isOpenInPreviewShare} from "../../utils";

interface VisualBuilderProps {
visualBuilderContainer: HTMLDivElement | null;
resizeObserver: ResizeObserver;
}

function VisualBuilderComponent(props: VisualBuilderProps): JSX.Element | null {
if (!isOpenInBuilder()) {
const isInBuilder = isOpenInBuilder();
const isInPreviewShare = isOpenInPreviewShare();

if (!isInBuilder && !isInPreviewShare) {
return null;
}

Expand Down
5 changes: 3 additions & 2 deletions src/visualBuilder/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render } from "preact";
import VisualBuilderComponent from "./VisualBuilder";
import { visualBuilderStyles } from "../visualBuilder.style";
import React from "preact/compat";
import { isOpenInBuilder } from "../../utils";
import { isOpenInBuilder , isOpenInPreviewShare} from "../../utils";

interface InitUIParams {
resizeObserver: ResizeObserver;
Expand All @@ -14,8 +14,9 @@ function initUI(props: InitUIParams): void {
);

const isInBuilder = isOpenInBuilder();
const isInPreviewShare = isOpenInPreviewShare();

if (!visualBuilderDOM && isInBuilder) {
if (!visualBuilderDOM && (isInBuilder || isInPreviewShare)) {
const visualBuilderContainer = document.createElement("div");
visualBuilderContainer.classList.add(
visualBuilderStyles()["visual-builder__container"],
Expand Down
Loading