[{"data":1,"prerenderedAt":396},["ShallowReactive",2],{"quirekit-doc:\u002Fplugins\u002Freference\u002Fblock-interaction":3},{"id":4,"title":5,"body":6,"description":12,"extension":383,"keywords":384,"locale":387,"meta":388,"navigation":389,"order":390,"path":391,"section":392,"seo":393,"stem":394,"__hash__":395},"docs\u002Fplugins\u002Freference\u002Fblock-interaction.zh-CN.md","BlockInteraction · 块选择与移动",{"type":7,"value":8,"toc":367},"minimark",[9,13,24,28,34,87,95,98,114,126,150,157,160,171,175,178,185,189,192,198,204,207,210,214,219,223,226,231,236,239,242,247,252,256,259,264,269,272,279,329,337,340,351,363],[10,11,12],"p",{},"为可操作块分配稳定身份，并提供范围选择、移动和插入命令。界面中的拖拽把手由产品实现；扩展本身不添加工具栏。",[10,14,15,19,20],{},[16,17,18],"code",{},"@quirekit\u002Fextensions"," · ",[21,22,23],"strong",{},"MIT",[25,26,27],"h2",{"id":27},"编辑器适用范围",[10,29,30,31],{},"层次：",[21,32,33],{},"共享文档能力",[35,36,37,53],"table",{},[38,39,40],"thead",{},[41,42,43,47,50],"tr",{},[44,45,46],"th",{},"编辑器",[44,48,49],{},"状态",[44,51,52],{},"所需装配与边界",[54,55,56,73],"tbody",{},[41,57,58,62,65],{},[59,60,61],"td",{},"Classic",[59,63,64],{},"直接支持",[59,66,67,72],{},[68,69,71],"a",{"href":70},"\u002Fplugins\u002Freference\u002Fclassic-editor-preset","classicEditorPreset"," — 使用产品中立的 classicEditorPreset；已有能力由预设装配，不要重复追加。Word 预设会替换段落、标题和容器列表，不能把通用结构直接叠加到 Word 模型。",[41,74,75,78,80],{},[59,76,77],{},"Block",[59,79,64],{},[59,81,82,86],{},[68,83,85],{"href":84},"\u002Fplugins\u002Freference\u002Fcreate-block-editor-preset","createBlockEditorPreset"," — createBlockEditor 默认预设已装配此能力。通过 preset 中对应子项配置；图形编辑使用预设注入的工作区，宿主仍负责保存和资源。不要重复安装同名扩展。",[10,88,89,90,94],{},"“直接支持”指已有上述产品装配；具体交互、宿主服务和格式支持仍有各自条件。",[68,91,93],{"href":92},"\u002Fplugins\u002Fcompatibility","状态与接入规则","。许可独立显示。",[25,96,97],{"id":97},"接入",[99,100,105],"pre",{"className":101,"code":102,"language":103,"meta":104,"style":104},"language-sh shiki shiki-themes github-light github-light github-dark","pnpm add @quirekit\u002Fextensions@alpha\n","sh","",[16,106,107],{"__ignoreMap":104},[108,109,112],"span",{"class":110,"line":111},"line",1,[108,113,102],{},[10,115,116,117,120,121,125],{},"在创建 Editor 时放入 ",[16,118,119],{},"extensions","。挂载容器、视图和保存由宿主提供，见",[68,122,124],{"href":123},"\u002Fguide\u002Fquick-start","快速开始","。",[99,127,131],{"className":128,"code":129,"language":130,"meta":104,"style":104},"language-ts shiki shiki-themes github-light github-light github-dark","import { BlockInteraction } from '@quirekit\u002Fextensions'\n","ts",[16,132,133],{"__ignoreMap":104},[108,134,135,139,143,146],{"class":110,"line":111},[108,136,138],{"class":137},"sDD9d","import",[108,140,142],{"class":141},"sVPnS"," { BlockInteraction } ",[108,144,145],{"class":137},"from",[108,147,149],{"class":148},"s-HEn"," '@quirekit\u002Fextensions'\n",[10,151,152,153,125],{},"安装时按包声明选择兼容版本，外部可用版本以分发源为准。本站使用工作区 Alpha；许可标签来自入口所属包，使用条件见",[68,154,156],{"href":155},"\u002Fsupport","支持与许可",[25,158,159],{"id":159},"按编辑器接入",[10,161,162,163,166,167,170],{},"以下片段沿用已挂载的宿主元素 ",[16,164,165],{},"element","，宿主负责容器尺寸与保存；退出页面时调用 ",[16,168,169],{},"instance.destroy()","。已有预设装配的能力不要再重复追加；需要宿主端口的入口应先完成下方配置。",[172,173],"plugin-integration",{"name":174},"BlockInteraction",[25,176,177],{"id":177},"配置",[10,179,180,181,125],{},"下面是扩展自身的默认选项。预设可以覆盖这些值；它们不等于当前文档属性。配置方法见",[68,182,184],{"href":183},"\u002Fplugins\u002Fconfiguration","配置插件",[186,187,188],"h3",{"id":188},"types",[10,190,191],{},"需要附加此能力的节点或标记类型名，必须与当前 schema 的实际名称一致。",[10,193,194,195],{},"类型：",[16,196,197],{},"readonly string[]",[10,199,200,201],{},"默认：",[16,202,203],{},"[\"paragraph\", \"heading\", \"codeBlock\", \"blockquote\", \"bulletList\", \"orderedList\", \"horizontalRule\", \"table\"]",[186,205,206],{"id":206},"scopes",[10,208,209],{},"可容纳块操作的结构范围类型，例如 doc。",[10,211,194,212],{},[16,213,197],{},[10,215,200,216],{},[16,217,218],{},"[\"doc\"]",[186,220,222],{"id":221},"createid","createId",[10,224,225],{},"为新块生成稳定身份的函数。复制与拆分仍需遵循块身份规则。",[10,227,194,228],{},[16,229,230],{},"(): string",[10,232,200,233],{},[16,234,235],{},"createBlockId",[186,237,238],{"id":238},"admit",[10,240,241],{},"块移动或插入前的准入函数，拒绝会破坏结构或业务规则的操作。",[10,243,194,244],{},[16,245,246],{},"(context: BlockAdmissionContext): BlockRejection | null",[10,248,200,249],{},[16,250,251],{},"() => null",[186,253,255],{"id":254},"requireportableidentity","requirePortableIdentity",[10,257,258],{},"是否要求参与操作的块具备可持久化的稳定身份。",[10,260,194,261],{},[16,262,263],{},"boolean",[10,265,200,266],{},[16,267,268],{},"false",[25,270,271],{"id":271},"命令与运行方式",[10,273,274,275,278],{},"以下命令由此扩展直接提供，均在当前 Editor 上调用。命令是否可用由已安装 schema、当前选区与保护策略决定；可以先用 ",[16,276,277],{},"editor.can()"," 查询。",[35,280,281,291],{},[38,282,283],{},[41,284,285,288],{},[44,286,287],{},"命令",[44,289,290],{},"参数签名",[54,292,293,305,317],{},[41,294,295,300],{},[59,296,297],{},[16,298,299],{},"selectBlockRange",[59,301,302],{},[16,303,304],{},"selectBlockRange(range: BlockRangeRef | null)",[41,306,307,312],{},[59,308,309],{},[16,310,311],{},"moveBlockRange",[59,313,314],{},[16,315,316],{},"moveBlockRange(request: BlockMoveRequest)",[41,318,319,324],{},[59,320,321],{},[16,322,323],{},"insertBlockAt",[59,325,326],{},[16,327,328],{},"insertBlockAt(request: BlockInsertRequest)",[10,330,331,332,336],{},"这里只展示参数签名。接界面时见",[68,333,335],{"href":334},"\u002Fbuild\u002Fcommands","命令与控件","，正文变更继续经过同一事务与历史。",[25,338,339],{"id":339},"下一步",[10,341,342,343,347,348,350],{},"返回",[68,344,346],{"href":345},"\u002Fplugins","全部插件","，或阅读",[68,349,184],{"href":183},"区分配置、文档属性与命令。",[10,352,353,354,358,359,125],{},"自己定义能力时见",[68,355,357],{"href":356},"\u002Fbuild\u002Fextension","扩展开发","；搭建完整宿主时见",[68,360,362],{"href":361},"\u002Fbuild","构建产品",[364,365,366],"style",{},"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);}html pre.shiki code .sDD9d, html code.shiki .sDD9d{--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583}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}",{"title":104,"searchDepth":368,"depth":368,"links":369},2,[370,371,372,373,381,382],{"id":27,"depth":368,"text":27},{"id":97,"depth":368,"text":97},{"id":159,"depth":368,"text":159},{"id":177,"depth":368,"text":177,"children":374},[375,377,378,379,380],{"id":188,"depth":376,"text":188},3,{"id":206,"depth":376,"text":206},{"id":221,"depth":376,"text":222},{"id":238,"depth":376,"text":238},{"id":254,"depth":376,"text":255},{"id":271,"depth":368,"text":271},{"id":339,"depth":368,"text":339},"md",[174,18,385,386,188,206,222,238,255,299,311,323,174],"块选择与移动","behavior","zh-CN",{"navigationTitle":174,"license":23},true,13,"\u002Fplugins\u002Freference\u002Fblock-interaction","编辑行为",{"title":5,"description":12},"plugins\u002Freference\u002Fblock-interaction.zh-CN","LhzXl3GEr_azD0AcbkuRozlfw5aILVkOYKj2ZeL09Zk",1793045212954]