Browse Source

fix: Fixed auto scrolling

pull/6444/head
Muhammed Mustafa 1 year ago
parent
commit
610fdcf161
  1. 6
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  2. 2
      packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue
  3. 6
      packages/nc-gui/components/dashboard/TreeView/index.vue
  4. 6
      packages/nc-gui/components/project/AllTables.vue

6
packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

@ -191,11 +191,7 @@ function openTableCreateDialog(baseIndex?: number | undefined) {
const newTableDom = document.querySelector(`[data-table-id="${table.id}"]`)
if (!newTableDom) return
// Verify that table node is not in the viewport
if (isElementInvisible(newTableDom)) {
// Scroll to the table node
newTableDom?.scrollIntoView({ behavior: 'smooth' })
}
newTableDom?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
}, 1000)
close(1000)

2
packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue

@ -190,7 +190,7 @@ function onRef(el: HTMLElement) {
if (activeViewTitleOrId.value === vModel.value.id) {
nextTick(() => {
setTimeout(() => {
el?.scrollIntoView({ block: 'center', inline: 'center' })
el?.scrollIntoView({ block: 'nearest', inline: 'nearest' })
}, 1000)
})
}

6
packages/nc-gui/components/dashboard/TreeView/index.vue

@ -212,10 +212,8 @@ const scrollTableNode = () => {
const activeTableDom = document.querySelector(`.nc-treeview [data-table-id="${_activeTable.value?.id}"]`)
if (!activeTableDom) return
if (isElementInvisible(activeTableDom)) {
// Scroll to the table node
activeTableDom?.scrollIntoView({ behavior: 'smooth' })
}
// Scroll to the table node
activeTableDom?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
}
watch(

6
packages/nc-gui/components/project/AllTables.vue

@ -57,11 +57,7 @@ function openTableCreateDialog(baseIndex?: number | undefined) {
const newTableDom = document.querySelector(`[data-table-id="${table.id}"]`)
if (!newTableDom) return
// Verify that table node is not in the viewport
if (isElementInvisible(newTableDom)) {
// Scroll to the table node
newTableDom?.scrollIntoView({ behavior: 'smooth' })
}
newTableDom?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
}, 1000)
close(1000)

Loading…
Cancel
Save