Skip to content

Commit e713f8d

Browse files
authored
fix(client): removed the editor button in ContextMenu when not developing (#2237)
1 parent 806580e commit e713f8d

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

packages/client/internals/ContextMenu.vue

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,33 @@ const top = computed(() => {
6767
>
6868
<template v-for="item, index of currentContextMenu.items.value" :key="index">
6969
<div v-if="item === 'separator'" :key="index" class="w-full my1 border-t border-main" />
70-
<div
71-
v-else-if="item.small"
72-
class="p-2 w-[40px] h-[40px] inline-block text-center cursor-pointer rounded flex"
73-
:class="item.disabled ? `op40` : `hover:bg-active`"
74-
:title="(item.label as string)"
75-
@click="item.action"
76-
>
77-
<div v-if="typeof item.icon === 'string'" :class="item.icon" class="text-1.2em ma" />
78-
<component :is="item.icon" v-else />
79-
</div>
80-
<div
81-
v-else
82-
class="w-full grid grid-cols-[35px_1fr] p-2 pl-0 cursor-pointer rounded"
83-
:class="item.disabled ? `op40` : `hover:bg-active`"
84-
@click="item.action"
85-
>
86-
<div class="mx-auto flex">
70+
<template v-else-if="item.show ?? true">
71+
<div
72+
v-if="item.small"
73+
class="p-2 w-[40px] h-[40px] inline-block text-center cursor-pointer rounded flex"
74+
:class="item.disabled ? `op40` : `hover:bg-active`"
75+
:title="(item.label as string)"
76+
@click="item.action"
77+
>
8778
<div v-if="typeof item.icon === 'string'" :class="item.icon" class="text-1.2em ma" />
8879
<component :is="item.icon" v-else />
8980
</div>
90-
<div v-if="typeof item.label === 'string'">
91-
{{ item.label }}
81+
<div
82+
v-else
83+
class="w-full grid grid-cols-[35px_1fr] p-2 pl-0 cursor-pointer rounded"
84+
:class="item.disabled ? `op40` : `hover:bg-active`"
85+
@click="item.action"
86+
>
87+
<div class="mx-auto flex">
88+
<div v-if="typeof item.icon === 'string'" :class="item.icon" class="text-1.2em ma" />
89+
<component :is="item.icon" v-else />
90+
</div>
91+
<div v-if="typeof item.label === 'string'">
92+
{{ item.label }}
93+
</div>
94+
<component :is="item.label" v-else />
9295
</div>
93-
<component :is="item.label" v-else />
94-
</div>
96+
</template>
9597
</template>
9698
<template v-if="!isExplicitEnabled">
9799
<div class="w-full my1 border-t border-main" />

packages/client/setup/context-menu.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export default () => {
7373
icon: 'i-carbon:text-annotation-toggle', // IconTextNotationToggle,
7474
label: showEditor.value ? 'Hide editor' : 'Show editor',
7575
action: () => (showEditor.value = !showEditor.value),
76+
show: __DEV__,
7677
},
7778
{
7879
icon: 'i-carbon:pen',

packages/types/src/context-menu.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { Component } from 'vue'
33
type ContextMenuOption = {
44
action: () => void
55
disabled?: boolean
6+
show?: boolean
67
} & (
78
| {
89
small?: false

0 commit comments

Comments
 (0)