@vishu1301/script-writing 1.0.7 → 1.0.9

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 CHANGED
@@ -995,6 +995,10 @@ 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 onSaveRef = react.useRef(options == null ? void 0 : options.onSave);
999
+ react.useEffect(() => {
1000
+ onSaveRef.current = options == null ? void 0 : options.onSave;
1001
+ }, [options == null ? void 0 : options.onSave]);
998
1002
  const characterExtensions = react.useMemo(
999
1003
  () => ["(V.O.)", "(O.S.)", "(O.C.)", "(SUBTITLE)", "(CONT'D)"],
1000
1004
  []
@@ -1380,8 +1384,7 @@ function useScreenplayEditor(options) {
1380
1384
  return block;
1381
1385
  });
1382
1386
  setBlocks(finalizedBlocks);
1383
- if (options == null ? void 0 : options.onSave) {
1384
- options.onSave(content);
1387
+ if (onSaveRef.current) {
1385
1388
  const typeToDivClass = {
1386
1389
  SCENE_HEADING: "divtype0",
1387
1390
  ACTION: "divtype2",
@@ -1405,7 +1408,8 @@ function useScreenplayEditor(options) {
1405
1408
  }
1406
1409
  return `<div class="${divClass}" id="par${block.id}"${extraAttributes}>${text}</div>`;
1407
1410
  }).join("");
1408
- options.onSave(sbxData);
1411
+ const blob = new Blob([sbxData], { type: "text/plain" });
1412
+ onSaveRef.current(blob);
1409
1413
  }
1410
1414
  setTimeout(() => {
1411
1415
  var _a;
@@ -1417,7 +1421,7 @@ function useScreenplayEditor(options) {
1417
1421
  }, 100);
1418
1422
  }
1419
1423
  },
1420
- [refs, options == null ? void 0 : options.onSave]
1424
+ [refs]
1421
1425
  );
1422
1426
  const handleFocus = react.useCallback(
1423
1427
  (id) => {