【微信openclaw修复】使用新版本openclaw,对openclaw-weixin在openclaw2026.3.23-2版本的修复
<div class="ce-block ce-block--focused" data-id="UkjzFidMRa" ><div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">openclaw新版本的升级,重构了plugin sdk:</div>
</div>
</div><div class="ce-block ce-block--focused" data-id="cdzFMzelc2" >
<div class="ce-block__content">
<ul class="cdx-list-unordered"><li class="cdx-list__item"><code>openclaw/plugin-sdk/channel-config-schema</code></li><li class="cdx-list__item"><code>openclaw/plugin-sdk/account-id</code></li><li class="cdx-list__item"><code>openclaw/plugin-sdk/infra-runtime</code></li><li class="cdx-list__item"><code>openclaw/plugin-sdk/channel-runtime</code></li><li class="cdx-list__item"></li><li class="cdx-list__item"><code>openclaw/plugin-sdk/text-runtime</code></li><li class="cdx-list__item"><code>openclaw/plugin-sdk/config-runtime</code></li></ul>
</div>
</div><div class="ce-block ce-block--focused" data-id="dsePnzAfCz" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">查看插件入口<span> </span><code>index.ts</code>,发现它一上来就导入:</div>
</div>
</div><div class="ce-block ce-block--focused" data-id="j_EVbbzHRe" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-j_EVbbzHRe">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-j_EVbbzHRe">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-j_EVbbzHRe" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-j_EVbbzHRe">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?Srv"></script>
<script type="application/javascript">
const editorElem1779023944N9Q3F = document.getElementById('codeflask-j_EVbbzHRe');
var isCollapsed1779023944N9Q3F = true;
const flask1779023944N9Q3F = new CodeFlask(editorElem1779023944N9Q3F, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1779023944N9Q3F = `import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";`;
code1779023944N9Q3F = code1779023944N9Q3F.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1779023944N9Q3F.addLanguage('javascript', Prism.languages['javascript']);
flask1779023944N9Q3F.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1779023944N9Q3F.updateCode(code1779023944N9Q3F);
const currentCode1779023944N9Q3F = flask1779023944N9Q3F.getCode();
var coderow1779023944N9Q3F = parseInt('');
if (coderow1779023944N9Q3F === undefined || coderow1779023944N9Q3F !== coderow1779023944N9Q3F || coderow1779023944N9Q3F === 0) {
coderow1779023944N9Q3F = flask1779023944N9Q3F.lineNumber;
}
if (coderow1779023944N9Q3F < 20) {
editorElem1779023944N9Q3F.parentElement.style.height = '300px';
editorElem1779023944N9Q3F.style.height = '300px';
} else if (coderow1779023944N9Q3F >= 20) {
editorElem1779023944N9Q3F.parentElement.style.height = '500px';
editorElem1779023944N9Q3F.style.height = '500px';
}
//console.log({currentCode1779023944N9Q3F})
const copyBtn1779023944N9Q3F = document.getElementById('codeflask-copy-j_EVbbzHRe');
copyBtn1779023944N9Q3F.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1779023944N9Q3F).then(function() {
// 复制成功提示
const originalText = copyBtn1779023944N9Q3F.innerHTML;
copyBtn1779023944N9Q3F.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1779023944N9Q3F.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1779023944N9Q3F);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1779023944N9Q3F);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1779023944N9Q3F.innerHTML;
copyBtn1779023944N9Q3F.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1779023944N9Q3F.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1779023944N9Q3F = document.getElementById('codeflask-bottomBtn-j_EVbbzHRe');
const Toggle1779023944N9Q3F = document.getElementById('codeflask-Toggle-j_EVbbzHRe');
bottomBtn1779023944N9Q3F.addEventListener('click', function() {
if (isCollapsed1779023944N9Q3F) {
// 展开代码
isCollapsed1779023944N9Q3F = false;
const codeElement1779023944N9Q3F = editorElem1779023944N9Q3F.querySelector('.codeflask__code');
if (codeElement1779023944N9Q3F) {
const actualHeight1779023944N9Q3F = codeElement1779023944N9Q3F.scrollHeight + 20;
editorElem1779023944N9Q3F.parentElement.style.height = actualHeight1779023944N9Q3F + 'px';
editorElem1779023944N9Q3F.style.height = actualHeight1779023944N9Q3F + 'px';
}
bottomBtn1779023944N9Q3F.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1779023944N9Q3F.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1779023944N9Q3F = true;
if (coderow1779023944N9Q3F < 20) {
editorElem1779023944N9Q3F.parentElement.style.height = '300px';
editorElem1779023944N9Q3F.style.height = '300px';
} else if (coderow1779023944N9Q3F >= 20) {
editorElem1779023944N9Q3F.parentElement.style.height = '500px';
editorElem1779023944N9Q3F.style.height = '500px';
}
bottomBtn1779023944N9Q3F.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1779023944N9Q3F.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1779023944N9Q3F.addEventListener('click', function() {
bottomBtn1779023944N9Q3F.click();
});
</script><div class="ce-block ce-block--focused" data-id="-N-BOubO38" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">再查看宿主<span> </span><code>openclaw</code><span> </span>的 package exports,确认当前运行环境下并没有正确暴露这个子路径。</div>
</div>
</div><div class="ce-block" data-id="Wa_4_2HC0l" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">修复提示词</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="hIUyxMp-PC" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left"> 为了方便,直接交给AI修改</div>
</div>
</div><div class="ce-block ce-block--focused" data-id="cGtOqaDR3v" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-cGtOqaDR3v">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-cGtOqaDR3v">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-cGtOqaDR3v" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-cGtOqaDR3v">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?Srv"></script>
<script type="application/javascript">
const editorElem1779023944J4M75 = document.getElementById('codeflask-cGtOqaDR3v');
var isCollapsed1779023944J4M75 = true;
const flask1779023944J4M75 = new CodeFlask(editorElem1779023944J4M75, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1779023944J4M75 = `# 修复提示词:OpenClaw 微信插件 \`openclaw-weixin\` Plugin SDK 兼容性修复
你现在是在一台安装了 OpenClaw 的 Linux 机器上,目标是修复微信插件 \`@tencent-weixin/openclaw-weixin\`,使其能够:
1. 正常加载
2. 扫码登录成功
3. 启动微信入站监听
4. 正常接收并回复微信消息
5. 日志写入 OpenClaw 新版本兼容的主日志文件,能通过 \`openclaw logs --follow\` 查看
---
## 一、背景与问题特征
这类机器上常见的现象是:
- \`openclaw-weixin\` 已安装、已启用
- \`openclaw status --deep\` 里看起来 channel 存在
- 微信扫码登录似乎成功
- 但插件启动时报一串类似错误:
\`\`\`text
Cannot find module 'openclaw/plugin-sdk/channel-config-schema'
Cannot find module 'openclaw/plugin-sdk/account-id'
Cannot find module 'openclaw/plugin-sdk/infra-runtime'
Cannot find module 'openclaw/plugin-sdk/channel-runtime'
Cannot find module 'openclaw/plugin-sdk/command-auth'
Cannot find module 'openclaw/plugin-sdk/text-runtime'
Cannot find module 'openclaw/plugin-sdk/config-runtime'
\`\`\`
注意:
- 宿主 \`openclaw\` 版本可能已经是最新
- 问题不是“版本太旧”
- 而是 **插件源码 import 的多个 \`openclaw/plugin-sdk/*\` 子路径,在当前宿主插件加载链中无法被正确解析**
- 宿主包内部可能存在对应 dist 文件,但插件直接按包子路径 import 会失败
---
## 二、修复原则
### 目标
不是简单降级插件,而是做一组**本地兼容补丁**,使插件在当前宿主上正常运行。
### 原则
1. **优先复用宿主真实实现**
- 例如宿主 \`dist/plugin-sdk/infra-runtime.js\`
- 例如宿主 \`dist/plugin-sdk/config-runtime.js\`
2. **如果宿主真实实现无法直接调用,再 fallback 本地兼容实现**
3. **路径、日志、配置写回、文件锁** 尽量对齐 OpenClaw 新版本行为
4. **高风险 SDK 子路径**(如 command-auth / text-runtime / account-id)允许保留本地兼容实现,避免再次把插件搞挂
---
## 三、需要修改的文件
默认插件路径通常是:
\`\`\`bash
~/.openclaw/extensions/openclaw-weixin
\`\`\`
你需要检查并修改这些文件:
### 已修改/需要修改的文件
- \`index.ts\`
- \`src/channel.ts\`
- \`src/auth/accounts.ts\`
- \`src/auth/pairing.ts\`
- \`src/util/logger.ts\`
- \`src/messaging/process-message.ts\`
- \`src/messaging/send.ts\`
- \`src/log-upload.ts\`
### 需要新增的兼容文件
- \`src/util/account-id-compat.ts\`
- \`src/util/command-auth-compat.ts\`
- \`src/util/text-runtime-compat.ts\`
- \`src/util/openclaw-host-compat.ts\`
### 还要检查宿主配置文件
- \`~/.openclaw/openclaw.json\`
---
## 四、具体修改要求
### 1. 修改 \`index.ts\`
#### 问题
不要再依赖:
\`\`\`ts
openclaw/plugin-sdk/channel-config-schema
\`\`\`
#### 修改要求
删除:
\`\`\`ts
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
\`\`\`
把:
\`\`\`ts
configSchema: buildChannelConfigSchema(WeixinConfigSchema)
\`\`\`
改成:
\`\`\`ts
configSchema: WeixinConfigSchema
\`\`\`
---
### 2. 新增 \`src/util/account-id-compat.ts\`
添加一个本地账号 ID 兼容函数:
\`\`\`ts
export function normalizeAccountId(value: string): string {
return value.trim().replace(/@/g, "-").replace(/\./g, "-");
}
\`\`\`
#### 用途
替代:
\`\`\`ts
openclaw/plugin-sdk/account-id
\`\`\`
---
### 3. 新增 \`src/util/command-auth-compat.ts\`
实现一个最小可用版本,至少提供:
- \`resolveSenderCommandAuthorizationWithRuntime\`
- \`resolveDirectDmAuthorizationOutcome\`
核心逻辑要求:
- 读取 \`allowFrom\`
- 判断 sender 是否授权
- 只有 \`/命令\` 才视为 commandAuthorized
- \`dmPolicy = pairing\` 且未授权时返回 \`unauthorized\`
示意逻辑:
\`\`\`ts
type DmPolicy = "allow" | "pairing" | "disabled" | string;
export async function resolveSenderCommandAuthorizationWithRuntime(...) {
...
}
export function resolveDirectDmAuthorizationOutcome(...) {
...
}
\`\`\`
---
### 4. 新增 \`src/util/text-runtime-compat.ts\`
实现一个轻量 \`stripMarkdown(text: string)\`,至少能去掉:
- 行内代码
- 标题符号
- 粗体/斜体
- 引用
- 列表符号
用于替代:
\`\`\`ts
openclaw/plugin-sdk/text-runtime
\`\`\`
---
### 5. 新增 \`src/util/openclaw-host-compat.ts\`
这是关键文件。
这个文件要负责提供:
#### (1) \`resolvePreferredOpenClawTmpDirCompat()\`
要求:
- 尽量按宿主 OpenClaw \`tmp-openclaw-dir\` 真实逻辑实现
- 优先 \`/tmp/openclaw\`
- 如果不安全或不可写,再 fallback 到 \`tmpdir()/openclaw[-uid]\`
- 权限尽量使用 0700
- 行为尽量对齐宿主 \`resolvePreferredOpenClawTmpDir\`
#### (2) \`withFileLockCompat(filePath, options, fn)\`
要求:
- 优先动态 import 宿主真实实现:
\`\`\`ts
dist/plugin-sdk/infra-runtime.js
\`\`\`
- 调用宿主的 \`withFileLock\`
- 如果加载失败,再直接执行 \`fn()\`
#### (3) \`loadConfigCompat()\` / \`writeConfigFileCompat()\`
要求:
- 优先动态 import 宿主真实实现:
\`\`\`ts
dist/plugin-sdk/config-runtime.js
\`\`\`
- 调用宿主:
- \`loadConfig\`
- \`writeConfigFile\`
- 如果失败,再 fallback 读写:
\`\`\`bash
~/.openclaw/openclaw.json
\`\`\`
#### 技术要求
建议用:
\`\`\`ts
createRequire(import.meta.url)
pathToFileURL(...)
\`\`\`
来定位宿主 \`openclaw/package.json\`,再拼出 dist 文件路径。
---
### 6. 修改 \`src/channel.ts\`
#### 修改要求
1. 不再使用:
\`\`\`ts
openclaw/plugin-sdk/account-id
\`\`\`
改成:
\`\`\`ts
./util/account-id-compat.js
\`\`\`
2. 不再使用:
\`\`\`ts
openclaw/plugin-sdk/infra-runtime
\`\`\`
媒体临时目录改成:
\`\`\`ts
path.join(resolvePreferredOpenClawTmpDirCompat(), "weixin/media/outbound-temp")
\`\`\`
---
### 7. 修改 \`src/messaging/process-message.ts\`
#### 修改要求
1. 不再使用:
\`\`\`ts
openclaw/plugin-sdk/channel-runtime
\`\`\`
如果只用到 \`createTypingCallbacks\`,就在本地实现一个简化版
2. 不再使用:
\`\`\`ts
openclaw/plugin-sdk/command-auth
\`\`\`
改为:
\`\`\`ts
../util/command-auth-compat.js
\`\`\`
3. 不再使用:
\`\`\`ts
openclaw/plugin-sdk/infra-runtime
\`\`\`
媒体临时目录改成:
\`\`\`ts
path.join(resolvePreferredOpenClawTmpDirCompat(), "weixin/media/outbound-temp")
\`\`\`
---
### 8. 修改 \`src/messaging/send.ts\`
#### 修改要求
不再使用:
\`\`\`ts
openclaw/plugin-sdk/text-runtime
\`\`\`
改为:
\`\`\`ts
../util/text-runtime-compat.js
\`\`\`
保持 \`markdownToPlainText()\` 逻辑不变,只替换 \`stripMarkdown\` 来源。
---
### 9. 修改 \`src/util/logger.ts\`
#### 目标
让插件日志写入 **OpenClaw 新版本兼容主日志文件**,使其能通过:
\`\`\`bash
openclaw logs --follow
\`\`\`
查看。
#### 修改要求
1. 日志目录用:
\`\`\`ts
resolvePreferredOpenClawTmpDirCompat()
\`\`\`
2. 日志文件名使用固定文件:
\`\`\`ts
openclaw.log
\`\`\`
不要再使用按天命名:
\`\`\`ts
openclaw-YYYY-MM-DD.log
\`\`\`
#### 目标效果
插件日志最终写入类似:
\`\`\`bash
/tmp/openclaw/openclaw.log
\`\`\`
并与 OpenClaw 新版本主日志规则一致。
---
### 10. 修改 \`src/log-upload.ts\`
#### 修改要求
1. 日志目录改成:
\`\`\`ts
resolvePreferredOpenClawTmpDirCompat()
\`\`\`
2. 默认日志文件名改成:
\`\`\`ts
openclaw.log
\`\`\`
3. \`uninstall\` 子命令里不要再直接 import:
\`\`\`ts
openclaw/plugin-sdk/config-runtime
\`\`\`
改用:
- \`loadConfigCompat()\`
- \`writeConfigFileCompat()\`
4. 保留兼容:
- 如果用户传 \`YYYYMMDD\`
- 或 \`YYYYMMDDHH\`
- 也可以映射到 \`openclaw.log\`
---
### 11. 修改 \`src/auth/pairing.ts\`
#### 修改要求
1. 不再直接 import:
\`\`\`ts
openclaw/plugin-sdk/infra-runtime
\`\`\`
2. 改为使用:
\`\`\`ts
withFileLockCompat(...)
\`\`\`
3. 保留 allowFrom 文件逻辑,写入:
- \`openclaw-weixin-<accountId>-allowFrom.json\`
4. 如果宿主真实 \`withFileLock\` 加载成功,则优先使用宿主实现
5. 只有加载失败时才 fallback 到无锁直接写
---
### 12. 修改 \`src/auth/accounts.ts\`
这是关键。
#### 修改要求
1. 账号 ID 规范化改用:
\`\`\`ts
../util/account-id-compat.js
\`\`\`
2. 登录成功后的 \`triggerWeixinChannelReload()\`:
- 不要再直接依赖:
\`\`\`ts
openclaw/plugin-sdk/config-runtime
\`\`\`
- 改成使用:
- \`loadConfigCompat()\`
- \`writeConfigFileCompat()\`
#### 必须保证
扫码登录成功后,如果 \`channels.openclaw-weixin\` 缺失,就自动写回:
\`\`\`json
"channels": {
"openclaw-weixin": {
"enabled": true,
"accounts": {}
}
}
\`\`\`
否则即使 token 保存成功,gateway 也不会真正启动微信监听。
---
### 13. 检查 \`~/.openclaw/openclaw.json\`
确认这些配置存在:
#### 插件已启用
\`\`\`json
"plugins": {
"entries": {
"openclaw-weixin": {
"enabled": true
}
}
}
\`\`\`
#### channels 里有 openclaw-weixin
\`\`\`json
"channels": {
"openclaw-weixin": {
"enabled": true,
"accounts": {}
}
}
\`\`\`
如果缺失,需要补上。
---
## 五、修复后的验证步骤
修改完成后,按这个顺序验证。
### 1. 重启 gateway
\`\`\`bash
openclaw gateway restart
\`\`\`
### 2. 看深度状态
\`\`\`bash
openclaw status --deep
\`\`\`
确认:
- \`openclaw-weixin\` 存在
- \`accounts 1/1\` 或相应账号数
- 没有新的插件加载错误
### 3. 查看日志
\`\`\`bash
openclaw logs --follow
\`\`\`
### 4. 微信发测试消息
发:
\`\`\`text
你好
\`\`\`
### 5. 预期日志
应看到类似:
\`\`\`text
starting weixin webhook
waiting for Weixin runtime...
Weixin runtime acquired
Monitor started
inbound message
outbound: text sent OK
\`\`\`
---
## 六、判断修复成功的标准
满足以下全部条件即视为修复成功:
1. 插件不再报 \`Cannot find module 'openclaw/plugin-sdk/...'\`
2. \`openclaw status --deep\` 中微信 channel 正常
3. \`openclaw logs --follow\` 能看到微信插件日志
4. 微信入站消息可被 OpenClaw 收到
5. OpenClaw 可以正常回复微信消息
---
## 七、注意事项
1. 不要为了省事直接把所有逻辑都改成 \`/tmp\`
- 路径、日志、配置写回、文件锁应尽量对齐宿主真实实现
2. 不要优先降级插件,除非确认本地补丁不可控
- 这里优先做源码兼容修复
3. 保留本地 compat 文件是合理的
- 尤其是:
- \`account-id-compat\`
- \`command-auth-compat\`
- \`text-runtime-compat\`
4. 如果插件更新/重装,这些改动可能会丢失
- 建议后续导出 patch
---
## 八、最终目标
修复后,插件应实现:
- 正常加载
- 正常扫码登录
- 自动写回 channel 配置
- gateway 自动拉起监听
- 正常轮询微信消息
- 正常回复
- 日志进入 OpenClaw 主日志文件,可被 \`openclaw logs --follow\` 直接查看
---
如果你是 AI coding agent,请直接:
1. 读取上述文件
2. 对照是否存在相关 import
3. 执行最小必要改动
4. 完成后列出修改的文件与关键 diff
5. 指导用户执行:
\`\`\`bash
openclaw gateway restart
openclaw status --deep
openclaw logs --follow
\`\`\``;
code1779023944J4M75 = code1779023944J4M75.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1779023944J4M75.addLanguage('javascript', Prism.languages['javascript']);
flask1779023944J4M75.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1779023944J4M75.updateCode(code1779023944J4M75);
const currentCode1779023944J4M75 = flask1779023944J4M75.getCode();
var coderow1779023944J4M75 = parseInt('');
if (coderow1779023944J4M75 === undefined || coderow1779023944J4M75 !== coderow1779023944J4M75 || coderow1779023944J4M75 === 0) {
coderow1779023944J4M75 = flask1779023944J4M75.lineNumber;
}
if (coderow1779023944J4M75 < 20) {
editorElem1779023944J4M75.parentElement.style.height = '300px';
editorElem1779023944J4M75.style.height = '300px';
} else if (coderow1779023944J4M75 >= 20) {
editorElem1779023944J4M75.parentElement.style.height = '500px';
editorElem1779023944J4M75.style.height = '500px';
}
//console.log({currentCode1779023944J4M75})
const copyBtn1779023944J4M75 = document.getElementById('codeflask-copy-cGtOqaDR3v');
copyBtn1779023944J4M75.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1779023944J4M75).then(function() {
// 复制成功提示
const originalText = copyBtn1779023944J4M75.innerHTML;
copyBtn1779023944J4M75.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1779023944J4M75.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1779023944J4M75);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1779023944J4M75);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1779023944J4M75.innerHTML;
copyBtn1779023944J4M75.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1779023944J4M75.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1779023944J4M75 = document.getElementById('codeflask-bottomBtn-cGtOqaDR3v');
const Toggle1779023944J4M75 = document.getElementById('codeflask-Toggle-cGtOqaDR3v');
bottomBtn1779023944J4M75.addEventListener('click', function() {
if (isCollapsed1779023944J4M75) {
// 展开代码
isCollapsed1779023944J4M75 = false;
const codeElement1779023944J4M75 = editorElem1779023944J4M75.querySelector('.codeflask__code');
if (codeElement1779023944J4M75) {
const actualHeight1779023944J4M75 = codeElement1779023944J4M75.scrollHeight + 20;
editorElem1779023944J4M75.parentElement.style.height = actualHeight1779023944J4M75 + 'px';
editorElem1779023944J4M75.style.height = actualHeight1779023944J4M75 + 'px';
}
bottomBtn1779023944J4M75.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1779023944J4M75.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1779023944J4M75 = true;
if (coderow1779023944J4M75 < 20) {
editorElem1779023944J4M75.parentElement.style.height = '300px';
editorElem1779023944J4M75.style.height = '300px';
} else if (coderow1779023944J4M75 >= 20) {
editorElem1779023944J4M75.parentElement.style.height = '500px';
editorElem1779023944J4M75.style.height = '500px';
}
bottomBtn1779023944J4M75.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1779023944J4M75.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1779023944J4M75.addEventListener('click', function() {
bottomBtn1779023944J4M75.click();
});
</script><div class="ce-block ce-block--focused" data-id="6y3fSVrj29" >
<div class="ce-block__content">
<div class="cdx-block image-tool image-tool--filled ">
<div class="image-tool__image">
<div class="image-tool__image-preloader" style=""></div>
<img id="aimg_6y3fSVrj29" class="image-tool__image-picture _zoom" src="https://bbs.clzjwl.cn/data/attachment/forum/202604/18/165600l2rxb6tiwtq008s6.png" title="" alt="" data-aid="134"/>
</div>
<div class="cdx-input image-tool__caption" data-placeholder=""></div>
</div>
</div>
</div><style type="text/css">
.ce-block {
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
}
.ce-paragraph {
line-height: 1.6em;
outline: none;
text-indent: 2em;
font-size: 16px;
}
.ce-paragraph--right {
text-align: right;
}
.ce-paragraph--center {
text-align: center;
}
.ce-paragraph--left {
text-align: left;
}
.ce-paragraph--justify {
text-align: justify;
}
.ce-paragraph-text-indent {
text-align: justify;
}
.ce-paragraph:empty::before{
content: attr(data-placeholder);
color: #707684;
font-weight: normal;
opacity: 0;
}
/** Show placeholder at the first paragraph if Editor is empty */
.codex-editor--empty .ce-block:first-child .ce-paragraph:empty::before {
opacity: 1;
}
.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph:empty::before,
.codex-editor--empty .ce-block:first-child .ce-paragraph:empty:focus::before {
opacity: 0;
}
.ce-paragraph p:first-of-type{
margin-top: 0;
}
.ce-paragraph p:last-of-type{
margin-bottom: 0;
}
.svg-icon {
width: 1em;
height: 1em;
}
.svg-icon path,
.svg-icon polygon,
.svg-icon rect {
fill: #4691f6;
}
.svg-icon circle {
stroke: #4691f6;
stroke-width: 1;
}
</style><style type="text/css">
.ce-block {
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
}
.cdx-list {
margin:0;
outline:none;
display:block;
counter-reset:item;
padding:6px;
}
.cdx-list__item {
line-height:1.45em;
display:block;
padding-top:8px;
margin-left: 2em;
}
.cdx-list__item-children {
display:block;
}
.cdx-list__item {
outline:none
}
.cdx-list__item-content {
word-break:break-word;
white-space:pre-wrap;
grid-area:content;
padding-left:8px
}
.cdx-list__item:before {
counter-increment:item;
white-space:nowrap
}
.cdx-list-li-container {
display: flex;
}
.cdx-list-ordered .cdx-list__item:before {
/* content:counters(item,".",numeric) "." */
}
.cdx-list-ordered {
list-style-type: none;
margin-left: -15px;
counter-reset:item;
font-size: 16px;
}
.cdx-list-unordered {
font-size: 16px;
}
.cdx-list-unordered .cdx-list__item:before {
content:"•"
}
.cdx-list-checklist .cdx-list__item:before {
content:""
}
.cdx-list__settings .cdx-settings-button {
width:50%
}
.cdx-list__checkbox {
padding-top:calc((1.45em - 1.2em) / 2);
grid-area:checkbox;
width:1.2em;
height:1.2em;
display:flex;
cursor:pointer;
font-size: 16px;
}
.cdx-list__checkbox svg {
opacity:0;
height:1.2em;
width:1.2em;
left:-1px;
top:-1px;
position:absolute
}
@media (hover:hover) {
.cdx-list__checkbox:not(.cdx-list__checkbox--no-hover):hover .cdx-list__checkbox-check svg {
opacity:1
}
}.cdx-list__checkbox--checked-1 {
line-height:1.45em
}
@media (hover:hover) {
.cdx-list__checkbox--checked-1:not(.cdx-list__checkbox--checked-1--no-hover):hover .cdx-checklist__checkbox-check {
background:#0059AB;
border-color:#0059AB
}
}.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check {
background:#369FFF;
border-color:#369FFF
}
.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check svg {
opacity:1
}
.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check svg path {
stroke:#fff
}
.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check:before {
opacity:0;
visibility:visible;
transform:scale(2.5)
}
.cdx-list__checkbox-check {
cursor:pointer;
display:inline-block;
position:relative;
margin:0 auto;
width:1.2em;
height:1.2em;
box-sizing:border-box;
border-radius:5px;
border:1px solid #C9C9C9;
background:#fff
}
.cdx-list__checkbox-check:before {
content:"";
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
border-radius:100%;
background-color:#369FFF;
visibility:hidden;
pointer-events:none;
transform:scale(1);
transition:transform .4s ease-out,opacity .4s
}
.cdx-list__checkbox-check--disabled {
pointer-events:none
}
.cdx-list-start-with-field {
background:#F8F8F8;
border:1px solid rgba(226,226,229,.2);
border-radius:6px;
padding:2px;
display:grid;
grid-template-columns:auto auto 1fr;
grid-template-rows:auto
}
.cdx-list-start-with-field--invalid {
background:#FFECED;
border:1px solid #E13F3F
}
.cdx-list-start-with-field--invalid .cdx-list-start-with-field__input {
color:#e13f3f
}
.cdx-list-start-with-field__input {
font-size:16px;
outline:none;
font-weight:500;
font-family:inherit;
border:0;
background:transparent;
margin:0;
padding:0;
line-height:22px;
min-width:calc(100% - 10px)
}
.cdx-list-start-with-field__input::placeholder {
color:#797979;
font-weight:500
}
</style><style type="text/css">
.ce-block {
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
position: relative;
}
/* 主容器 */
.editorjs-codeFlask_Wrapper {
border: 1px solid #dcdfe6;
border-radius: 5px;
background-color: #f6f8fa;
margin-bottom: 10px;
position: relative;
transition: all 0.3s ease;
width: 100%;
min-height: 100px;
overflow: hidden;
}
/* 标题栏 */
.editorjs-codeFlask_Header {
display: flex;
justify-content: flex-end;
align-items: center;
padding: 8px 12px;
background-color: #e9ecef;
border-bottom: 1px solid #dcdfe6;
position: relative;
z-index: 0; /* 从10降低到2 */
}
/* 语言显示 */
.editorjs-codeFlask_LangDisplay {
padding: 2px 8px;
background-color: #409eff;
color: white;
border-radius: 3px;
font-size: 12px;
font-weight: 500;
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
}
/* 内容容器 - 禁止纵向滚动 */
.editorjs-codeFlask_ContentContainer {
position: relative;
min-height: 100px;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
transition: height 0.3s ease;
}
/* 编辑器容器 - 禁止纵向滚动 */
.editorjs-codeFlask_Editor {
position: relative;
min-height: 100px;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
transition: height 0.3s ease;
}
/* 底部按钮容器 - 优化为更简洁的样式 */
.editorjs-codeFlask_BottomButtonContainer {
display: flex;
justify-content: center;
align-items: center;
padding: 4px;
background-color: #f8f9fa;
border-top: 1px solid #e9ecef;
position: relative;
z-index: 0;
}
/* 底部横向折叠/展开按钮 - 优化样式,使其更融入设计 */
.editorjs-codeFlask_BottomToggle {
width: 100%;
background-color: transparent;
color: #606266;
border: none;
border-radius: 4px;
padding: 6px 12px;
font-size: 12px;
font-weight: 400;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
text-align: center;
position: relative;
}
.editorjs-codeFlask_BottomToggle:hover {
background-color: #e9ecef;
color: #409eff;
}
.editorjs-codeFlask_BottomToggle:active {
background-color: #dee2e6;
}
.editorjs-codeFlask_BottomToggle .toggle-icon {
font-size: 11px;
transition: transform 0.3s ease;
}
/* 展开按钮(显示"展开"文本)上边缘添加渐变虚化效果 */
.editorjs-codeFlask_BottomToggle:has(span.toggle-icon:contains("▲"))::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6px;
background: linear-gradient(to bottom, rgba(248, 249, 250, 0) 0%, rgba(248, 249, 250, 1) 100%);
pointer-events: none;
}
/* 展开按钮(显示"展开"文本)上边缘添加渐变虚化效果 */
/* 删除不被广泛支持的:contains()选择器 */
.editorjs-codeFlask_BottomToggle.expand-mode::before {
content: '';
position: absolute;
top: -60px;
left: 0;
right: 0;
height: 60px;
background: linear-gradient(to bottom, rgb(255 255 255 / 0%) 0%, rgba(248, 249, 250, 1) 100%);
pointer-events: none;
}
/* CodeFlask 主容器样式 */
.editorjs-codeFlask_Editor .codeflask {
position: relative;
background: #fafafa;
border-radius: 0 0 4px 4px;
min-height: 100px;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
/* 行号容器 */
.editorjs-codeFlask_Editor .codeflask.codeflask--has-line-numbers:before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 40px;
background-color: #f5f5f5;
border-right: 1px solid #e0e0e0;
z-index: 0;
}
/* 行号 */
.editorjs-codeFlask_Editor .codeflask__lines {
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 40px;
padding: 10px 0;
background-color: #f5f5f5;
border-right: 1px solid #e0e0e0;
z-index: 0;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
color: #666;
text-align: right;
user-select: none;
overflow: hidden;
}
.editorjs-codeFlask_Editor .codeflask__lines__line {
padding-right: 8px;
}
/* 文本区域 - 输入框 */
.editorjs-codeFlask_Editor .codeflask__textarea {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 10px;
border: none;
background: transparent;
color: transparent;
caret-color: #333;
resize: none;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
z-index: 1;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
white-space: pre-wrap; /* 自动换行 */
tab-size: 4;
outline: none;
}
/* 添加选中文本样式 */
.editorjs-codeFlask_Editor .codeflask__textarea::selection {
background-color: #b3d4fc;
color: #333;
}
.editorjs-codeFlask_Editor .codeflask__textarea::-moz-selection {
background-color: #b3d4fc;
color: #333;
}
/* 代码预览区域 */
.editorjs-codeFlask_Editor .codeflask__pre {
position: absolute;
top: 0;
left: 0;
width: 100%; /* 确保宽度不超出容器 */
height: 100%;
padding: 10px;
margin: 0;
border: none;
background: transparent;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
z-index: 0;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
white-space: pre-wrap; /* 自动换行 */
pointer-events: none;
}
/* 代码高亮区域 */
.editorjs-codeFlask_Editor .codeflask__code {
display: block;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
color: #333;
white-space: pre-wrap; /* 自动换行 */
tab-size: 4;
overflow: visible;
}
/* 语法高亮样式 - 确保Prism.js样式正确应用 */
.editorjs-codeFlask_Editor .codeflask__code {
background: transparent !important;
}
/* 通用语法高亮token样式 */
.editorjs-codeFlask_Editor .token.comment,
.editorjs-codeFlask_Editor .token.prolog,
.editorjs-codeFlask_Editor .token.doctype,
.editorjs-codeFlask_Editor .token.cdata {
color: #708090;
}
.editorjs-codeFlask_Editor .token.punctuation {
color: #999;
}
.editorjs-codeFlask_Editor .token.namespace {
opacity: 0.7;
}
.editorjs-codeFlask_Editor .token.property,
.editorjs-codeFlask_Editor .token.tag,
.editorjs-codeFlask_Editor .token.boolean,
.editorjs-codeFlask_Editor .token.number,
.editorjs-codeFlask_Editor .token.constant,
.editorjs-codeFlask_Editor .token.symbol,
.editorjs-codeFlask_Editor .token.deleted {
color: #905;
}
.editorjs-codeFlask_Editor .token.selector,
.editorjs-codeFlask_Editor .token.attr-name,
.editorjs-codeFlask_Editor .token.string,
.editorjs-codeFlask_Editor .token.char,
.editorjs-codeFlask_Editor .token.builtin,
.editorjs-codeFlask_Editor .token.inserted {
color: #690;
}
.editorjs-codeFlask_Editor .token.operator,
.editorjs-codeFlask_Editor .token.entity,
.editorjs-codeFlask_Editor .token.url,
.editorjs-codeFlask_Editor .language-css .token.string,
.editorjs-codeFlask_Editor .style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, 0.5);
}
.editorjs-codeFlask_Editor .token.atrule,
.editorjs-codeFlask_Editor .token.attr-value,
.editorjs-codeFlask_Editor .token.keyword {
color: #07a;
}
.editorjs-codeFlask_Editor .token.function,
.editorjs-codeFlask_Editor .token.class-name {
color: #dd4a68;
}
.editorjs-codeFlask_Editor .token.regex,
.editorjs-codeFlask_Editor .token.important,
.editorjs-codeFlask_Editor .token.variable {
color: #e90;
}
/* 复制按钮样式 */
.editorjs-codeFlask_CopyButton {
background-color: #409eff;
color: white;
border: none;
border-radius: 3px;
padding: 6px 12px;
margin-right: 8px;
font-size: 12px;
cursor: pointer;
transition: background-color 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
min-width: 28px;
height: 28px;
}
.editorjs-codeFlask_CopyButton:hover {
background-color: #66b1ff;
}
.editorjs-codeFlask_CopyButton.copied {
background-color: #67c23a;
}
/* 折叠/展开按钮样式 */
.editorjs-codeFlask_Toggle {
background-color: #909399;
color: white;
border: none;
border-radius: 3px;
padding: 0 8px;
font-size: 12px;
cursor: pointer;
transition: background-color 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
min-width: 28px;
height: 28px;
font-weight: bold;
}
.editorjs-codeFlask_Toggle:hover {
background-color: #a6a9ad;
}
/* 响应式调整 */
@media (max-width: 768px) {
.editorjs-codeFlask_Header {
padding: 6px 8px;
}
.editorjs-codeFlask_Editor .codeflask__textarea,
.editorjs-codeFlask_Editor .codeflask__pre,
.editorjs-codeFlask_Editor .codeflask__code {
font-size: 13px;
line-height: 19px;
padding: 8px;
}
.editorjs-codeFlask_Editor .codeflask.codeflask--has-line-numbers:before {
width: 35px;
}
.editorjs-codeFlask_Editor .codeflask__lines {
width: 35px;
font-size: 12px;
}
}
/* 滚动条样式 - 完全隐藏纵向滚动条 */
.editorjs-codeFlask_Wrapper ::-webkit-scrollbar {
width: 0;/* 纵向滚动条宽度为0 */
height: 6px;/* 横向滚动条保持6px宽度 */
}
.editorjs-codeFlask_Wrapper ::-webkit-scrollbar-track {
background: transparent;
border-radius: 0;
}
.editorjs-codeFlask_Wrapper ::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 0;
}
/* Firefox 滚动条隐藏 */
.editorjs-codeFlask_Wrapper {
scrollbar-width: none;/* Firefox 隐藏纵向滚动条 */
}
.editorjs-codeFlask_Wrapper ::-moz-scrollbar {
width: 0;
height: 6px;
}
/* 焦点状态 */
.editorjs-codeFlask_Wrapper:focus-within {
border-color: #409eff;
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}
/* 只读模式样式 */
.editorjs-codeFlask_Wrapper.readonly .editorjs-codeFlask_Header {
background-color: #f5f7fa;
}
.editorjs-codeFlask_Wrapper.readonly .editorjs-codeFlask_Editor .codeflask__textarea {
cursor: default;
}
/* 确保所有元素正确显示 */
.editorjs-codeFlask_Wrapper * {
box-sizing: border-box;
}
/* 修复行号对齐 */
.editorjs-codeFlask_Editor .codeflask--has-line-numbers .codeflask__textarea,
.editorjs-codeFlask_Editor .codeflask--has-line-numbers .codeflask__pre {
padding-left: 50px;
}
.editorjs-codeFlask_Editor .codeflask--has-line-numbers .codeflask__lines {
padding-top: 10px;
}
/* 语言显示元素 - 添加点击样式 */
.editorjs-codeFlask_LangDisplay {
padding: 2px 8px;
background-color: #409eff;
color: white;
border-radius: 3px;
font-size: 12px;
font-weight: 500;
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
transition: all 0.2s ease;
}
.editorjs-codeFlask_LangDisplay:hover {
background-color: #66b1ff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* 语言选择弹窗 */
.editorjs-codeFlask_LanguagePopup {
background-color: white;
border: 1px solid #dcdfe6;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
width: 250px;
max-height: 300px;
z-index: 1000;
overflow: hidden;
}
/* 搜索框 */
.editorjs-codeFlask_LanguageSearch {
width: 100%;
padding: 8px 12px;
border: none;
border-bottom: 1px solid #ebeef5;
font-size: 12px;
outline: none;
box-sizing: border-box;
}
/* 语言列表 */
.editorjs-codeFlask_LanguagesList {
max-height: 250px;
overflow-y: auto;
}
/* 语言选项 */
.editorjs-codeFlask_LanguageItem {
padding: 8px 12px;
font-size: 12px;
cursor: pointer;
transition: background-color 0.2s ease;
}
.editorjs-codeFlask_LanguageItem:hover {
background-color: #f5f7fa;
}
.editorjs-codeFlask_LanguageItem.selected {
background-color: #ecf5ff;
color: #409eff;
font-weight: 500;
}
/* 滚动条样式 */
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar {
width: 6px;
}
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar-track {
background-color: #f5f7fa;
}
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar-thumb {
background-color: #c0c4cc;
border-radius: 3px;
}
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar-thumb:hover {
background-color: #909399;
}
</style><style type="text/css">
.ce-block {
margin-top: 20px;
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
}
/**
* Plugin styles
*/
.ce-header {
position: relative;
padding: 1px 0px 1px 15px;
margin: 0;
line-height: 1.25em;
outline: none;
margin-bottom: 10px;
}
.ce-header p,
.ce-header div {
padding: 0 !important;
margin: 0 !important;
}
.ce-header::before {
content: "";
background-color: #3e8fe3;
width: 6px;
height: 100%;
position: absolute;
left: 0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
/**
* Styles for Plugin icon in Toolbar
*/
.ce-header__icon {
}
.ce-header::before {
position: absolute;
content: attr(data-placeholder);
color: #707684;
font-weight: normal;
display: none;
cursor: text;
}
.ce-header:empty::before {
display: block;
}
.ce-header:empty:focus::before {
display: none;
}
/* FontSize */
h1.ce-header {
font-size: 2.0em;
}
h2.ce-header {
font-size: 1.7em;
}
h3.ce-header {
font-size: 1.4em;
}
h4.ce-header {
font-size: 1.15em;
}
h5.ce-header {
font-size: 0.95em;
}
h6.ce-header {
font-size: 0.8em;
}
/* Alignment*/
.ce-header--right {
text-align: right;
}
.ce-header--center {
text-align: center;
}
.ce-header--left {
text-align: left;
}
.ce-header--justify {
text-align: justify;
}
</style><style type="text/css">
.ce-block {
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
}
.image-tool {
--bg-color: #cdd1e0;
--front-color: #388ae5;
--border-color: #e8e8eb;
}
.image-tool__image {
border-radius: 3px;
overflow: hidden;
margin-bottom: 10px;
}
.image-tool__image-picture {
max-width: 100%;
vertical-align: bottom;
display: block;
margin-left: auto;
margin-right: auto;
}
.image-tool__image-preloader {
width: 50px;
height: 50px;
border-radius: 50%;
background-size: cover;
margin: auto;
position: relative;
background-color: #cdd1e0;
background-position: center center;
}
.image-tool__image-preloader::after {
content: "";
position: absolute;
z-index: 3;
width: 60px;
height: 60px;
border-radius: 50%;
border: 2px solid #cdd1e0;
border-top-color: #388ae5;
left: 50%;
top: 50%;
margin-top: -30px;
margin-left: -30px;
animation: image-preloader-spin 2s infinite linear;
box-sizing: border-box;
}
.image-tool__caption::before {
position: absolute !important;
content: attr(data-placeholder);
color: #707684;
font-weight: normal;
display: none;
}
.image-tool__caption:empty::before {
display: block;
}
.image-tool__caption:empty:focus::before {
display: none;
}
.image-tool--empty .image-tool__image {
display: none;
}
.image-tool--empty .image-tool__caption, .image-tool--loading .image-tool__caption {
display: none;
}
.image-tool .cdx-button {
display: flex;
align-items: center;
justify-content: center;
}
.image-tool .cdx-button svg {
height: auto;
margin: 0 6px 0 0;
}
.image-tool--filled .cdx-button {
display: none;
}
.image-tool--filled .image-tool__image-preloader {
display: none;
}
.image-tool--loading .image-tool__image {
min-height: 200px;
display: flex;
border: 1px solid #e8e8eb;
background-color: #fff;
}
.image-tool--loading .image-tool__image-picture {
display: none;
}
.image-tool--loading .cdx-button {
display: none;
}
/**
* Tunes
* ----------------
*/
.image-tool--withBorder .image-tool__image {
border: 1px solid #e8e8eb;
}
.image-tool--withBackground .image-tool__image {
padding: 15px;
background: #cdd1e0;
}
.image-tool--withBackground .image-tool__image-picture {
max-width: 60%;
margin: 0 auto;
}
.image-tool--stretched .image-tool__image-picture {
width: 100%;
}
.image-tool__caption {
text-align: center;
font-size: 14px;
color: #a3a3a3;
}
@keyframes image-preloader-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style><style type="text/css">
.inline-code {
background: rgba(250, 239, 240, 0.78);
color: #b44437;
padding: 3px 4px;
border-radius: 5px;
margin: 0 1px;
font-family: inherit;
font-size: 0.86em;
font-weight: 500;
letter-spacing: 0.3px;
}
</style>
页:
[1]