mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-28 21:08:52 -07:00
refactor: ⚡ improve performance of contextmenu
This commit is contained in:
parent
8040a0093a
commit
bc4a457dcd
3 changed files with 17 additions and 14 deletions
13
packages/backend/assets/LICENSE
Normal file
13
packages/backend/assets/LICENSE
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright 2023 Calckey
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
|
@ -436,10 +436,7 @@ onMounted(() => {
|
||||||
setPosition();
|
setPosition();
|
||||||
|
|
||||||
props.textarea.addEventListener("keydown", onKeydown);
|
props.textarea.addEventListener("keydown", onKeydown);
|
||||||
|
document.body.addEventListener("mousedown", onMousedown);
|
||||||
for (const el of Array.from(document.querySelectorAll("body *"))) {
|
|
||||||
el.addEventListener("mousedown", onMousedown);
|
|
||||||
}
|
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
exec();
|
exec();
|
||||||
|
@ -457,10 +454,7 @@ onMounted(() => {
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
props.textarea.removeEventListener("keydown", onKeydown);
|
props.textarea.removeEventListener("keydown", onKeydown);
|
||||||
|
document.body.removeEventListener("mousedown", onMousedown);
|
||||||
for (const el of Array.from(document.querySelectorAll("body *"))) {
|
|
||||||
el.removeEventListener("mousedown", onMousedown);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -57,15 +57,11 @@ onMounted(() => {
|
||||||
rootEl.style.top = `${top}px`;
|
rootEl.style.top = `${top}px`;
|
||||||
rootEl.style.left = `${left}px`;
|
rootEl.style.left = `${left}px`;
|
||||||
|
|
||||||
for (const el of Array.from(document.querySelectorAll("body *"))) {
|
document.body.addEventListener("mousedown", onMousedown);
|
||||||
el.addEventListener("mousedown", onMousedown);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
for (const el of Array.from(document.querySelectorAll("body *"))) {
|
document.body.removeEventListener("mousedown", onMousedown);
|
||||||
el.removeEventListener("mousedown", onMousedown);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function onMousedown(evt: Event) {
|
function onMousedown(evt: Event) {
|
||||||
|
|
Loading…
Reference in a new issue