Commit 352e72e
committed
Improve link anchor wrapping
When URLs are wrapped in anchor tags, we reparent the text nodes from
the DOM to the new anchor node in order to prevent CodeMirror from
getting confused and hiding the cursor when it's inside the URL.
Additionally, we apply the cm-string class to the anchor tag to keep the
style the same. We also only apply the cm-string-link class to the
surrounding span tag when links are not wrapped in anchor tags in order
to avoid triggering the custom link behavior by accident. Finally, we
put an event listener on the anchor tags that prevents the contextmenu
event from bubbling to CodeMirror's handler in order to restore the
expected behavior of context menus for links.1 parent f63c6aa commit 352e72e
1 file changed
+15
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
97 | 95 | | |
98 | | - | |
99 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
100 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
| |||
0 commit comments