Skip to content

Commit 0ec882d

Browse files
committed
update version
1 parent 819e1aa commit 0ec882d

5 files changed

Lines changed: 11 additions & 32 deletions

File tree

apps/app-pc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@script-example/app-pc",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"private": true,
55
"type": "module",
66
"scripts": {

apps/app-pc/src/pages/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"binds": [],
3-
"description": "这是一个run函数,返回的格式为int类型。",
3+
"description": "<b>run</b> 函数用于执行核心业务逻辑,返回 <code>int</code> 类型的结果。<br><br><span style='color:#e5c07b'>▸ 入参</span><br> request: <code>MyScriptRequest</code> 请求对象,包含 count、test 等字段<br><span style='color:#e5c07b'>▸ 返回值</span><br> <code>Integer</code> 处理后的整型结果<br><span style='color:#e5c07b'>▸ 示例</span><br> <code style='background:rgba(255,255,255,0.08);padding:2px 6px;border-radius:3px'>def result = run(request)</code><br><br><em>注意:request 中的 count 字段必须大于 0,否则将抛出异常。</em>",
44
"mainMethod": "run",
55
"requests": [
66
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coding-script/root",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "script-engine",
55
"main": "index.js",
66
"scripts": {

packages/script-engine/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coding-script/script-engine",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "script-engine components",
55
"keywords": [
66
"coding-script",

packages/script-engine/src/components/toolbar.tsx

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,6 @@ function calcTooltipPos(anchorRect: DOMRect, el: HTMLDivElement | null): Tooltip
6767
return { top, left, maxWidth, maxHeight: Math.max(maxHeight, 80) };
6868
}
6969

70-
// ── 描述行解析:key: value 高亮 ──────────────────────────────────
71-
72-
const KV_RE = /^([^:]+):\s*([\s\S]+)$/;
73-
74-
function renderDescLine(line: string, accent: string): React.ReactNode {
75-
const m = line.match(KV_RE);
76-
if (m) {
77-
return (
78-
<span>
79-
<span style={{ color: accent, fontWeight: 600 }}>{m[1]}</span>
80-
<span>: {m[2]}</span>
81-
</span>
82-
);
83-
}
84-
return line;
85-
}
8670

8771
// ── 问号图标 ─────────────────────────────────────────────────────
8872

@@ -170,9 +154,9 @@ export const Toolbar: React.FC<ToolbarProps> = ({
170154
if (!description) setShowDesc(false);
171155
}, [description]);
172156

173-
const descLines = description
174-
? description.replace(/\\n/g, '\n').split('\n').filter((l) => l.trim())
175-
: [];
157+
const descHtml = description
158+
? description.replace(/\\n/g, '\n').replace(/\n/g, '<br>')
159+
: '';
176160

177161
const handleThemeToggle = () => {
178162
const next = isDark ? 'light' : 'dark';
@@ -211,7 +195,7 @@ export const Toolbar: React.FC<ToolbarProps> = ({
211195

212196

213197
{/* 脚本说明按钮 */}
214-
{descLines.length > 0 && (
198+
{descHtml && (
215199
<ToolbarButton
216200
ref={descBtnRef}
217201
label={
@@ -316,7 +300,7 @@ export const Toolbar: React.FC<ToolbarProps> = ({
316300
{toolbarExtra}
317301

318302
{/* 脚本说明 Tooltip(fixed 定位,脱离滚动容器) */}
319-
{showDesc && tipPos && descLines.length > 0 && (
303+
{showDesc && tipPos && descHtml && (
320304
<div
321305
ref={tipRef}
322306
style={{
@@ -338,13 +322,8 @@ export const Toolbar: React.FC<ToolbarProps> = ({
338322
boxShadow: '0 4px 16px rgba(0,0,0,0.3)',
339323
pointerEvents: 'auto',
340324
}}
341-
>
342-
{descLines.map((line, i) => (
343-
<div key={i} style={{ marginBottom: i < descLines.length - 1 ? 4 : 0 }}>
344-
{renderDescLine(line, colors.accent)}
345-
</div>
346-
))}
347-
</div>
325+
dangerouslySetInnerHTML={{ __html: descHtml }}
326+
/>
348327
)}
349328
</div>
350329
);

0 commit comments

Comments
 (0)