This commit is contained in:
1 parent
ba9a4448e4
commit
eb6880b11f
4 files changed
+13
-6
No files matched your search
+5
-2
@@ -1,4 +1,4 @@
|
|||||||
# sticky · 便利贴(v1.0.4)
|
# sticky · 便利贴(v1.0.5)
|
||||||
|
|
||||||
画布上的便签节点:一张纸片,写多行文字,能调字号、粗细、背景色,能拖大拖小。
|
画布上的便签节点:一张纸片,写多行文字,能调字号、粗细、背景色,能拖大拖小。
|
||||||
**不连线、不进生图链路**——纯标注用途(说明节点、分组标题、随手记)。
|
**不连线、不进生图链路**——纯标注用途(说明节点、分组标题、随手记)。
|
||||||
@@ -29,6 +29,9 @@
|
|||||||
> v1.0.4 修掉最后一行空白:textarea 没写 `rows`,浏览器默认是 **2 行**;`fitBody()` 把高度
|
> v1.0.4 修掉最后一行空白:textarea 没写 `rows`,浏览器默认是 **2 行**;`fitBody()` 把高度
|
||||||
> 设成 `auto` 再读 `scrollHeight` 时,单行文字也被算成两行高,于是一行字和两行字的便签一样高。
|
> 设成 `auto` 再读 `scrollHeight` 时,单行文字也被算成两行高,于是一行字和两行字的便签一样高。
|
||||||
> 现在显式 `rows="1"`,`scrollHeight` 才等于真实内容行数;多行文本照常换行、高度跟着涨。
|
> 现在显式 `rows="1"`,`scrollHeight` 才等于真实内容行数;多行文本照常换行、高度跟着涨。
|
||||||
|
>
|
||||||
|
> v1.0.5 统一圆角:纸片内圈从写死的 10px 改成 `calc(var(--iwb-node-radius, 14px) - 1px)`,
|
||||||
|
> 与宿主节点选中框(外圈 14px + 1px 边框)对齐,选中时两层边缘不再错开。
|
||||||
|
|
||||||
## 长什么样
|
## 长什么样
|
||||||
|
|
||||||
@@ -94,7 +97,7 @@
|
|||||||
## 校验
|
## 校验
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node sticky/tools/harness.mjs # 纯 node,50 项:注册/渲染/字号无上限/贴字自适应/rows=1/外框 minHeight 校正/色板定位/双击编辑/换色/文本/幂等/插入
|
node sticky/tools/harness.mjs # 纯 node,51 项:注册/渲染/字号无上限/贴字自适应/rows=1/外框 minHeight 校正/圆角对齐/色板定位/双击编辑/换色/文本/幂等/插入
|
||||||
npm run validate # 全仓契约校验
|
npm run validate # 全仓契约校验
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@iwb-plugin/sticky",
|
"name": "@iwb-plugin/sticky",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯标注节点不连线",
|
"description": "画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯标注节点不连线",
|
||||||
"ibwPlugin": {
|
"ibwPlugin": {
|
||||||
"id": "sticky",
|
"id": "sticky",
|
||||||
|
|||||||
+4
-2
@@ -35,7 +35,9 @@
|
|||||||
// ---- 节点体 ----
|
// ---- 节点体 ----
|
||||||
// 宿主容器 .iwb-plugin-node-body 是 flex 列且 padding:0;这里必须 flex:1 撑满,
|
// 宿主容器 .iwb-plugin-node-body 是 flex 列且 padding:0;这里必须 flex:1 撑满,
|
||||||
// 不能只写 height:100%(WKWebView 下百分比对 flex 项算不准,拖大后下半露出宿主底色)。
|
// 不能只写 height:100%(WKWebView 下百分比对 flex 项算不准,拖大后下半露出宿主底色)。
|
||||||
'.iwb-sticky-node{position:relative;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;width:100%;box-sizing:border-box;border-radius:10px;overflow:visible}' +
|
// 圆角对齐宿主节点:外框 .iwb-node 用 var(--iwb-node-radius)=14px 且有 1px 边框,
|
||||||
|
// 纸片在框内 ⇒ 内圈半径 = 外圈 - 1px,选中时两层边缘才不会错开。
|
||||||
|
'.iwb-sticky-node{position:relative;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;width:100%;box-sizing:border-box;border-radius:calc(var(--iwb-node-radius, 14px) - 1px);overflow:visible}' +
|
||||||
'.iwb-sticky-tools{display:flex;align-items:center;gap:6px;padding:6px 8px;border-bottom:1px solid rgba(0,0,0,.08);flex:0 0 auto;position:relative;z-index:2}' +
|
'.iwb-sticky-tools{display:flex;align-items:center;gap:6px;padding:6px 8px;border-bottom:1px solid rgba(0,0,0,.08);flex:0 0 auto;position:relative;z-index:2}' +
|
||||||
'.iwb-sticky-btn{cursor:pointer;border:1px solid rgba(0,0,0,.2);border-radius:6px;background:transparent;color:inherit;font-size:11px;padding:2px 6px;font-family:inherit;line-height:1.4;user-select:none}' +
|
'.iwb-sticky-btn{cursor:pointer;border:1px solid rgba(0,0,0,.2);border-radius:6px;background:transparent;color:inherit;font-size:11px;padding:2px 6px;font-family:inherit;line-height:1.4;user-select:none}' +
|
||||||
'.iwb-sticky-btn:hover{background:rgba(0,0,0,.07)}' +
|
'.iwb-sticky-btn:hover{background:rgba(0,0,0,.07)}' +
|
||||||
@@ -416,7 +418,7 @@
|
|||||||
global.IWBPluginHost.register({
|
global.IWBPluginHost.register({
|
||||||
id: 'sticky',
|
id: 'sticky',
|
||||||
name: '便利贴',
|
name: '便利贴',
|
||||||
version: '1.0.4',
|
version: '1.0.5',
|
||||||
apiVersion: 1,
|
apiVersion: 1,
|
||||||
capabilities: ['panels', 'nodeTypes', 'canvas'],
|
capabilities: ['panels', 'nodeTypes', 'canvas'],
|
||||||
}, function (ctx) {
|
}, function (ctx) {
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ const r = runPlugin()
|
|||||||
|
|
||||||
check('manifest.id = sticky', r.manifest.id === 'sticky')
|
check('manifest.id = sticky', r.manifest.id === 'sticky')
|
||||||
check('manifest.name = 便利贴', r.manifest.name === '便利贴')
|
check('manifest.name = 便利贴', r.manifest.name === '便利贴')
|
||||||
check('manifest.version = 1.0.4', r.manifest.version === '1.0.4')
|
check('manifest.version = 1.0.5', r.manifest.version === '1.0.5')
|
||||||
check('manifest.apiVersion = 1', r.manifest.apiVersion === 1)
|
check('manifest.apiVersion = 1', r.manifest.apiVersion === 1)
|
||||||
check('capabilities 含 panels/nodeTypes/canvas',
|
check('capabilities 含 panels/nodeTypes/canvas',
|
||||||
['panels', 'nodeTypes', 'canvas'].every((c) => r.manifest.capabilities.includes(c)))
|
['panels', 'nodeTypes', 'canvas'].every((c) => r.manifest.capabilities.includes(c)))
|
||||||
@@ -255,6 +255,8 @@ const ta = findByClass(nh.h, 'iwb-sticky-body')
|
|||||||
check('正文默认只读(单击穿透给节点选中/拖动)', ta.readOnly === true && ta.getAttribute('readonly') !== null)
|
check('正文默认只读(单击穿透给节点选中/拖动)', ta.readOnly === true && ta.getAttribute('readonly') !== null)
|
||||||
const injectedCss = (findById(r.head, 'iwb-sticky-style') || {}).textContent || ''
|
const injectedCss = (findById(r.head, 'iwb-sticky-style') || {}).textContent || ''
|
||||||
check('根容器 flex:1 撑满宿主(修拖动后漏底)', /\.iwb-sticky-node\{[^}]*flex:1 1 auto/.test(injectedCss))
|
check('根容器 flex:1 撑满宿主(修拖动后漏底)', /\.iwb-sticky-node\{[^}]*flex:1 1 auto/.test(injectedCss))
|
||||||
|
check('纸片圆角对齐宿主节点(node-radius - 1px 边框)',
|
||||||
|
/\.iwb-sticky-node\{[^}]*border-radius:calc\(var\(--iwb-node-radius, 14px\) - 1px\)/.test(injectedCss))
|
||||||
const rootNode = findByClass(nh.h, 'iwb-sticky-node')
|
const rootNode = findByClass(nh.h, 'iwb-sticky-node')
|
||||||
const dblEv = { target: ta, stopPropagation() {} }
|
const dblEv = { target: ta, stopPropagation() {} }
|
||||||
rootNode.fire('dblclick', dblEv)
|
rootNode.fire('dblclick', dblEv)
|
||||||
|
|||||||
Reference in new issue
Block a user