[visual-markdown-editor] Support for images for in project files

GitOrigin-RevId: 488ebcfc6429cfa2ce4f919f8c736822c80fdca1
This commit is contained in:
Domagoj Kriskovic
2026-09-17 11:56:36 +00:00
committed by Copybot
parent cd7ac6f2fc
commit 0adf9ea45c
3 changed files with 41 additions and 3 deletions
@@ -0,0 +1,23 @@
import {
Compartment,
Extension,
Facet,
TransactionSpec,
} from '@codemirror/state'
const docFolderConf = new Compartment()
/**
* Folder of the open document (null at the project root), for resolving
* document-relative file paths.
*/
export const docFolderFacet = Facet.define<string | null, string | null>({
combine: values => values[0] ?? null,
})
export const docFolder = (docFolder: string | null): Extension =>
docFolderConf.of(docFolderFacet.of(docFolder))
export const setDocFolder = (docFolder: string | null): TransactionSpec => ({
effects: docFolderConf.reconfigure(docFolderFacet.of(docFolder)),
})