[{"data":1,"prerenderedAt":552},["ShallowReactive",2],{"docs:\u002Fen\u002Fdocs\u002Freference\u002Fmethods":3},{"id":4,"title":5,"body":6,"description":542,"extension":543,"meta":544,"navigation":547,"path":548,"seo":549,"stem":550,"__hash__":551},"docs_en\u002Fen\u002Fdocs\u002Freference\u002Fmethods.md","ViText methods",{"type":7,"value":8,"toc":535},"minimark",[9,14,137,146,150,267,274,278,384,388,398,424,428,445,531],[10,11,13],"h2",{"id":12},"reading-and-readiness","Reading and readiness",[15,16,17,33],"table",{},[18,19,20],"thead",{},[21,22,23,27,30],"tr",{},[24,25,26],"th",{},"Method",[24,28,29],{},"Result",[24,31,32],{},"Contract",[34,35,36,48,59,70,81,91,102,113,124],"tbody",{},[21,37,38,42,45],{},[39,40,41],"td",{},"getHTML \u002F getCSS \u002F getText",[39,43,44],{},"string",[39,46,47],{},"Last applied content\u002Fstyles\u002Ftext",[21,49,50,53,56],{},[39,51,52],{},"getJSON",[39,54,55],{},"DocumentNode",[39,57,58],{},"Independent structured snapshot",[21,60,61,64,67],{},[39,62,63],{},"getConfiguration",[39,65,66],{},"ResolvedConfiguration",[39,68,69],{},"Independent configuration copy",[21,71,72,75,78],{},[39,73,74],{},"whenReady",[39,76,77],{},"Promise\u003Cvoid>",[39,79,80],{},"Initial Markdown\u002FCSS; rejection on error",[21,82,83,86,88],{},[39,84,85],{},"whenSourceReady",[39,87,77],{},[39,89,90],{},"Lazy HTML\u002FCSS UI loading and mount",[21,92,93,96,99],{},[39,94,95],{},"getMode",[39,97,98],{},"visual\u002Fhtml\u002Fmarkdown",[39,100,101],{},"Actual active mode",[21,103,104,107,110],{},[39,105,106],{},"isFullscreen",[39,108,109],{},"boolean",[39,111,112],{},"Fullscreen state",[21,114,115,118,121],{},[39,116,117],{},"getSelection",[39,119,120],{},"SelectionInfo",[39,122,123],{},"from\u002Fto\u002Ftext\u002Frevision",[21,125,126,129,134],{},[39,127,128],{},"getPluginIds",[39,130,44,131],{},[132,133],"span",{},[39,135,136],{},"Copy of installed IDs",[138,139,140,141,145],"p",{},"Call argumentless names as ",[142,143,144],"code",{},"editor.getHTML()"," and similarly.",[10,147,149],{"id":148},"document-changes","Document changes",[15,151,152,162],{},[18,153,154],{},[21,155,156,158,160],{},[24,157,26],{},[24,159,29],{},[24,161,32],{},[34,163,164,175,185,196,206,216,226,236,246,256],{},[21,165,166,169,172],{},[39,167,168],{},"setContent(value, options?)",[39,170,171],{},"Promise\u003CImportReport>",[39,173,174],{},"format\u002FallowLossy\u002Fcss; checked atomic document+CSS, one history step; HTML\u002FJSON without CSS applies before Promise return",[21,176,177,180,182],{},[39,178,179],{},"setCSS(css)",[39,181,77],{},[39,183,184],{},"Checks the whole stylesheet, one history step, keeps selection",[21,186,187,190,193],{},[39,188,189],{},"setSelection(from, to?)",[39,191,192],{},"void",[39,194,195],{},"Structured positions; to defaults to from; does not mutate content",[21,197,198,201,203],{},[39,199,200],{},"replaceRange(range, value, options?)",[39,202,171],{},[39,204,205],{},"HTML\u002FMarkdown, one history step; stale range.revision throws StaleDocumentError",[21,207,208,211,213],{},[39,209,210],{},"replaceText(edits, revision)",[39,212,109],{},[39,214,215],{},"Synchronous atomic plain replacements; RangeError or StaleDocumentError",[21,217,218,221,223],{},[39,219,220],{},"transformText(callback)",[39,222,109],{},[39,224,225],{},"callback(text, startsBlock) returns text; keeps marks\u002FCSS, one history step",[21,227,228,231,233],{},[39,229,230],{},"execute(command)",[39,232,109],{},[39,234,235],{},"Formatting\u002Fhistory\u002Ftable commands; false when inapplicable",[21,237,238,241,243],{},[39,239,240],{},"insertTable(rows?, cols?, withHeaderRow?)",[39,242,109],{},[39,244,245],{},"Default 3×3\u002Fheader; integer 1–20, otherwise RangeError",[21,247,248,251,253],{},[39,249,250],{},"insertImage(attributes)",[39,252,109],{},[39,254,255],{},"Validated src\u002Fdimensions\u002Fattributes, one history step",[21,257,258,261,264],{},[39,259,260],{},"uploadImage(file, options?)",[39,262,263],{},"Promise\u003Cboolean>",[39,265,266],{},"signal\u002Falt, upload callback and captured range; AbortError\u002FStaleDocumentError",[138,268,269,270,273],{},"replaceText uses non-overlapping ",[142,271,272],{},"{from,to,text}"," edits inside individual text blocks, without inline atoms or replacement line breaks. Literal markup remains text. transformText\u002FreplaceText in the UI operate only in visual mode. CSS changes increase revision; structured positions are not getText offsets.",[10,275,277],{"id":276},"interface-events-and-extensions","Interface, events and extensions",[15,279,280,290],{},[18,281,282],{},[21,283,284,286,288],{},[24,285,26],{},[24,287,29],{},[24,289,32],{},[34,291,292,302,312,322,333,343,354,364,374],{},[21,293,294,297,299],{},[39,295,296],{},"setMode(mode)",[39,298,192],{},[39,300,301],{},"Errors can keep the current mode; cannot bypass draft validation",[21,303,304,307,309],{},[39,305,306],{},"setFullscreen(enabled)",[39,308,192],{},[39,310,311],{},"Within the browser\u002Fiframe document; no native Fullscreen API; disabled feature throws",[21,313,314,317,319],{},[39,315,316],{},"focus()",[39,318,192],{},[39,320,321],{},"Returns document focus and selection",[21,323,324,327,330],{},[39,325,326],{},"on(name, listener)",[39,328,329],{},"unsubscribe",[39,331,332],{},"Event subscription",[21,334,335,338,340],{},[39,336,337],{},"off(name, listener)",[39,339,192],{},[39,341,342],{},"Remove that listener",[21,344,345,348,351],{},[39,346,347],{},"usePlugin(plugin)",[39,349,350],{},"disposer",[39,352,353],{},"API 1 installation with ID\u002Fversion\u002Ffeature checks",[21,355,356,359,361],{},[39,357,358],{},"removePlugin(id)",[39,360,192],{},[39,362,363],{},"Plugin cleanup",[21,365,366,369,371],{},[39,367,368],{},"executePluginCommand(id, name)",[39,370,109],{},[39,372,373],{},"Registered command; unknown command throws",[21,375,376,379,381],{},[39,377,378],{},"destroy()",[39,380,192],{},[39,382,383],{},"Idempotent cleanup; AggregateError possible after resources are released",[10,385,387],{"id":386},"reconnecting-the-editor","Reconnecting the editor",[138,389,390,393,394,397],{},[142,391,392],{},"getSourceDraft(): SourceDraft | null"," captures the active HTML+CSS or Markdown draft, including invalid source. Visual mode returns null. ",[142,395,396],{},"restoreSourceDraft(draft): Promise\u003Cvoid>"," restores it on a fresh visual instance after initial CSS and lazy source loading. Disabled modes reject. Normal validation, autosave and lossy-import confirmation still apply.",[138,399,400,401,403,404,407,408,411,412,415,416,419,420,423],{},"Before ",[142,402,378],{},", save ",[142,405,406],{},"getJSON()",", ",[142,409,410],{},"getCSS()"," and ",[142,413,414],{},"getSourceDraft()",". Create a new instance with the new ",[142,417,418],{},"language",", saved JSON\u002FCSS and new plugin instances, then await ",[142,421,422],{},"restoreSourceDraft(draft)"," when non-null. Site language switching uses this flow. Document text is not translated. Undo history, open dialogs and source cursor position are not transferred.",[10,425,427],{"id":426},"execute-commands","execute commands",[138,429,430,431,407,436,407,440,444],{},"bold, italic, underline, strike, bulletList, orderedList, blockquote, codeBlock, paragraph, h1, h2, h3, undo, redo, insertTable, addRowAfter, addColumnAfter, deleteRow, deleteColumn, toggleHeaderRow, deleteTable. Import accepts H1–H6. Link\u002Fimage\u002Fhtml\u002Fmarkdown\u002Ffullscreen are UI tools; not every toolbar tool is an execute command. ",[432,433,435],"a",{"href":434},"\u002Fen\u002Fdocs\u002Freference\u002Fevents","Events",[432,437,439],{"href":438},"\u002Fen\u002Fdocs\u002Freference\u002Ferrors","errors",[432,441,443],{"href":442},"\u002Fen\u002Fdocs\u002Freference\u002Fdocument","document",".",[446,447,452],"pre",{"className":448,"code":449,"language":450,"meta":451,"style":451},"language-ts shiki shiki-themes github-dark","editor.execute('bold');\nconst range = editor.getSelection();\nawait editor.replaceRange(range, '\u003Cstrong>New text\u003C\u002Fstrong>');\neditor.execute('undo');\n","ts","",[142,453,454,476,498,517],{"__ignoreMap":451},[132,455,458,462,466,469,473],{"class":456,"line":457},"line",1,[132,459,461],{"class":460},"s95oV","editor.",[132,463,465],{"class":464},"svObZ","execute",[132,467,468],{"class":460},"(",[132,470,472],{"class":471},"sU2Wk","'bold'",[132,474,475],{"class":460},");\n",[132,477,479,483,487,490,493,495],{"class":456,"line":478},2,[132,480,482],{"class":481},"snl16","const",[132,484,486],{"class":485},"sDLfK"," range",[132,488,489],{"class":481}," =",[132,491,492],{"class":460}," editor.",[132,494,117],{"class":464},[132,496,497],{"class":460},"();\n",[132,499,501,504,506,509,512,515],{"class":456,"line":500},3,[132,502,503],{"class":481},"await",[132,505,492],{"class":460},[132,507,508],{"class":464},"replaceRange",[132,510,511],{"class":460},"(range, ",[132,513,514],{"class":471},"'\u003Cstrong>New text\u003C\u002Fstrong>'",[132,516,475],{"class":460},[132,518,520,522,524,526,529],{"class":456,"line":519},4,[132,521,461],{"class":460},[132,523,465],{"class":464},[132,525,468],{"class":460},[132,527,528],{"class":471},"'undo'",[132,530,475],{"class":460},[532,533,534],"style",{},"html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":451,"searchDepth":478,"depth":478,"links":536},[537,538,539,540,541],{"id":12,"depth":478,"text":13},{"id":148,"depth":478,"text":149},{"id":276,"depth":478,"text":277},{"id":386,"depth":478,"text":387},{"id":426,"depth":478,"text":427},"Document access, mutation, UI, history and plugins.","md",{"group":545,"order":546},"API reference",41,true,"\u002Fen\u002Fdocs\u002Freference\u002Fmethods",{"title":5,"description":542},"en\u002Fdocs\u002Freference\u002Fmethods","RPtZ_TCCMA0nXwtT6Mli9S4P3cZcxqRy3KZL3fwxLEE",1792670389598]