Merge remote-tracking branch 'origin/main' into fix-canvas-images
This commit is contained in:
commit
1e42364019
23 changed files with 337 additions and 76 deletions
|
@ -1,21 +0,0 @@
|
|||
import { render } from "vue";
|
||||
import ContextMenu from "~/components/UserInterface/ContextMenu.vue";
|
||||
import type { ContextMenuItem } from "~/types/interfaces";
|
||||
|
||||
export default (e: PointerEvent | MouseEvent, menuItems: ContextMenuItem[]) => {
|
||||
console.log("Rendering new context menu");
|
||||
const menuContainer = document.createElement("div");
|
||||
console.log("hello");
|
||||
menuContainer.id = "context-menu";
|
||||
document.body.appendChild(menuContainer);
|
||||
console.log("pointer x:", e.clientX);
|
||||
console.log("pointer y:", e.clientY);
|
||||
console.log("menu items:", menuItems);
|
||||
const contextMenu = h(ContextMenu, {
|
||||
menuItems,
|
||||
pointerX: e.clientX,
|
||||
pointerY: e.clientY
|
||||
});
|
||||
render(contextMenu, menuContainer);
|
||||
console.log("Rendered");
|
||||
}
|
|
@ -1,6 +1,12 @@
|
|||
export default () => {
|
||||
const contextMenu = document.getElementById("context-menu");
|
||||
if (contextMenu) {
|
||||
contextMenu.remove();
|
||||
import type { ContextMenuInterface } from "~/types/interfaces";
|
||||
|
||||
export default (contextMenu: Ref<ContextMenuInterface>) => {
|
||||
console.log("resetting and hiding context menu");
|
||||
contextMenu.value = {
|
||||
show: false,
|
||||
pointerX: 0,
|
||||
pointerY: 0,
|
||||
items: []
|
||||
}
|
||||
console.log("hidden context menu");
|
||||
}
|
||||
|
|
|
@ -10,5 +10,9 @@ export default (element: HTMLDivElement, props: MessageProps) => {
|
|||
const messageReply = h(MessageReply, { author: getDisplayName(props.author), text: props.text || "", id: props.message.uuid, replyId: props.replyMessage?.uuid || element.dataset.messageId!, maxWidth: "full" });
|
||||
messageBox.prepend(div);
|
||||
render(messageReply, div);
|
||||
const message = document.querySelector(`.message[data-message-id='${props.message.uuid}']`);
|
||||
if (message) {
|
||||
message.classList.add("replying-to");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
utils/showContextMenu.ts
Normal file
12
utils/showContextMenu.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { render } from "vue";
|
||||
import ContextMenu from "~/components/UserInterface/ContextMenu.vue";
|
||||
import type { ContextMenuInterface, ContextMenuItem } from "~/types/interfaces";
|
||||
|
||||
export default (e: MouseEvent | PointerEvent, contextMenu: ContextMenuInterface, menuItems: ContextMenuItem[]) => {
|
||||
console.log("Showing context menu");
|
||||
contextMenu.show = true;
|
||||
contextMenu.pointerX = e.clientX;
|
||||
contextMenu.pointerY = e.clientY;
|
||||
contextMenu.items = menuItems;
|
||||
console.log("Showed");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue