Skip to content

Call onClueSelected on click of cell and input to know the clue #554

@RJBernardo

Description

@RJBernardo

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @jaredreisinger/react-crossword@5.2.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@jaredreisinger/react-crossword/dist/CrosswordProvider.js b/node_modules/@jaredreisinger/react-crossword/dist/CrosswordProvider.js
index 8165e51..e55772a 100644
--- a/node_modules/@jaredreisinger/react-crossword/dist/CrosswordProvider.js
+++ b/node_modules/@jaredreisinger/react-crossword/dist/CrosswordProvider.js
@@ -561,6 +561,9 @@ const CrosswordProvider = react_1.default.forwardRef(({ data, theme, onAnswerCom
                 direction = other;
             }
             setCurrentNumber((_a = cellData[direction]) !== null && _a !== void 0 ? _a : '');
+            if (onClueSelected) {
+                onClueSelected(direction, cellData[direction] ?? '');
+            }
         }
         focus();
     }, [currentDirection, focus, focused, focusedCol, focusedRow]);
diff --git a/node_modules/@jaredreisinger/react-crossword/src/CrosswordProvider.tsx b/node_modules/@jaredreisinger/react-crossword/src/CrosswordProvider.tsx
index 8d8633c..2ad68a5 100644
--- a/node_modules/@jaredreisinger/react-crossword/src/CrosswordProvider.tsx
+++ b/node_modules/@jaredreisinger/react-crossword/src/CrosswordProvider.tsx
@@ -886,6 +886,9 @@ const CrosswordProvider = React.forwardRef<
           }
 
           setCurrentNumber(cellData[direction] ?? '');
+          if (onClueSelected) {
+            onClueSelected(direction, cellData[direction] ?? '');
+          }
         }
 
         focus();

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions