This commit is contained in:
1 parent
e7f8e68909
commit
9959096ab3
4 files changed
+30
-6
No files matched your search
+7
-3
@@ -1,4 +1,4 @@
|
||||
# sticky · 便利贴(v1.0.6)
|
||||
# sticky · 便利贴(v1.0.7)
|
||||
|
||||
画布上的便签节点:一张纸片,写多行文字,能调字号、粗细、背景色,能拖大拖小。
|
||||
**不连线、不进生图链路**——纯标注用途(说明节点、分组标题、随手记)。
|
||||
@@ -37,6 +37,10 @@
|
||||
> 但文本从两行删回一行时这个 h 没跟着降,外框就一直留着两行高。现在区分**自动跟随**与
|
||||
> **用户手动拖尺寸**:自动写出的 h 双向贴合内容(长高就涨、缩回就降);用户拖手柄改过 h
|
||||
> 后退出自动跟随,手动尺寸照旧保留。
|
||||
>
|
||||
> v1.0.7 修自定义调色后面板不退出:预设色块点完会收起,但色轮走的是隐藏的原生
|
||||
> `<input type="color">`,`change` 回调只写 `bgColor`、没关浮层,选完色色板仍压在便签上。
|
||||
> 现在**点色轮打开系统取色器时即收起**(确认/取消都不留浮层),自定义色 `change` 到达时再兜底收一次。
|
||||
|
||||
## 长什么样
|
||||
|
||||
@@ -47,7 +51,7 @@
|
||||
| `−` / `+` | 字号缩放,每步 ±2,下限 6、**无上限** |
|
||||
| `B` | 正文粗细在 400 / 600 间切换(按钮高亮表示已加粗) |
|
||||
| 圆点 | 展开色板:8 个预设色 + 底部彩虹色轮;**色板落在圆点正下方**,不挡 resize 手柄 |
|
||||
| 色轮 | 调起系统颜色选择器,可选任意色 |
|
||||
| 色轮 | 调起系统颜色选择器,可选任意色;点开即收起色板,选完色不再压在便签上 |
|
||||
| 正文区 | 多行 textarea,透明底,随字号自动换行;**单击=选中/拖动节点,双击=进入编辑,失焦/ESC 退出** |
|
||||
|
||||
选中节点后宿主自带的浮动气泡(信息 / 删除、复制、缩放手柄)照常出现,不是本插件画的。
|
||||
@@ -103,7 +107,7 @@
|
||||
## 校验
|
||||
|
||||
```bash
|
||||
node sticky/tools/harness.mjs # 纯 node,53 项:注册/渲染/字号无上限/贴字自适应/rows=1/外框 minHeight 双向回缩/圆角对齐/色板定位/双击编辑/换色/文本/幂等/插入
|
||||
node sticky/tools/harness.mjs # 纯 node,58 项:注册/渲染/字号无上限/贴字自适应/rows=1/外框 minHeight 双向回缩/圆角对齐/色板定位/自定义色后面板收起/双击编辑/换色/文本/幂等/插入
|
||||
npm run validate # 全仓契约校验
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@iwb-plugin/sticky",
|
||||
"private": true,
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"description": "画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯标注节点不连线",
|
||||
"ibwPlugin": {
|
||||
"id": "sticky",
|
||||
|
||||
+6
-1
@@ -218,6 +218,9 @@
|
||||
}
|
||||
var act = t.getAttribute && t.getAttribute('data-act')
|
||||
if (act === 'wheel') {
|
||||
// 点开系统取色器后这个浮层就完成使命:无论最终确认还是取消都先收起,
|
||||
// 避免取色器关闭后色板还压在便签上(用户报的“自定义调色后面板不退出”)。
|
||||
st.palOpen = false; pal.hidden = true
|
||||
try { colorInput.click() } catch (e2) { /* noop */ }
|
||||
}
|
||||
}
|
||||
@@ -227,6 +230,8 @@
|
||||
var up = st.props && st.props.onUpdate
|
||||
var id = st.node && st.node.id
|
||||
if (up && id && e.target && e.target.value) up(id, { bgColor: e.target.value })
|
||||
// 自定义色确认后兜底再收一次(个别平台 change 先于上面的收起逻辑到达)。
|
||||
st.palOpen = false; pal.hidden = true
|
||||
}
|
||||
colorInput.addEventListener('change', onColor)
|
||||
|
||||
@@ -436,7 +441,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'sticky',
|
||||
name: '便利贴',
|
||||
version: '1.0.6',
|
||||
version: '1.0.7',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'nodeTypes', 'canvas'],
|
||||
}, function (ctx) {
|
||||
|
||||
@@ -127,7 +127,7 @@ const r = runPlugin()
|
||||
|
||||
check('manifest.id = sticky', r.manifest.id === 'sticky')
|
||||
check('manifest.name = 便利贴', r.manifest.name === '便利贴')
|
||||
check('manifest.version = 1.0.6', r.manifest.version === '1.0.6')
|
||||
check('manifest.version = 1.0.7', r.manifest.version === '1.0.7')
|
||||
check('manifest.apiVersion = 1', r.manifest.apiVersion === 1)
|
||||
check('capabilities 含 panels/nodeTypes/canvas',
|
||||
['panels', 'nodeTypes', 'canvas'].every((c) => r.manifest.capabilities.includes(c)))
|
||||
@@ -269,6 +269,21 @@ check('点色块写 bgColor=#EF9F27', nh.h.__updates.some((u) => u.patch.bgColor
|
||||
check('选色后色板收起', pal.hidden === true)
|
||||
check('有色轮自定义按钮', !!findByAct(nh.h, 'wheel'))
|
||||
|
||||
// v1.0.7:自定义调色(色轮)也必须自动收起面板
|
||||
paletteBtn.fire('click', { target: paletteBtn })
|
||||
check('再次展开色板(自定义调色前)', pal.hidden === false)
|
||||
const wheelBtn = findByAct(nh.h, 'wheel')
|
||||
wheelBtn.fire('click', { target: wheelBtn })
|
||||
check('点色轮打开取色器时色板自动收起', pal.hidden === true)
|
||||
const colorInput = findByAct(nh.h, 'color')
|
||||
check('有隐藏的原生取色 input', !!colorInput && colorInput.tagName === 'INPUT')
|
||||
paletteBtn.fire('click', { target: paletteBtn })
|
||||
nh.h.__updates.length = 0
|
||||
colorInput.value = '#C0392B'
|
||||
colorInput.fire('change', { target: colorInput })
|
||||
check('自定义色写回 bgColor', nh.h.__updates.some((u) => u.patch.bgColor === '#C0392B'))
|
||||
check('自定义色确认后色板保持收起', pal.hidden === true)
|
||||
|
||||
// ---- 单击选中 / 双击编辑状态机 ----
|
||||
const ta = findByClass(nh.h, 'iwb-sticky-body')
|
||||
check('正文默认只读(单击穿透给节点选中/拖动)', ta.readOnly === true && ta.getAttribute('readonly') !== null)
|
||||
|
||||
Reference in new issue
Block a user