[{"data":1,"prerenderedAt":459},["ShallowReactive",2],{"quirekit-doc:\u002Fen\u002Fconcepts\u002Fextensions":3,"quirekit-source:core\u002Fshortcuts.ts":209,"mdc-5ht98-key":210},{"id":4,"title":5,"body":6,"description":197,"extension":198,"keywords":199,"locale":200,"meta":201,"navigation":202,"order":203,"path":204,"section":205,"seo":206,"stem":207,"__hash__":208},"docs\u002Fconcepts\u002Fextensions.en.md","Extension model",{"type":7,"value":8,"toc":189},"minimark",[9,13,18,81,84,88,111,115,125,129,147,165,169,172],[10,11,12],"p",{},"Installed extensions determine whether an editor supports headings, bold or shortcuts. Each extension groups a feature's configuration, commands and lifecycle for Editor to consume.",[14,15,17],"h2",{"id":16},"choose-an-extension-kind","Choose an extension kind",[19,20,21,37],"table",{},[22,23,24],"thead",{},[25,26,27,31,34],"tr",{},[28,29,30],"th",{},"Add",[28,32,33],{},"Use",[28,35,36],{},"Examples",[38,39,40,55,68],"tbody",{},[25,41,42,46,52],{},[43,44,45],"td",{},"Behavior without new structure",[43,47,48],{},[49,50,51],"code",{},"Extension",[43,53,54],{},"Shortcuts, history",[25,56,57,60,65],{},[43,58,59],{},"A content structure",[43,61,62],{},[49,63,64],{},"Node",[43,66,67],{},"Paragraphs, images, note groups",[25,69,70,73,78],{},[43,71,72],{},"Formatting attached to text",[43,74,75],{},[49,76,77],{},"Mark",[43,79,80],{},"Bold, italic, links",[10,82,83],{},"StarterKit combines common extensions. Use it directly or configure its features for your product.",[14,85,87],{"id":86},"start-with-a-shortcut","Start with a shortcut",[10,89,90,91,94,95,98,99,102,103,106,107,110],{},"To bind ",[49,92,93],{},"Mod-Shift-b"," to Bold, add behavior rather than a new node. ",[49,96,97],{},"core\u002Fshortcuts.ts"," uses ",[49,100,101],{},"Extension.create()"," and calls the existing ",[49,104,105],{},"toggleBold()"," in ",[49,108,109],{},"addKeyboardShortcuts()",".",[112,113],"docs-recipe",{"name":114},"core\u002Fshortcuts",[10,116,117,120,121,124],{},[49,118,119],{},"this.editor"," is the receiving editor. The command uses its selection and undo history. Install the extension in the creation-time ",[49,122,123],{},"extensions"," array.",[14,126,128],{"id":127},"configure-and-extend","Configure and extend",[10,130,131,134,135,138,139,142,143,146],{},[49,132,133],{},".configure(options)"," changes public options; ",[49,136,137],{},".extend(config)"," adds or replaces behavior. ",[49,140,141],{},"addOptions()"," supplies defaults, while ",[49,144,145],{},"addStorage()"," holds instance runtime state.",[10,148,149,150,155,156,160,161,110],{},"Options and storage are not document data. Persisted business fields belong in node or mark attributes. Implement a command in the ",[151,152,154],"a",{"href":153},"\u002Fen\u002Fguide\u002Fbehavior","behavior tutorial",", then explore ",[151,157,159],{"href":158},"\u002Fen\u002Fguide\u002Frules","input rules and PM plugins"," and ",[151,162,164],{"href":163},"\u002Fen\u002Fguide\u002Fnode-view","NodeViews",[14,166,168],{"id":167},"add-other-content-capabilities","Add other content capabilities",[10,170,171],{},"A Node defines content structure. HTML output, Canvas layout, structured selection, DOCX conversion and AI reading require their respective implementations.",[10,173,174,175,179,180,184,185,110],{},"Follow the ",[151,176,178],{"href":177},"\u002Fen\u002Fbuild\u002Fextension","note-group tutorial"," for a first content extension. Find existing features in ",[151,181,183],{"href":182},"\u002Fen\u002Fplugins","plugins",", and hooks and types in ",[151,186,188],{"href":187},"\u002Fen\u002Fapi\u002Fextensions","extension API",{"title":190,"searchDepth":191,"depth":191,"links":192},"",2,[193,194,195,196],{"id":16,"depth":191,"text":17},{"id":86,"depth":191,"text":87},{"id":127,"depth":191,"text":128},{"id":167,"depth":191,"text":168},"Learn how behavior, document structures and text formatting join an editor.","md",null,"en",{},true,1,"\u002Fen\u002Fconcepts\u002Fextensions","Core concepts",{"title":5,"description":197},"concepts\u002Fextensions.en","otA-aaZYdRG8PXkpfx2jKrIuM858yIVt8nx9RScLl-A","import { Extension } from \"@quirekit\u002Fcore\";\n\n\u002F** A host-authored behavior extension using the same typed command registry as the toolbar. *\u002F\nexport const writingShortcuts = Extension.create({\n  name: \"writingShortcuts\",\n  \u002F** @returns A keyboard binding that participates in the editor's existing history. *\u002F\n  addKeyboardShortcuts() {\n    return { \"Mod-Shift-b\": () => this.editor?.commands.toggleBold() ?? false };\n  },\n});\n",{"data":211,"body":212},{},{"type":213,"children":214},"root",[215,453],{"type":216,"tag":217,"props":218,"children":222},"element","pre",{"className":219,"code":220,"language":221,"meta":190,"style":190},"language-ts shiki shiki-themes github-light github-light github-dark","import { Extension } from \"@quirekit\u002Fcore\";\n\n\u002F** A host-authored behavior extension using the same typed command registry as the toolbar. *\u002F\nexport const writingShortcuts = Extension.create({\n  name: \"writingShortcuts\",\n  \u002F** @returns A keyboard binding that participates in the editor's existing history. *\u002F\n  addKeyboardShortcuts() {\n    return { \"Mod-Shift-b\": () => this.editor?.commands.toggleBold() ?? false };\n  },\n});\n\n","ts",[223],{"type":216,"tag":49,"props":224,"children":225},{"__ignoreMap":190},[226,260,268,278,319,338,357,371,435,444],{"type":216,"tag":227,"props":228,"children":230},"span",{"class":229,"line":203},"line",[231,238,244,249,255],{"type":216,"tag":227,"props":232,"children":234},{"style":233},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[235],{"type":236,"value":237},"text","import",{"type":216,"tag":227,"props":239,"children":241},{"style":240},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[242],{"type":236,"value":243}," { Extension } ",{"type":216,"tag":227,"props":245,"children":246},{"style":233},[247],{"type":236,"value":248},"from",{"type":216,"tag":227,"props":250,"children":252},{"style":251},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[253],{"type":236,"value":254}," \"@quirekit\u002Fcore\"",{"type":216,"tag":227,"props":256,"children":257},{"style":240},[258],{"type":236,"value":259},";\n",{"type":216,"tag":227,"props":261,"children":262},{"class":229,"line":191},[263],{"type":216,"tag":227,"props":264,"children":265},{"emptyLinePlaceholder":202},[266],{"type":236,"value":267},"\n",{"type":216,"tag":227,"props":269,"children":271},{"class":229,"line":270},3,[272],{"type":216,"tag":227,"props":273,"children":275},{"style":274},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[276],{"type":236,"value":277},"\u002F** A host-authored behavior extension using the same typed command registry as the toolbar. *\u002F\n",{"type":216,"tag":227,"props":279,"children":281},{"class":229,"line":280},4,[282,287,292,298,303,308,314],{"type":216,"tag":227,"props":283,"children":284},{"style":233},[285],{"type":236,"value":286},"export",{"type":216,"tag":227,"props":288,"children":289},{"style":233},[290],{"type":236,"value":291}," const",{"type":216,"tag":227,"props":293,"children":295},{"style":294},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[296],{"type":236,"value":297}," writingShortcuts",{"type":216,"tag":227,"props":299,"children":300},{"style":233},[301],{"type":236,"value":302}," =",{"type":216,"tag":227,"props":304,"children":305},{"style":240},[306],{"type":236,"value":307}," Extension.",{"type":216,"tag":227,"props":309,"children":311},{"style":310},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[312],{"type":236,"value":313},"create",{"type":216,"tag":227,"props":315,"children":316},{"style":240},[317],{"type":236,"value":318},"({\n",{"type":216,"tag":227,"props":320,"children":322},{"class":229,"line":321},5,[323,328,333],{"type":216,"tag":227,"props":324,"children":325},{"style":240},[326],{"type":236,"value":327},"  name: ",{"type":216,"tag":227,"props":329,"children":330},{"style":251},[331],{"type":236,"value":332},"\"writingShortcuts\"",{"type":216,"tag":227,"props":334,"children":335},{"style":240},[336],{"type":236,"value":337},",\n",{"type":216,"tag":227,"props":339,"children":341},{"class":229,"line":340},6,[342,347,352],{"type":216,"tag":227,"props":343,"children":344},{"style":274},[345],{"type":236,"value":346},"  \u002F** ",{"type":216,"tag":227,"props":348,"children":349},{"style":233},[350],{"type":236,"value":351},"@returns",{"type":216,"tag":227,"props":353,"children":354},{"style":274},[355],{"type":236,"value":356}," A keyboard binding that participates in the editor's existing history. *\u002F\n",{"type":216,"tag":227,"props":358,"children":360},{"class":229,"line":359},7,[361,366],{"type":216,"tag":227,"props":362,"children":363},{"style":310},[364],{"type":236,"value":365},"  addKeyboardShortcuts",{"type":216,"tag":227,"props":367,"children":368},{"style":240},[369],{"type":236,"value":370},"() {\n",{"type":216,"tag":227,"props":372,"children":374},{"class":229,"line":373},8,[375,380,385,390,395,400,405,410,415,420,425,430],{"type":216,"tag":227,"props":376,"children":377},{"style":233},[378],{"type":236,"value":379},"    return",{"type":216,"tag":227,"props":381,"children":382},{"style":240},[383],{"type":236,"value":384}," { ",{"type":216,"tag":227,"props":386,"children":387},{"style":251},[388],{"type":236,"value":389},"\"Mod-Shift-b\"",{"type":216,"tag":227,"props":391,"children":392},{"style":240},[393],{"type":236,"value":394},": () ",{"type":216,"tag":227,"props":396,"children":397},{"style":233},[398],{"type":236,"value":399},"=>",{"type":216,"tag":227,"props":401,"children":402},{"style":294},[403],{"type":236,"value":404}," this",{"type":216,"tag":227,"props":406,"children":407},{"style":240},[408],{"type":236,"value":409},".editor?.commands.",{"type":216,"tag":227,"props":411,"children":412},{"style":310},[413],{"type":236,"value":414},"toggleBold",{"type":216,"tag":227,"props":416,"children":417},{"style":240},[418],{"type":236,"value":419},"() ",{"type":216,"tag":227,"props":421,"children":422},{"style":233},[423],{"type":236,"value":424},"??",{"type":216,"tag":227,"props":426,"children":427},{"style":294},[428],{"type":236,"value":429}," false",{"type":216,"tag":227,"props":431,"children":432},{"style":240},[433],{"type":236,"value":434}," };\n",{"type":216,"tag":227,"props":436,"children":438},{"class":229,"line":437},9,[439],{"type":216,"tag":227,"props":440,"children":441},{"style":240},[442],{"type":236,"value":443},"  },\n",{"type":216,"tag":227,"props":445,"children":447},{"class":229,"line":446},10,[448],{"type":216,"tag":227,"props":449,"children":450},{"style":240},[451],{"type":236,"value":452},"});\n",{"type":216,"tag":454,"props":455,"children":456},"style",{},[457],{"type":236,"value":458},"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);}",1793045210418]