Skip to content

Commit

Permalink
fix(editor): 画布右键菜单中粘贴按钮显示条件修改
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen authored and jia000 committed Aug 9, 2022
1 parent 23617a6 commit beee67b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/editor/src/layouts/workspace/ViewerMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</template>

<script lang="ts" setup>
import { computed, inject, markRaw, onMounted, reactive, ref, watch } from 'vue';
import { computed, inject, markRaw, reactive, ref, watch } from 'vue';
import { Bottom, Delete, DocumentCopy, Top } from '@element-plus/icons-vue';
import { MNode, NodeType } from '@tmagic/schema';
Expand Down Expand Up @@ -133,11 +133,6 @@ const menuData = reactive<MenuItem[]>([
...stageContentMenu,
]);
onMounted(async () => {
const data = await storageService.getItem(COPY_STORAGE_KEY);
canPaste.value = data !== 'undefined' && !!data;
});
watch(
parent,
async () => {
Expand All @@ -152,8 +147,10 @@ watch(
{ immediate: true },
);
const show = (e: MouseEvent) => {
const show = async (e: MouseEvent) => {
menu.value?.show(e);
const data = await storageService.getItem(COPY_STORAGE_KEY);
canPaste.value = data !== 'undefined' && !!data;
};
defineExpose({ show });
Expand Down

0 comments on commit beee67b

Please sign in to comment.