@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.cjs
CHANGED
|
@@ -995,6 +995,7 @@ function useScreenplayEditor(options) {
|
|
|
995
995
|
const [showExtensionSuggestions, setShowExtensionSuggestions] = react.useState(false);
|
|
996
996
|
const blurTimeout = react.useRef(null);
|
|
997
997
|
const loadedUrlRef = react.useRef(null);
|
|
998
|
+
const lastSavedContent = react.useRef(null);
|
|
998
999
|
const onSaveRef = react.useRef(options == null ? void 0 : options.onSave);
|
|
999
1000
|
react.useEffect(() => {
|
|
1000
1001
|
onSaveRef.current = options == null ? void 0 : options.onSave;
|
|
@@ -1358,7 +1359,7 @@ function useScreenplayEditor(options) {
|
|
|
1358
1359
|
let parsedBlocks = [];
|
|
1359
1360
|
if (preParsedBlocks && preParsedBlocks.length > 0) {
|
|
1360
1361
|
parsedBlocks = preParsedBlocks.map((b) => ({
|
|
1361
|
-
id: uuid(),
|
|
1362
|
+
id: b.id || uuid(),
|
|
1362
1363
|
type: b.type || "ACTION",
|
|
1363
1364
|
text: b.text || "",
|
|
1364
1365
|
sceneNumber: b.sceneNumber,
|
|
@@ -1408,8 +1409,11 @@ function useScreenplayEditor(options) {
|
|
|
1408
1409
|
}
|
|
1409
1410
|
return `<div class="${divClass}" id="par${block.id}"${extraAttributes}>${text}</div>`;
|
|
1410
1411
|
}).join("");
|
|
1411
|
-
|
|
1412
|
-
|
|
1412
|
+
if (sbxData !== lastSavedContent.current) {
|
|
1413
|
+
lastSavedContent.current = sbxData;
|
|
1414
|
+
const blob = new Blob([sbxData], { type: "text/plain" });
|
|
1415
|
+
onSaveRef.current(blob);
|
|
1416
|
+
}
|
|
1413
1417
|
}
|
|
1414
1418
|
setTimeout(() => {
|
|
1415
1419
|
var _a;
|
|
@@ -1498,6 +1502,10 @@ function useScreenplayEditor(options) {
|
|
|
1498
1502
|
}
|
|
1499
1503
|
}
|
|
1500
1504
|
const block = { type, text: divText };
|
|
1505
|
+
const idAttr = div.getAttribute("id");
|
|
1506
|
+
if (idAttr && idAttr.startsWith("par")) {
|
|
1507
|
+
block.id = idAttr.substring(3);
|
|
1508
|
+
}
|
|
1501
1509
|
if (type === "SCENE_HEADING") {
|
|
1502
1510
|
const sceneNum = div.getAttribute("data-scene");
|
|
1503
1511
|
if (sceneNum) block.sceneNumber = sceneNum;
|