[{"data":1,"prerenderedAt":133},["ShallowReactive",2],{"msfe-doc:\u002Fen\u002Fguide\u002Flifecycle":3},{"id":4,"title":5,"body":6,"description":118,"extension":119,"keywords":120,"locale":125,"meta":126,"navigation":127,"order":110,"path":128,"section":129,"seo":130,"stem":131,"__hash__":132},"docs\u002Fguide\u002Flifecycle.en.md","Mounting and cleanup",{"type":7,"value":8,"toc":108},"minimark",[9,14,26,30,34,41,44,48,64,68,79,83,86,93,97,100],[10,11,13],"h2",{"id":12},"native-dom","Native DOM",[15,16,17,21,22,25],"p",{},[18,19,20],"code",{},"createMsfeEditor()"," works directly on a regular web page. The example's ",[18,23,24],{},"mount.ts"," has no Vue dependency; its Vue component only supplies the documentation demo container.",[27,28],"msfe-demo",{"name":29},"native\u002Feditor",[10,31,33],{"id":32},"lifecycle-boundaries","Lifecycle boundaries",[15,35,36,37,40],{},"Create the editor when its DOM container is ready, and call ",[18,38,39],{},"destroy()"," before removing that container. Destruction releases editor plugins, listeners, and view resources. Do not recreate the instance on every framework render.",[15,42,43],{},"Each instance owns independent content, selection, and history. Instances may share extension definitions, but each instance owns its mutable state.",[10,45,47],{"id":46},"switching-documents","Switching documents",[15,49,50,53,54,57,58,63],{},[18,51,52],{},"replaceDocument(markdown, documentId)"," explicitly switches documents and resets history and selection. To merge external changes to the same document, use version-checked ",[18,55,56],{},"applyChanges()",". See ",[59,60,62],"a",{"href":61},"\u002Fen\u002Fguide\u002Fsaving","Reading and saving",".",[10,65,67],{"id":66},"asynchronous-work","Asynchronous work",[15,69,70,71,74,75,78],{},"A custom node's ",[18,72,73],{},"load(attrs, signal)"," may return a resource and ",[18,76,77],{},"release()",". Respect cancellation after attributes change, views unmount, or the editor is destroyed; stale results will not become the current node's resource. Persistent business requests belong to the host application.",[10,80,82],{"id":81},"dom-and-host-responsibilities","DOM and host responsibilities",[15,84,85],{},"The runtime owns its editor nodes inside parent. Do not overwrite that area's innerHTML during framework updates. Use separate parents and accessible labels for multiple editors. Share immutable definitions, not mutable business instances.",[15,87,88,89,92],{},"If you call ",[18,90,91],{},"createComponentHost()"," directly rather than using an adapter, you also own its disposal. End the editor and mounted views before disposing the host to avoid orphaned portals.",[10,94,96],{"id":95},"route-lifecycle","Route lifecycle",[15,98,99],{},"Save or preserve unsaved text, cancel document work, dispose the editor, then remove its container. Reopening creates an instance from saved Markdown. Mode changes that retain the same document and history should call setMode instead of recreating the editor.",[15,101,102,103,107],{},"Assign resources to the shortest suitable scope. See ",[59,104,106],{"href":105},"\u002Fen\u002Fextensions\u002Fresources","Resources"," for complete ownership and cancellation patterns.",{"title":109,"searchDepth":110,"depth":110,"links":111},"",2,[112,113,114,115,116,117],{"id":12,"depth":110,"text":13},{"id":32,"depth":110,"text":33},{"id":46,"depth":110,"text":47},{"id":66,"depth":110,"text":67},{"id":81,"depth":110,"text":82},{"id":95,"depth":110,"text":96},"Let your application own containers and storage while the editor owns input, selections, and runtime resources.","md",[121,122,123,124],"native DOM","destroy","multiple instances","lifecycle","en",{},true,"\u002Fen\u002Fguide\u002Flifecycle","Integration",{"title":5,"description":118},"guide\u002Flifecycle.en","xf5lEf17M2EkRcOJWOISAcGiNHEvJMSpAcvBlUOVASc",1793046311992]