[{"data":1,"prerenderedAt":632},["ShallowReactive",2],{"quirekit-doc:\u002Fguide\u002Ftiptap":3,"quirekit-source:core\u002Fshortcuts.ts":381,"mdc-5ht98-key":382},{"id":4,"title":5,"body":6,"description":370,"extension":371,"keywords":372,"locale":373,"meta":374,"navigation":375,"order":363,"path":376,"section":377,"seo":378,"stem":379,"__hash__":380},"docs\u002Fguide\u002Ftiptap.zh-CN.md","与 Tiptap 的关系",{"type":7,"value":8,"toc":361},"minimark",[9,22,26,57,60,193,208,211,308,311,314,317,321,334,337],[10,11,12,13,17,18,21],"p",{},"QuireKit 基于 Tiptap Core 的代码和扩展模型进行扩展开发，并保留相应许可证声明。它不是运行时安装 ",[14,15,16],"code",{},"@tiptap\u002Fcore"," 后的简单包装：Core 与 ProseMirror 包在 ",[14,19,20],{},"@quirekit"," 下统一维护，视图可显式接入。",[23,24,25],"h2",{"id":25},"可以沿用的概念",[10,27,28,31,32,31,35,31,38,31,41,31,44,31,47,31,50,31,53,56],{},[14,29,30],{},"new Editor()","、",[14,33,34],{},"Extension.create()",[14,36,37],{},"Node.create()",[14,39,40],{},"Mark.create()",[14,42,43],{},".configure()",[14,45,46],{},".extend()",[14,48,49],{},"editor.commands",[14,51,52],{},"editor.chain()",[14,54,55],{},"editor.can()","、输入规则、快捷键、存储与生命周期钩子保持熟悉的编写方式。",[23,58,59],{"id":59},"常用同名命令",[61,62,63,79],"table",{},[64,65,66],"thead",{},[67,68,69,73,76],"tr",{},[70,71,72],"th",{},"用途",[70,74,75],{},"命令入口",[70,77,78],{},"前提",[80,81,82,108,133,155,177],"tbody",{},[67,83,84,88,105],{},[85,86,87],"td",{},"读写内容",[85,89,90,31,93,31,96,31,99,31,102],{},[14,91,92],{},"getJSON()",[14,94,95],{},"getHTML()",[14,97,98],{},"commands.setContent()",[14,100,101],{},"insertContent()",[14,103,104],{},"clearContent()",[85,106,107],{},"内容符合当前 Schema",[67,109,110,113,130],{},[85,111,112],{},"选区与焦点",[85,114,115,31,118,31,121,31,124,31,127],{},[14,116,117],{},"focus()",[14,119,120],{},"blur()",[14,122,123],{},"setTextSelection()",[14,125,126],{},"setNodeSelection()",[14,128,129],{},"selectAll()",[85,131,132],{},"已挂载的视图与有效文档位置",[67,134,135,138,152],{},[85,136,137],{},"标记与属性",[85,139,140,31,143,31,146,31,149],{},[14,141,142],{},"setMark()",[14,144,145],{},"toggleMark()",[14,147,148],{},"unsetMark()",[14,150,151],{},"updateAttributes()",[85,153,154],{},"目标 Node \u002F Mark 已注册",[67,156,157,160,174],{},[85,158,159],{},"常用格式",[85,161,162,31,165,31,168,31,171],{},[14,163,164],{},"toggleBold()",[14,166,167],{},"toggleItalic()",[14,169,170],{},"toggleHeading()",[14,172,173],{},"toggleBulletList()",[85,175,176],{},"对应扩展或 StarterKit",[67,178,179,182,190],{},[85,180,181],{},"历史",[85,183,184,31,187],{},[14,185,186],{},"undo()",[14,188,189],{},"redo()",[85,191,192],{},"已注册历史扩展",[10,194,195,196,198,199,201,202,204,205,207],{},"除 ",[14,197,92],{}," \u002F ",[14,200,95],{}," 外，表中命令均从 ",[14,203,49],{}," 或 ",[14,206,52],{}," 访问。\n这是常用迁移入口，不是所有生态包的兼容清单；参数与返回值以当前公开类型为准。",[23,209,210],{"id":210},"迁移对照",[61,212,213,226],{},[64,214,215],{},[67,216,217,220,223],{},[70,218,219],{},"Tiptap 项目",[70,221,222],{},"QuireKit 项目",[70,224,225],{},"核查重点",[80,227,228,242,257,279,297],{},[67,229,230,234,239],{},[85,231,232],{},[14,233,16],{},[85,235,236],{},[14,237,238],{},"@quirekit\u002Fcore",[85,240,241],{},"使用当前公开类型检查",[67,243,244,249,254],{},[85,245,246],{},[14,247,248],{},"@tiptap\u002Fstarter-kit",[85,250,251],{},[14,252,253],{},"@quirekit\u002Fstarter-kit",[85,255,256],{},"逐项核对配置和已安装扩展",[67,258,259,267,276],{},[85,260,261,198,264],{},[14,262,263],{},"@tiptap\u002Fpm\u002F*",[14,265,266],{},"prosemirror-*",[85,268,269,270,204,273],{},"对应 ",[14,271,272],{},"@quirekit\u002Fpm-*",[14,274,275],{},"@quirekit\u002Fpm",[85,277,278],{},"一个实例使用同一份 PM 身份",[67,280,281,284,294],{},[85,282,283],{},"默认 DOM 挂载",[85,285,286,287,290,291],{},"显式 ",[14,288,289],{},"DomViewExtension"," 和 ",[14,292,293],{},"mode: 'dom'",[85,295,296],{},"Canvas 等后端需要各自呈现能力",[67,298,299,302,305],{},[85,300,301],{},"Tiptap Vue \u002F React 包装组件",[85,303,304],{},"宿主创建、挂载和销毁 Core",[85,306,307],{},"不假定现有包装器无改动可用",[10,309,310],{},"API 高度一致不等于所有生态插件都能直接运行。依赖 DOM NodeView、浏览器几何、私有字段或原生 DOM 选区的插件，迁到 Canvas\u002FSVG 时需要对应的视图实现；第三方包还要检查许可与依赖身份。",[23,312,313],{"id":313},"一个迁移后的扩展",[10,315,316],{},"这是本网站示例自己的快捷键扩展，不是内置插件。它使用同一命令表，加粗仍进入编辑器历史。",[318,319],"docs-recipe",{"name":320},"core\u002Fshortcuts",[10,322,323,328,329,333],{},[324,325,327],"a",{"href":326},"\u002Fguide\u002Fquick-start","快速开始","运行了这个扩展；",[324,330,332],{"href":331},"\u002Fconcepts\u002Fextensions","扩展模型","继续解释节点、标记与行为的差别。",[23,335,336],{"id":336},"产品开发时的状态与替换差异",[10,338,339,340,343,344,347,348,351,352,355,356,360],{},"外部原生 PM 状态通过 ",[14,341,342],{},"editor.state.pm"," 读取；raw command 回调的 ",[14,345,346],{},"state"," 仍是 PM facade。文件恢复使用 QuireKit 的 ",[14,349,350],{},"replaceDocument()"," 连同顶层属性替换；",[14,353,354],{},"setContent()"," 保留普通内容替换语义。具体输入、返回和生命周期见 ",[324,357,359],{"href":358},"\u002Fapi\u002Feditor","Editor API","。",{"title":362,"searchDepth":363,"depth":363,"links":364},"",2,[365,366,367,368,369],{"id":25,"depth":363,"text":25},{"id":59,"depth":363,"text":59},{"id":210,"depth":363,"text":210},{"id":313,"depth":363,"text":313},{"id":336,"depth":363,"text":336},"沿用熟悉的 Core API，明确包身份与视图适配边界。","md",null,"zh-CN",{},true,"\u002Fguide\u002Ftiptap","开始使用",{"title":5,"description":370},"guide\u002Ftiptap.zh-CN","rs65ud5KyQl_gYWvUEs9VOLhmUqeadZWiSKaNkAtrHE","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":383,"body":384},{},{"type":385,"children":386},"root",[387,626],{"type":388,"tag":389,"props":390,"children":394},"element","pre",{"className":391,"code":392,"language":393,"meta":362,"style":362},"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",[395],{"type":388,"tag":14,"props":396,"children":397},{"__ignoreMap":362},[398,433,441,451,492,511,530,544,608,617],{"type":388,"tag":399,"props":400,"children":403},"span",{"class":401,"line":402},"line",1,[404,411,417,422,428],{"type":388,"tag":399,"props":405,"children":407},{"style":406},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[408],{"type":409,"value":410},"text","import",{"type":388,"tag":399,"props":412,"children":414},{"style":413},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[415],{"type":409,"value":416}," { Extension } ",{"type":388,"tag":399,"props":418,"children":419},{"style":406},[420],{"type":409,"value":421},"from",{"type":388,"tag":399,"props":423,"children":425},{"style":424},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[426],{"type":409,"value":427}," \"@quirekit\u002Fcore\"",{"type":388,"tag":399,"props":429,"children":430},{"style":413},[431],{"type":409,"value":432},";\n",{"type":388,"tag":399,"props":434,"children":435},{"class":401,"line":363},[436],{"type":388,"tag":399,"props":437,"children":438},{"emptyLinePlaceholder":375},[439],{"type":409,"value":440},"\n",{"type":388,"tag":399,"props":442,"children":444},{"class":401,"line":443},3,[445],{"type":388,"tag":399,"props":446,"children":448},{"style":447},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[449],{"type":409,"value":450},"\u002F** A host-authored behavior extension using the same typed command registry as the toolbar. *\u002F\n",{"type":388,"tag":399,"props":452,"children":454},{"class":401,"line":453},4,[455,460,465,471,476,481,487],{"type":388,"tag":399,"props":456,"children":457},{"style":406},[458],{"type":409,"value":459},"export",{"type":388,"tag":399,"props":461,"children":462},{"style":406},[463],{"type":409,"value":464}," const",{"type":388,"tag":399,"props":466,"children":468},{"style":467},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[469],{"type":409,"value":470}," writingShortcuts",{"type":388,"tag":399,"props":472,"children":473},{"style":406},[474],{"type":409,"value":475}," =",{"type":388,"tag":399,"props":477,"children":478},{"style":413},[479],{"type":409,"value":480}," Extension.",{"type":388,"tag":399,"props":482,"children":484},{"style":483},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[485],{"type":409,"value":486},"create",{"type":388,"tag":399,"props":488,"children":489},{"style":413},[490],{"type":409,"value":491},"({\n",{"type":388,"tag":399,"props":493,"children":495},{"class":401,"line":494},5,[496,501,506],{"type":388,"tag":399,"props":497,"children":498},{"style":413},[499],{"type":409,"value":500},"  name: ",{"type":388,"tag":399,"props":502,"children":503},{"style":424},[504],{"type":409,"value":505},"\"writingShortcuts\"",{"type":388,"tag":399,"props":507,"children":508},{"style":413},[509],{"type":409,"value":510},",\n",{"type":388,"tag":399,"props":512,"children":514},{"class":401,"line":513},6,[515,520,525],{"type":388,"tag":399,"props":516,"children":517},{"style":447},[518],{"type":409,"value":519},"  \u002F** ",{"type":388,"tag":399,"props":521,"children":522},{"style":406},[523],{"type":409,"value":524},"@returns",{"type":388,"tag":399,"props":526,"children":527},{"style":447},[528],{"type":409,"value":529}," A keyboard binding that participates in the editor's existing history. *\u002F\n",{"type":388,"tag":399,"props":531,"children":533},{"class":401,"line":532},7,[534,539],{"type":388,"tag":399,"props":535,"children":536},{"style":483},[537],{"type":409,"value":538},"  addKeyboardShortcuts",{"type":388,"tag":399,"props":540,"children":541},{"style":413},[542],{"type":409,"value":543},"() {\n",{"type":388,"tag":399,"props":545,"children":547},{"class":401,"line":546},8,[548,553,558,563,568,573,578,583,588,593,598,603],{"type":388,"tag":399,"props":549,"children":550},{"style":406},[551],{"type":409,"value":552},"    return",{"type":388,"tag":399,"props":554,"children":555},{"style":413},[556],{"type":409,"value":557}," { ",{"type":388,"tag":399,"props":559,"children":560},{"style":424},[561],{"type":409,"value":562},"\"Mod-Shift-b\"",{"type":388,"tag":399,"props":564,"children":565},{"style":413},[566],{"type":409,"value":567},": () ",{"type":388,"tag":399,"props":569,"children":570},{"style":406},[571],{"type":409,"value":572},"=>",{"type":388,"tag":399,"props":574,"children":575},{"style":467},[576],{"type":409,"value":577}," this",{"type":388,"tag":399,"props":579,"children":580},{"style":413},[581],{"type":409,"value":582},".editor?.commands.",{"type":388,"tag":399,"props":584,"children":585},{"style":483},[586],{"type":409,"value":587},"toggleBold",{"type":388,"tag":399,"props":589,"children":590},{"style":413},[591],{"type":409,"value":592},"() ",{"type":388,"tag":399,"props":594,"children":595},{"style":406},[596],{"type":409,"value":597},"??",{"type":388,"tag":399,"props":599,"children":600},{"style":467},[601],{"type":409,"value":602}," false",{"type":388,"tag":399,"props":604,"children":605},{"style":413},[606],{"type":409,"value":607}," };\n",{"type":388,"tag":399,"props":609,"children":611},{"class":401,"line":610},9,[612],{"type":388,"tag":399,"props":613,"children":614},{"style":413},[615],{"type":409,"value":616},"  },\n",{"type":388,"tag":399,"props":618,"children":620},{"class":401,"line":619},10,[621],{"type":388,"tag":399,"props":622,"children":623},{"style":413},[624],{"type":409,"value":625},"});\n",{"type":388,"tag":627,"props":628,"children":629},"style",{},[630],{"type":409,"value":631},"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);}",1793045207996]