Browse Source

feat(nc-gui): applyNonSelectable

pull/4482/head
Wing-Kam Wong 2 years ago
parent
commit
632b7ebab6
  1. 4
      packages/nc-gui/app.vue
  2. 14
      packages/nc-gui/assets/css/global.css
  3. 4
      packages/nc-gui/utils/viewUtils.ts

4
packages/nc-gui/app.vue

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, useRoute, useTheme } from '#imports' import { applyNonSelectable, computed, useRoute, useTheme } from '#imports'
const route = useRoute() const route = useRoute()
@ -7,6 +7,8 @@ const disableBaseLayout = computed(() => route.path.startsWith('/nc/view') || ro
useTheme() useTheme()
applyNonSelectable()
// TODO: Remove when https://github.com/vuejs/core/issues/5513 fixed // TODO: Remove when https://github.com/vuejs/core/issues/5513 fixed
const key = ref(0) const key = ref(0)

14
packages/nc-gui/assets/css/global.css

@ -9,7 +9,8 @@ html {
} }
body { body {
font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, Vazirmatn, sans-serif; font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, Vazirmatn,
sans-serif;
} }
/* /*
@ -30,3 +31,14 @@ For Drag and Drop
.grabbing * { .grabbing * {
cursor: grabbing; cursor: grabbing;
} }
/*
Prevent Ctrl + A selection
*/
.non-selectable {
-webkit-user-select: none;
-webkit-touch-callout: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

4
packages/nc-gui/utils/viewUtils.ts

@ -37,3 +37,7 @@ export function applyLanguageDirection(dir: typeof rtl | typeof ltr) {
document.body.classList.add(dir) document.body.classList.add(dir)
document.body.style.direction = dir document.body.style.direction = dir
} }
export function applyNonSelectable() {
document.body.classList.add('non-selectable')
}

Loading…
Cancel
Save