feat: add isEditing composable

This commit is contained in:
Jesse Mazzella 2023-12-21 16:45:24 -08:00
parent f5d57374fb
commit f0f3733ac1

View File

@ -0,0 +1,19 @@
import { ref } from 'vue';
import { useEventListener } from './event';
/**
* @param {import('../../../openmct').OpenMCT} openmct
* @returns {{isEditing: import('vue').Ref<boolean>}} isEditing
*/
export function useIsEditing(openmct) {
const isEditing = ref(false);
// eslint-disable-next-line func-style
const handler = (value) => (isEditing.value = value);
// Use the base event listener composable
useEventListener(openmct.editor, 'isEditing', handler);
return { isEditing };
}