An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:lipstick: Improve mind map, iframe and widget resize handles https://github.com/siyuan-note/siyuan/issues/20017
Daniel45f864758d3c
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.syindex 205237724f..cce3b2a9cd 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy@@ -6,7 +6,7 @@"id": "20200924101225-k254i8g","title": "Content Block Type","type": "doc",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -1405,7 +1405,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091538-a55chyw",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2533,7 +2533,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-r1kfene",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2694,12 +2694,12 @@"Type": "NodeParagraph","Properties": {"id": "20261001015635-3w0f58c",- "updated": "20261001015635"+ "updated": "20261002002136"},"Children": [{"Type": "NodeText",- "Data": "Hover over the outer frame to reveal the resize handles. Drag the right edge to change width, the bottom edge to change height, or the bottom-right corner to change both. On touch devices, drag the handles directly. This changes the block size in the document, not the canvas zoom. Releasing saves one undoable change; press "+ "Data": "Hover over the outer frame to reveal the small handles outside the border. Drag the handle at the center of the right edge to change width, the one at the center of the bottom edge to change height, or the rounded bottom-right handle to change both. On touch devices, drag the handles directly. This changes the block size in the document, not the canvas zoom. Releasing saves one undoable change; press "},{"Type": "NodeTextMark",diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.syindex 4578424349..83744d9e84 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy@@ -8,7 +8,7 @@"title": "Formatting elements","title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;","type": "doc",- "updated": "20260929221400"+ "updated": "20261002002136"},"Children": [{@@ -4061,7 +4061,7 @@"HeadingLevel": 2,"Properties": {"id": "20210604230350-ql890l0",- "updated": "20210608004924"+ "updated": "20261002002136"},"Children": [{@@ -4079,6 +4079,20 @@"updated": "20220909095329"}},+ {+ "ID": "20261002002136-2v39dr6",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-2v39dr6",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Hover over the block to reveal the small handles outside its border. Drag the handle at the center of the right edge to change width, the one at the center of the bottom edge to change height, or the rounded bottom-right handle to change both. On touch devices, drag the handles directly; changing one dimension preserves the other."+ }+ ]+ },{"ID": "20210608121322-k9l5wuv","Type": "NodeHeading",diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210824202056-udkf7wg.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210824202056-udkf7wg.syindex ea0053ca6a..7d9d321eed 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210824202056-udkf7wg.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210824202056-udkf7wg.sy@@ -6,7 +6,7 @@"id": "20210824202056-udkf7wg","title": "Widgets","type": "doc",- "updated": "20260809232000"+ "updated": "20261002002136"},"Children": [{@@ -86,7 +86,7 @@"HeadingLevel": 2,"Properties": {"id": "20210824202107-3zt4469",- "updated": "20210824202323"+ "updated": "20261002002136"},"Children": [{@@ -118,6 +118,20 @@}]},+ {+ "ID": "20261002002136-7ap8ig7",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-7ap8ig7",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Hover over the block to reveal the small handles outside its border. Drag the handle at the center of the right edge to change width, the one at the center of the bottom edge to change height, or the rounded bottom-right handle to change both. On touch devices, drag the handles directly; changing one dimension preserves the other."+ }+ ]+ },{"ID": "20211222095842-700ar7j","Type": "NodeHeading",diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.syindex 73e4ef0198..040b79446d 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy@@ -8,7 +8,7 @@"title": "排版元素","title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);","type": "doc",- "updated": "20260929221400"+ "updated": "20261002002136"},"Children": [{@@ -4056,7 +4056,7 @@"HeadingLevel": 2,"Properties": {"id": "20210604183551-ob6f6wk",- "updated": "20210608004838"+ "updated": "20261002002136"},"Children": [{@@ -4074,6 +4074,20 @@"updated": "20220908200902"}},+ {+ "ID": "20261002002136-ke75879",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-ke75879",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "将鼠标移到块上即可显示边框外的小尺寸手柄:拖动右侧中间的手柄调整宽度,拖动底部中间的手柄调整高度,拖动右下角的圆角手柄同时调整宽高。触屏可直接拖动手柄,单独调整宽度或高度时会保留另一项尺寸。"+ }+ ]+ },{"ID": "20210608113637-i04ffr2","Type": "NodeHeading",diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.syindex 6974d14d09..49557fe8d4 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy@@ -6,7 +6,7 @@"id": "20200905090211-2vixtlf","title": "内容块类型","type": "doc",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -1438,7 +1438,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104090624-9qgquxh",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2612,7 +2612,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-j34ty5i",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2773,12 +2773,12 @@"Type": "NodeParagraph","Properties": {"id": "20261001015635-u2ja640",- "updated": "20261001015635"+ "updated": "20261002002136"},"Children": [{"Type": "NodeText",- "Data": "将鼠标移到脑图外框上即可显示尺寸手柄:拖动右边缘调整宽度,拖动下边缘调整高度,拖动右下角同时调整宽高;触屏可直接拖动手柄。此操作调整脑图块在文档中的尺寸,不改变画布缩放比例。松手后保存一次可撤销的修改;按 "+ "Data": "将鼠标移到脑图外框上即可显示边框外的小尺寸手柄:拖动右侧中间的手柄调整宽度,拖动底部中间的手柄调整高度,拖动右下角的圆角手柄同时调整宽高;触屏可直接拖动手柄。此操作调整脑图块在文档中的尺寸,不改变画布缩放比例。松手后保存一次可撤销的修改;按 "},{"Type": "NodeTextMark",diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210824201257-cy7icrc.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210824201257-cy7icrc.syindex 925cdf4a03..3a577e76aa 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210824201257-cy7icrc.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210824201257-cy7icrc.sy@@ -6,7 +6,7 @@"id": "20210824201257-cy7icrc","title": "挂件","type": "doc",- "updated": "20260809232000"+ "updated": "20261002002136"},"Children": [{@@ -78,7 +78,7 @@"HeadingLevel": 2,"Properties": {"id": "20210824201352-9vey615",- "updated": "20210824202222"+ "updated": "20261002002136"},"Children": [{@@ -110,6 +110,20 @@}]},+ {+ "ID": "20261002002136-lrwocp1",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-lrwocp1",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "将鼠标移到块上即可显示边框外的小尺寸手柄:拖动右侧中间的手柄调整宽度,拖动底部中间的手柄调整高度,拖动右下角的圆角手柄同时调整宽高。触屏可直接拖动手柄,单独调整宽度或高度时会保留另一项尺寸。"+ }+ ]+ },{"ID": "20211222095016-3jjm95h","Type": "NodeHeading",diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.syindex 1db0a39f2a..15f7e4c6a4 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy@@ -6,7 +6,7 @@"id": "20211226120147-ib6yy3i","title": "內容區塊類型","type": "doc",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -1434,7 +1434,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226120227-esm6f20",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2548,7 +2548,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-cfx2ewc",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2709,12 +2709,12 @@"Type": "NodeParagraph","Properties": {"id": "20261001015635-x8m40zw",- "updated": "20261001015635"+ "updated": "20261002002136"},"Children": [{"Type": "NodeText",- "Data": "將滑鼠移到心智圖外框上即可顯示尺寸控制點:拖曳右邊緣調整寬度,拖曳下邊緣調整高度,拖曳右下角同時調整寬高;觸控螢幕可直接拖曳控制點。此操作調整心智圖區塊在文件中的尺寸,不改變畫布縮放比例。放開後儲存一次可復原的修改;按 "+ "Data": "將滑鼠移到心智圖外框上即可顯示邊框外的小尺寸控制點:拖曳右側中間的控制點調整寬度,拖曳底部中間的控制點調整高度,拖曳右下角的圓角控制點同時調整寬高;觸控螢幕可直接拖曳控制點。此操作調整心智圖區塊在文件中的尺寸,不改變畫布縮放比例。放開後儲存一次可復原的修改;按 "},{"Type": "NodeTextMark",diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.syindex 1325644741..58f5adddb7 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy@@ -8,7 +8,7 @@"title": "排版元素","title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);","type": "doc",- "updated": "20260929221400"+ "updated": "20261002002136"},"Children": [{@@ -4055,7 +4055,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226122008-zl8npgo",- "updated": "20211226122008"+ "updated": "20261002002136"},"Children": [{@@ -4073,6 +4073,20 @@"updated": "20220909095422"}},+ {+ "ID": "20261002002136-cjh38oq",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-cjh38oq",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "將滑鼠移到區塊上即可顯示邊框外的小尺寸控制點:拖曳右側中間的控制點調整寬度,拖曳底部中間的控制點調整高度,拖曳右下角的圓角控制點同時調整寬高。觸控螢幕可直接拖曳控制點,單獨調整寬度或高度時會保留另一項尺寸。"+ }+ ]+ },{"ID": "20211226122008-je7yc30","Type": "NodeHeading",diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123101-qjw03ab.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123101-qjw03ab.syindex 97326b9152..e21441a075 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123101-qjw03ab.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123101-qjw03ab.sy@@ -6,7 +6,7 @@"id": "20211226123101-qjw03ab","title": "小工具","type": "doc",- "updated": "20260809232000"+ "updated": "20261002002136"},"Children": [{@@ -78,7 +78,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226123118-fqy6ibk",- "updated": "20211226005327"+ "updated": "20261002002136"},"Children": [{@@ -110,6 +110,20 @@}]},+ {+ "ID": "20261002002136-0dv9g8q",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-0dv9g8q",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "將滑鼠移到區塊上即可顯示邊框外的小尺寸控制點:拖曳右側中間的控制點調整寬度,拖曳底部中間的控制點調整高度,拖曳右下角的圓角控制點同時調整寬高。觸控螢幕可直接拖曳控制點,單獨調整寬度或高度時會保留另一項尺寸。"+ }+ ]+ },{"ID": "20211226123118-9luabq8","Type": "NodeHeading",diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-5gi76ax.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-5gi76ax.syindex 62729d16b6..33aa9ba8ca 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-5gi76ax.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-5gi76ax.sy@@ -7,7 +7,7 @@"id": "20240530101000-5gi76ax","title": "ウィジェット","type": "doc",- "updated": "20260809232000"+ "updated": "20261002002136"},"Children": [{@@ -79,7 +79,7 @@"Properties": {"ID": "20240530101000-hw8mkkp","id": "20240530101000-51f06sm",- "updated": "20240530101000"+ "updated": "20261002002136"},"Children": [{@@ -121,6 +121,20 @@}]},+ {+ "ID": "20261002002136-5fi5hoi",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-5fi5hoi",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "ブロックにマウスカーソルを合わせると、枠の外側に小さなサイズ変更ハンドルが表示されます。右側中央のハンドルをドラッグすると幅、下側中央のハンドルは高さ、右下の丸い角のハンドルは両方を変更できます。タッチ操作ではハンドルを直接ドラッグします。幅または高さだけを変更する場合、もう一方のサイズは維持されます。"+ }+ ]+ },{"ID": "20240530101000-v1ifwqn","Type": "NodeHeading",diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.syindex 45229c3eb1..820d9e1556 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy@@ -7,7 +7,7 @@"id": "20240530101000-35bbvcx","title": "コンテンツブロックの種類","type": "doc",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -1491,7 +1491,7 @@"Properties": {"ID": "20240530101000-rjjxxn8","id": "20240530101000-p035stn",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2699,7 +2699,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-odykie5",- "updated": "20261001051950"+ "updated": "20261002002136"},"Children": [{@@ -2860,12 +2860,12 @@"Type": "NodeParagraph","Properties": {"id": "20261001015635-ganogsj",- "updated": "20261001015635"+ "updated": "20261002002136"},"Children": [{"Type": "NodeText",- "Data": "外枠にマウスカーソルを合わせると、サイズ変更ハンドルが表示されます。右端をドラッグすると幅、下端は高さ、右下の角は両方を変更できます。タッチ操作ではハンドルを直接ドラッグします。文書内のブロックのサイズが変わり、キャンバスのズーム倍率は変わりません。指を離すと元に戻せる一回の変更として保存されます。"+ "Data": "外枠にマウスカーソルを合わせると、枠の外側に小さなサイズ変更ハンドルが表示されます。右側中央のハンドルで幅、下側中央のハンドルで高さ、右下の丸い角のハンドルで両方を変更できます。タッチ操作ではハンドルを直接ドラッグします。文書内のブロックのサイズが変わり、キャンバスのズーム倍率は変わりません。指を離すと元に戻せる一回の変更として保存されます。"},{"Type": "NodeTextMark",diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.syindex 4f55bc1fc5..96cf5a9e36 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy@@ -9,7 +9,7 @@"title": "書式要素","title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;","type": "doc",- "updated": "20260929221400"+ "updated": "20261002002136"},"Children": [{@@ -4229,7 +4229,7 @@"Properties": {"ID": "20240530101000-5be67rn","id": "20240530101000-7nhcll9",- "updated": "20240530101000"+ "updated": "20261002002136"},"Children": [{@@ -4248,6 +4248,20 @@"updated": "20240530101000"}},+ {+ "ID": "20261002002136-ika0ql3",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261002002136-ika0ql3",+ "updated": "20261002002136"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "ブロックにマウスカーソルを合わせると、枠の外側に小さなサイズ変更ハンドルが表示されます。右側中央のハンドルをドラッグすると幅、下側中央のハンドルは高さ、右下の丸い角のハンドルは両方を変更できます。タッチ操作ではハンドルを直接ドラッグします。幅または高さだけを変更する場合、もう一方のサイズは維持されます。"+ }+ ]+ },{"ID": "20240530101000-8t5ocsw","Type": "NodeHeading",diff --git a/app/src/assets/scss/protyle/_block-resize.scss b/app/src/assets/scss/protyle/_block-resize.scssnew file mode 100644index 0000000000..21cb205f0e--- /dev/null+++ b/app/src/assets/scss/protyle/_block-resize.scss@@ -0,0 +1,125 @@+.protyle-block-resize {+ position: absolute;+ z-index: 6;+ touch-action: none;+ user-select: none;+ box-sizing: border-box;+ opacity: 0;+ color: var(--b3-theme-on-surface-light);++ &::after {+ content: "";+ position: absolute;+ pointer-events: none;+ box-sizing: border-box;+ }++ &[data-resize-axis="width"] {+ width: 12px;+ height: min(40px, 50%);+ right: -12px;+ top: 50%;+ transform: translateY(-50%);+ cursor: ew-resize;++ &::after {+ width: 3px;+ height: min(24px, 100%);+ left: 4px;+ top: 50%;+ transform: translateY(-50%);+ border-radius: 2px;+ background-color: currentColor;+ }+ }++ &[data-resize-axis="height"] {+ height: 12px;+ width: min(40px, 50%);+ bottom: -12px;+ left: 50%;+ transform: translateX(-50%);+ cursor: ns-resize;++ &::after {+ height: 3px;+ width: min(24px, 100%);+ top: 4px;+ left: 50%;+ transform: translateX(-50%);+ border-radius: 2px;+ background-color: currentColor;+ }+ }++ &[data-resize-axis="both"] {+ width: 24px;+ height: 24px;+ right: -16px;+ bottom: -16px;+ cursor: nwse-resize;++ &::after {+ width: 16px;+ height: 16px;+ right: 4px;+ bottom: 4px;+ border-right: 3px solid currentColor;+ border-bottom: 3px solid currentColor;+ border-bottom-right-radius: 10px;+ }+ }++ &:hover,+ &:focus-visible {+ color: var(--b3-theme-on-surface);+ }++ &:focus-visible {+ outline: 1px solid var(--b3-theme-primary);+ outline-offset: -2px;+ }++ &.touch-resize-active {+ opacity: 1;+ color: var(--b3-theme-primary);+ background-color: transparent;+ }+}++@media (any-pointer: coarse) {+ // 外侧命中区域为触屏加宽,装饰尺寸保持不变。+ .protyle-block-resize {+ opacity: 1;++ &[data-resize-axis="width"] {+ width: 20px;+ right: -20px;+ height: min(48px, 50%);+ }++ &[data-resize-axis="height"] {+ height: 20px;+ bottom: -20px;+ width: min(48px, 50%);+ }++ &[data-resize-axis="both"] {+ width: 32px;+ height: 32px;+ right: -24px;+ bottom: -24px;++ &::after {+ right: 12px;+ bottom: 12px;+ }+ }+ }+}++@media print {+ .protyle-block-resize {+ display: none;+ }+}diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scssindex af56f05b9d..52f1e10780 100644--- a/app/src/assets/scss/protyle/_mindmap-view.scss+++ b/app/src/assets/scss/protyle/_mindmap-view.scss@@ -30,7 +30,8 @@height: var(--mindmap-view-height, 460px);min-height: min(260px, var(--mindmap-view-height, 260px));box-sizing: border-box;- overflow: hidden;+ // 画布由内部视口裁剪,外侧尺寸把手保持可见。+ overflow: visible;border: 1px solid var(--b3-border-color);border-radius: var(--b3-border-radius);background: var(--b3-theme-background);@@ -98,41 +99,6 @@flex: 1;}- &__resize {- z-index: 5;- opacity: 0;-- &.resize__r {- right: 0;- top: 42px;- bottom: 16px;- }-- &.resize__d {- bottom: 0;- right: 16px;- }-- &.resize__rd {- right: 0;- bottom: 0;- }-- &::before {- content: "";- position: absolute;- inset: 2px;- border-radius: var(--b3-border-radius);- background-color: var(--b3-theme-surface-lighter);- pointer-events: none;- }-- &:focus-visible {- outline: 1px solid var(--b3-theme-primary);- outline-offset: -2px;- }- }-&:hover &__resize,&:focus-within &__resize,&__resize.touch-resize-active {@@ -222,6 +188,7 @@flex: 1;min-height: 0;overflow: hidden;+ border-radius: inherit;cursor: default;touch-action: none;user-select: none;@@ -876,29 +843,6 @@height: 28px;}- // 脑图把手位于边框内,不沿用外层弹窗向外扩展的触摸定位。- .mindmap-view > .mindmap-view__resize {- opacity: 1;-- &.resize__r {- width: 14px;- right: 0;- bottom: 24px;- }-- &.resize__d {- height: 14px;- bottom: 0;- right: 24px;- }-- &.resize__rd {- width: 24px;- height: 24px;- right: 0;- bottom: 0;- }- }}@media print {diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scssindex 42d4511c85..72654dd297 100644--- a/app/src/assets/scss/protyle/_protyle.scss+++ b/app/src/assets/scss/protyle/_protyle.scss@@ -3,6 +3,7 @@@use "wysiwyg" as *;@use "attr" as *;@use "mindmap-view" as *;+@use "block-resize" as *;.protyle-lite-fragment .protyle-action__menu {display: none;diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scssindex aff725ba69..c9810629e9 100644--- a/app/src/assets/scss/protyle/_wysiwyg.scss+++ b/app/src/assets/scss/protyle/_wysiwyg.scss@@ -729,7 +729,7 @@}}- .protyle-action__drag {+ &:not([data-type="NodeIFrame"]):not([data-type="NodeWidget"]) .protyle-action__drag {height: 32px;width: 4px;background-color: var(--b3-theme-surface);@@ -973,6 +973,10 @@ body[data-format-painter] .protyle-wysiwyg[data-readonly="false"] {cursor: text;}+.protyle-wysiwyg[data-readonly="true"] .iframe .protyle-block-resize {+ display: none;+}+.protyle-format-painter__cursor {position: fixed;z-index: 9;@@ -1023,6 +1027,11 @@ body[data-format-painter] .protyle-wysiwyg[data-readonly="false"] {display: inline-block;}+ .iframe:hover .protyle-block-resize,+ .iframe:focus-within .protyle-block-resize {+ opacity: 1;+ }+.code-block .protyle-action {-webkit-user-modify: read-only;diff --git a/app/src/protyle/render/iframeResize.test.ts b/app/src/protyle/render/iframeResize.test.tsnew file mode 100644index 0000000000..02977ea277--- /dev/null+++ b/app/src/protyle/render/iframeResize.test.ts@@ -0,0 +1,291 @@+import * as assert from "node:assert/strict";+import {execFile} from "node:child_process";+import {mkdtempSync, readFileSync, rmSync, writeFileSync} from "node:fs";+import {tmpdir} from "node:os";+import * as path from "node:path";+import {test} from "node:test";+import {promisify} from "node:util";+import {compileString} from "sass";+import {createSourceFile, isIfStatement, ModuleKind, ScriptTarget, transpileModule} from "typescript";++const browserCases = async (renderSource: string, resizeSource: string, luteSource: string, css: string,+ bridgeSource: string, coreSource: string) => {+ const check: typeof assert = require("node:assert/strict");+ document.body.replaceChildren();+ new Function(luteSource)();+ const lute = Lute.New();+ const style = document.createElement("style");+ style.textContent = css + `+ :root { --b3-theme-on-surface-light: #888; --b3-theme-on-surface: #555;+ --b3-theme-primary: #4285f4; --b3-border-color: #ddd; --b3-border-radius: 6px;+ --b3-theme-background: #fff; --b3-theme-on-background: #222; }+ body { margin: 0; padding: 24px; }+ .protyle-wysiwyg { font-size: 24px; }+ `;+ document.head.appendChild(style);+ const render = new Function(renderSource + "\nreturn renderIFrameResize;")();+ const updates: {before: string, after: string}[] = [];+ const start = new Function("protyle", "target", "nodeElement", "event", "documentSelf", "mostRight", "mostBottom", "y",+ "focusBlock", "updateTransaction", "img3115", resizeSource);+ const root = document.createElement("div");+ root.className = "protyle-wysiwyg";+ root.dataset.readonly = "false";+ document.body.appendChild(root);+ const bridgeCore = {};+ new Function("exports", coreSource)(bridgeCore);+ const bridge = {} as {initTouchDragBridge: () => void};+ new Function("exports", "require", bridgeSource)(bridge, (id: string) => id === "./touchDragBridgeCore" ? bridgeCore : {+ Constants: {SIZE_DRAG_THRESHOLD: 5, TIMEOUT_LONGPRESS: 460, TIMEOUT_MOUSE_DRAG_DELAY: 150},+ isInAndroid: () => false, ipcRenderer: {on() {}}, stopScrollAnimation() {},+ });+ Object.assign(window, {siyuan: {touchDragActive: false}});+ bridge.initTouchDragBridge();+ const create = (type = "NodeIFrame", legacy = false) => {+ root.innerHTML = `<div class="iframe" data-node-id="20261002120000-aaaaaaa" data-type="${type}"+ style="width:300px;height:180px"><div class="iframe-content"><iframe src="about:blank"+ ${legacy ? 'style="width:280px;height:160px" width="280" height="160"' : ""}></iframe>+ <span class="protyle-action__drag" contenteditable="false"></span></div></div>`;+ return root.firstElementChild as HTMLElement;+ };+ for (const type of ["NodeIFrame", "NodeWidget"]) {+ const block = create(type);+ const original = lute.BlockDOM2StdMd(root.innerHTML);+ const corner = block.querySelector(".protyle-action__drag");+ render(root);+ render(block);+ check.equal(block.querySelectorAll(".protyle-block-resize").length, 3);+ check.equal(corner, block.querySelector('[data-resize-axis="both"]'));+ check.equal(lute.BlockDOM2StdMd(root.innerHTML), original, "derived handles preserve serialized source");+ for (const axis of ["width", "height", "both"]) {+ const handle = block.querySelector<HTMLElement>(`[data-resize-axis="${axis}"]`);+ const rect = handle.getBoundingClientRect();+ const frame = block.querySelector("iframe").getBoundingClientRect();+ check.equal(handle.getAttribute("data-prevent-swipe"), "true");+ if (axis !== "height") {+ check.ok(rect.right > frame.right, `${axis} hit region extends beyond the right edge`);+ }+ if (axis !== "width") {+ check.ok(rect.bottom > frame.bottom, `${axis} hit region extends beyond the bottom edge`);+ }+ const x = rect.left + rect.width / 2;+ const y = rect.top + rect.height / 2;+ check.equal(document.elementFromPoint(x, y), handle, `${axis} handle is not clipped`);+ const decoration = getComputedStyle(handle, "::after");+ check.ok(parseFloat(decoration.width) <= 24);+ check.ok(parseFloat(decoration.height) <= 24);+ }+ for (const legacy of [false, true]) {+ for (const axis of ["width", "height", "both"]) {+ const current = create(type, legacy);+ render(current);+ const iframe = current.querySelector("iframe");+ const width = iframe.clientWidth;+ const height = iframe.clientHeight;+ const handle = current.querySelector<HTMLElement>(`[data-resize-axis="${axis}"]`);+ updates.length = 0;+ const before = current.outerHTML;+ start({disabled: false}, handle, current, {clientX: 400}, document, 1000, 1000, 300,+ () => {}, (_owner: unknown, node: HTMLElement, html: string) => updates.push({before: html, after: node.outerHTML}),+ () => check.fail("iframe resizing must not normalize images"));+ check.equal(iframe.style.width, legacy ? "280px" : "");+ check.equal(iframe.style.height, legacy ? "160px" : "");+ document.onmousemove(new MouseEvent("mousemove", {clientX: 440, clientY: 350}));+ check.equal(current.style.width, axis === "height" ? "300px" : `${width + 40}px`);+ check.equal(current.style.height, axis === "width" ? "180px" : `${height + 50}px`);+ if (axis === "width") {+ check.equal(iframe.style.height, legacy ? "160px" : "");+ check.equal(iframe.getAttribute("height"), legacy ? "160" : null);+ } else if (axis === "height") {+ check.equal(iframe.style.width, legacy ? "280px" : "");+ check.equal(iframe.getAttribute("width"), legacy ? "280" : null);+ }+ document.onmouseup(new MouseEvent("mouseup"));+ check.equal(updates.length, 1);+ check.equal(updates[0].before, before, "undo retains the exact source including historical dimensions");+ check.equal(current.classList.contains("iframe--drag"), false);+ check.equal(handle.classList.contains("touch-resize-active"), false);+ check.equal(document.onmousemove, null);+ check.equal(document.onmouseup, null);+ }+ }+ }+ const centered = create();+ centered.style.margin = "0 auto";+ render(centered);+ const centeredWidth = centered.querySelector("iframe").clientWidth;+ start({disabled: false}, centered.querySelector('[data-resize-axis="width"]'), centered,+ {clientX: 400}, document, 1000, 1000, 300, () => {}, () => {}, () => {});+ document.onmousemove(new MouseEvent("mousemove", {clientX: 420, clientY: 300}));+ check.equal(centered.style.width, `${centeredWidth + 40}px`, "centered blocks resize symmetrically");+ document.onmouseup(new MouseEvent("mouseup"));+ for (const axis of ["width", "height", "both"]) {+ const block = create();+ render(block);+ const handle = block.querySelector<HTMLElement>(`[data-resize-axis="${axis}"]`);+ const rect = handle.getBoundingClientRect();+ const x = rect.left + rect.width / 2;+ const y = rect.top + rect.height / 2;+ const width = block.querySelector("iframe").clientWidth;+ const height = block.querySelector("iframe").clientHeight;+ updates.length = 0;+ handle.addEventListener("mousedown", event => start({disabled: false}, handle, block, event,+ document, 1000, 1000, event.clientY, () => {},+ (_owner: unknown, node: HTMLElement, html: string) => updates.push({before: html, after: node.outerHTML}), () => {}));+ const dispatch = (type: string, offset: number) => {+ const point = new Touch({identifier: 1, target: handle, clientX: x + offset, clientY: y + offset, radiusX: 1, radiusY: 1});+ const event = new TouchEvent(type, {bubbles: true, cancelable: true,+ touches: type === "touchend" ? [] : [point], changedTouches: [point]});+ handle.dispatchEvent(event);+ return event;+ };+ dispatch("touchstart", 0);+ check.equal(dispatch("touchmove", 20).defaultPrevented, true, `${axis} touch drag claims the gesture`);+ dispatch("touchend", 20);+ check.equal(block.style.width, axis === "height" ? "300px" : `${width + 20}px`);+ check.equal(block.style.height, axis === "width" ? "180px" : `${height + 20}px`);+ check.equal(updates.length, 1);+ check.equal(document.onmousemove, null);+ check.equal(handle.classList.contains("touch-resize-active"), false);+ }+ const readonly = create();+ render(readonly);+ root.dataset.readonly = "true";+ check.equal(getComputedStyle(readonly.querySelector(".protyle-block-resize")).display, "none");+ root.dataset.readonly = "false";+ const video = create("NodeVideo");+ render(video);+ check.equal(video.querySelector(".protyle-block-resize"), null);+ video.querySelector("iframe").replaceWith(document.createElement("video"));+ const videoContent = video.querySelector("video");+ videoContent.style.width = "300px";+ videoContent.style.height = "180px";+ start({disabled: false}, video.querySelector(".protyle-action__drag"), video, {clientX: 400},+ document, 1000, 1000, 300, () => {}, () => {}, () => {});+ document.onmousemove(new MouseEvent("mousemove", {clientX: 420, clientY: 330}));+ check.equal(videoContent.style.width, "320px");+ check.equal(videoContent.style.height, "210px");+ document.onmouseup(new MouseEvent("mouseup"));+ root.innerHTML = lute.Md2BlockDOM("");+ const image = root.querySelector("img");+ image.style.width = "100px";+ image.style.height = "60px";+ start({disabled: false}, image.parentElement.querySelector(".protyle-action__drag"), root.firstElementChild,+ {clientX: 400}, document, 1000, 1000, 300, () => {}, () => {}, () => {});+ document.onmousemove(new MouseEvent("mousemove", {clientX: 420, clientY: 330}));+ check.equal(image.parentElement.style.width, "120px");+ check.equal(image.style.height, "");+ document.onmouseup(new MouseEvent("mouseup"));+ const preview = create();+ preview.classList.add("mindmap-view__preview-block");+ render(preview);+ check.equal(preview.querySelector(".protyle-block-resize"), null);+ preview.className = "iframe protyle-wysiwyg__embed";+ render(preview);+ check.equal(preview.querySelector(".protyle-block-resize"), null);+ const block = create();+ render(block);+ const host = document.createElement("div");+ host.className = "mindmap-view";+ host.style.setProperty("--mindmap-view-height", "180px");+ host.innerHTML = '<div class="mindmap-view__viewport"><div style="position:absolute;left:320px">Clipped content</div></div>';+ for (const axis of ["width", "height", "both"]) {+ const handle = document.createElement("div");+ handle.className = "mindmap-view__resize protyle-block-resize touch-resize-active";+ handle.dataset.resizeAxis = axis;+ host.appendChild(handle);+ }+ const mindmap = document.createElement("div");+ mindmap.dataset.nodeId = "20261002120000-bbbbbbb";+ mindmap.dataset.type = "NodeMindmap";+ mindmap.dataset.mindmapViewRendered = "true";+ mindmap.appendChild(host);+ root.appendChild(mindmap);+ check.equal(getComputedStyle(host).overflow, "visible");+ check.equal(getComputedStyle(host.firstElementChild).overflow, "hidden");+ for (const handle of host.querySelectorAll<HTMLElement>(".mindmap-view__resize")) {+ const rect = handle.getBoundingClientRect();+ check.equal(document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2), handle,+ JSON.stringify({axis: handle.dataset.resizeAxis, rect: rect.toJSON(), root: root.getBoundingClientRect().toJSON(), viewport: innerWidth}));+ const decoration = getComputedStyle(handle, "::after");+ check.ok(parseFloat(decoration.width) <= 24);+ check.ok(parseFloat(decoration.height) <= 24);+ }+ host.classList.add("fullscreen");+ check.equal(getComputedStyle(host.querySelector(".mindmap-view__resize")).display, "none");+ host.classList.remove("fullscreen");+ block.querySelectorAll(".protyle-block-resize").forEach(handle => handle.classList.add("touch-resize-active"));+ return "IFrame, widget and mind map resize cases passed";+};++test("external resize handles preserve source, independent axes, historical dimensions and clipping", {+ skip: process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY,+ timeout: 45000,+}, async () => {+ const source = createSourceFile("index.ts", readFileSync("src/protyle/wysiwyg/index.ts", "utf8"), ScriptTarget.ES2021, true);+ let resize = "";+ const visit = (node: import("typescript").Node) => {+ if (isIfStatement(node) && node.expression.getText(source) === '!protyle.disabled && target.classList.contains("protyle-action__drag")') {+ resize = node.getText(source);+ }+ node.forEachChild(visit);+ };+ visit(source);+ assert.ok(resize);+ const resizeSource = transpileModule(`function resize() { ${resize} }`, {compilerOptions: {target: ScriptTarget.ES2021}})+ .outputText.replace(/^function resize\(\) \{/, "").replace(/\}\s*$/, "");+ const renderSource = transpileModule(readFileSync("src/protyle/render/iframeResize.ts", "utf8").replace(/^export /gm, ""),+ {compilerOptions: {target: ScriptTarget.ES2021}}).outputText;+ const css = compileString('@use "protyle/protyle"; @use "component/typography"; @use "business/resize";',+ {loadPaths: ["src/assets/scss"], logger: {warn() {}, debug() {}}}).css;+ const temporary = mkdtempSync(path.join(tmpdir(), "siyuan-block-resize-test-"));+ const script = path.join(temporary, "run.cjs");+ const bridgeSources = ["src/util/touchDragBridge.ts", "src/util/touchDragBridgeCore.ts"].map(file =>+ transpileModule(readFileSync(file, "utf8"), {compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2021}}).outputText);+ const code = "const __name = value => value; (" + browserCases.toString() + ")(" ++ [renderSource, resizeSource, readFileSync("stage/protyle/js/lute/lute.min.js", "utf8"), css, ...bridgeSources]+ .map(value => JSON.stringify(value)).join(",") + ")";+ writeFileSync(script, `const {app, BrowserWindow} = require("electron");+app.setPath("userData", ${JSON.stringify(path.join(temporary, "profile"))});+app.whenReady().then(async () => {+ const win = new BrowserWindow({show: false, width: 900, height: 700,+ webPreferences: {nodeIntegration: true, contextIsolation: false, offscreen: !!process.env.SIYUAN_RESIZE_PREVIEW}});+ win.webContents.setBackgroundThrottling(false);+ try {+ await win.loadURL("data:text/html,<html><body></body></html>");+ console.log(await win.webContents.executeJavaScript(${JSON.stringify(code)}));+ if (process.env.SIYUAN_RESIZE_PREVIEW) {+ await win.webContents.executeJavaScript("new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))");+ require("fs").writeFileSync(process.env.SIYUAN_RESIZE_PREVIEW + "-light.png", (await win.webContents.capturePage()).toPNG());+ }+ await win.webContents.executeJavaScript("document.documentElement.style.setProperty('--b3-theme-background', '#202124'); document.documentElement.style.setProperty('--b3-border-color', '#555'); document.body.style.background = '#202124';");+ if (process.env.SIYUAN_RESIZE_PREVIEW) {+ await win.webContents.executeJavaScript("new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))");+ require("fs").writeFileSync(process.env.SIYUAN_RESIZE_PREVIEW + "-dark.png", (await win.webContents.capturePage()).toPNG());+ }+ win.setSize(390, 700);+ win.webContents.debugger.attach("1.3");+ await win.webContents.debugger.sendCommand("Emulation.setTouchEmulationEnabled", {enabled: true});+ await win.loadURL("data:text/html,<html><body></body></html>");+ console.log(await win.webContents.executeJavaScript(${JSON.stringify(code)}));+ if (!await win.webContents.executeJavaScript("matchMedia('(any-pointer: coarse)').matches")) {+ throw new Error("Touch emulation must enable coarse pointer media queries");+ }+ if (process.env.SIYUAN_RESIZE_PREVIEW) {+ await win.webContents.executeJavaScript("new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))");+ require("fs").writeFileSync(process.env.SIYUAN_RESIZE_PREVIEW + "-narrow.png", (await win.webContents.capturePage()).toPNG());+ }+ app.exit(0);+ } catch (error) { console.error(error); app.exit(1); }+});`, "utf8");+ const env = {...process.env};+ delete env.ELECTRON_RUN_AS_NODE;+ try {+ const result = await promisify(execFile)(require("electron") as unknown as string, [script],+ {env, windowsHide: true, timeout: 40000});+ assert.match(result.stdout, /resize cases passed/);+ } finally {+ if (path.dirname(path.resolve(temporary)) === path.resolve(tmpdir()) && path.basename(temporary).startsWith("siyuan-block-resize-test-")) {+ rmSync(temporary, {recursive: true, force: true});+ }+ }+});diff --git a/app/src/protyle/render/iframeResize.ts b/app/src/protyle/render/iframeResize.tsnew file mode 100644index 0000000000..a1cf87ac19--- /dev/null+++ b/app/src/protyle/render/iframeResize.ts@@ -0,0 +1,31 @@+// 尺寸把手属于派生界面,沿用编辑器动作类以避免写入 iframe 正文。+export const renderIFrameResize = (root: Element) => {+ const selector = '[data-type="NodeIFrame"], [data-type="NodeWidget"]';+ const blocks = Array.from(root.querySelectorAll<HTMLElement>(selector));+ if (root.matches(selector)) {+ blocks.unshift(root as HTMLElement);+ }+ blocks.forEach(block => {+ if (!block.closest(".protyle-wysiwyg") || block.closest(".mindmap-view__preview-block, .protyle-wysiwyg__embed")) {+ return;+ }+ const content = block.querySelector<HTMLElement>(":scope > .iframe-content");+ if (!content?.querySelector(":scope > iframe")) {+ return;+ }+ for (const axis of ["both", "width", "height"]) {+ let handle = content.querySelector<HTMLElement>(`.protyle-action__drag[data-resize-axis="${axis}"]`);+ if (!handle && axis === "both") {+ handle = content.querySelector<HTMLElement>(".protyle-action__drag:not([data-resize-axis])");+ }+ if (!handle) {+ handle = block.ownerDocument.createElement("span");+ content.appendChild(handle);+ }+ handle.className = "protyle-action__drag protyle-block-resize";+ handle.contentEditable = "false";+ handle.dataset.resizeAxis = axis;+ handle.setAttribute("data-prevent-swipe", "true");+ }+ });+};diff --git a/app/src/protyle/render/listMindmap/resize.ts b/app/src/protyle/render/listMindmap/resize.tsindex 88e1bcdfbd..fe69702b93 100644--- a/app/src/protyle/render/listMindmap/resize.ts+++ b/app/src/protyle/render/listMindmap/resize.ts@@ -178,7 +178,7 @@ export const bindListMindmapResize = (options: ResizeOptions) => {const stopTouch = (event: Event) => event.stopPropagation();for (const axis of ["width", "height", "both"] as const) {const handle = documentSelf.createElement("div");- handle.className = `resize__${axis === "width" ? "r" : axis === "height" ? "d" : "rd"} mindmap-view__resize`;+ handle.className = "protyle-block-resize mindmap-view__resize";handle.dataset.resizeAxis = axis;handle.setAttribute("data-prevent-swipe", "true");if (axis !== "both") {diff --git a/app/src/protyle/util/processCode.ts b/app/src/protyle/util/processCode.tsindex 1970bfcc71..919404b1cd 100644--- a/app/src/protyle/util/processCode.ts+++ b/app/src/protyle/util/processCode.ts@@ -16,6 +16,7 @@ import {normalizeInlineElementBoundaries} from "./inlineElementBoundary";import {renderLongTextRuns} from "./longTextWrap";import {renderImageActions} from "../render/imageActions";import {renderImageDisplay} from "../render/imageDisplay";+import {renderIFrameResize} from "../render/iframeResize";export const processPasteCode = (html: string, text: string, originalTextHTML: string, protyle: IProtyle) => {const tempElement = document.createElement("div");@@ -76,6 +77,7 @@ export const processRender = (previewPanel: Element) => {mathRender(previewPanel);return;}+ renderIFrameResize(previewPanel);customBlockRender(previewPanel);mindmapRender(previewPanel);const language = previewPanel.getAttribute("data-subtype");diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex f71a0248d7..34fe00fdb2 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1960,6 +1960,9 @@ export class WYSIWYG {if (!nodeElement) {return;}+ const html = nodeElement.outerHTML;+ const isIFrame = ["NodeIFrame", "NodeWidget"].includes(nodeElement.dataset.type);+ const resizeAxis = isIFrame ? target.dataset.resizeAxis || "both" : "both";let isCenter = true;if ("NodeVideo" === nodeElement.dataset.type) {nodeElement.classList.add("iframe--drag");@@ -1975,38 +1978,45 @@ export class WYSIWYG {target.parentElement.parentElement.classList.add("img--drag");}- const html = nodeElement.outerHTML;const x = event.clientX;- const dragElement = target.previousElementSibling as HTMLElement;+ const dragElement = isIFrame ? nodeElement.querySelector<HTMLElement>(":scope > .iframe-content > iframe") :+ target.previousElementSibling as HTMLElement;+ if (!dragElement) {+ nodeElement.classList.remove("iframe--drag");+ return;+ }const dragWidth = dragElement.clientWidth;const dragHeight = dragElement.clientHeight;+ if (target.classList.contains("protyle-block-resize")) {+ target.classList.add("touch-resize-active");+ }const imgElement = dragElement.parentElement.parentElement;if (dragElement.tagName === "IMG") {img3115(imgElement);}- // 3.4.1 以前历史数据兼容- if (dragElement.tagName === "IFRAME") {- dragElement.style.height = "";- dragElement.style.width = "";- }documentSelf.onmousemove = (moveEvent: MouseEvent) => {if (dragElement.tagName === "IMG") {dragElement.style.height = "";}- if (moveEvent.clientX > x - dragWidth + 8 && moveEvent.clientX < mostRight) {+ if (resizeAxis !== "height" && moveEvent.clientX > x - dragWidth + 8 && moveEvent.clientX < mostRight) {const multiple = ((dragElement.tagName === "IMG" && !imgElement.style.minWidth && nodeElement.style.textAlign !== "center") || !isCenter) ? 1 : 2;if (dragElement.tagName === "IMG") {dragElement.parentElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";} else if (dragElement.tagName === "IFRAME") {+ // 只清理当前轴的历史尺寸,另一轴继续沿用原数据。+ dragElement.style.width = "";+ dragElement.removeAttribute("width");nodeElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";} else {dragElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";}}- if (dragElement.tagName !== "IMG") {+ if (resizeAxis !== "width" && dragElement.tagName !== "IMG") {if (moveEvent.clientY > y - dragHeight + 8 && moveEvent.clientY < mostBottom) {if (dragElement.tagName === "IFRAME") {+ dragElement.style.height = "";+ dragElement.removeAttribute("height");nodeElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";} else {dragElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";@@ -2021,12 +2031,13 @@ export class WYSIWYG {documentSelf.ondragstart = null;documentSelf.onselectstart = null;documentSelf.onselect = null;+ nodeElement.classList.remove("iframe--drag");+ target.classList.remove("touch-resize-active");+ target.parentElement.parentElement.classList.remove("img--drag");if (target.classList.contains("protyle-action__drag") && nodeElement) {focusBlock(nodeElement);updateTransaction(protyle, nodeElement, html);}- nodeElement.classList.remove("iframe--drag");- target.parentElement.parentElement.classList.remove("img--drag");};return;}