diff --git a/src/ui/composables/editor.js b/src/ui/composables/editor.js new file mode 100644 index 0000000000..10638ed8c7 --- /dev/null +++ b/src/ui/composables/editor.js @@ -0,0 +1,19 @@ +import { ref } from 'vue'; + +import { useEventListener } from './event'; + +/** + * @param {import('../../../openmct').OpenMCT} openmct + * @returns {{isEditing: import('vue').Ref}} 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 }; +}