Skip to content

修复古腾堡块的一些问题#1376

Open
nicocatxzc wants to merge 2 commits intomirai-mamori:previewfrom
nicocatxzc:fix
Open

修复古腾堡块的一些问题#1376
nicocatxzc wants to merge 2 commits intomirai-mamori:previewfrom
nicocatxzc:fix

Conversation

@nicocatxzc
Copy link
Contributor

No description provided.

修复拖拽卡死的问题
移除保存部分,使用和短代码同构的保存逻辑
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 主要围绕 Sakurairo 的古腾堡块(Gutenberg blocks)进行修复与重构:让编辑器端资源在主题/插件环境下都能正确加载,并将部分块改为服务端渲染以复用短代码渲染逻辑。

Changes:

  • 新增 blocks 资源基址/路径辅助函数,统一主题/插件环境下的资源定位与加载
  • 为编辑器新增 blocks 样式(style-index.css),并更新构建产物(index.js / index.asset.php
  • functions.php 中为多个块注册 render_callback,复用短代码渲染函数(notice/showcard/conversation/vbilibili/ghcard)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
inc/blocks/iro_blocks.php 统一 blocks 资源 URL/Path 获取逻辑,并调整编辑器端脚本与样式的入队方式
inc/blocks/build/style-index.css 新增编辑器端 blocks 样式(构建产物)
inc/blocks/build/index.js 更新 blocks 的编辑器端注册逻辑与 UI 文案(构建产物)
inc/blocks/build/index.asset.php 更新构建依赖与版本 hash(构建产物)
functions.php 抽取短代码渲染函数并新增多个动态块的服务端渲染注册

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

} else {
wp_enqueue_style('fontawesome-icons', 'https://s4.zstatic.net/ajax/libs/font-awesome/6.7.2/css/all.min.css', array(), null);
}
wp_enqueue_style('iro-codes', iro_block_base_url() . 'build/style-index.css', array(), '3.0');
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wp_enqueue_style('iro-codes', ...) is using a hard-coded version string ('3.0'), which will prevent proper cache-busting when build/style-index.css changes (and may cause stale editor styles). Consider using the asset version (from index.asset.php) or filemtime() on the CSS file instead of a fixed value.

Suggested change
wp_enqueue_style('iro-codes', iro_block_base_url() . 'build/style-index.css', array(), '3.0');
$style_path = iro_block_base_path() . 'build/style-index.css';
$style_version = file_exists($style_path) ? filemtime($style_path) : null;
wp_enqueue_style('iro-codes', iro_block_base_url() . 'build/style-index.css', array(), $style_version);

Copilot uses AI. Check for mistakes.


