@vishu1301/script-writing 1.0.9 → 1.1.1
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/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -970,6 +970,7 @@ function useScreenplayEditor(options) {
|
|
|
970
970
|
const [showExtensionSuggestions, setShowExtensionSuggestions] = useState(false);
|
|
971
971
|
const blurTimeout = useRef(null);
|
|
972
972
|
const loadedUrlRef = useRef(null);
|
|
973
|
+
const lastSavedContent = useRef(null);
|
|
973
974
|
const onSaveRef = useRef(options == null ? void 0 : options.onSave);
|
|
974
975
|
useEffect(() => {
|
|
975
976
|
onSaveRef.current = options == null ? void 0 : options.onSave;
|
|
@@ -1333,7 +1334,7 @@ function useScreenplayEditor(options) {
|
|
|
1333
1334
|
let parsedBlocks = [];
|
|
1334
1335
|
if (preParsedBlocks && preParsedBlocks.length > 0) {
|
|
1335
1336
|
parsedBlocks = preParsedBlocks.map((b) => ({
|
|
1336
|
-
id: uuid(),
|
|
1337
|
+
id: b.id || uuid(),
|
|
1337
1338
|
type: b.type || "ACTION",
|
|
1338
1339
|
text: b.text || "",
|
|
1339
1340
|
sceneNumber: b.sceneNumber,
|
|
@@ -1383,8 +1384,11 @@ function useScreenplayEditor(options) {
|
|
|
1383
1384
|
}
|
|
1384
1385
|
return `<div class="${divClass}" id="par${block.id}"${extraAttributes}>${text}</div>`;
|
|
1385
1386
|
}).join("");
|
|
1386
|
-
|
|
1387
|
-
|
|
1387
|
+
if (sbxData !== lastSavedContent.current) {
|
|
1388
|
+
lastSavedContent.current = sbxData;
|
|
1389
|
+
const blob = new Blob([sbxData], { type: "text/plain" });
|
|
1390
|
+
onSaveRef.current(blob);
|
|
1391
|
+
}
|
|
1388
1392
|
}
|
|
1389
1393
|
setTimeout(() => {
|
|
1390
1394
|
var _a;
|
|
@@ -1473,6 +1477,10 @@ function useScreenplayEditor(options) {
|
|
|
1473
1477
|
}
|
|
1474
1478
|
}
|
|
1475
1479
|
const block = { type, text: divText };
|
|
1480
|
+
const idAttr = div.getAttribute("id");
|
|
1481
|
+
if (idAttr && idAttr.startsWith("par")) {
|
|
1482
|
+
block.id = idAttr.substring(3);
|
|
1483
|
+
}
|
|
1476
1484
|
if (type === "SCENE_HEADING") {
|
|
1477
1485
|
const sceneNum = div.getAttribute("data-scene");
|
|
1478
1486
|
if (sceneNum) block.sceneNumber = sceneNum;
|