[{"data":1,"prerenderedAt":218},["ShallowReactive",2],{"docs:\u002Fen\u002Fdocs\u002Fplugins\u002Fword-count":3},{"id":4,"title":5,"body":6,"description":208,"extension":209,"meta":210,"navigation":213,"path":214,"seo":215,"stem":216,"__hash__":217},"docs_en\u002Fen\u002Fdocs\u002Fplugins\u002Fword-count.md","Word count",{"type":7,"value":8,"toc":203},"minimark",[9,14,27,31,34,38,52,149,199],[10,11,13],"h2",{"id":12},"installation","Installation",[15,16,17,18,22,23,26],"p",{},"Factory: ",[19,20,21],"code",{},"createWordCountPlugin(onUpdate?)",", id ",[19,24,25],{},"word-count",". Requires preset pro and enabled features.plugins. Use a constructor plugins array or usePlugin on an existing editor; do not install the same id twice. In the script build the factory belongs to the ViText namespace; workspace ESM imports are shown below.",[10,28,30],{"id":29},"behavior-and-limitations","Behavior and limitations",[15,32,33],{},"Adds a live word count to the status and an optional numeric callback. Paragraph and br boundaries are respected. Without this plugin the default status counts only characters.",[10,35,37],{"id":36},"removal-and-ownership","Removal and ownership",[15,39,40,41,46,47,51],{},"usePlugin returns a disposer; removePlugin('word-count') removes the same plugin. Destroy automatically revokes its managed commands, subscriptions and UI. The document stays intact. Application-owned requests still need application cleanup. ",[42,43,45],"a",{"href":44},"\u002Fen\u002Fdocs\u002Fplugins\u002Foverview","Plugin contract",", ",[42,48,50],{"href":49},"\u002Fen\u002Fdocs\u002Freference\u002Fmethods","methods",".",[53,54,59],"pre",{"className":55,"code":56,"language":57,"meta":58,"style":58},"language-ts shiki shiki-themes github-dark","import { ViText, createWordCountPlugin } from '@vitext-ru\u002Feditor';\nconst editor = new ViText('#editor', {\n  preset: 'pro', language: 'en',\n  plugins: [createWordCountPlugin()]\n});\n","ts","",[19,60,61,84,113,131,143],{"__ignoreMap":58},[62,63,66,70,74,77,81],"span",{"class":64,"line":65},"line",1,[62,67,69],{"class":68},"snl16","import",[62,71,73],{"class":72},"s95oV"," { ViText, createWordCountPlugin } ",[62,75,76],{"class":68},"from",[62,78,80],{"class":79},"sU2Wk"," '@vitext-ru\u002Feditor'",[62,82,83],{"class":72},";\n",[62,85,87,90,94,97,100,104,107,110],{"class":64,"line":86},2,[62,88,89],{"class":68},"const",[62,91,93],{"class":92},"sDLfK"," editor",[62,95,96],{"class":68}," =",[62,98,99],{"class":68}," new",[62,101,103],{"class":102},"svObZ"," ViText",[62,105,106],{"class":72},"(",[62,108,109],{"class":79},"'#editor'",[62,111,112],{"class":72},", {\n",[62,114,116,119,122,125,128],{"class":64,"line":115},3,[62,117,118],{"class":72},"  preset: ",[62,120,121],{"class":79},"'pro'",[62,123,124],{"class":72},", language: ",[62,126,127],{"class":79},"'en'",[62,129,130],{"class":72},",\n",[62,132,134,137,140],{"class":64,"line":133},4,[62,135,136],{"class":72},"  plugins: [",[62,138,139],{"class":102},"createWordCountPlugin",[62,141,142],{"class":72},"()]\n",[62,144,146],{"class":64,"line":145},5,[62,147,148],{"class":72},"});\n",[53,150,152],{"className":55,"code":151,"language":57,"meta":58,"style":58},"const remove = editor.usePlugin(createWordCountPlugin(words => console.log(words)));\nremove();\n",[19,153,154,191],{"__ignoreMap":58},[62,155,156,158,161,163,166,169,171,173,175,179,182,185,188],{"class":64,"line":65},[62,157,89],{"class":68},[62,159,160],{"class":92}," remove",[62,162,96],{"class":68},[62,164,165],{"class":72}," editor.",[62,167,168],{"class":102},"usePlugin",[62,170,106],{"class":72},[62,172,139],{"class":102},[62,174,106],{"class":72},[62,176,178],{"class":177},"s9osk","words",[62,180,181],{"class":68}," =>",[62,183,184],{"class":72}," console.",[62,186,187],{"class":102},"log",[62,189,190],{"class":72},"(words)));\n",[62,192,193,196],{"class":64,"line":86},[62,194,195],{"class":102},"remove",[62,197,198],{"class":72},"();\n",[200,201,202],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}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);}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":58,"searchDepth":86,"depth":86,"links":204},[205,206,207],{"id":12,"depth":86,"text":13},{"id":29,"depth":86,"text":30},{"id":36,"depth":86,"text":37},"Installation, behavior and limitations of the word count plugin.","md",{"group":211,"order":212},"Plugins",31,true,"\u002Fen\u002Fdocs\u002Fplugins\u002Fword-count",{"title":5,"description":208},"en\u002Fdocs\u002Fplugins\u002Fword-count","ZCwhp1y666muBVUE8csISUadiAO2O4W0y1sET1Zr_CE",1792670389577]