add_shortcode('showcard', function($attr, $content = '') {
$atts = shortcode_atts(array("icon" => "", "title" => "", "img" => "", "color" => ""), $attr);
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The showcard shortcode currently cannot accept a link attribute because shortcode_atts(...) only whitelists icon/title/img/color; any provided link attr will be dropped and $atts['link'] will always be unset. Add link to the defaults (or adjust parsing) so [showcard link="..."] works as intended.

Suggested change
$atts = shortcode_atts(array("icon" => "", "title" => "", "img" => "", "color" => ""), $attr);
$atts = shortcode_atts(array("icon" => "", "title" => "", "img" => "", "color" => "", "link" => ""), $attr);

Copilot uses AI. Check for mistakes.
Comment on lines 2946 to 2948
'<div class="conversations-code" style="flex-direction: %s;">
<img src="%s">
<div class="conversations-code-text">%s%s</div>
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversations markup outputs an <img> without an alt attribute, which is an accessibility issue for screen readers. Add an appropriate alt (e.g., the speaker name) or at least alt="" if it's decorative.

Copilot uses AI. Check for mistakes.
Comment on lines 2704 to +2741
function register_shortcodes() {
add_shortcode('task', function($attr, $content = '') {
return '<div class="task shortcodestyle"><i class="fa-solid fa-clipboard-list"></i>' . $content . '</div>';
});
// 提示块
function iro_render_notice($type, $content = '') {

$map = [
'task' => ['fa-solid fa-clipboard-list', 'task'],
'warning' => ['fa-solid fa-triangle-exclamation', 'warning'],
'noway' => ['fa-solid fa-square-xmark', 'noway'],
'buy' => ['fa-solid fa-square-check', 'buy'],
];

add_shortcode('warning', function($attr, $content = '') {
return '<div class="warning shortcodestyle"><i class="fa-solid fa-triangle-exclamation"></i>' . $content . '</div>';
});
if (!isset($map[$type])) {
return '';
}

add_shortcode('noway', function($attr, $content = '') {
return '<div class="noway shortcodestyle"><i class="fa-solid fa-square-xmark"></i>' . $content . '</div>';
});
[$icon, $class] = $map[$type];

add_shortcode('buy', function($attr, $content = '') {
return '<div class="buy shortcodestyle"><i class="fa-solid fa-square-check"></i>' . $content . '</div>';
});
return sprintf(
'<div class="shortcodestyle %s">
<i class="%s"></i>
<span>%s</span>
</div>',
esc_attr($class),
esc_attr($icon),
wp_kses_post($content)
);
}

add_shortcode('ghcard', function($attr, $content = '') {
//获取内容
$atts = shortcode_atts(array("path" => "mirai-mamori/Sakurairo"), $attr);
add_shortcode('task', fn($a,$c='') => iro_render_notice('task',$c));
add_shortcode('warning', fn($a,$c='') => iro_render_notice('warning',$c));
add_shortcode('noway', fn($a,$c='') => iro_render_notice('noway',$c));
add_shortcode('buy', fn($a,$c='') => iro_render_notice('buy',$c));

$path = trim($atts['path']);
register_block_type('sakurairo/notice', [
'render_callback' => 'iro_render_notice_block',
]);
function iro_render_notice_block($attributes, $content) {

Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several named functions (iro_render_notice, iro_render_notice_block, etc.) are declared inside register_shortcodes(). In PHP this can fatally error with "Cannot redeclare" if register_shortcodes() is invoked more than once in a request (e.g., if the init hook gets added twice or the function is called directly). Consider moving these helper functions to file scope or wrapping them with function_exists() guards.

Copilot uses AI. Check for mistakes.
$path = trim($atts['path']);
register_block_type('sakurairo/notice', [
'render_callback' => 'iro_render_notice_block',
]);
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changes block names from the previous sakurairo/*-block identifiers to new names like sakurairo/notice/sakurairo/showcard/sakurairo/conversation. Existing posts using the old block names will become "unsupported" unless the old block types remain registered (with deprecated/transforms or a server-side alias). Please add backward-compat registration/migration for the old block names.

Suggested change
]);
]);
// Backward compatibility for the old block name used in existing posts.
register_block_type('sakurairo/notice-block', [
'render_callback' => 'iro_render_notice_block',
]);

Copilot uses AI. Check for mistakes.
@@ -1 +1 @@
(()=>{"use strict";var e,l={291(e,l,a){const t=window.wp.blocks,o=window.wp.domReady;var i=a.n(o);const s=window.wp.hooks,r=window.wp.blockEditor,n=window.wp.components,c=window.wp.element,d=window.wp.primitives,b=window.ReactJSXRuntime;var u=(0,b.jsx)(d.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,b.jsx)(d.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})});const h=(()=>{const e=(window.iroBlockEditor?.language||window.navigator.language||"en").replace("_","-").toLowerCase();return e.startsWith("zh-cn")||e.startsWith("zh-hans")?"zh-CN":e.startsWith("zh-tw")||e.startsWith("zh-hk")||e.startsWith("zh-mo")?"zh-TW":e.startsWith("ja")?"ja":"en"})();function p(e,l="en"){return e[h]||e[l]||{}}let g=p({"zh-CN":{hljsTitle:"高亮语言设置",hljsLabel:"高亮显示遵循的语法",hljsPlaceholder:"此处编写代码...",hljsAuto:"自动识别"},"zh-TW":{hljsTitle:"高亮語言設置",hljsLabel:"高亮顯示遵循的語法",hljsPlaceholder:"此處編寫代碼...",hljsAuto:"自動識別"},ja:{hljsTitle:"シンタックスハイライト設定",hljsLabel:"ハイライト対象の言語文法",hljsPlaceholder:"コードを入力...",hljsAuto:"自動識別"},en:{hljsTitle:"Syntax Highlighting Settings",hljsLabel:"Language grammar for highlighting",hljsPlaceholder:"Enter your code here...",hljsAuto:"Auto Detect"}});const v=[{label:g.hljsAuto||"Auto Detect",value:""},{label:"HTML",value:"html"},{label:"CSS",value:"css"},{label:"JavaScript",value:"javascript"},{label:"TypeScript",value:"typescript"},{label:"PHP",value:"php"},{label:"SCSS",value:"scss"},{label:"LESS",value:"less"},{label:"Stylus",value:"stylus"},{label:"Vue",value:"vue"},{label:"React+js",value:"jsx"},{label:"React+ts",value:"tsx"},{label:"Python",value:"python"},{label:"Java",value:"java"},{label:"JSON",value:"json"},{label:"Dart",value:"dart"},{label:"C",value:"c"},{label:"C++",value:"cpp"},{label:"C#",value:"csharp"},{label:"Go",value:"go"},{label:"Lua",value:"lua"},{label:"Swift",value:"swift"},{label:"Kotlin",value:"kotlin"},{label:"Ruby",value:"ruby"},{label:"Rust",value:"rust"},{label:"JSP",value:"jsp"},{label:"ASP",value:"asp"},{label:"YAML",value:"yaml"},{label:"TOML",value:"toml"},{label:"INI",value:"ini"},{label:"SQL",value:"sql"},{label:"XML",value:"xml"},{label:"bash",value:"bash"},{label:"CMD",value:"cmd"},{label:"PowerShell",value:"powershell"},{label:"VBScript",value:"vbscript"},{label:"Markdown",value:"markdown"},{label:"Plain Text",value:"plaintext"}];let m=p({"zh-CN":{blockTitle:"提示块",typeTitle:"提示类型",placeholder:"此处输入内容...",taskLabel:"任务提示",warningLabel:"警告提示",nowayLabel:"禁止提示",buyLabel:"允许提示"},"zh-TW":{blockTitle:"提示區塊",typeTitle:"提示類型",placeholder:"此處輸入內容...",taskLabel:"任務提示",warningLabel:"警告提示",nowayLabel:"禁止提示",buyLabel:"允許提示"},ja:{blockTitle:"ヒントブロック",typeTitle:"ヒントタイプ",placeholder:"ここに内容を入力...",taskLabel:"タスク",warningLabel:"警告",nowayLabel:"禁止",buyLabel:"許可"},en:{blockTitle:"Callout Block",typeTitle:"Callout Type",placeholder:"Enter content here...",taskLabel:"Task",warningLabel:"Warning",nowayLabel:"Forbidden",buyLabel:"Allowed"}});const x={task:{label:m.taskLabel,icon:'<i class="fa-solid fa-clipboard-list"></i>',className:"task"},warning:{label:m.warningLabel,icon:'<i class="fa-solid fa-triangle-exclamation"></i>',className:"warning"},noway:{label:m.nowayLabel,icon:'<i class="fa-solid fa-square-xmark"></i>',className:"noway"},buy:{label:m.buyLabel,icon:'<i class="fa-solid fa-square-check"></i>',className:"buy"}};function k({attributes:e,setAttributes:l}){const{content:a,type:t,isExample:o}=e;if(o)return[(0,b.jsx)("img",{src:"https://docs.fuukei.org/short-code/noway.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}}),(0,b.jsx)("img",{src:"https://docs.fuukei.org/short-code/buy.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}}),(0,b.jsx)("img",{src:"https://docs.fuukei.org/short-code/warn.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}})];const i=(0,r.useBlockProps)(),s=x[t];return(0,b.jsxs)(c.Fragment,{children:[(0,b.jsx)(r.BlockControls,{children:(0,b.jsx)(n.ToolbarGroup,{children:(0,b.jsx)(n.ToolbarDropdownMenu,{icon:"admin-generic",label:m.typeTitle,controls:Object.entries(x).map(([e,{label:a}])=>({title:a,icon:!1,onClick:()=>l({type:e}),isActive:t===e}))})})}),(0,b.jsxs)("div",{...i,className:`shortcodestyle ${s.className}`,children:[(0,b.jsx)(c.RawHTML,{children:s.icon}),(0,b.jsx)(r.RichText,{tagName:"span",value:a,onChange:e=>l({content:e}),placeholder:m.placeholder})]})]})}window.wp.i18n;let j=p({"zh-CN":{blockTitle:"展示卡片",toolbarButtonLabel:"选择图片",panelTitle:"展示卡片设置",iconClassLabel:"FontAwesome 图标类名",iconClassHelp:"例如 fa-solid fa-book",titleLabel:"标题",imgUrlLabel:"图片链接(可选)",iconColorLabel:"图标颜色与按钮文字颜色",linkLabel:"跳转链接",iconPlaceholder:"输入图标类名...",titlePlaceholder:"输入卡片标题..."},"zh-TW":{blockTitle:"展示卡片",toolbarButtonLabel:"選擇圖片",panelTitle:"展示卡片設定",iconClassLabel:"FontAwesome 圖標類名",iconClassHelp:"例如 fa-solid fa-book",titleLabel:"標題",imgUrlLabel:"圖片連結(可選)",iconColorLabel:"圖標顏色與按鈕文字顏色",linkLabel:"跳轉連結",iconPlaceholder:"輸入圖標類名...",titlePlaceholder:"輸入卡片標題..."},ja:{blockTitle:"カード表示",toolbarButtonLabel:"画像を選択",panelTitle:"カード表示設定",iconClassLabel:"FontAwesomeアイコンクラス",iconClassHelp:"例: fa-solid fa-book",titleLabel:"タイトル",imgUrlLabel:"画像リンク(任意)",iconColorLabel:"アイコンとボタンテキストの色",linkLabel:"リンク",iconPlaceholder:"アイコンクラスを入力...",titlePlaceholder:"カードタイトルを入力..."},en:{blockTitle:"ShowCard",toolbarButtonLabel:"Select Image",panelTitle:"ShowCard Settings",iconClassLabel:"FontAwesome Icon Classes",iconClassHelp:"e.g., fa-solid fa-book",titleLabel:"Title",imgUrlLabel:"Image URL (Optional)",iconColorLabel:"Icon & Button Text Color",linkLabel:"Link",iconPlaceholder:"Enter icon classes...",titlePlaceholder:"Enter card title..."}});const y=j.titlePlaceholder;function w({attributes:e,setAttributes:l}){const{icon:a,title:t,img:o,color:i,link:s,isExample:d}=e;if(d)return(0,b.jsx)("img",{src:"https://docs.fuukei.org/short-code/showc.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}});const u=(0,r.useBlockProps)();return(0,b.jsxs)(c.Fragment,{children:[(0,b.jsx)(r.BlockControls,{children:(0,b.jsx)(n.ToolbarGroup,{children:(0,b.jsx)(r.MediaUploadCheck,{children:(0,b.jsx)(r.MediaUpload,{onSelect:e=>{l({img:e.url})},allowedTypes:["image"],render:({open:e})=>(0,b.jsx)(n.ToolbarButton,{icon:"format-image",label:j.toolbarButtonLabel,onClick:e})})})})}),(0,b.jsx)(r.InspectorControls,{children:(0,b.jsxs)(n.PanelBody,{title:j.panelTitle,initialOpen:!0,children:[(0,b.jsx)(n.TextControl,{label:j.iconClassLabel,value:a,onChange:e=>l({icon:e}),help:j.iconClassHelp}),(0,b.jsx)(n.TextControl,{label:j.titleLabel,value:t,onChange:e=>l({title:e})}),(0,b.jsx)(n.TextControl,{label:j.imgUrlLabel,value:o,onChange:e=>l({img:e})}),(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:j.iconColorLabel})}),(0,b.jsx)(n.ColorPicker,{color:i,onChangeComplete:e=>l({color:e.hex}),disableAlpha:!0}),(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:j.linkLabel})}),(0,b.jsx)(r.URLInputButton,{url:s,onChange:e=>l({link:e})})]})}),(0,b.jsxs)("div",{...u,className:"showcard",children:[(0,b.jsx)("div",{className:"img",style:{background:o?`url(${o}) center center / cover no-repeat`:"#ccc"},children:(0,b.jsx)("a",{href:s,children:(0,b.jsx)("button",{className:"showcard-button",style:{color:i},children:(0,b.jsx)("i",{className:"fa-solid fa-angle-right"})})})}),(0,b.jsxs)("div",{className:"icon-title",children:[(0,b.jsx)(c.RawHTML,{children:`<i class="${a}" style="color:${i} !important;"></i>`}),(0,b.jsx)("span",{className:"title",children:t})]})]})]})}let f=p({"zh-CN":{blockTitle:"对话块",imageLabel:"设置头像",directionLabel:"切换方向",placeholder:"请输入对话内容…"},"zh-TW":{blockTitle:"對話區塊",imageLabel:"設定大頭貼",directionLabel:"切換方向",placeholder:"請輸入對話內容…"},ja:{blockTitle:"会話ブロック",imageLabel:"アバター設定",directionLabel:"方向切替",placeholder:"ここに会話内容を入力…"},en:{blockTitle:"Conversations Block",imageLabel:"Set Avatar",directionLabel:"Toggle Direction",placeholder:"Enter conversation text…"}}),L=p({"zh-CN":{blockTitle:"Bilibili 视频",placeholder:"请输入 Bilibili 视频 ID(如 BV1xx、av123456)",label:"视频 ID",error:"无效的视频 ID,请输入 BV 或 av 编号。"},"zh-TW":{blockTitle:"Bilibili 視頻",placeholder:"請輸入 Bilibili 視頻 ID(例如 BV1xx、av123456)",label:"視頻 ID",error:"無效的視頻 ID,請輸入 BV 或 av 編號。"},ja:{blockTitle:"Bilibili ビデオ",placeholder:"Bilibiliの動画ID(例:BV1xx、av123456)を入力してください",label:"動画 ID",error:"無効な動画IDです。BVまたはav形式で入力してください。"},en:{blockTitle:"Bilibili Video",placeholder:"Enter Bilibili Video ID (e.g. BV1xx or av123456)",label:"Video ID",error:"Invalid video ID. Please enter BV or av format."}});i()(()=>{const e=(0,t.getCategories)(),l=[...e.slice(0,1),{slug:"sakurairo",title:"Sakurairo"},...e.slice(1)];(0,t.setCategories)(l)}),function(){try{!function(){function e({attributes:e,setAttributes:l}){const{content:a,language:t}=e,o=(0,r.useBlockProps)();let i=t||"",s=(v.find(e=>e.value===i)||v[0]).label;return(0,b.jsxs)(c.Fragment,{children:[(0,b.jsx)(r.BlockControls,{children:(0,b.jsx)(n.ToolbarGroup,{children:(0,b.jsx)(n.DropdownMenu,{icon:u,label:g.hljsTitle,text:s,controls:v.map(({value:e,label:a})=>({title:a,isActive:i===e,onClick:()=>l({language:e})}))})})}),(0,b.jsx)("pre",{...o,children:(0,b.jsx)("code",{className:i?`language-${i}`:"",children:(0,b.jsx)(r.PlainText,{value:a,onChange:e=>l({content:e}),placeholder:g.hljsPlaceholder})})})]})}(0,s.addFilter)("blocks.registerBlockType","sakurairo/code-language-support",l=>"core/code"!==l.name?l:{...l,attributes:{...l.attributes,language:{type:"string",default:""}},edit:e})}(),(0,t.registerBlockType)("sakurairo/notice-block",{title:m.blockTitle,description:"",icon:"format-status",category:"sakurairo",attributes:{content:{type:"string",source:"html",selector:"span"},type:{type:"string",default:"task"},isExample:{type:"boolean",default:!1}},edit:k,save({attributes:e}){const{content:l,type:a}=e,{icon:t,className:o}=x[a];return(0,b.jsxs)("div",{className:`shortcodestyle ${o}`,children:[(0,b.jsx)(c.RawHTML,{children:t}),(0,b.jsx)(r.RichText.Content,{tagName:"span",value:l})]})},example:{attributes:{isExample:!0}}}),(0,t.registerBlockType)("sakurairo/showcard-block",{title:j.blockTitle,icon:"id-alt",category:"sakurairo",attributes:{icon:{type:"string",default:"fa-regular fa-bookmark"},title:{type:"string",default:y},img:{type:"string",default:""},color:{type:"string",default:"#ffffff"},link:{type:"string",default:""},isExample:{type:"boolean",default:!1}},edit:w,save({attributes:e}){const{icon:l,title:a,img:t,color:o,link:i}=e;return(0,b.jsxs)("div",{className:"showcard",children:[(0,b.jsx)("div",{className:"img",style:{background:`url(${t}) center center / cover no-repeat`},children:(0,b.jsx)("a",{href:i,children:(0,b.jsx)("button",{className:"showcard-button",style:{color:`${o} !important`},children:(0,b.jsx)("i",{className:"fa-solid fa-angle-right"})})})}),(0,b.jsxs)("div",{className:"icon-title",children:[(0,b.jsx)(c.RawHTML,{children:`<i class="${l}" style="color:${o} !important;"></i>`}),(0,b.jsx)("span",{className:"title",children:a})]})]})},example:{attributes:{isExample:!0}}}),(0,t.registerBlockType)("sakurairo/conversations-block",{title:f.blockTitle,icon:(0,c.createElement)("i",{className:"fa-regular fa-comments"}),category:"sakurairo",attributes:{avatar:{type:"string",default:""},direction:{type:"string",default:"row"},content:{type:"string",source:"html",selector:".conversations-code-text"},isExample:{type:"boolean",default:!1}},edit:function({attributes:e,setAttributes:l}){const{avatar:a,direction:t,content:o,isExample:i}=e;if(i)return(0,b.jsx)("img",{src:"https://docs.fuukei.org/short-code/dis.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}});const s=(0,r.useBlockProps)();return(0,b.jsxs)(c.Fragment,{children:[(0,b.jsx)(r.BlockControls,{children:(0,b.jsxs)(n.ToolbarGroup,{children:[(0,b.jsx)(r.MediaUploadCheck,{children:(0,b.jsx)(r.MediaUpload,{onSelect:e=>l({avatar:e.url}),allowedTypes:["image"],value:a,render:({open:e})=>(0,b.jsx)(n.ToolbarButton,{icon:"format-image",label:f.imageLabel,onClick:e})})}),(0,b.jsx)(n.ToolbarButton,{icon:"row"===t?"arrow-right-alt":"arrow-left-alt",label:f.directionLabel,onClick:()=>{l({direction:"row"===t?"row-reverse":"row"})}})]})}),(0,b.jsxs)("div",{...s,className:"conversations-code",style:{display:"flex",flexDirection:t},children:[a?(0,b.jsx)("img",{src:a,alt:""}):(0,b.jsx)(n.TextControl,{placeholder:f.imageLabel+" URL…",value:a,onChange:e=>l({avatar:e})}),(0,b.jsx)(r.RichText,{tagName:"div",className:"conversations-code-text",placeholder:f.placeholder,value:o,onChange:e=>l({content:e})})]})]})},save({attributes:e}){const{avatar:l,direction:a,content:t}=e;return(0,b.jsxs)("div",{className:"conversations-code",style:{display:"flex",flexDirection:a},children:[l&&(0,b.jsx)("img",{src:l,alt:""}),(0,b.jsx)("div",{className:"conversations-code-text",dangerouslySetInnerHTML:{__html:t}})]})},example:{attributes:{isExample:!0}}}),(0,t.registerBlockType)("sakurairo/vbilibili",{title:L.blockTitle,icon:(0,c.createElement)("i",{className:"fa-brands fa-bilibili"}),category:"sakurairo",supports:{html:!1},attributes:{videoId:{type:"string"},isExample:{type:"boolean",default:!1}},edit:function({attributes:e,setAttributes:l}){const{videoId:a,isExample:t}=e;if(t)return(0,b.jsx)("img",{src:"https://docs.fuukei.org/short-code/bvcode.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}});const o=(0,r.useBlockProps)();let i=null;const s=(a||"").trim();return/^av\d+$/i.test(s)?i=`https://player.bilibili.com/player.html?avid=${s.replace(/^av/i,"")}&page=1&autoplay=0&danmaku=0`:/^BV[a-zA-Z0-9]+$/.test(s)&&(i=`https://player.bilibili.com/player.html?bvid=${s}&page=1&autoplay=0&danmaku=0`),(0,b.jsxs)(c.Fragment,{children:[(0,b.jsx)(r.InspectorControls,{children:(0,b.jsx)(n.PanelBody,{title:L.label,children:(0,b.jsx)(n.TextControl,{label:L.label,value:a,onChange:e=>l({videoId:e}),placeholder:L.placeholder})})}),(0,b.jsx)("div",{...o,children:i?(0,b.jsx)("div",{style:{position:"relative",padding:"30% 45%"},children:(0,b.jsx)("iframe",{src:i,sandbox:"allow-top-navigation allow-same-origin allow-forms allow-scripts",allowFullScreen:!0,style:{pointerEvents:"none",position:"absolute",width:"100%",height:"100%",left:0,top:0,border:"none",overflow:"hidden"}})}):(0,b.jsx)(n.TextControl,{label:L.label,value:a,onChange:e=>l({videoId:e}),placeholder:L.placeholder,help:a?L.error:""})})]})},save({attributes:e}){const l=e.videoId?.trim();if(!l)return null;let a="";return/^av\d+$/i.test(l)?a=`https://player.bilibili.com/player.html?avid=${l.replace(/^av/i,"")}&page=1&autoplay=0&danmaku=0`:/^BV[a-zA-Z0-9]+$/.test(l)&&(a=`https://player.bilibili.com/player.html?bvid=${l}&page=1&autoplay=0&danmaku=0`),a?(0,b.jsx)("div",{style:{position:"relative",padding:"30% 45%"},children:(0,b.jsx)("iframe",{src:a,sandbox:"allow-top-navigation allow-same-origin allow-forms allow-scripts",allowFullScreen:!0,style:{position:"absolute",width:"100%",height:"100%",left:0,top:0,border:"none",overflow:"hidden"}})}):null},example:{attributes:{videoId:"",isExample:!0}}})}catch(e){console.log(`发生错误${e}`),console.log(e.stack)}}()}},a={};function t(e){var o=a[e];if(void 0!==o)return o.exports;var i=a[e]={exports:{}};return l[e](i,i.exports,t),i.exports}t.m=l,e=[],t.O=(l,a,o,i)=>{if(!a){var s=1/0;for(d=0;d<e.length;d++){for(var[a,o,i]=e[d],r=!0,n=0;n<a.length;n++)(!1&i||s>=i)&&Object.keys(t.O).every(e=>t.O[e](a[n]))?a.splice(n--,1):(r=!1,i<s&&(s=i));if(r){e.splice(d--,1);var c=o();void 0!==c&&(l=c)}}return l}i=i||0;for(var d=e.length;d>0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[a,o,i]},t.n=e=>{var l=e&&e.__esModule?()=>e.default:()=>e;return t.d(l,{a:l}),l},t.d=(e,l)=>{for(var a in l)t.o(l,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:l[a]})},t.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),(()=>{var e={57:0,350:0};t.O.j=l=>0===e[l];var l=(l,a)=>{var o,i,[s,r,n]=a,c=0;if(s.some(l=>0!==e[l])){for(o in r)t.o(r,o)&&(t.m[o]=r[o]);if(n)var d=n(t)}for(l&&l(a);c<s.length;c++)i=s[c],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(d)},a=globalThis.webpackChunkiro_blocks=globalThis.webpackChunkiro_blocks||[];a.forEach(l.bind(null,0)),a.push=l.bind(null,a.push.bind(a))})();var o=t.O(void 0,[350],()=>t(291));o=t.O(o)})(); No newline at end of file
(()=>{"use strict";var e,l={382(e,l,a){const t=window.wp.blocks,o=window.wp.domReady;var i=a.n(o);const r=window.wp.hooks,s=window.wp.blockEditor,n=window.wp.components,c=window.wp.element,b=window.wp.primitives,d=window.ReactJSXRuntime;var u=(0,d.jsx)(b.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,d.jsx)(b.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})});const h=(()=>{const e=(window.iroBlockEditor?.language||window.navigator.language||"en").replace("_","-").toLowerCase();return e.startsWith("zh-cn")||e.startsWith("zh-hans")?"zh-CN":e.startsWith("zh-tw")||e.startsWith("zh-hk")||e.startsWith("zh-mo")?"zh-TW":e.startsWith("ja")?"ja":"en"})();function p(e,l="en"){return e[h]||e[l]||{}}let g=p({"zh-CN":{hljsTitle:"高亮语言设置",hljsLabel:"高亮显示遵循的语法",hljsPlaceholder:"此处编写代码...",hljsAuto:"自动识别"},"zh-TW":{hljsTitle:"高亮語言設置",hljsLabel:"高亮顯示遵循的語法",hljsPlaceholder:"此處編寫代碼...",hljsAuto:"自動識別"},ja:{hljsTitle:"シンタックスハイライト設定",hljsLabel:"ハイライト対象の言語文法",hljsPlaceholder:"コードを入力...",hljsAuto:"自動識別"},en:{hljsTitle:"Syntax Highlighting Settings",hljsLabel:"Language grammar for highlighting",hljsPlaceholder:"Enter your code here...",hljsAuto:"Auto Detect"}});const x=[{label:g.hljsAuto||"Auto Detect",value:""},{label:"HTML",value:"html"},{label:"CSS",value:"css"},{label:"JavaScript",value:"javascript"},{label:"TypeScript",value:"typescript"},{label:"PHP",value:"php"},{label:"SCSS",value:"scss"},{label:"LESS",value:"less"},{label:"Stylus",value:"stylus"},{label:"Vue",value:"vue"},{label:"React+js",value:"jsx"},{label:"React+ts",value:"tsx"},{label:"Python",value:"python"},{label:"Java",value:"java"},{label:"JSON",value:"json"},{label:"Dart",value:"dart"},{label:"C",value:"c"},{label:"C++",value:"cpp"},{label:"C#",value:"csharp"},{label:"Go",value:"go"},{label:"Lua",value:"lua"},{label:"Swift",value:"swift"},{label:"Kotlin",value:"kotlin"},{label:"Ruby",value:"ruby"},{label:"Rust",value:"rust"},{label:"JSP",value:"jsp"},{label:"ASP",value:"asp"},{label:"YAML",value:"yaml"},{label:"TOML",value:"toml"},{label:"INI",value:"ini"},{label:"SQL",value:"sql"},{label:"XML",value:"xml"},{label:"bash",value:"bash"},{label:"CMD",value:"cmd"},{label:"PowerShell",value:"powershell"},{label:"VBScript",value:"vbscript"},{label:"Markdown",value:"markdown"},{label:"Plain Text",value:"plaintext"}];let v=p({"zh-CN":{blockTitle:"提示块",typeTitle:"提示类型",placeholder:"此处输入内容...",taskLabel:"任务提示",warningLabel:"警告提示",nowayLabel:"禁止提示",buyLabel:"允许提示"},"zh-TW":{blockTitle:"提示區塊",typeTitle:"提示類型",placeholder:"此處輸入內容...",taskLabel:"任務提示",warningLabel:"警告提示",nowayLabel:"禁止提示",buyLabel:"允許提示"},ja:{blockTitle:"ヒントブロック",typeTitle:"ヒントタイプ",placeholder:"ここに内容を入力...",taskLabel:"タスク",warningLabel:"警告",nowayLabel:"禁止",buyLabel:"許可"},en:{blockTitle:"Callout Block",typeTitle:"Callout Type",placeholder:"Enter content here...",taskLabel:"Task",warningLabel:"Warning",nowayLabel:"Forbidden",buyLabel:"Allowed"}});const m={task:{label:v.taskLabel,icon:"fa-solid fa-clipboard-list",className:"task"},warning:{label:v.warningLabel,icon:"fa-solid fa-triangle-exclamation",className:"warning"},noway:{label:v.nowayLabel,icon:"fa-solid fa-square-xmark",className:"noway"},buy:{label:v.buyLabel,icon:"fa-solid fa-square-check",className:"buy"}};function k({attributes:e,setAttributes:l}){const{content:a,type:t,isExample:o}=e;if(o)return[(0,d.jsx)("img",{src:"https://docs.fuukei.org/short-code/noway.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}}),(0,d.jsx)("img",{src:"https://docs.fuukei.org/short-code/buy.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}}),(0,d.jsx)("img",{src:"https://docs.fuukei.org/short-code/warn.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}})];const i=m[t],r=(0,s.useBlockProps)({className:`shortcodestyle ${i.className}`});return(0,d.jsxs)(c.Fragment,{children:[(0,d.jsx)(s.BlockControls,{children:(0,d.jsx)(n.ToolbarGroup,{children:(0,d.jsx)(n.ToolbarDropdownMenu,{icon:"admin-generic",label:v.typeTitle,controls:Object.entries(m).map(([e,{label:a}])=>({title:a,icon:!1,onClick:()=>l({type:e}),isActive:t===e}))})})}),(0,d.jsxs)("div",{...r,children:[(0,d.jsx)("span",{contentEditable:!1,children:(0,d.jsx)("i",{className:i.icon})}),(0,d.jsx)(s.RichText,{tagName:"span",value:a,onChange:e=>l({content:e}),placeholder:v.placeholder})]})]})}window.wp.i18n;let f=p({"zh-CN":{blockTitle:"展示卡片",toolbarButtonLabel:"选择图片",panelTitle:"展示卡片设置",iconClassLabel:"FontAwesome 图标类名",iconClassHelp:"例如 fa-solid fa-book",titleLabel:"标题",imgUrlLabel:"图片链接(可选)",iconColorLabel:"图标颜色与按钮文字颜色",linkLabel:"跳转链接",iconPlaceholder:"输入图标类名...",titlePlaceholder:"输入卡片标题..."},"zh-TW":{blockTitle:"展示卡片",toolbarButtonLabel:"選擇圖片",panelTitle:"展示卡片設定",iconClassLabel:"FontAwesome 圖標類名",iconClassHelp:"例如 fa-solid fa-book",titleLabel:"標題",imgUrlLabel:"圖片連結(可選)",iconColorLabel:"圖標顏色與按鈕文字顏色",linkLabel:"跳轉連結",iconPlaceholder:"輸入圖標類名...",titlePlaceholder:"輸入卡片標題..."},ja:{blockTitle:"カード表示",toolbarButtonLabel:"画像を選択",panelTitle:"カード表示設定",iconClassLabel:"FontAwesomeアイコンクラス",iconClassHelp:"例: fa-solid fa-book",titleLabel:"タイトル",imgUrlLabel:"画像リンク(任意)",iconColorLabel:"アイコンとボタンテキストの色",linkLabel:"リンク",iconPlaceholder:"アイコンクラスを入力...",titlePlaceholder:"カードタイトルを入力..."},en:{blockTitle:"ShowCard",toolbarButtonLabel:"Select Image",panelTitle:"ShowCard Settings",iconClassLabel:"FontAwesome Icon Classes",iconClassHelp:"e.g., fa-solid fa-book",titleLabel:"Title",imgUrlLabel:"Image URL (Optional)",iconColorLabel:"Icon & Button Text Color",linkLabel:"Link",iconPlaceholder:"Enter icon classes...",titlePlaceholder:"Enter card title..."}});const j=f.titlePlaceholder;function y({attributes:e,setAttributes:l}){const{icon:a,title:t,img:o,color:i,link:r,isExample:b}=e;if(b)return(0,d.jsx)("img",{src:"https://docs.fuukei.org/short-code/showc.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}});const u=(0,s.useBlockProps)({className:"showcard"});return(0,d.jsxs)(c.Fragment,{children:[(0,d.jsx)(s.BlockControls,{children:(0,d.jsx)(n.ToolbarGroup,{children:(0,d.jsx)(s.MediaUploadCheck,{children:(0,d.jsx)(s.MediaUpload,{onSelect:e=>{l({img:e.url})},allowedTypes:["image"],render:({open:e})=>(0,d.jsx)(n.ToolbarButton,{icon:"format-image",label:f.toolbarButtonLabel,onClick:e})})})})}),(0,d.jsx)(s.InspectorControls,{children:(0,d.jsxs)(n.PanelBody,{title:f.panelTitle,initialOpen:!0,children:[(0,d.jsx)(n.TextControl,{label:f.iconClassLabel,value:a,onChange:e=>l({icon:e}),help:f.iconClassHelp}),(0,d.jsx)(n.TextControl,{label:f.titleLabel,value:t,onChange:e=>l({title:e})}),(0,d.jsx)(n.TextControl,{label:f.imgUrlLabel,value:o,onChange:e=>l({img:e})}),(0,d.jsx)("p",{children:(0,d.jsx)("strong",{children:f.iconColorLabel})}),(0,d.jsx)(n.ColorPicker,{color:i,onChangeComplete:e=>l({color:e.hex}),disableAlpha:!0}),(0,d.jsx)("p",{children:(0,d.jsx)("strong",{children:f.linkLabel})}),(0,d.jsx)(s.URLInputButton,{url:r,onChange:e=>l({link:e})})]})}),(0,d.jsxs)("div",{...u,children:[(0,d.jsx)("div",{className:"img",style:{background:o?`url(${o}) center center / cover no-repeat`:"#ccc"},children:(0,d.jsx)("a",{href:r,onClick:e=>e.preventDefault(),children:(0,d.jsx)("button",{className:"showcard-button",style:{color:i},children:(0,d.jsx)("i",{className:"fa-solid fa-angle-right"})})})}),(0,d.jsxs)("div",{className:"icon-title",children:[(0,d.jsx)("i",{className:a,style:{color:i}}),(0,d.jsx)(s.RichText,{tagName:"span",className:"title",value:t,onChange:e=>l({title:e}),placeholder:f.titlePlaceholder})]})]})]})}let w=p({"zh-CN":{blockTitle:"对话块",imageLabel:"设置头像",directionLabel:"切换方向",placeholder:"请输入对话内容…"},"zh-TW":{blockTitle:"對話區塊",imageLabel:"設定大頭貼",directionLabel:"切換方向",placeholder:"請輸入對話內容…"},ja:{blockTitle:"会話ブロック",imageLabel:"アバター設定",directionLabel:"方向切替",placeholder:"ここに会話内容を入力…"},en:{blockTitle:"Conversations Block",imageLabel:"Set Avatar",directionLabel:"Toggle Direction",placeholder:"Enter conversation text…"}}),L=p({"zh-CN":{blockTitle:"Bilibili 视频",placeholder:"请输入 Bilibili 视频 ID(如 BV1xx、av123456)",label:"视频 ID",error:"无效的视频 ID,请输入 BV 或 av 编号。"},"zh-TW":{blockTitle:"Bilibili 視頻",placeholder:"請輸入 Bilibili 視頻 ID(例如 BV1xx、av123456)",label:"視頻 ID",error:"無效的視頻 ID,請輸入 BV 或 av 編號。"},ja:{blockTitle:"Bilibili ビデオ",placeholder:"Bilibiliの動画ID(例:BV1xx、av123456)を入力してください",label:"動画 ID",error:"無効な動画IDです。BVまたはav形式で入力してください。"},en:{blockTitle:"Bilibili Video",placeholder:"Enter Bilibili Video ID (e.g. BV1xx or av123456)",label:"Video ID",error:"Invalid video ID. Please enter BV or av format."}}),T=p({"zh-CN":{blockTitle:"Github 仓库卡片",fieldLabel:"仓库地址",fieldHelp:"示例:author/repo 或 https://github.com/author/repo"},"zh-TW":{blockTitle:"Github 倉庫卡片",fieldLabel:"倉庫地址",fieldHelp:"範例:author/repo 或 https://github.com/author/repo"},ja:{blockTitle:"GitHub リポジトリカード",fieldLabel:"リポジトリURL",fieldHelp:"例:author/repo または https://github.com/author/repo"},en:{blockTitle:"GitHub Repository Card",fieldLabel:"Repository URL",fieldHelp:"Example: author/repo or https://github.com/author/repo"}});i()(()=>{const e=(0,t.getCategories)(),l=[...e.slice(0,1),{slug:"sakurairo",title:"Sakurairo"},...e.slice(1)];(0,t.setCategories)(l)}),function(){try{!function(){function e({attributes:e,setAttributes:l}){const{content:a,language:t}=e,o=(0,s.useBlockProps)();let i=t||"",r=(x.find(e=>e.value===i)||x[0]).label;return(0,d.jsxs)(c.Fragment,{children:[(0,d.jsx)(s.BlockControls,{children:(0,d.jsx)(n.ToolbarGroup,{children:(0,d.jsx)(n.DropdownMenu,{icon:u,label:g.hljsTitle,text:r,controls:x.map(({value:e,label:a})=>({title:a,isActive:i===e,onClick:()=>l({language:e})}))})})}),(0,d.jsx)("pre",{...o,children:(0,d.jsx)("code",{className:i?`language-${i}`:"",children:(0,d.jsx)(s.PlainText,{value:a,onChange:e=>l({content:e}),placeholder:g.hljsPlaceholder})})})]})}(0,r.addFilter)("blocks.registerBlockType","sakurairo/code-language-support",l=>"core/code"!==l.name?l:{...l,attributes:{...l.attributes,language:{type:"string",default:""}},edit:e})}(),(0,t.registerBlockType)("sakurairo/notice",{apiVersion:2,title:v.blockTitle,description:"",icon:"format-status",category:"sakurairo",attributes:{content:{type:"string"},type:{type:"string",default:"task"},isExample:{type:"boolean",default:!1}},edit:k,save:()=>null,example:{attributes:{isExample:!0}}}),(0,t.registerBlockType)("sakurairo/showcard",{apiVersion:2,title:f.blockTitle,icon:"id-alt",category:"sakurairo",attributes:{icon:{type:"string",default:"fa-regular fa-bookmark"},title:{type:"string",default:j},img:{type:"string",default:""},color:{type:"string",default:"#ffffff"},link:{type:"string",default:""},isExample:{type:"boolean",default:!1}},edit:y,save:()=>null,example:{attributes:{isExample:!0}}}),(0,t.registerBlockType)("sakurairo/conversation",{apiVersion:2,title:w.blockTitle,icon:(0,c.createElement)("i",{className:"fa-regular fa-comments"}),category:"sakurairo",attributes:{avatar:{type:"string",default:""},direction:{type:"string",default:"row"},content:{type:"string"},isExample:{type:"boolean",default:!1}},edit:function({attributes:e,setAttributes:l}){const{avatar:a,direction:t,content:o,isExample:i}=e;if(i)return(0,d.jsx)("img",{src:"https://docs.fuukei.org/short-code/dis.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}});const r=(0,s.useBlockProps)({className:"conversations-code",style:{display:"flex",flexDirection:t}});return(0,d.jsxs)(c.Fragment,{children:[(0,d.jsx)(s.BlockControls,{children:(0,d.jsxs)(n.ToolbarGroup,{children:[(0,d.jsx)(s.MediaUploadCheck,{children:(0,d.jsx)(s.MediaUpload,{onSelect:e=>l({avatar:e.url}),allowedTypes:["image"],value:a,render:({open:e})=>(0,d.jsx)(n.ToolbarButton,{icon:"format-image",label:w.imageLabel,onClick:e})})}),(0,d.jsx)(n.ToolbarButton,{icon:"row"===t?"arrow-right-alt":"arrow-left-alt",label:w.directionLabel,onClick:()=>{l({direction:"row"===t?"row-reverse":"row"})}})]})}),(0,d.jsxs)("div",{...r,style:{display:"flex",flexDirection:t},children:[a?(0,d.jsx)("img",{src:a,alt:""}):(0,d.jsx)(n.TextControl,{placeholder:w.imageLabel+" URL…",value:a,onChange:e=>l({avatar:e})}),(0,d.jsx)(s.RichText,{tagName:"div",className:"conversations-code-text",placeholder:w.placeholder,value:o,onChange:e=>l({content:e})})]})]})},save:()=>null,example:{attributes:{isExample:!0}}}),(0,t.registerBlockType)("sakurairo/vbilibili",{apiVersion:2,title:L.blockTitle,icon:(0,c.createElement)("i",{className:"fa-brands fa-bilibili"}),category:"sakurairo",supports:{html:!1},attributes:{videoId:{type:"string"},isExample:{type:"boolean",default:!1}},edit:function({attributes:e,setAttributes:l}){const{videoId:a,isExample:t}=e;if(t)return(0,d.jsx)("img",{src:"https://docs.fuukei.org/short-code/bvcode.png",alt:"预览",style:{width:"100%",height:"auto",display:"block"}});const o=(0,s.useBlockProps)();let i=null;const r=(a||"").trim();return/^av\d+$/i.test(r)?i=`https://player.bilibili.com/player.html?avid=${r.replace(/^av/i,"")}&page=1&autoplay=0&danmaku=0`:/^BV[a-zA-Z0-9]+$/.test(r)&&(i=`https://player.bilibili.com/player.html?bvid=${r}&page=1&autoplay=0&danmaku=0`),(0,d.jsxs)(c.Fragment,{children:[(0,d.jsx)(s.InspectorControls,{children:(0,d.jsx)(n.PanelBody,{title:L.label,children:(0,d.jsx)(n.TextControl,{label:L.label,value:a,onChange:e=>l({videoId:e}),placeholder:L.placeholder})})}),(0,d.jsx)("div",{...o,children:i?(0,d.jsx)("div",{style:{position:"relative",padding:"30% 45%"},children:(0,d.jsx)("iframe",{src:i,sandbox:"allow-top-navigation allow-same-origin allow-forms allow-scripts",allowFullScreen:!0,style:{pointerEvents:"none",position:"absolute",width:"100%",height:"100%",left:0,top:0,border:"none",overflow:"hidden"}})}):(0,d.jsx)(n.TextControl,{label:L.label,value:a,onChange:e=>l({videoId:e}),placeholder:L.placeholder,help:a?L.error:""})})]})},save:()=>null,example:{attributes:{videoId:"",isExample:!0}}}),(0,t.registerBlockType)("sakurairo/ghcard",{apiVersion:2,title:T.blockTitle,icon:(0,c.createElement)("i",{className:"fa-brands fa-github"}),category:"sakurairo",attributes:{path:{type:"string",default:""}},edit({attributes:e,setAttributes:l}){const{path:a}=e,t=(0,s.useBlockProps)();return(0,d.jsx)("div",{...t,children:(0,d.jsxs)("div",{style:{border:"1px solid #ddd",padding:"16px",borderRadius:"6px",background:"#fff"},children:[(0,d.jsxs)("div",{style:{fontWeight:"600",fontSize:"16px",marginBottom:"12px",display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("i",{className:"fa-brands fa-github"}),T.blockTitle]}),(0,d.jsx)(n.TextControl,{label:T.fieldLabel,help:T.fieldHelp,value:a,onChange:e=>l({path:e})})]})})},save:()=>null})}catch(e){console.log(`发生错误${e}`),console.log(e.stack)}}()}},a={};function t(e){var o=a[e];if(void 0!==o)return o.exports;var i=a[e]={exports:{}};return l[e](i,i.exports,t),i.exports}t.m=l,e=[],t.O=(l,a,o,i)=>{if(!a){var r=1/0;for(b=0;b<e.length;b++){for(var[a,o,i]=e[b],s=!0,n=0;n<a.length;n++)(!1&i||r>=i)&&Object.keys(t.O).every(e=>t.O[e](a[n]))?a.splice(n--,1):(s=!1,i<r&&(r=i));if(s){e.splice(b--,1);var c=o();void 0!==c&&(l=c)}}return l}i=i||0;for(var b=e.length;b>0&&e[b-1][2]>i;b--)e[b]=e[b-1];e[b]=[a,o,i]},t.n=e=>{var l=e&&e.__esModule?()=>e.default:()=>e;return t.d(l,{a:l}),l},t.d=(e,l)=>{for(var a in l)t.o(l,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:l[a]})},t.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),(()=>{var e={57:0,350:0};t.O.j=l=>0===e[l];var l=(l,a)=>{var o,i,[r,s,n]=a,c=0;if(r.some(l=>0!==e[l])){for(o in s)t.o(s,o)&&(t.m[o]=s[o]);if(n)var b=n(t)}for(l&&l(a);c<r.length;c++)i=r[c],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(b)},a=globalThis.webpackChunkiro_blocks=globalThis.webpackChunkiro_blocks||[];a.forEach(l.bind(null,0)),a.push=l.bind(null,a.push.bind(a))})();var o=t.O(void 0,[350],()=>t(382));o=t.O(o)})(); No newline at end of file
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI strings for the GitHub repository card use "Github" (e.g., "Github 仓库卡片"), but the correct brand capitalization is "GitHub". Please update these localized strings (preferably in the unminified source and rebuild) for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines 2945 to 2953
return sprintf(
'<div class="conversations-code" style="flex-direction: %s;">
<img src="%s">
<div class="conversations-code-text">%s%s</div>
</div>',
esc_attr($atts['direction']),
$atts['avatar'],
$direction,
esc_url($avatar),
$speaker_alt,
$content
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function iro_render_conversations outputs $content directly into the HTML div without any sanitization or escaping, while both the conversations shortcode and the new sakurairo/conversation block pass user-controlled text into this parameter. An attacker with the ability to create or edit posts can craft shortcode or block content (for example via the block editor code view) that includes <script> or malicious HTML in the conversation text, leading to stored XSS when the post is viewed. You should sanitize or escape $content (for example by passing it through wp_kses_post or similar) before including it in the conversations-code-text markup for both the shortcode and block rendering.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants