Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
2c4e0ee
chore: fieldlocation fetch completed
SahilCs15 Jun 29, 2025
26a70f4
chore: rendered the fieldmodifier apps added an event listner to send…
SahilCs15 Jun 30, 2025
c394b1f
chore: added test cases for the field location data
SahilCs15 Jul 1, 2025
bf2cc68
fix: undo unneccsary changes
SahilCs15 Jul 1, 2025
a0ff5b0
fix: resolved the issues
SahilCs15 Jul 3, 2025
000168e
feat: hovertoolbar component and rendering
csAyushDubey Jul 4, 2025
d9a0d09
chore: talismanrc update
csAyushDubey Jul 4, 2025
bc21aae
test: fieldlabelwrapper
csAyushDubey Jul 4, 2025
d2c1c70
Merge pull request #449 from contentstack/Field-modifiers-in-canvas
sairaj-cs Jul 7, 2025
88a81a4
redner the app on dom
SahilCs15 Jul 9, 2025
19f865a
Merge pull request #450 from contentstack/VE-6701-Hover-Toolbar-Support
csAyushDubey Jul 9, 2025
1cae0c3
fix: disable scroll when field modifer is active
SahilCs15 Jul 9, 2025
42c1576
feat: fieldLabelWrapper changes
csAyushDubey Jul 9, 2025
bab4171
fix: tooltip arrow change
csAyushDubey Jul 10, 2025
bfd84b7
Merge pull request #453 from contentstack/VE-6698-reference-map-sync
csAyushDubey Jul 10, 2025
8478bbc
fix: missed rendering case
csAyushDubey Jul 10, 2025
14ba432
fix:removed uncessary changes
SahilCs15 Jul 11, 2025
764fc0b
Merge branch 'render-field-modifier-in-canvas' into disable-scroll-wh…
SahilCs15 Jul 11, 2025
12be298
fix: addresed the requested cahnges
SahilCs15 Jul 14, 2025
51204af
chore: cleanup commit
csAyushDubey Jul 15, 2025
71f24d8
fix: tests
csAyushDubey Jul 15, 2025
8830f3c
chore: increased test timeout for CI
csAyushDubey Jul 15, 2025
eb2d72f
chore: incresed hook timeout for CI
csAyushDubey Jul 15, 2025
abfd640
chore: added retry to vitest
csAyushDubey Jul 15, 2025
da638dd
chore: increased timeout further
csAyushDubey Jul 15, 2025
cd63458
Merge pull request #458 from contentstack/disable-scroll-when-field-m…
SahilCs15 Jul 15, 2025
0d36fbc
Merge pull request #455 from contentstack/VE-6600-Hover-Toolbar-Support
csAyushDubey Jul 16, 2025
aa16fa2
Merge branch 'develop_v3' into VE-5474-Field-Modifier-support-for-can…
SahilCs15 Jul 16, 2025
c8e3a35
fix: fixed conficts
SahilCs15 Jul 16, 2025
435a028
fix: fixed the required changes
SahilCs15 Jul 16, 2025
37dccb8
fix: removed not requied changes
SahilCs15 Jul 16, 2025
366fc87
Merge pull request #460 from contentstack/VE-5474-Field-Modifier-supp…
SahilCs15 Jul 16, 2025
a80d08d
fix: no hovertoolbar when focussed
csAyushDubey Jul 16, 2025
69328d4
Merge pull request #461 from contentstack/VE-6600-Hover-Toolbar-Support
csAyushDubey Jul 16, 2025
cc71759
fix: changed order in tooltip and customcursor hiding
csAyushDubey Jul 18, 2025
565d56d
Merge pull request #464 from contentstack/VE-6600-Hover-Toolbar-Support
csAyushDubey Jul 18, 2025
b43682d
fix: modified the way we were handling fieldlocation data fetch (#462)
SahilCs15 Jul 18, 2025
ac4fdb3
fix: field parent clickability
csAyushDubey Jul 22, 2025
3b897a4
Merge pull request #467 from contentstack/VE-7005-hover-toolbar-click…
csAyushDubey Jul 22, 2025
6b83664
chore(VE-6918/error-text): warning message improved
csAdityaPachauri Jul 15, 2025
ec3ccab
chore(VE-6918/error-text): component name changed to title case
csAdityaPachauri Jul 23, 2025
7ecfb19
chore(VE-6918/error-text): unit test file added
csAdityaPachauri Jul 25, 2025
3d5afdc
Merge branch 'main' of https://github.com/contentstack/live-preview-s…
csAdityaPachauri Jul 30, 2025
baea843
Merge pull request #475 from contentstack/VE-6918/error-text-main
csAdityaPachauri Jul 30, 2025
13ace62
fix: removed edit icon when the click is on the container (#478)
SahilCs15 Aug 4, 2025
7682fc4
Merge pull request #479 from contentstack/VE_6673
contentstackMridul Aug 5, 2025
5de0102
Merge branch 'stage_v3' into develop_v3
faraazb-contentstack Aug 7, 2025
ce60715
Merge branch 'develop_v3' into dev-VE-7062-disable-entry-edit-workflo…
faraazb-contentstack Aug 7, 2025
81c84bc
Merge branch 'main' into develop_v3
faraazb-contentstack Aug 7, 2025
0bbf435
Merge branch 'develop_v3' into dev-VE-7062-disable-entry-edit-workflo…
faraazb-contentstack Aug 7, 2025
2e5044e
Merge branch 'VE-7062-disable-entry-edit-workflow-stage' into dev-VE-…
faraazb-contentstack Aug 7, 2025
b26c4ac
Merge branch 'VE-7062-disable-entry-edit-workflow-stage' into dev-VE-…
faraazb-contentstack Aug 8, 2025
289c505
Merge branch 'VE-7062-disable-entry-edit-workflow-stage' into dev-VE-…
faraazb-contentstack Aug 11, 2025
fb85e53
Merge pull request #489 from contentstack/dev-VE-7062-disable-entry-e…
faraazb Aug 13, 2025
625d820
VB-248 fixed the cursor moving to the start with a explicitly adding …
SahilCs15 Aug 22, 2025
41de9c3
chore: added test cases for testing the pseudo element
SahilCs15 Sep 2, 2025
07ffb6e
chore: added test cases and updated .talismanrc
SahilCs15 Sep 2, 2025
4e8d5e8
Merge branch 'develop_v4' into VB-248-dev
SahilCs15 Sep 3, 2025
b223988
Merge pull request #497 from contentstack/VB-248-dev
SahilCs15 Sep 3, 2025
51fec5b
fix: remove integrity attribute from script tag and update copyright …
hitesh-shetty-cstk Sep 4, 2025
2305f45
chore: remove ssri and @types/ssri from installed packages
hitesh-shetty-cstk Sep 4, 2025
ba866e8
Merge pull request #499 from contentstack/VB-448
hiteshshetty-dev Sep 4, 2025
52f91a4
Delete secrets-scan.yml
Aravind-Kumar-cstk Sep 8, 2025
1b89e20
Updated codeowners
Aravind-Kumar-cstk Sep 8, 2025
b78db51
fix: new tab ssr params issue fix
contentstackMridul Sep 16, 2025
f3c6abc
test: updated new tab test for ssr reload
contentstackMridul Sep 16, 2025
e65d15c
chore: removed unused console log
contentstackMridul Sep 16, 2025
9cbb317
Merge pull request #502 from contentstack/live-preview-new-tab-ssr-issue
contentstackMridul Sep 16, 2025
b365b99
Merge pull request #505 from contentstack/18th-sept-2025-release
kirtesh-cstk Sep 16, 2025
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
29 changes: 0 additions & 29 deletions .github/workflows/secrets-scan.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ fileignoreconfig:
checksum: d0ef271ee5381d9feab06bda6e7e89bd0a882fee87495627bd811c1f0a5459c7
- filename: package-lock.json
checksum: fd06363871d0ee16ebfb5d9d0cc479e0922a615bb76584b80bb6933ee6c3e237
- filename: src/visualBuilder/utils/__test__/handleFieldMouseDown.test.ts
checksum: dc20802eab76834de7aadb797b14076f1f1a9c0662b32493563fe68fd5cd6e16
- filename: CHANGELOG.md
checksum: 873106e25dafe0355c55724936cfe0ecc9d0192a2a82c98eddaf5648f23d5ee7
version: "1.0"
12 changes: 11 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
* @contentstack/security-admin
* @contentstack/ghost-pr-reviewers

.github/workflows/sca-scan.yml @contentstack/security-admin

.github/workflows/codeql-anaylsis.yml @contentstack/security-admin

**/.snyk @contentstack/security-admin

.github/workflows/policy-scan.yml @contentstack/security-admin

.github/workflows/issues-jira.yml @contentstack/security-admin
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @contentstack/live-preview-utils
Alternatively, if you want to include the package directly in your website HTML code, use the following command:

```html
<script type='module' integrity='sha384-b6G+ggU20rGxqCqsgaS6zludFgj5N11xsuXhMEIARMuQY2PtyDS04TU0H5goP+32' crossorigin="anonymous">
<script type='module' crossorigin="anonymous">
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@4.0.1';

ContentstackLivePreview.init({
Expand Down Expand Up @@ -51,7 +51,7 @@ ContentstackLivePreview.init({

MIT License

Copyright © 2024 [Contentstack](https://www.contentstack.com/). All Rights Reserved
Copyright © 2021-2025 [Contentstack](https://www.contentstack.com/). All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
4 changes: 2 additions & 2 deletions main.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @contentstack/live-preview-utils
Alternatively, if you want to include the package directly in your website HTML code, use the following command:

```html
<script type='module' integrity='{{integrity}}' crossorigin="anonymous">
<script type='module' crossorigin="anonymous">
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@{{packageVersion}}';

ContentstackLivePreview.init({
Expand Down Expand Up @@ -51,7 +51,7 @@ ContentstackLivePreview.init({

MIT License

Copyright © 2024 [Contentstack](https://www.contentstack.com/). All Rights Reserved
Copyright © 2021-{{currentYear}} [Contentstack](https://www.contentstack.com/). All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
7 changes: 2 additions & 5 deletions mustache.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
// index.js
// import { render } from 'mustache';
import * as mustache from 'mustache';
import { readFile, readFileSync, writeFileSync } from 'fs';
import { readFile, writeFileSync } from 'fs';
import packageJson from "./package.json" assert { type: "json" };
import ssri from 'ssri';
const MUSTACHE_MAIN_DIR = './main.mustache';
const fileContent = readFileSync('./dist/modern/index.js');
const integrity = ssri.fromData(fileContent, { algorithms: ['sha384'] });
/**
* DATA is the object that contains all
* the data to be provided to Mustache
* Notice the "name" and "date" property.
*/
const DATA = {
packageVersion: packageJson.version,
integrity: integrity.toString(),
currentYear: new Date().getFullYear(),
};
function generateReadMe() {

Expand Down
23 changes: 0 additions & 23 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"@types/mustache": "^4.2.2",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"@types/ssri": "^7.1.5",
"@types/uuid": "^8.3.1",
"@vitest/coverage-v8": "^2.1.2",
"@vitest/ui": "^2.1.2",
Expand All @@ -71,7 +70,6 @@
"jsdom": "^25.0.0",
"prettier": "^3.3.3",
"prettier-eslint": "^15.0.1",
"ssri": "^11.0.0",
"ts-node": "^10.9.2",
"tsc": "^2.0.4",
"tsup": "^8.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ describe("postMessageEvent.hooks", () => {
(Config.get as any).mockReturnValue(mockConfig);
});

it("should reload window when ssr is true and no event_type", () => {
// Set URL to include live_preview parameter so reload path is taken
mockWindow.location.href = "https://example.com?live_preview=old-hash";
it("should reload window when ssr is true and no event_type and all params present", () => {
// Set URL to include all required params so reload path is taken
mockWindow.location.href = "https://example.com?live_preview=old-hash&content_type_uid=blog&entry_uid=entry-123";

const eventData: OnChangeLivePreviewPostMessageEventData = {
hash: "test-hash",
Expand Down
52 changes: 34 additions & 18 deletions src/livePreview/eventManager/postMessageEvent.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function useOnEntryUpdatePostMessageEvent(): void {
LIVE_PREVIEW_POST_MESSAGE_EVENTS.ON_CHANGE,
(event) => {
try {
const { ssr, onChange } = Config.get();
const { ssr, onChange, stackDetails } = Config.get();
const event_type = event.data._metadata?.event_type;
setConfigFromParams({
live_preview: event.data.hash,
Expand All @@ -59,41 +59,57 @@ export function useOnEntryUpdatePostMessageEvent(): void {
// This section will run when there is a change in the entry and the website is CSR
if (!ssr && !event_type) {
onChange();
}
}

if(isOpeningInNewTab()) {
if(!window) {
if (isOpeningInNewTab()) {
if (!window) {
PublicLogger.error("window is not defined");
return;
};

// This section will run when there is a change in the entry and the website is SSR
if(ssr && !event_type) {
if(window.location.href.includes("live_preview")) {

if (ssr && !event_type) {
const url = new URL(window.location.href);
let live_preview = url.searchParams.get("live_preview");
let content_type_uid = url.searchParams.get("content_type_uid");
let entry_uid = url.searchParams.get("entry_uid");

if (live_preview && content_type_uid && entry_uid) {
// All required params are present, just reload
window.location.reload();
} else {
const url = new URL(window.location.href);
url.searchParams.set("live_preview", event.data.hash);
url.searchParams.set("content_type_uid", Config.get().stackDetails.contentTypeUid || "");
url.searchParams.set("entry_uid", Config.get().stackDetails.entryUid || "");
live_preview = event.data.hash;
content_type_uid = event.data.content_type_uid || stackDetails.$contentTypeUid?.toString() || "";
entry_uid = event.data.entry_uid || stackDetails.$entryUid?.toString() || "";
// Set missing params and redirect
url.searchParams.set("live_preview", live_preview);
if (content_type_uid) {
url.searchParams.set(
"content_type_uid",
content_type_uid
);
}
if (entry_uid) {
url.searchParams.set(
"entry_uid",
entry_uid
);
}
window.location.href = url.toString();
}
}

// This section will run when the hash changes and the website is SSR or CSR
if(event_type === OnChangeLivePreviewPostMessageEventTypes.HASH_CHANGE){
if (event_type === OnChangeLivePreviewPostMessageEventTypes.HASH_CHANGE) {
const newUrl = new URL(window.location.href);
newUrl.searchParams.set("live_preview", event.data.hash);
window.history.pushState({}, "", newUrl.toString());
}

// This section will run when the URL of the page changes
if(event_type === OnChangeLivePreviewPostMessageEventTypes.URL_CHANGE && event.data.url){
if (event_type === OnChangeLivePreviewPostMessageEventTypes.URL_CHANGE && event.data.url) {
window.location.href = event.data.url;
}
}


} catch (error) {
PublicLogger.error("Error handling live preview update:", error);
return;
Expand Down
Loading
Loading