Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
chore: add onCodemirrorInstanceMount hook to platform (#3043)
Akash Ka6426587fb1d
diff --git a/packages/hoppscotch-common/src/components/smart/EnvInput.vue b/packages/hoppscotch-common/src/components/smart/EnvInput.vueindex dbcbf36d8..23218ec8b 100644--- a/packages/hoppscotch-common/src/components/smart/EnvInput.vue+++ b/packages/hoppscotch-common/src/components/smart/EnvInput.vue@@ -34,6 +34,7 @@ import { inputTheme } from "~/helpers/editor/themes/baseTheme"import { HoppReactiveEnvPlugin } from "~/helpers/editor/extensions/HoppEnvironment"import { useReadonlyStream } from "@composables/stream"import { AggregateEnvironment, aggregateEnvs$ } from "~/newstore/environments"+import { platform } from "~/platform"const props = withDefaults(defineProps<{@@ -219,6 +220,7 @@ onMounted(() => {if (editor.value) {if (!view.value) initView(editor.value)if (props.selectTextOnMount) triggerTextSelection()+ platform.ui?.onCodemirrorInstanceMount?.(editor.value)}})diff --git a/packages/hoppscotch-common/src/composables/codemirror.ts b/packages/hoppscotch-common/src/composables/codemirror.tsindex 0f4affc7a..8dbfaf0a1 100644--- a/packages/hoppscotch-common/src/composables/codemirror.ts+++ b/packages/hoppscotch-common/src/composables/codemirror.ts@@ -38,6 +38,7 @@ import {baseHighlightStyle,} from "@helpers/editor/themes/baseTheme"import { HoppEnvironmentPlugin } from "@helpers/editor/extensions/HoppEnvironment"+import { platform } from "~/platform"// TODO: Migrate from legacy modetype ExtendedEditorConfig = {@@ -267,6 +268,7 @@ export function useCodemirror(onMounted(() => {if (el.value) {if (!view.value) initView(el.value)+ platform.ui?.onCodemirrorInstanceMount?.(el.value)}})diff --git a/packages/hoppscotch-common/src/platform/ui.ts b/packages/hoppscotch-common/src/platform/ui.tsindex 57ceb9280..49d5a0a40 100644--- a/packages/hoppscotch-common/src/platform/ui.ts+++ b/packages/hoppscotch-common/src/platform/ui.ts@@ -5,4 +5,5 @@ export type UIPlatformDef = {paddingTop?: Ref<string>paddingLeft?: Ref<string>}+ onCodemirrorInstanceMount?: (element: HTMLElement) => void}