@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.cjs CHANGED
@@ -995,10 +995,6 @@ 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]);
1002
998
  const characterExtensions = react.useMemo(
1003
999
  () => ["(V.O.)", "(O.S.)", "(O.C.)", "(SUBTITLE)", "(CONT'D)"],
1004
1000
  []
@@ -1355,6 +1351,7 @@ function useScreenplayEditor(options) {
1355
1351
  );
1356
1352
  const handleScriptImport = react.useCallback(
1357
1353
  (title, content, preParsedBlocks) => {
1354
+ var _a;
1358
1355
  let parsedBlocks = [];
1359
1356
  if (preParsedBlocks && preParsedBlocks.length > 0) {
1360
1357
  parsedBlocks = preParsedBlocks.map((b) => ({
@@ -1384,7 +1381,7 @@ function useScreenplayEditor(options) {
1384
1381
  return block;
1385
1382
  });
1386
1383
  setBlocks(finalizedBlocks);
1387
- if (onSaveRef.current) {
1384
+ if (options == null ? void 0 : options.onSave) {
1388
1385
  const typeToDivClass = {
1389
1386
  SCENE_HEADING: "divtype0",
1390
1387
  ACTION: "divtype2",
@@ -1409,14 +1406,14 @@ function useScreenplayEditor(options) {
1409
1406
  return `<div class="${divClass}" id="par${block.id}"${extraAttributes}>${text}</div>`;
1410
1407
  }).join("");
1411
1408
  const blob = new Blob([sbxData], { type: "text/plain" });
1412
- onSaveRef.current(blob);
1409
+ (_a = options == null ? void 0 : options.onSave) == null ? void 0 : _a.call(options, blob);
1413
1410
  }
1414
1411
  setTimeout(() => {
1415
- var _a;
1412
+ var _a2;
1416
1413
  const firstId = parsedBlocks[0].id;
1417
1414
  if (firstId && refs.current[firstId]) {
1418
1415
  setFocusedBlockId(firstId);
1419
- (_a = refs.current[firstId]) == null ? void 0 : _a.focus();
1416
+ (_a2 = refs.current[firstId]) == null ? void 0 : _a2.focus();
1420
1417
  }
1421
1418
  }, 100);
1422
1419
  }