Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/renderer/components/editor/EditorPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ import { computed, ref, onMounted, watch } from 'vue'
import interact from 'interactjs'
import { useAppStore } from '@/store/app'
import { i18n, ipc, track } from '@/electron'
import { useMagicKeys } from '@vueuse/core'

const snippetStore = useSnippetStore()
const appStore = useAppStore()
const { escape } = useMagicKeys()

const srcDoc = ref()
const height = computed(() => appStore.sizes.codePreviewHeight + 'px')

Expand Down Expand Up @@ -112,6 +115,10 @@ const onClickSnippetShowcase = () => {
track('app/open-url', 'https://masscode.io/snippets')
}

watch(escape, () => {
snippetStore.isCodePreview = false
})

onMounted(() => {
interact(previewRef.value).resizable({
edges: { top: true },
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/components/markdown/TheMarkdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import mermaid from 'mermaid'
import { useHljsTheme, goToSnippet } from '@/composable'
import { useCodemirror } from '@/composable/codemirror'
import { nanoid } from 'nanoid'
import { useMagicKeys } from '@vueuse/core'

const isDev = import.meta.env.DEV

Expand All @@ -38,6 +39,7 @@ const props = withDefaults(defineProps<Props>(), {

const appStore = useAppStore()
const snippetStore = useSnippetStore()
const { escape } = useMagicKeys()

const renderedHtml = ref()

Expand Down Expand Up @@ -269,6 +271,10 @@ watch(
}
)

watch(escape, () => {
snippetStore.isMarkdownPreview = false
})

init()

onMounted(() => {
Expand Down
9 changes: 8 additions & 1 deletion src/renderer/components/screenshot/TheScreenshot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<div class="right">
<AppActionButton
v-tooltip="i18n.t('saveScreenshot')"
@click="onSaveScreenshot">
@click="onSaveScreenshot"
>
<UniconsFileDownload />
</AppActionButton>
</div>
Expand Down Expand Up @@ -109,6 +110,7 @@ import { computed, onMounted, ref, watch } from 'vue'
import { useHljsTheme } from '@/composable'
import { store, track, i18n } from '@/electron'
import { useSnippetStore } from '@/store/snippets'
import { useMagicKeys } from '@vueuse/core'

const GUTTER_RIGHT_OFFSET = 10
const GUTTER_WIDTH = 8
Expand All @@ -125,6 +127,7 @@ const props = defineProps<Props>()

const appStore = useAppStore()
const snippetStore = useSnippetStore()
const { escape } = useMagicKeys()

const frameRef = ref<HTMLElement>()
const snippetRef = ref<HTMLElement>()
Expand Down Expand Up @@ -211,6 +214,10 @@ watch(
{ deep: true }
)

watch(escape, () => {
snippetStore.isScreenshotPreview = false
})

onMounted(() => {
interact(frameRef.value!).resizable({
allowFrom: gutterRef.value!,
Expand Down