[{"data":1,"prerenderedAt":1086},["ShallowReactive",2],{"quirekit-doc:\u002Fguide\u002Fbehavior":3,"quirekit-source:core\u002Fbehavior\u002Fgreeting.ts":306,"mdc--8uaz3e-key":307},{"id":4,"title":5,"body":6,"description":294,"extension":295,"keywords":296,"locale":297,"meta":298,"navigation":299,"order":300,"path":301,"section":302,"seo":303,"stem":304,"__hash__":305},"docs\u002Fguide\u002Fbehavior.zh-CN.md","编写行为扩展",{"type":7,"value":8,"toc":286},"minimark",[9,24,29,93,96,100,118,122,141,145,181,192,202,206,220,231,235,244,264,282],[10,11,12,13,17,18,23],"p",{},"假设你的产品需要一个“插入问候语”按钮。它只插入普通文字，不增加文档结构，因此使用 ",[14,15,16],"code",{},"Extension","。本章从已装有 StarterKit 的 Editor 开始；尚未创建编辑器时，先完成",[19,20,22],"a",{"href":21},"\u002Fguide\u002Fquick-start","快速开始","。",[25,26,28],"h2",{"id":27},"_1-区分配置运行状态和正文","1. 区分配置、运行状态和正文",[30,31,32,48],"table",{},[33,34,35],"thead",{},[36,37,38,42,45],"tr",{},[39,40,41],"th",{},"数据",[39,43,44],{},"放在哪里",[39,46,47],{},"会随 JSON 保存吗",[49,50,51,70,82],"tbody",{},[36,52,53,57,67],{},[54,55,56],"td",{},"按钮要插入的问候语",[54,58,59,62,63,66],{},[14,60,61],{},"addOptions()","，由 ",[14,64,65],{},".configure()"," 设置",[54,68,69],{},"不会",[36,71,72,75,80],{},[54,73,74],{},"本次会话收到多少次内容更新",[54,76,77],{},[14,78,79],{},"addStorage()",[54,81,69],{},[36,83,84,87,90],{},[54,85,86],{},"插入后的文字",[54,88,89],{},"命令产生的正文",[54,91,92],{},"会",[10,94,95],{},"需要刷新后恢复的业务数据应进入节点或标记属性，不能只存在 storage。扩展对象会缓存自己的 storage；为每个 Editor 创建一个新扩展，避免两个编辑器共享可变状态。",[25,97,99],{"id":98},"_2-提供一个有类型的命令","2. 提供一个有类型的命令",[10,101,102,105,106,109,110,113,114,117],{},[14,103,104],{},"createGreeting()"," 定义 ",[14,107,108],{},"insertGreeting()","。命令内部使用现有 ",[14,111,112],{},"insertContent()"," 插入文本节点，所以 ",[14,115,116],{},"\u003Cb>Hello\u003C\u002Fb>"," 也是字面文字。它不把宿主提供的字符串当成 HTML。",[119,120],"docs-recipe",{"name":121},"core\u002Fbehavior\u002Fgreeting",[10,123,124,125,128,129,132,133,136,137,140],{},"文件中的 ",[14,126,127],{},"declare module"," 为 ",[14,130,131],{},"editor.commands","、",[14,134,135],{},"chain()"," 和 ",[14,138,139],{},"can()"," 补充同一个命令类型。声明只帮助 TypeScript；实际功能仍要安装扩展才存在。",[25,142,144],{"id":143},"_3-安装并调用","3. 安装并调用",[146,147,153],"pre",{"className":148,"code":149,"filename":150,"language":151,"meta":152,"style":152},"language-ts shiki shiki-themes github-light github-light github-dark","extensions: [StarterKit, createGreeting('你好！')]\n","创建 Editor 时加入 extensions","ts","",[14,154,155],{"__ignoreMap":152},[156,157,160,164,168,171,174,178],"span",{"class":158,"line":159},"line",1,[156,161,163],{"class":162},"sgQzM","extensions",[156,165,167],{"class":166},"sVPnS",": [StarterKit, ",[156,169,170],{"class":162},"createGreeting",[156,172,173],{"class":166},"(",[156,175,177],{"class":176},"s-HEn","'你好！'",[156,179,180],{"class":166},")]\n",[10,182,183,184,187,188,191],{},"按钮点击时调用 ",[14,185,186],{},"editor.chain().focus().insertGreeting().run()","；按钮可用性读取 ",[14,189,190],{},"editor.can().insertGreeting()","。输入焦点不是权限检查，应用仍需确认当前用户可以修改文档。",[10,193,194,195,197,198,201],{},"命令必须支持 ",[14,196,139],{},"：不发请求、不改 storage、不操作 DOM。例程把插入交给现有命令，内容真正更新后才由 ",[14,199,200],{},"onUpdate"," 增加计数。查询按钮可用性不会增加它。",[25,203,205],{"id":204},"_4-配置与继承分别做什么","4. 配置与继承分别做什么",[10,207,208,211,212,215,216,219],{},[14,209,210],{},".configure({ text: '欢迎' })"," 调整已有公开选项；",[14,213,214],{},".extend({ ... })"," 修改扩展定义，例如覆盖快捷键。覆盖已有钩子又需要原行为时，通过该钩子的 ",[14,217,218],{},"this.parent?.()"," 调用父实现。",[10,221,222,223,226,227,230],{},"只安装最终扩展。把原扩展与同名的 ",[14,224,225],{},".extend()"," 结果一起装入，会造成名称、Schema 或命令冲突。",[14,228,229],{},"priority"," 可以调整扩展处理顺序，数值越大越早；不要用优先级掩盖两个模块争用同一功能的问题。",[25,232,234],{"id":233},"_5-如何验证","5. 如何验证",[10,236,237,238,240,241,243],{},"调用 ",[14,239,139],{}," 后正文与 storage 应不变；执行命令后应出现问候语，撤销后消失。创建两个 Editor，分别传入两个 ",[14,242,104],{}," 结果，一个编辑器的计数不应影响另一个。计数也不会出现在下载的 JSON 中。",[10,245,246,247,132,249,252,253,256,257,259,260,23],{},"复杂命令应通过传入的 ",[14,248,36],{},[14,250,251],{},"commands"," 与 ",[14,254,255],{},"chain"," 组合，避免在命令内另起 ",[14,258,131],{}," 事务。链中后续步骤返回 false 不会回滚之前已写入的步骤，详见",[19,261,263],{"href":262},"\u002Fconcepts\u002Fcommands","命令与事务",[10,265,266,267,271,272,276,277,281],{},"接下来学习",[19,268,270],{"href":269},"\u002Fguide\u002Frules","输入规则与状态插件","，或为可持久内容添加",[19,273,275],{"href":274},"\u002Fbuild\u002Fextension","节点与布局","。完整钩子在",[19,278,280],{"href":279},"\u002Fapi\u002Fextensions","扩展 API","查询。",[283,284,285],"style",{},"html pre.shiki code .sgQzM, html code.shiki .sgQzM{--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVPnS, html code.shiki .sVPnS{--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s-HEn, html code.shiki .s-HEn{--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF}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 .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":152,"searchDepth":287,"depth":287,"links":288},2,[289,290,291,292,293],{"id":27,"depth":287,"text":28},{"id":98,"depth":287,"text":99},{"id":143,"depth":287,"text":144},{"id":204,"depth":287,"text":205},{"id":233,"depth":287,"text":234},"从一个插入问候语的命令开始，理解配置、storage、命令与生命周期。","md",null,"zh-CN",{},true,0,"\u002Fguide\u002Fbehavior","扩展开发",{"title":5,"description":294},"guide\u002Fbehavior.zh-CN","WMgHwu5S7-ewrtxUv7OYyTRgBBzV_ITjcJ6AH2nwXRw","import { Extension } from \"@quirekit\u002Fcore\";\nimport type { GreetingOptions, GreetingStorage } from \".\u002Ftypes\";\n\ndeclare module \"@quirekit\u002Fcore\" {\n  \u002F** Application commands installed by the greeting extension. *\u002F\n  interface Commands\u003CReturnType> {\n    \u002F** Greeting behavior. *\u002F\n    greeting: {\n      \u002F** @returns Whether insertion can run or was accepted. *\u002F\n      insertGreeting: () => ReturnType;\n    };\n  }\n}\n\n\u002F**\n * Creates fresh options\u002Fstorage for each editor instead of sharing a mutable extension.\n * @param text - Literal greeting, never interpreted as HTML.\n * @returns One installable, configured behavior.\n *\u002F\nexport function createGreeting(text = \"Hello!\") {\n  return Extension.create\u003CGreetingOptions, GreetingStorage>({\n    name: \"greeting\",\n    \u002F** @returns Application defaults. *\u002F\n    addOptions() { return { text: \"Hello!\" }; },\n    \u002F** @returns Session-local state; it is not document JSON. *\u002F\n    addStorage() { return { updates: 0 }; },\n    \u002F** @returns The same command for direct, chain and can modes. *\u002F\n    addCommands() {\n      return {\n        insertGreeting: () => ({ commands }) => this.options.text.length > 0\n          && commands.insertContent({ type: \"text\", text: this.options.text }),\n      };\n    },\n    \u002F** Counts accepted document updates; querying can() does not run this hook. *\u002F\n    onUpdate() { this.storage.updates += 1; },\n  }).configure({ text });\n}\n",{"data":308,"body":309},{},{"type":310,"children":311},"root",[312,1081],{"type":313,"tag":146,"props":314,"children":316},"element",{"className":148,"code":315,"language":151,"meta":152,"style":152},"import { Extension } from \"@quirekit\u002Fcore\";\nimport type { GreetingOptions, GreetingStorage } from \".\u002Ftypes\";\n\ndeclare module \"@quirekit\u002Fcore\" {\n  \u002F** Application commands installed by the greeting extension. *\u002F\n  interface Commands\u003CReturnType> {\n    \u002F** Greeting behavior. *\u002F\n    greeting: {\n      \u002F** @returns Whether insertion can run or was accepted. *\u002F\n      insertGreeting: () => ReturnType;\n    };\n  }\n}\n\n\u002F**\n * Creates fresh options\u002Fstorage for each editor instead of sharing a mutable extension.\n * @param text - Literal greeting, never interpreted as HTML.\n * @returns One installable, configured behavior.\n *\u002F\nexport function createGreeting(text = \"Hello!\") {\n  return Extension.create\u003CGreetingOptions, GreetingStorage>({\n    name: \"greeting\",\n    \u002F** @returns Application defaults. *\u002F\n    addOptions() { return { text: \"Hello!\" }; },\n    \u002F** @returns Session-local state; it is not document JSON. *\u002F\n    addStorage() { return { updates: 0 }; },\n    \u002F** @returns The same command for direct, chain and can modes. *\u002F\n    addCommands() {\n      return {\n        insertGreeting: () => ({ commands }) => this.options.text.length > 0\n          && commands.insertContent({ type: \"text\", text: this.options.text }),\n      };\n    },\n    \u002F** Counts accepted document updates; querying can() does not run this hook. *\u002F\n    onUpdate() { this.storage.updates += 1; },\n  }).configure({ text });\n}\n\n",[317],{"type":313,"tag":14,"props":318,"children":319},{"__ignoreMap":152},[320,352,382,391,414,424,454,463,482,501,533,542,551,560,568,577,586,610,627,636,678,721,740,758,792,809,841,858,872,885,946,990,999,1008,1017,1054,1073],{"type":313,"tag":156,"props":321,"children":322},{"class":158,"line":159},[323,330,336,341,347],{"type":313,"tag":156,"props":324,"children":326},{"style":325},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[327],{"type":328,"value":329},"text","import",{"type":313,"tag":156,"props":331,"children":333},{"style":332},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[334],{"type":328,"value":335}," { Extension } ",{"type":313,"tag":156,"props":337,"children":338},{"style":325},[339],{"type":328,"value":340},"from",{"type":313,"tag":156,"props":342,"children":344},{"style":343},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[345],{"type":328,"value":346}," \"@quirekit\u002Fcore\"",{"type":313,"tag":156,"props":348,"children":349},{"style":332},[350],{"type":328,"value":351},";\n",{"type":313,"tag":156,"props":353,"children":354},{"class":158,"line":287},[355,359,364,369,373,378],{"type":313,"tag":156,"props":356,"children":357},{"style":325},[358],{"type":328,"value":329},{"type":313,"tag":156,"props":360,"children":361},{"style":325},[362],{"type":328,"value":363}," type",{"type":313,"tag":156,"props":365,"children":366},{"style":332},[367],{"type":328,"value":368}," { GreetingOptions, GreetingStorage } ",{"type":313,"tag":156,"props":370,"children":371},{"style":325},[372],{"type":328,"value":340},{"type":313,"tag":156,"props":374,"children":375},{"style":343},[376],{"type":328,"value":377}," \".\u002Ftypes\"",{"type":313,"tag":156,"props":379,"children":380},{"style":332},[381],{"type":328,"value":351},{"type":313,"tag":156,"props":383,"children":385},{"class":158,"line":384},3,[386],{"type":313,"tag":156,"props":387,"children":388},{"emptyLinePlaceholder":299},[389],{"type":328,"value":390},"\n",{"type":313,"tag":156,"props":392,"children":394},{"class":158,"line":393},4,[395,400,405,409],{"type":313,"tag":156,"props":396,"children":397},{"style":325},[398],{"type":328,"value":399},"declare",{"type":313,"tag":156,"props":401,"children":402},{"style":325},[403],{"type":328,"value":404}," module",{"type":313,"tag":156,"props":406,"children":407},{"style":343},[408],{"type":328,"value":346},{"type":313,"tag":156,"props":410,"children":411},{"style":332},[412],{"type":328,"value":413}," {\n",{"type":313,"tag":156,"props":415,"children":417},{"class":158,"line":416},5,[418],{"type":313,"tag":156,"props":419,"children":421},{"style":420},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[422],{"type":328,"value":423},"  \u002F** Application commands installed by the greeting extension. *\u002F\n",{"type":313,"tag":156,"props":425,"children":427},{"class":158,"line":426},6,[428,433,439,444,449],{"type":313,"tag":156,"props":429,"children":430},{"style":325},[431],{"type":328,"value":432},"  interface",{"type":313,"tag":156,"props":434,"children":436},{"style":435},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[437],{"type":328,"value":438}," Commands",{"type":313,"tag":156,"props":440,"children":441},{"style":332},[442],{"type":328,"value":443},"\u003C",{"type":313,"tag":156,"props":445,"children":446},{"style":435},[447],{"type":328,"value":448},"ReturnType",{"type":313,"tag":156,"props":450,"children":451},{"style":332},[452],{"type":328,"value":453},"> {\n",{"type":313,"tag":156,"props":455,"children":457},{"class":158,"line":456},7,[458],{"type":313,"tag":156,"props":459,"children":460},{"style":420},[461],{"type":328,"value":462},"    \u002F** Greeting behavior. *\u002F\n",{"type":313,"tag":156,"props":464,"children":466},{"class":158,"line":465},8,[467,473,478],{"type":313,"tag":156,"props":468,"children":470},{"style":469},"--shiki-default:#E36209;--shiki-light:#E36209;--shiki-dark:#FFAB70",[471],{"type":328,"value":472},"    greeting",{"type":313,"tag":156,"props":474,"children":475},{"style":325},[476],{"type":328,"value":477},":",{"type":313,"tag":156,"props":479,"children":480},{"style":332},[481],{"type":328,"value":413},{"type":313,"tag":156,"props":483,"children":485},{"class":158,"line":484},9,[486,491,496],{"type":313,"tag":156,"props":487,"children":488},{"style":420},[489],{"type":328,"value":490},"      \u002F** ",{"type":313,"tag":156,"props":492,"children":493},{"style":325},[494],{"type":328,"value":495},"@returns",{"type":313,"tag":156,"props":497,"children":498},{"style":420},[499],{"type":328,"value":500}," Whether insertion can run or was accepted. *\u002F\n",{"type":313,"tag":156,"props":502,"children":504},{"class":158,"line":503},10,[505,510,514,519,524,529],{"type":313,"tag":156,"props":506,"children":507},{"style":435},[508],{"type":328,"value":509},"      insertGreeting",{"type":313,"tag":156,"props":511,"children":512},{"style":325},[513],{"type":328,"value":477},{"type":313,"tag":156,"props":515,"children":516},{"style":332},[517],{"type":328,"value":518}," () ",{"type":313,"tag":156,"props":520,"children":521},{"style":325},[522],{"type":328,"value":523},"=>",{"type":313,"tag":156,"props":525,"children":526},{"style":435},[527],{"type":328,"value":528}," ReturnType",{"type":313,"tag":156,"props":530,"children":531},{"style":332},[532],{"type":328,"value":351},{"type":313,"tag":156,"props":534,"children":536},{"class":158,"line":535},11,[537],{"type":313,"tag":156,"props":538,"children":539},{"style":332},[540],{"type":328,"value":541},"    };\n",{"type":313,"tag":156,"props":543,"children":545},{"class":158,"line":544},12,[546],{"type":313,"tag":156,"props":547,"children":548},{"style":332},[549],{"type":328,"value":550},"  }\n",{"type":313,"tag":156,"props":552,"children":554},{"class":158,"line":553},13,[555],{"type":313,"tag":156,"props":556,"children":557},{"style":332},[558],{"type":328,"value":559},"}\n",{"type":313,"tag":156,"props":561,"children":563},{"class":158,"line":562},14,[564],{"type":313,"tag":156,"props":565,"children":566},{"emptyLinePlaceholder":299},[567],{"type":328,"value":390},{"type":313,"tag":156,"props":569,"children":571},{"class":158,"line":570},15,[572],{"type":313,"tag":156,"props":573,"children":574},{"style":420},[575],{"type":328,"value":576},"\u002F**\n",{"type":313,"tag":156,"props":578,"children":580},{"class":158,"line":579},16,[581],{"type":313,"tag":156,"props":582,"children":583},{"style":420},[584],{"type":328,"value":585}," * Creates fresh options\u002Fstorage for each editor instead of sharing a mutable extension.\n",{"type":313,"tag":156,"props":587,"children":589},{"class":158,"line":588},17,[590,595,600,605],{"type":313,"tag":156,"props":591,"children":592},{"style":420},[593],{"type":328,"value":594}," * ",{"type":313,"tag":156,"props":596,"children":597},{"style":325},[598],{"type":328,"value":599},"@param",{"type":313,"tag":156,"props":601,"children":602},{"style":332},[603],{"type":328,"value":604}," text",{"type":313,"tag":156,"props":606,"children":607},{"style":420},[608],{"type":328,"value":609}," - Literal greeting, never interpreted as HTML.\n",{"type":313,"tag":156,"props":611,"children":613},{"class":158,"line":612},18,[614,618,622],{"type":313,"tag":156,"props":615,"children":616},{"style":420},[617],{"type":328,"value":594},{"type":313,"tag":156,"props":619,"children":620},{"style":325},[621],{"type":328,"value":495},{"type":313,"tag":156,"props":623,"children":624},{"style":420},[625],{"type":328,"value":626}," One installable, configured behavior.\n",{"type":313,"tag":156,"props":628,"children":630},{"class":158,"line":629},19,[631],{"type":313,"tag":156,"props":632,"children":633},{"style":420},[634],{"type":328,"value":635}," *\u002F\n",{"type":313,"tag":156,"props":637,"children":639},{"class":158,"line":638},20,[640,645,650,655,659,663,668,673],{"type":313,"tag":156,"props":641,"children":642},{"style":325},[643],{"type":328,"value":644},"export",{"type":313,"tag":156,"props":646,"children":647},{"style":325},[648],{"type":328,"value":649}," function",{"type":313,"tag":156,"props":651,"children":652},{"style":435},[653],{"type":328,"value":654}," createGreeting",{"type":313,"tag":156,"props":656,"children":657},{"style":332},[658],{"type":328,"value":173},{"type":313,"tag":156,"props":660,"children":661},{"style":469},[662],{"type":328,"value":328},{"type":313,"tag":156,"props":664,"children":665},{"style":325},[666],{"type":328,"value":667}," =",{"type":313,"tag":156,"props":669,"children":670},{"style":343},[671],{"type":328,"value":672}," \"Hello!\"",{"type":313,"tag":156,"props":674,"children":675},{"style":332},[676],{"type":328,"value":677},") {\n",{"type":313,"tag":156,"props":679,"children":681},{"class":158,"line":680},21,[682,687,692,697,701,706,711,716],{"type":313,"tag":156,"props":683,"children":684},{"style":325},[685],{"type":328,"value":686},"  return",{"type":313,"tag":156,"props":688,"children":689},{"style":332},[690],{"type":328,"value":691}," Extension.",{"type":313,"tag":156,"props":693,"children":694},{"style":435},[695],{"type":328,"value":696},"create",{"type":313,"tag":156,"props":698,"children":699},{"style":332},[700],{"type":328,"value":443},{"type":313,"tag":156,"props":702,"children":703},{"style":435},[704],{"type":328,"value":705},"GreetingOptions",{"type":313,"tag":156,"props":707,"children":708},{"style":332},[709],{"type":328,"value":710},", ",{"type":313,"tag":156,"props":712,"children":713},{"style":435},[714],{"type":328,"value":715},"GreetingStorage",{"type":313,"tag":156,"props":717,"children":718},{"style":332},[719],{"type":328,"value":720},">({\n",{"type":313,"tag":156,"props":722,"children":724},{"class":158,"line":723},22,[725,730,735],{"type":313,"tag":156,"props":726,"children":727},{"style":332},[728],{"type":328,"value":729},"    name: ",{"type":313,"tag":156,"props":731,"children":732},{"style":343},[733],{"type":328,"value":734},"\"greeting\"",{"type":313,"tag":156,"props":736,"children":737},{"style":332},[738],{"type":328,"value":739},",\n",{"type":313,"tag":156,"props":741,"children":743},{"class":158,"line":742},23,[744,749,753],{"type":313,"tag":156,"props":745,"children":746},{"style":420},[747],{"type":328,"value":748},"    \u002F** ",{"type":313,"tag":156,"props":750,"children":751},{"style":325},[752],{"type":328,"value":495},{"type":313,"tag":156,"props":754,"children":755},{"style":420},[756],{"type":328,"value":757}," Application defaults. *\u002F\n",{"type":313,"tag":156,"props":759,"children":761},{"class":158,"line":760},24,[762,767,772,777,782,787],{"type":313,"tag":156,"props":763,"children":764},{"style":435},[765],{"type":328,"value":766},"    addOptions",{"type":313,"tag":156,"props":768,"children":769},{"style":332},[770],{"type":328,"value":771},"() { ",{"type":313,"tag":156,"props":773,"children":774},{"style":325},[775],{"type":328,"value":776},"return",{"type":313,"tag":156,"props":778,"children":779},{"style":332},[780],{"type":328,"value":781}," { text: ",{"type":313,"tag":156,"props":783,"children":784},{"style":343},[785],{"type":328,"value":786},"\"Hello!\"",{"type":313,"tag":156,"props":788,"children":789},{"style":332},[790],{"type":328,"value":791}," }; },\n",{"type":313,"tag":156,"props":793,"children":795},{"class":158,"line":794},25,[796,800,804],{"type":313,"tag":156,"props":797,"children":798},{"style":420},[799],{"type":328,"value":748},{"type":313,"tag":156,"props":801,"children":802},{"style":325},[803],{"type":328,"value":495},{"type":313,"tag":156,"props":805,"children":806},{"style":420},[807],{"type":328,"value":808}," Session-local state; it is not document JSON. *\u002F\n",{"type":313,"tag":156,"props":810,"children":812},{"class":158,"line":811},26,[813,818,822,826,831,837],{"type":313,"tag":156,"props":814,"children":815},{"style":435},[816],{"type":328,"value":817},"    addStorage",{"type":313,"tag":156,"props":819,"children":820},{"style":332},[821],{"type":328,"value":771},{"type":313,"tag":156,"props":823,"children":824},{"style":325},[825],{"type":328,"value":776},{"type":313,"tag":156,"props":827,"children":828},{"style":332},[829],{"type":328,"value":830}," { updates: ",{"type":313,"tag":156,"props":832,"children":834},{"style":833},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[835],{"type":328,"value":836},"0",{"type":313,"tag":156,"props":838,"children":839},{"style":332},[840],{"type":328,"value":791},{"type":313,"tag":156,"props":842,"children":844},{"class":158,"line":843},27,[845,849,853],{"type":313,"tag":156,"props":846,"children":847},{"style":420},[848],{"type":328,"value":748},{"type":313,"tag":156,"props":850,"children":851},{"style":325},[852],{"type":328,"value":495},{"type":313,"tag":156,"props":854,"children":855},{"style":420},[856],{"type":328,"value":857}," The same command for direct, chain and can modes. *\u002F\n",{"type":313,"tag":156,"props":859,"children":861},{"class":158,"line":860},28,[862,867],{"type":313,"tag":156,"props":863,"children":864},{"style":435},[865],{"type":328,"value":866},"    addCommands",{"type":313,"tag":156,"props":868,"children":869},{"style":332},[870],{"type":328,"value":871},"() {\n",{"type":313,"tag":156,"props":873,"children":875},{"class":158,"line":874},29,[876,881],{"type":313,"tag":156,"props":877,"children":878},{"style":325},[879],{"type":328,"value":880},"      return",{"type":313,"tag":156,"props":882,"children":883},{"style":332},[884],{"type":328,"value":413},{"type":313,"tag":156,"props":886,"children":888},{"class":158,"line":887},30,[889,894,899,903,908,912,917,921,926,931,936,941],{"type":313,"tag":156,"props":890,"children":891},{"style":435},[892],{"type":328,"value":893},"        insertGreeting",{"type":313,"tag":156,"props":895,"children":896},{"style":332},[897],{"type":328,"value":898},": () ",{"type":313,"tag":156,"props":900,"children":901},{"style":325},[902],{"type":328,"value":523},{"type":313,"tag":156,"props":904,"children":905},{"style":332},[906],{"type":328,"value":907}," ({ ",{"type":313,"tag":156,"props":909,"children":910},{"style":469},[911],{"type":328,"value":251},{"type":313,"tag":156,"props":913,"children":914},{"style":332},[915],{"type":328,"value":916}," }) ",{"type":313,"tag":156,"props":918,"children":919},{"style":325},[920],{"type":328,"value":523},{"type":313,"tag":156,"props":922,"children":923},{"style":833},[924],{"type":328,"value":925}," this",{"type":313,"tag":156,"props":927,"children":928},{"style":332},[929],{"type":328,"value":930},".options.text.",{"type":313,"tag":156,"props":932,"children":933},{"style":833},[934],{"type":328,"value":935},"length",{"type":313,"tag":156,"props":937,"children":938},{"style":325},[939],{"type":328,"value":940}," >",{"type":313,"tag":156,"props":942,"children":943},{"style":833},[944],{"type":328,"value":945}," 0\n",{"type":313,"tag":156,"props":947,"children":949},{"class":158,"line":948},31,[950,955,960,965,970,975,980,985],{"type":313,"tag":156,"props":951,"children":952},{"style":325},[953],{"type":328,"value":954},"          &&",{"type":313,"tag":156,"props":956,"children":957},{"style":332},[958],{"type":328,"value":959}," commands.",{"type":313,"tag":156,"props":961,"children":962},{"style":435},[963],{"type":328,"value":964},"insertContent",{"type":313,"tag":156,"props":966,"children":967},{"style":332},[968],{"type":328,"value":969},"({ type: ",{"type":313,"tag":156,"props":971,"children":972},{"style":343},[973],{"type":328,"value":974},"\"text\"",{"type":313,"tag":156,"props":976,"children":977},{"style":332},[978],{"type":328,"value":979},", text: ",{"type":313,"tag":156,"props":981,"children":982},{"style":833},[983],{"type":328,"value":984},"this",{"type":313,"tag":156,"props":986,"children":987},{"style":332},[988],{"type":328,"value":989},".options.text }),\n",{"type":313,"tag":156,"props":991,"children":993},{"class":158,"line":992},32,[994],{"type":313,"tag":156,"props":995,"children":996},{"style":332},[997],{"type":328,"value":998},"      };\n",{"type":313,"tag":156,"props":1000,"children":1002},{"class":158,"line":1001},33,[1003],{"type":313,"tag":156,"props":1004,"children":1005},{"style":332},[1006],{"type":328,"value":1007},"    },\n",{"type":313,"tag":156,"props":1009,"children":1011},{"class":158,"line":1010},34,[1012],{"type":313,"tag":156,"props":1013,"children":1014},{"style":420},[1015],{"type":328,"value":1016},"    \u002F** Counts accepted document updates; querying can() does not run this hook. *\u002F\n",{"type":313,"tag":156,"props":1018,"children":1020},{"class":158,"line":1019},35,[1021,1026,1030,1034,1039,1044,1049],{"type":313,"tag":156,"props":1022,"children":1023},{"style":435},[1024],{"type":328,"value":1025},"    onUpdate",{"type":313,"tag":156,"props":1027,"children":1028},{"style":332},[1029],{"type":328,"value":771},{"type":313,"tag":156,"props":1031,"children":1032},{"style":833},[1033],{"type":328,"value":984},{"type":313,"tag":156,"props":1035,"children":1036},{"style":332},[1037],{"type":328,"value":1038},".storage.updates ",{"type":313,"tag":156,"props":1040,"children":1041},{"style":325},[1042],{"type":328,"value":1043},"+=",{"type":313,"tag":156,"props":1045,"children":1046},{"style":833},[1047],{"type":328,"value":1048}," 1",{"type":313,"tag":156,"props":1050,"children":1051},{"style":332},[1052],{"type":328,"value":1053},"; },\n",{"type":313,"tag":156,"props":1055,"children":1057},{"class":158,"line":1056},36,[1058,1063,1068],{"type":313,"tag":156,"props":1059,"children":1060},{"style":332},[1061],{"type":328,"value":1062},"  }).",{"type":313,"tag":156,"props":1064,"children":1065},{"style":435},[1066],{"type":328,"value":1067},"configure",{"type":313,"tag":156,"props":1069,"children":1070},{"style":332},[1071],{"type":328,"value":1072},"({ text });\n",{"type":313,"tag":156,"props":1074,"children":1076},{"class":158,"line":1075},37,[1077],{"type":313,"tag":156,"props":1078,"children":1079},{"style":332},[1080],{"type":328,"value":559},{"type":313,"tag":283,"props":1082,"children":1083},{},[1084],{"type":328,"value":1085},"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 .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",1793045209087]