mirror of
https://github.com/directus/directus.git
synced 2026-01-28 10:58:01 -05:00
tweak shortcuts
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
:batch-active="batchActive"
|
||||
:disabled="isDisabled"
|
||||
:primary-key="primaryKey"
|
||||
data-disable-mousetrap
|
||||
@input="$emit('input', $event)"
|
||||
/>
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, computed, provide } from '@vue/composition-api';
|
||||
import useShortcut from '@/composables/use-shortcut';
|
||||
|
||||
export default defineComponent({
|
||||
model: {
|
||||
@@ -72,6 +73,11 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
useShortcut('esc', () => {
|
||||
console.log('A');
|
||||
|
||||
_active.value = false;
|
||||
});
|
||||
const sidebarActive = ref(false);
|
||||
const localActive = ref(false);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import Mousetrap from 'mousetrap';
|
||||
const mousetrap = new Mousetrap();
|
||||
mousetrap.stopCallback = function (e: Event, element: Element) {
|
||||
// if the element has the class "mousetrap" then no need to stop
|
||||
if (element.hasAttribute('data-disable-mousetrap')) {
|
||||
if (element.hasAttribute('data-disable-mousetrap') || element.closest('*[data-disable-mousetrap]') !== null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import { defineComponent, ref, PropType } from '@vue/composition-api';
|
||||
import notify from '@/utils/notify';
|
||||
import api from '@/api';
|
||||
import i18n from '@/lang';
|
||||
import useShortcut from '@/composables/use-shortcut';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -39,12 +40,14 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const newCommentContent = ref(null);
|
||||
useShortcut('mod+enter', postComment);
|
||||
const newCommentContent = ref<string | null>(null);
|
||||
const saving = ref(false);
|
||||
|
||||
return { newCommentContent, postComment, saving };
|
||||
|
||||
async function postComment() {
|
||||
if (newCommentContent.value === null || newCommentContent.value.length === 0) return;
|
||||
saving.value = true;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user