- function stickyCursor(func) {
- const supportedTypes = ["text", "search", "url", "tel", "password"];
- if (!supportedTypes.includes(selection2.node()?.type)) {
- return func;
- }
- return function() {
- const cursor = { start: this.selectionStart, end: this.selectionEnd };
- func.apply(this, arguments);
- this.setSelectionRange(cursor.start, cursor.end);
- };
- }