chore: add onCodemirrorInstanceMount hook to platform (#3043)
This commit is contained in:
@@ -34,6 +34,7 @@ import { inputTheme } from "~/helpers/editor/themes/baseTheme"
|
|||||||
import { HoppReactiveEnvPlugin } from "~/helpers/editor/extensions/HoppEnvironment"
|
import { HoppReactiveEnvPlugin } from "~/helpers/editor/extensions/HoppEnvironment"
|
||||||
import { useReadonlyStream } from "@composables/stream"
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
import { AggregateEnvironment, aggregateEnvs$ } from "~/newstore/environments"
|
import { AggregateEnvironment, aggregateEnvs$ } from "~/newstore/environments"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -219,6 +220,7 @@ onMounted(() => {
|
|||||||
if (editor.value) {
|
if (editor.value) {
|
||||||
if (!view.value) initView(editor.value)
|
if (!view.value) initView(editor.value)
|
||||||
if (props.selectTextOnMount) triggerTextSelection()
|
if (props.selectTextOnMount) triggerTextSelection()
|
||||||
|
platform.ui?.onCodemirrorInstanceMount?.(editor.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
baseHighlightStyle,
|
baseHighlightStyle,
|
||||||
} from "@helpers/editor/themes/baseTheme"
|
} from "@helpers/editor/themes/baseTheme"
|
||||||
import { HoppEnvironmentPlugin } from "@helpers/editor/extensions/HoppEnvironment"
|
import { HoppEnvironmentPlugin } from "@helpers/editor/extensions/HoppEnvironment"
|
||||||
|
import { platform } from "~/platform"
|
||||||
// TODO: Migrate from legacy mode
|
// TODO: Migrate from legacy mode
|
||||||
|
|
||||||
type ExtendedEditorConfig = {
|
type ExtendedEditorConfig = {
|
||||||
@@ -267,6 +268,7 @@ export function useCodemirror(
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (el.value) {
|
if (el.value) {
|
||||||
if (!view.value) initView(el.value)
|
if (!view.value) initView(el.value)
|
||||||
|
platform.ui?.onCodemirrorInstanceMount?.(el.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ export type UIPlatformDef = {
|
|||||||
paddingTop?: Ref<string>
|
paddingTop?: Ref<string>
|
||||||
paddingLeft?: Ref<string>
|
paddingLeft?: Ref<string>
|
||||||
}
|
}
|
||||||
|
onCodemirrorInstanceMount?: (element: HTMLElement) => void
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user