Fix menu postiion, fix copy and paste in menu not working
This commit is contained in:
parent
6bf6d15849
commit
fe5ab61941
|
@ -42,7 +42,7 @@
|
|||
<Menu>
|
||||
<MenuItem
|
||||
icon="Copy"
|
||||
on:click={clipboard.actions.copyCell}
|
||||
on:click={clipboard.actions.copy}
|
||||
on:click={menu.actions.close}
|
||||
>
|
||||
Copy
|
||||
|
@ -50,7 +50,7 @@
|
|||
<MenuItem
|
||||
icon="Paste"
|
||||
disabled={$copiedCell == null}
|
||||
on:click={clipboard.actions.pasteCell}
|
||||
on:click={clipboard.actions.paste}
|
||||
on:click={menu.actions.close}
|
||||
>
|
||||
Paste
|
||||
|
@ -85,7 +85,7 @@
|
|||
.menu {
|
||||
position: absolute;
|
||||
background: var(--cell-background);
|
||||
border: var(--cell-border);
|
||||
border: 1px solid var(--spectrum-global-color-gray-300);
|
||||
width: 180px;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
|
|
|
@ -2,20 +2,17 @@ import { writable, get } from "svelte/store"
|
|||
|
||||
export const createStores = () => {
|
||||
const copiedCell = writable(null)
|
||||
const copiedRow = writable(null)
|
||||
|
||||
return {
|
||||
copiedCell,
|
||||
copiedRow,
|
||||
}
|
||||
}
|
||||
|
||||
export const deriveStores = context => {
|
||||
const { copiedCell, copiedRow, focusedCellAPI } = context
|
||||
const { copiedCell, focusedCellAPI } = context
|
||||
|
||||
const copy = () => {
|
||||
copiedCell.set(get(focusedCellAPI)?.getValue())
|
||||
copiedRow.set(null)
|
||||
}
|
||||
|
||||
const paste = () => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { writable, get } from "svelte/store"
|
||||
import { GutterWidth } from "../lib/constants"
|
||||
|
||||
export const createStores = () => {
|
||||
const menu = writable({
|
||||
|
@ -22,8 +23,9 @@ export const deriveStores = context => {
|
|||
e.preventDefault()
|
||||
focusedCellId.set(cellId)
|
||||
menu.set({
|
||||
left: e.clientX - $bounds.left + 44 + ($stickyColumn?.width || 0),
|
||||
top: e.clientY - $bounds.top + $rowHeight + 4,
|
||||
left:
|
||||
e.clientX - $bounds.left + GutterWidth + ($stickyColumn?.width || 0),
|
||||
top: e.clientY - $bounds.top + $rowHeight,
|
||||
visible: true,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue