Replace ev -> event (#1209)
This commit is contained in:
parent
00c5823a5e
commit
ae1eee15cc
@ -71,7 +71,7 @@ export function textWysiwyg({
|
|||||||
backfaceVisibility: "hidden",
|
backfaceVisibility: "hidden",
|
||||||
});
|
});
|
||||||
|
|
||||||
editable.onpaste = (ev) => {
|
editable.onpaste = (event) => {
|
||||||
try {
|
try {
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (!selection?.rangeCount) {
|
if (!selection?.rangeCount) {
|
||||||
@ -79,7 +79,7 @@ export function textWysiwyg({
|
|||||||
}
|
}
|
||||||
selection.deleteFromDocument();
|
selection.deleteFromDocument();
|
||||||
|
|
||||||
const text = ev.clipboardData!.getData("text").replace(/\r\n?/g, "\n");
|
const text = event.clipboardData!.getData("text").replace(/\r\n?/g, "\n");
|
||||||
|
|
||||||
const span = document.createElement("span");
|
const span = document.createElement("span");
|
||||||
span.innerText = text;
|
span.innerText = text;
|
||||||
@ -92,7 +92,7 @@ export function textWysiwyg({
|
|||||||
range.setEnd(span, span.childNodes.length);
|
range.setEnd(span, span.childNodes.length);
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
|
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@ -104,26 +104,29 @@ export function textWysiwyg({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
editable.onkeydown = (ev) => {
|
editable.onkeydown = (event) => {
|
||||||
if (ev.key === KEYS.ESCAPE) {
|
if (event.key === KEYS.ESCAPE) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
handleSubmit();
|
handleSubmit();
|
||||||
}
|
}
|
||||||
if (ev.key === KEYS.ENTER && (ev.shiftKey || ev[KEYS.CTRL_OR_CMD])) {
|
if (
|
||||||
ev.preventDefault();
|
event.key === KEYS.ENTER &&
|
||||||
if (ev.isComposing || ev.keyCode === 229) {
|
(event.shiftKey || event[KEYS.CTRL_OR_CMD])
|
||||||
|
) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (event.isComposing || event.keyCode === 229) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handleSubmit();
|
handleSubmit();
|
||||||
}
|
}
|
||||||
if (ev.key === KEYS.ENTER && !ev.shiftKey) {
|
if (event.key === KEYS.ENTER && !event.shiftKey) {
|
||||||
ev.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
editable.onblur = handleSubmit;
|
editable.onblur = handleSubmit;
|
||||||
|
|
||||||
function stopEvent(ev: Event) {
|
function stopEvent(event: Event) {
|
||||||
ev.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user