Commit 74c9430
authored
fix(custom-selection): respect disableContextMenu so right-click isn't dead (SD-2944) (#3171)
The contextmenu DOM handler in the custom-selection PM extension calls
event.preventDefault() unconditionally to keep focus and selection
visible while SuperDoc's built-in right-click menu opens. When the
consumer sets disableContextMenu: true the built-in UI refuses to
open, but the preventDefault still fires, so the browser's native
right-click menu and any consumer-attached contextmenu listener are
both suppressed. Right-click on plain text inside the editor goes
dead with no menu of any kind.
Short-circuits the contextmenu handler with a return false (no
preventDefault, no focus-preservation transaction) when
editor.options.disableContextMenu is true. Default behavior unchanged
for consumers using SuperDoc's built-in menu. The mousedown-side
selection preservation still runs, so a consumer rendering their own
menu sees the visible selection underneath.1 parent 97e3526 commit 74c9430
2 files changed
Lines changed: 63 additions & 0 deletions
File tree
- packages/super-editor/src/editors/v1/extensions/custom-selection
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
201 | 215 | | |
202 | 216 | | |
203 | 217 | | |
| |||
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
135 | 184 | | |
136 | 185 | | |
137 | 186 | | |
| |||
0 commit comments