From 585a49aafb10e46d88de68feea8c3ddeed12ebf1 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 12 May 2021 12:08:56 -0600 Subject: [PATCH] only show context menu option in edit mode --- .../trigger_actions/filter_by_map_extent_action.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/trigger_actions/filter_by_map_extent_action.ts b/x-pack/plugins/maps/public/trigger_actions/filter_by_map_extent_action.ts index e587d2f1b5a9ba..5e9cf57fa4293b 100644 --- a/x-pack/plugins/maps/public/trigger_actions/filter_by_map_extent_action.ts +++ b/x-pack/plugins/maps/public/trigger_actions/filter_by_map_extent_action.ts @@ -6,7 +6,11 @@ */ import { i18n } from '@kbn/i18n'; -import { Embeddable, EmbeddableInput } from 'src/plugins/embeddable/public'; +import { + Embeddable, + EmbeddableInput, + ViewMode, +} from '../../../../../src/plugins/embeddable/public'; import { MAP_SAVED_OBJECT_TYPE } from '../../common/constants'; import { createAction } from '../../../../../src/plugins/ui_actions/public'; @@ -37,7 +41,9 @@ export const filterByMapExtentAction = createAction { - return embeddable.type === MAP_SAVED_OBJECT_TYPE; + return ( + embeddable.type === MAP_SAVED_OBJECT_TYPE && embeddable.getInput().viewMode === ViewMode.EDIT + ); }, execute: async ({ embeddable }: FilterByMapExtentActionContext) => { embeddable.updateInput({