Commit aa6fc5f
feat: add comparison check to word-editor (#191)
## Description
Currently, when creating or editing a word, every request is submitted
regardless of whether any content has actually changed.
This PR introduces a **content comparison check** so that submissions
only proceed when there are real changes.
- Added a `hasWordChanged` check in the `handleSubmit` function to
compare current editor values with their initial values.
- Display a short, user-friendly message when the user tries to submit
without making any changes.
## Related Issue
Fixes #38
## Screenshots/Screencasts
<img width="1588" height="784" alt="image"
src="https://github.com/user-attachments/assets/9240bfe5-adc7-45d1-b3b5-27c501164189"
/>
## Notes to Reviewer
- Added `initialContent` to the store.
- Extended `useWordEditor` to expose these values along with their
corresponding setters.
---------
Co-authored-by: Olabode Lawal-Shittabey <babblebey@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 7aa51ea commit aa6fc5f
File tree
3 files changed
+25
-1
lines changed- src
- components/islands
- lib
- hooks
- stores
3 files changed
+25
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
| 121 | + | |
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
| |||
120 | 128 | | |
121 | 129 | | |
122 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
123 | 139 | | |
124 | 140 | | |
125 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
0 commit comments