@vishu1301/script-writing 1.0.9 → 1.1.0

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.js CHANGED
@@ -970,10 +970,6 @@ function useScreenplayEditor(options) {
970
970
  const [showExtensionSuggestions, setShowExtensionSuggestions] = useState(false);
971
971
  const blurTimeout = useRef(null);
972
972
  const loadedUrlRef = useRef(null);
973
- const onSaveRef = useRef(options == null ? void 0 : options.onSave);
974
- useEffect(() => {
975
- onSaveRef.current = options == null ? void 0 : options.onSave;
976
- }, [options == null ? void 0 : options.onSave]);
977
973
  const characterExtensions = useMemo(
978
974
  () => ["(V.O.)", "(O.S.)", "(O.C.)", "(SUBTITLE)", "(CONT'D)"],
979
975
  []
@@ -1330,6 +1326,7 @@ function useScreenplayEditor(options) {
1330
1326
  );
1331
1327
  const handleScriptImport = useCallback(
1332
1328
  (title, content, preParsedBlocks) => {
1329
+ var _a;
1333
1330
  let parsedBlocks = [];
1334
1331
  if (preParsedBlocks && preParsedBlocks.length > 0) {
1335
1332
  parsedBlocks = preParsedBlocks.map((b) => ({
@@ -1359,7 +1356,7 @@ function useScreenplayEditor(options) {
1359
1356
  return block;
1360
1357
  });
1361
1358
  setBlocks(finalizedBlocks);
1362
- if (onSaveRef.current) {
1359
+ if (options == null ? void 0 : options.onSave) {
1363
1360
  const typeToDivClass = {
1364
1361
  SCENE_HEADING: "divtype0",
1365
1362
  ACTION: "divtype2",
@@ -1384,14 +1381,14 @@ function useScreenplayEditor(options) {
1384
1381
  return `<div class="${divClass}" id="par${block.id}"${extraAttributes}>${text}</div>`;
1385
1382
  }).join("");
1386
1383
  const blob = new Blob([sbxData], { type: "text/plain" });
1387
- onSaveRef.current(blob);
1384
+ (_a = options == null ? void 0 : options.onSave) == null ? void 0 : _a.call(options, blob);
1388
1385
  }
1389
1386
  setTimeout(() => {
1390
- var _a;
1387
+ var _a2;
1391
1388
  const firstId = parsedBlocks[0].id;
1392
1389
  if (firstId && refs.current[firstId]) {
1393
1390
  setFocusedBlockId(firstId);
1394
- (_a = refs.current[firstId]) == null ? void 0 : _a.focus();
1391
+ (_a2 = refs.current[firstId]) == null ? void 0 : _a2.focus();
1395
1392
  }
1396
1393
  }, 100);
1397
1394
  }