Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Add map height presets and refine map presentation https://github.com/siyuan-note/siyuan/issues/20129

Danield51691c4850d
diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html
index 58de67d828..90311b87ee 100644
--- a/app/appearance/icons/index.html
+++ b/app/appearance/icons/index.html
@@ -286,6 +286,12 @@
</svg>
iconGlobe
</div>
+ <div>
+ <svg>
+ <use xlink:href="#iconMap"></use>
+ </svg>
+ iconMap
+ </div>
<div>
<svg>
<use xlink:href="#iconMapPin"></use>
diff --git a/app/appearance/icons/litheness/icon.LICENSE b/app/appearance/icons/litheness/icon.LICENSE
new file mode 100644
index 0000000000..182d1bc104
--- /dev/null
+++ b/app/appearance/icons/litheness/icon.LICENSE
@@ -0,0 +1,9 @@
+iconMap: https://github.com/lucide-icons/lucide/blob/main/icons/map.svg
+
+ISC License
+
+Copyright (c) 2026 Lucide Icons and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/app/appearance/icons/litheness/icon.js b/app/appearance/icons/litheness/icon.js
index 7138d1bc05..b85998ae78 100644
--- a/app/appearance/icons/litheness/icon.js
+++ b/app/appearance/icons/litheness/icon.js
@@ -142,6 +142,11 @@ document.body.insertAdjacentHTML('afterbegin', `<svg id="iconsLitheness" style="
<symbol id="iconGlobe" stroke-width="1.7" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>
</symbol>
+ <symbol id="iconMap" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z" />
+ <path d="M15 5.764v15" />
+ <path d="M9 3.236v15" />
+ </symbol>
<symbol id="iconMapPin" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" />
<circle cx="12" cy="10" r="3" />
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 38c398d434..02bc9d36d3 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "كبير جدًا",
"mapUnplaced": "عناصر بلا إحداثيات",
"mapLoadedCount": "تم تحميل ${shown}/${total}",
"mapSkippedCount": "تم تخطي ${count}",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index 73cc8527e7..415fef1270 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Sehr groß",
"mapUnplaced": "Einträge ohne Koordinaten",
"mapLoadedCount": "Geladen ${shown}/${total}",
"mapSkippedCount": "Übersprungen ${count}",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index 58f0e42c53..74a046ba78 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Extra large",
"mapUnplaced": "Unplaced records",
"mapLoadedCount": "Loaded ${shown}/${total}",
"mapSkippedCount": "Skipped ${count}",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 0f432ff237..f393c023d5 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Extragrande",
"mapUnplaced": "Registros sin coordenadas",
"mapLoadedCount": "Cargados ${shown}/${total}",
"mapSkippedCount": "Omitidos ${count}",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index a077a6eb4d..e9103c9135 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Très grand",
"mapUnplaced": "Entrées sans coordonnées",
"mapLoadedCount": "Chargés ${shown}/${total}",
"mapSkippedCount": "Ignorés ${count}",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index a12e6ade1d..e832283e7b 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "גדול במיוחד",
"mapUnplaced": "רשומות ללא קואורדינטות",
"mapLoadedCount": "נטענו ${shown}/${total}",
"mapSkippedCount": "דולגו ${count}",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index 40c02a1872..7423f0fca9 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "अतिरिक्त बड़ा",
"mapUnplaced": "निर्देशांक के बिना प्रविष्टियाँ",
"mapLoadedCount": "लोड हुए ${shown}/${total}",
"mapSkippedCount": "छोड़े गए ${count}",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index aeb3cf5f7c..ad422cc9c5 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Sangat besar",
"mapUnplaced": "Entri tanpa koordinat",
"mapLoadedCount": "Dimuat ${shown}/${total}",
"mapSkippedCount": "Dilewati ${count}",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index 6549073b16..ea9e70c6f3 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Molto grande",
"mapUnplaced": "Voci senza coordinate",
"mapLoadedCount": "Caricati ${shown}/${total}",
"mapSkippedCount": "Ignorati ${count}",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index eb2fce581a..565f50266a 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "特大",
"mapUnplaced": "座標未設定の項目",
"mapLoadedCount": "読み込み済み ${shown}/${total}",
"mapSkippedCount": "スキップ ${count}",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index d9dff9a1a3..1d5bdb9ee8 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "매우 크게",
"mapUnplaced": "좌표가 없는 항목",
"mapLoadedCount": "불러옴 ${shown}/${total}",
"mapSkippedCount": "건너뜀 ${count}",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index cda25b9c5d..d1a405fef2 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Extra groot",
"mapUnplaced": "Items zonder coördinaten",
"mapLoadedCount": "Geladen ${shown}/${total}",
"mapSkippedCount": "Overgeslagen ${count}",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index dd65bd1919..0faf52448a 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Bardzo duży",
"mapUnplaced": "Wpisy bez współrzędnych",
"mapLoadedCount": "Wczytano ${shown}/${total}",
"mapSkippedCount": "Pominięto ${count}",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 41cc20ade0..62a848ca57 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Muito grande",
"mapUnplaced": "Registros sem coordenadas",
"mapLoadedCount": "Carregados ${shown}/${total}",
"mapSkippedCount": "Ignorados ${count}",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index 6d4b54051d..25b606f093 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Очень большой",
"mapUnplaced": "Записи без координат",
"mapLoadedCount": "Загружено ${shown}/${total}",
"mapSkippedCount": "Пропущено ${count}",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 641bc552e5..e95097c1a1 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Veľmi veľký",
"mapUnplaced": "Záznamy bez súradníc",
"mapLoadedCount": "Načítané ${shown}/${total}",
"mapSkippedCount": "Vynechané ${count}",
diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.json
index ed3bcf5f35..a4411e55fb 100644
--- a/app/appearance/langs/sr.json
+++ b/app/appearance/langs/sr.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Веома велико",
"mapUnplaced": "Записи без координата",
"mapLoadedCount": "Учитано ${shown}/${total}",
"mapSkippedCount": "Прескочено ${count}",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index a0f2449745..b17d140684 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "ใหญ่พิเศษ",
"mapUnplaced": "รายการที่ไม่มีพิกัด",
"mapLoadedCount": "โหลดแล้ว ${shown}/${total}",
"mapSkippedCount": "ข้าม ${count}",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index cdf99eaa26..96bf248c9c 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Çok büyük",
"mapUnplaced": "Koordinatı olmayan kayıtlar",
"mapLoadedCount": "Yüklendi ${shown}/${total}",
"mapSkippedCount": "Atlandı ${count}",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 14d2dbbf2c..302b066903 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "Дуже великий",
"mapUnplaced": "Записи без координат",
"mapLoadedCount": "Завантажено ${shown}/${total}",
"mapSkippedCount": "Пропущено ${count}",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index 7cf165db36..d74656bce4 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "超大",
"mapUnplaced": "未定位条目",
"mapLoadedCount": "已加载 ${shown}/${total}",
"mapSkippedCount": "已跳过 ${count}",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 3a0f21e5d8..d2a9a99f3e 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,5 @@
{
+ "extraLarge": "超大",
"mapUnplaced": "未定位項目",
"mapLoadedCount": "已載入 ${shown}/${total}",
"mapSkippedCount": "已略過 ${count}",
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
index cf16fd07d5..0cf979f891 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
@@ -7,7 +7,7 @@
"id": "20240208172514-9dsv6na",
"title": "Database",
"type": "doc",
- "updated": "20261010222552"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3921,7 +3921,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009050034-byowtq3",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3935,12 +3935,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009050034-yqulacv",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
"Type": "NodeText",
- "Data": "The map uses built-in OpenFreeMap. When no Location field is selected, the first Location field in the view is used; you can change it in the view settings. In an editable view, use the Unplaced records button to the right of the summary to browse records without coordinates in that field under the current filters and search, including records with only a place name. The list supports search and loading more records in batches. Click a record to open and edit it. Switch to a Table view to browse all records."
+ "Data": "The map uses built-in OpenFreeMap. When no Location field is selected, the first Location field in the view is used; you can change it in the view settings. In an editable view, use the Unplaced records button to the right of the summary to browse records without coordinates in that field under the current filters and search, including records with only a place name. The list supports search and loading more records in batches. Click a record to open and edit it. Switch to a Table view to browse all records. In the view settings, Height offers Small (320 px), Medium (480 px), Large (640 px), and Extra large (800 px), with Medium as the default. The height is saved separately for each view and adapts to small screens."
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
index c08e58410c..9a1b0a9934 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
@@ -7,7 +7,7 @@
"id": "20240208113259-nykkvaq",
"title": "数据库",
"type": "doc",
- "updated": "20261010222552"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3921,7 +3921,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009050034-dfwj4cb",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3935,12 +3935,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009050034-dz1fw4j",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
"Type": "NodeText",
- "Data": "地图使用内置 OpenFreeMap。未指定位置字段时,默认使用视图中的第一个位置字段,也可在视图设置中更改。在可编辑视图中,点击摘要右侧的“未定位条目”按钮,可查看当前筛选和搜索结果中该字段尚无坐标的条目,包括仅填写地点名称的条目。列表支持搜索和分批加载,点击条目可打开并编辑。浏览全部记录可切换到表格视图。"
+ "Data": "地图使用内置 OpenFreeMap。未指定位置字段时,默认使用视图中的第一个位置字段,也可在视图设置中更改。在可编辑视图中,点击摘要右侧的“未定位条目”按钮,可查看当前筛选和搜索结果中该字段尚无坐标的条目,包括仅填写地点名称的条目。列表支持搜索和分批加载,点击条目可打开并编辑。浏览全部记录可切换到表格视图。 视图设置中的高度提供小(320 px)、中(480 px)、大(640 px)和超大(800 px)四档,默认使用中档。高度按视图独立保存,并适配小屏幕。"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
index 4763f821e1..630e0153bc 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
@@ -7,7 +7,7 @@
"id": "20240208171522-y7dxcno",
"title": "資料庫",
"type": "doc",
- "updated": "20261010222552"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3921,7 +3921,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009050034-7n1yzkx",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3935,12 +3935,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009050034-ctek3na",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
"Type": "NodeText",
- "Data": "地圖使用內建 OpenFreeMap。未指定位置欄位時,預設使用檢視中的第一個位置欄位,也可在檢視設定中變更。在可編輯檢視中,點擊摘要右側的「未定位項目」按鈕,可查看目前篩選和搜尋結果中該欄位尚無座標的項目,包括僅填寫地點名稱的項目。清單支援搜尋和分批載入,點擊項目可開啟並編輯。瀏覽全部記錄可切換到表格檢視。"
+ "Data": "地圖使用內建 OpenFreeMap。未指定位置欄位時,預設使用檢視中的第一個位置欄位,也可在檢視設定中變更。在可編輯檢視中,點擊摘要右側的「未定位項目」按鈕,可查看目前篩選和搜尋結果中該欄位尚無座標的項目,包括僅填寫地點名稱的項目。清單支援搜尋和分批載入,點擊項目可開啟並編輯。瀏覽全部記錄可切換到表格檢視。 視圖設定中的高度提供小(320 px)、中(480 px)、大(640 px)和超大(800 px)四種尺寸,預設使用中尺寸。高度依視圖獨立儲存,並適配小螢幕。"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
index d2b80d16f7..cde1f896c4 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
@@ -8,7 +8,7 @@
"id": "20240530101000-3eaevtp",
"title": "データベース",
"type": "doc",
- "updated": "20261010222552"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3931,7 +3931,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009050034-lzsqdz2",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
@@ -3945,12 +3945,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009050034-xn4up1k",
- "updated": "20261010104905"
+ "updated": "20261010233500"
},
"Children": [
{
"Type": "NodeText",
- "Data": "地図には組み込みの OpenFreeMap を使用します。位置フィールドを指定していない場合は、ビュー内の最初の位置フィールドを使用します。ビューの設定で変更できます。編集可能なビューでは、件数表示の右側にある「座標未設定の項目」ボタンから、現在のフィルターと検索条件に一致し、そのフィールドに座標がない項目を確認できます。場所の名前だけを入力した項目も含まれます。一覧内で検索したり、項目を追加で読み込んだりできます。項目をクリックすると開いて編集できます。すべてのレコードを閲覧するにはテーブルビューに切り替えてください。"
+ "Data": "地図には組み込みの OpenFreeMap を使用します。位置フィールドを指定していない場合は、ビュー内の最初の位置フィールドを使用します。ビューの設定で変更できます。編集可能なビューでは、件数表示の右側にある「座標未設定の項目」ボタンから、現在のフィルターと検索条件に一致し、そのフィールドに座標がない項目を確認できます。場所の名前だけを入力した項目も含まれます。一覧内で検索したり、項目を追加で読み込んだりできます。項目をクリックすると開いて編集できます。すべてのレコードを閲覧するにはテーブルビューに切り替えてください。 ビュー設定の高さには、小(320 px)、中(480 px)、大(640 px)、特大(800 px)の4段階があり、既定は中です。高さはビューごとに保存され、小さな画面にも適応します。"
}
]
},
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index 26306e4b35..2d859dbf03 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -60,7 +60,20 @@
.av__map-canvas {
width: 100%;
- height: clamp(240px, 50vh, 480px);
+ height: clamp(240px, 60vh, 480px);
+
+ // 保留外层矩形命中区域,避免圆角透明区中断地图可见性与署名计时。
+ > iframe,
+ > webview {
+ border-radius: var(--b3-border-radius);
+ overflow: hidden;
+ }
+}
+
+@each $height, $minimum, $viewport in ((320, 160px, 40vh), (640, 320px, 80vh), (800, 400px, 100vh)) {
+ .av__map[data-map-height="#{$height}"] > .av__map-canvas {
+ height: clamp($minimum, $viewport, #{$height}px);
+ }
}
.av__map-empty {
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index dc10f6c86b..989b31409c 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -281,7 +281,7 @@ export const getBuiltinSlashMenuItems = (protyle: IProtyle): IHintData[] => {
filter: [window.siyuan.languages.databaseMapView, "database map view", "地图", "数据库地图视图", "ditu", "shujukuditushitu", "sjkdts"],
id: "databaseMapView",
value: '<div data-type="NodeAttributeView" data-av-type="map"></div>',
- html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconGlobe"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.databaseMapView}</span></div>`,
+ html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconMap"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.databaseMapView}</span></div>`,
}, {
value: "",
id: "separator_2",
diff --git a/app/src/protyle/hint/mapSlashEntry.test.ts b/app/src/protyle/hint/mapSlashEntry.test.ts
index 2a4e14da0b..acf1fd1bb4 100644
--- a/app/src/protyle/hint/mapSlashEntry.test.ts
+++ b/app/src/protyle/hint/mapSlashEntry.test.ts
@@ -29,7 +29,7 @@ test("the map slash entry is searchable and creates a map database block", () =>
assert.equal(resolveSlashMenuItems([item], {...options, key})[0], item);
}
assert.equal(item.value, '<div data-type="NodeAttributeView" data-av-type="map"></div>');
- assert.match(item.html, /#iconGlobe/);
+ assert.match(item.html, /#iconMap/);
assert.match(item.html, /Database map view/);
assert.equal(resolveSlashMenuItems([item], {...options, key: "map", visible: () => false}).length, 0);
assert.equal(resolveSlashMenuItems([item], {...options, key: "map", lite: true}).length, 0);
diff --git a/app/src/protyle/render/av/fieldVisibility.ts b/app/src/protyle/render/av/fieldVisibility.ts
index cddfa348f5..ceae29fd50 100644
--- a/app/src/protyle/render/av/fieldVisibility.ts
+++ b/app/src/protyle/render/av/fieldVisibility.ts
@@ -8,7 +8,7 @@ import {setPosition} from "../../../util/setPosition";
const getViewIcon = (type: TAVView) => {
switch (type) {
case "map":
- return "iconGlobe";
+ return "iconMap";
case "calendar":
return "iconCalendar";
case "list":
diff --git a/app/src/protyle/render/av/layout.ts b/app/src/protyle/render/av/layout.ts
index ff6b4340cc..680dccd28f 100644
--- a/app/src/protyle/render/av/layout.ts
+++ b/app/src/protyle/render/av/layout.ts
@@ -148,7 +148,7 @@ export const getLayoutHTML = (data: IAV) => {
<div>${window.siyuan.languages.calendarView}</div>
</div>
<div data-type="set-layout" data-view-type="map" class="av__layout-item${data.viewType === "map" ? " av__layout-item--select" : ""}">
- <svg><use xlink:href="#iconGlobe"></use></svg>
+ <svg><use xlink:href="#iconMap"></use></svg>
<div class="fn__hr"></div>
<div>${window.siyuan.languages.mapView}</div>
</div>
diff --git a/app/src/protyle/render/av/map/render.test.ts b/app/src/protyle/render/av/map/render.test.ts
index 9d977fa612..5f36fecaf3 100644
--- a/app/src/protyle/render/av/map/render.test.ts
+++ b/app/src/protyle/render/av/map/render.test.ts
@@ -275,7 +275,7 @@ test("deleted and changed-type map fields show a repairable location setup", asy
await scenario.render();
const html = scenario.setupHTML();
assert.match(html, /class="av__map-empty"/);
- assert.match(html, /#iconGlobe/);
+ assert.match(html, /#iconMap/);
assert.match(html, locationKeyID ? /mapMissingLocationField/ : /mapSelectLocationField/);
assert.match(html, /<label class="av__map-setting"><span>mapLocationField<\/span>/);
const select = scenario.control("[data-map-location-field]");
@@ -294,6 +294,20 @@ test("deleted and changed-type map fields show a repairable location setup", asy
assert.match(empty.setupHTML(), /mapSelectLocationField/);
});
+test("map height is derived per view without changing the stored settings", async () => {
+ for (const height of [undefined, 320, 480, 640, 800] as const) {
+ const scenario = setup();
+ const view = scenario.data.view as IAVTable;
+ if (height !== undefined) view.map.height = height;
+ const stored = JSON.stringify(view.map);
+ await scenario.render();
+ assert.equal(scenario.roots[0].dataset.mapHeight, (height || 480).toString());
+ assert.equal(JSON.stringify(view.map), stored);
+ assert.equal(scenario.hosts.length, 1);
+ scenario.destroyMap();
+ }
+});
+
test("parsed templates do not manufacture missing controls and reject a canvas class mutation", async () => {
const scenario = setup();
await scenario.render();
@@ -347,6 +361,7 @@ test("selecting an existing location field submits one undoable transaction and
const scenario = setup();
const view = scenario.data.view as IAVTable;
view.map.locationKeyID = "deleted";
+ view.map.height = 640;
const before = JSON.stringify(view);
await scenario.render();
const select = scenario.control("[data-map-location-field]");
@@ -364,8 +379,8 @@ test("selecting an existing location field submits one undoable transaction and
assert.equal(scenario.control("[data-map-create-field]").disabled, true);
const {perform, undo} = scenario.transactions[0];
assert.equal(JSON.stringify(perform), JSON.stringify([{avID: "database", blockID: "carrier", viewID: "map-view",
- action: "setAttrViewMap", data: {locationKeyID: "location"}}]));
- assert.equal(JSON.stringify(undo[0].data), JSON.stringify({locationKeyID: "deleted"}));
+ action: "setAttrViewMap", data: {locationKeyID: "location", height: 640}}]));
+ assert.equal(JSON.stringify(undo[0].data), JSON.stringify({locationKeyID: "deleted", height: 640}));
assert.equal(JSON.stringify(view), before);
assert.equal(scenario.refreshes(), 0);
await scenario.completeTransaction();
diff --git a/app/src/protyle/render/av/map/render.ts b/app/src/protyle/render/av/map/render.ts
index c831a25975..2e91f343bc 100644
--- a/app/src/protyle/render/av/map/render.ts
+++ b/app/src/protyle/render/av/map/render.ts
@@ -18,12 +18,12 @@ const getTheme = () => document.documentElement.getAttribute("data-theme-mode")
const renderMapSetup = (root: HTMLElement, blockElement: HTMLElement, protyle: IProtyle,
data: IAV, current: () => boolean) => {
const view = data.view as IAVTable;
- const previous = {locationKeyID: view.map?.locationKeyID || ""};
+ const previous = {...view.map, locationKeyID: view.map?.locationKeyID || ""};
const editable = canEditMapSettings(protyle);
const message = previous.locationKeyID ? window.siyuan.languages.mapMissingLocationField :
window.siyuan.languages.mapSelectLocationField;
root.querySelector(".av__map-status").innerHTML = `<div class="av__map-empty">
- <svg aria-hidden="true"><use xlink:href="#iconGlobe"></use></svg><p>${escapeHtml(message)}</p>
+ <svg aria-hidden="true"><use xlink:href="#iconMap"></use></svg><p>${escapeHtml(message)}</p>
${editable ? `<div class="av__map-setup"><label class="av__map-setting"><span>${escapeHtml(window.siyuan.languages.mapLocationField)}</span>
<select class="b3-select" data-map-location-field aria-label="${escapeAttr(window.siyuan.languages.mapLocationField)}">
<option value="">${escapeHtml(window.siyuan.languages.mapSelectLocationField)}</option>
@@ -48,7 +48,7 @@ const renderMapSetup = (root: HTMLElement, blockElement: HTMLElement, protyle: I
let committed = false;
try {
const id = locationKeyID || Lute.NewNodeID();
- const update: IOperation = {...context, action: "setAttrViewMap", data: {locationKeyID: id}};
+ const update: IOperation = {...context, action: "setAttrViewMap", data: {...previous, locationKeyID: id}};
const undo: IOperation = {...context, action: "setAttrViewMap", data: previous};
transaction(protyle, locationKeyID ? [update] : [
{...context, action: "addAttrViewCol", id, type: "location", name: window.siyuan.languages.location},
@@ -97,6 +97,7 @@ export const renderMap = async (blockElement: HTMLElement, protyle: IProtyle, da
const settings = getMapSettings(view);
const root = document.createElement("div");
root.className = "av__map";
+ root.dataset.mapHeight = settings.height.toString();
root.setAttribute("contenteditable", "false");
root.setAttribute("aria-label", window.siyuan.languages.mapView);
const pageText = window.siyuan.languages.mapPageScope.replace("${shown}", view.rows.length.toString())
diff --git a/app/src/protyle/render/av/map/settings.test.ts b/app/src/protyle/render/av/map/settings.test.ts
index 393834f27f..068b453f10 100644
--- a/app/src/protyle/render/av/map/settings.test.ts
+++ b/app/src/protyle/render/av/map/settings.test.ts
@@ -26,7 +26,8 @@ const setup = (mobile = false) => {
const menus: Array<{items: IMenu[]; independent: boolean; position?: IPosition; element: DOMElement}> = [];
let closed = 0;
const context = {siyuan: {isPublish: false,
- languages: {mapLocationField: "Location", mapSelectLocationField: "Select field", mapMissingLocationField: "Missing field"},
+ languages: {mapLocationField: "Location", mapSelectLocationField: "Select field", mapMissingLocationField: "Missing field",
+ height: "Height", small: "Small", medium: "Medium", large: "Large", extraLarge: "Extra large"},
menus: {menu: {showSubMenu: (element: DOMElement) => shown.push(element), remove: () => { closed++; }}}}};
const sharedMenu = {} as typeof import("../../../../menus/Menu");
runInNewContext(menuSource, {exports: sharedMenu, document, window: context, require: requireFixture({
@@ -70,7 +71,9 @@ const setup = (mobile = false) => {
methods.bindMapSettings({data: database, protyle, menuElement: menuElement as unknown as Element,
blockElement: blockElement as unknown as Element, onChange: () => { updated++; }});
const field = menuElement.querySelector('[data-map-setting="locationKeyID"]');
- return {database, protyle, field, menuElement, updated: () => updated,
+ const height = menuElement.querySelector('[data-map-setting="height"]');
+ return {database, protyle, field, height, menuElement, updated: () => updated,
+ heightChoices: () => height.querySelector(".b3-menu__submenu").querySelectorAll("button"),
choices: () => field.querySelector(".b3-menu__submenu").querySelectorAll("button")};
};
return {methods, document, operations, shown, menus, context, mount, closed: () => closed};
@@ -204,9 +207,12 @@ test("readonly, both history modes and published maps cannot open field submenus
for (const mode of ["disabled", "created", "snapshot", "published"]) {
const scenario = setup();
scenario.context.siyuan.isPublish = mode === "published";
- const {field} = scenario.mount(data(), {disabled: mode === "disabled",
+ const {field, height} = scenario.mount(data(), {disabled: mode === "disabled",
options: {history: ["created", "snapshot"].includes(mode) ? {[mode]: "version"} : undefined}} as IProtyle);
assert.equal(field.disabled, true);
+ assert.equal(height.disabled, true);
+ assert.equal(height.querySelector(".b3-menu__submenu"), null);
+ height.dispatch("click");
assert.equal(field.querySelector(".b3-menu__submenu"), null);
field.dispatch("click");
assert.equal(scenario.operations.length, 0);
@@ -214,6 +220,53 @@ test("readonly, both history modes and published maps cannot open field submenus
}
});
+test("map height has four checked presets, defaults without mutation, and preserves raw field selection", () => {
+ for (const locationKeyID of ["", "missing-field"]) {
+ const scenario = setup();
+ const database = data();
+ const view = database.view as IAVTable;
+ view.map.locationKeyID = locationKeyID;
+ const before = JSON.stringify(view);
+ const {height, heightChoices, updated} = scenario.mount(database);
+ assert.equal(height.querySelector(".av__map-setting-value").textContent, "Medium");
+ assert.deepEqual(heightChoices().map(choice => choice.querySelector(".b3-menu__label").textContent),
+ ["Small", "Medium", "Large", "Extra large"]);
+ assert.ok(heightChoices()[1].querySelector(".b3-menu__checked"));
+ assert.equal(JSON.stringify(view), before);
+ heightChoices()[3].dispatch("click");
+ assert.equal(updated(), 1);
+ assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].perform[0].data)), {locationKeyID, height: 800});
+ assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].undo[0].data)), {locationKeyID});
+ assert.equal(view.map.locationKeyID, locationKeyID);
+ }
+});
+
+test("changing location preserves height and selecting the current saved height is a no-op", () => {
+ const scenario = setup();
+ const database = data();
+ const view = database.view as IAVTable;
+ view.map.height = 640;
+ const {choices, heightChoices} = scenario.mount(database);
+ heightChoices()[2].dispatch("click");
+ assert.equal(scenario.operations.length, 0);
+ choices()[0].dispatch("click");
+ assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].perform[0].data)), {locationKeyID: "location", height: 640});
+ assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].undo[0].data)), {locationKeyID: "missing-field", height: 640});
+});
+
+test("mobile height choices use the shared independent menu and protect later readonly transitions", () => {
+ const scenario = setup(true);
+ const {height, protyle} = scenario.mount();
+ height.dispatch("click");
+ assert.equal(scenario.menus[0].independent, true);
+ assert.equal(scenario.menus[0].position.target, height);
+ assert.equal(scenario.menus[0].items.length, 4);
+ assert.equal(scenario.menus[0].items[1].checked, true);
+ protyle.disabled = true;
+ scenario.menus[0].element.querySelector("button").dispatch("click");
+ assert.equal(scenario.operations.length, 0);
+});
+
test("dismissed controls and later readonly transitions cannot change fields", () => {
for (const mobile of [false, true]) {
for (const mode of ["dismissed", "readonly"]) {
diff --git a/app/src/protyle/render/av/map/settings.ts b/app/src/protyle/render/av/map/settings.ts
index fc023825de..5e26ef7fb7 100644
--- a/app/src/protyle/render/av/map/settings.ts
+++ b/app/src/protyle/render/av/map/settings.ts
@@ -3,7 +3,7 @@ import {escapeAttr, escapeHtml} from "../../../../util/escape";
import {Menu} from "../../../../plugin/Menu";
import {MenuItem} from "../../../../menus/Menu";
import {isMobile} from "../../../../util/functions";
-import {getMapSettings} from "./state";
+import {AV_MAP_HEIGHTS, getMapSettings} from "./state";
export const canEditMapSettings = (protyle: IProtyle) => !protyle.disabled && !window.siyuan.isPublish &&
!protyle.options.history?.created && !protyle.options.history?.snapshot;
@@ -20,15 +20,23 @@ const getChoices = (view: IAVTable) => {
return choices;
};
-export const getMapSettingsHTML = (view: IAVTable) => {
- const value = getMapSettings(view).locationKeyID;
- const label = getChoices(view).find(choice => choice.value === value).label;
- return `<button class="b3-menu__item" data-map-setting="locationKeyID">
- <span class="fn__flex-center">${window.siyuan.languages.mapLocationField}</span><span class="fn__flex-1"></span>
+type MapSetting = "locationKeyID" | "height";
+
+const getSettingChoices = (view: IAVTable, key: MapSetting): Array<{value: string | IAVMapSettings["height"]; label: string}> =>
+ key === "locationKeyID" ? getChoices(view) : AV_MAP_HEIGHTS.map((value, index) => ({value,
+ label: window.siyuan.languages[(["small", "medium", "large", "extraLarge"] as const)[index]]}));
+
+const getSettingLabel = (key: MapSetting) => key === "height" ? window.siyuan.languages.height : window.siyuan.languages.mapLocationField;
+
+export const getMapSettingsHTML = (view: IAVTable) => (["locationKeyID", "height"] as const).map(key => {
+ const value = getMapSettings(view)[key];
+ const label = getSettingChoices(view, key).find(choice => choice.value === value).label;
+ return `<button class="b3-menu__item" data-map-setting="${key}">
+ <span class="fn__flex-center">${getSettingLabel(key)}</span><span class="fn__flex-1"></span>
<span class="b3-menu__accelerator fn__ellipsis av__map-setting-value" title="${escapeAttr(label)}">${escapeHtml(label)}</span>
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
</button>`;
-};
+}).join("");
export const bindMapSettings = (options: {
protyle: IProtyle;
@@ -37,17 +45,17 @@ export const bindMapSettings = (options: {
menuElement: Element;
onChange?: () => void;
}) => {
- const controls = options.menuElement.querySelectorAll<HTMLButtonElement>('[data-map-setting="locationKeyID"]');
+ const controls = options.menuElement.querySelectorAll<HTMLButtonElement>("[data-map-setting]");
const view = options.data.view as IAVTable;
if (!canEditMapSettings(options.protyle)) {
controls.forEach(control => { control.disabled = true; });
return;
}
- const update = (locationKeyID: string) => {
+ const update = (key: MapSetting, value: string | IAVMapSettings["height"]) => {
if (!canEditMapSettings(options.protyle)) return;
- const previous = {locationKeyID: view.map?.locationKeyID || ""};
- if (previous.locationKeyID === locationKeyID) return;
- const next = {locationKeyID};
+ const previous: IAVMapSettings = {locationKeyID: "", ...view.map};
+ if (previous[key] === value) return;
+ const next: IAVMapSettings = {...previous, [key]: value};
const operation = {action: "setAttrViewMap" as const, avID: options.data.id,
blockID: options.blockElement.getAttribute("data-node-id"), viewID: options.data.viewID};
transaction(options.protyle, [{...operation, data: next}], [{...operation, data: previous}]);
@@ -55,15 +63,16 @@ export const bindMapSettings = (options: {
options.onChange?.();
};
controls.forEach(control => {
- const choices = getChoices(view);
+ const key = control.dataset.mapSetting as MapSetting;
+ const choices = getSettingChoices(view, key);
const items: IMenu[] = choices.map(choice => ({iconHTML: "", label: escapeHtml(choice.label),
- checked: getMapSettings(view).locationKeyID === choice.value, click: () => {
- if (item.element.isConnected) update(choice.value);
+ checked: getMapSettings(view)[key] === choice.value, click: () => {
+ if (item.element.isConnected) update(key, choice.value);
}}));
- const label = choices.find(choice => choice.value === getMapSettings(view).locationKeyID).label;
- const item = new MenuItem({iconHTML: "", label: window.siyuan.languages.mapLocationField,
+ const label = choices.find(choice => choice.value === getMapSettings(view)[key]).label;
+ const item = new MenuItem({iconHTML: "", label: getSettingLabel(key),
accelerator: " ", submenu: items});
- item.element.dataset.mapSetting = "locationKeyID";
+ item.element.dataset.mapSetting = key;
const valueElement = item.element.querySelector(".b3-menu__accelerator");
valueElement.textContent = label;
valueElement.classList.add("fn__ellipsis", "av__map-setting-value");
diff --git a/app/src/protyle/render/av/map/state.test.ts b/app/src/protyle/render/av/map/state.test.ts
index 8e2e7351c0..b60bec4c38 100644
--- a/app/src/protyle/render/av/map/state.test.ts
+++ b/app/src/protyle/render/av/map/state.test.ts
@@ -48,8 +48,18 @@ test("missing or changed location fields retain their saved identifiers and do n
assert.equal(getMapSettings(view).locationKeyID, "removed");
view.map.locationKeyID = "primary";
assert.deepEqual(getMapPoints(view), {points: [], skipped: {empty: 0, invalid: 0, projection: 0}});
- assert.deepEqual(getMapSettings(view), {locationKeyID: "primary"});
- assert.deepEqual(getMapSettings({} as IAVTable), {locationKeyID: ""});
+ assert.deepEqual(getMapSettings(view), {locationKeyID: "primary", height: 480});
+ assert.deepEqual(getMapSettings({} as IAVTable), {locationKeyID: "", height: 480});
+});
+
+test("map height derives a safe default without changing stored settings", () => {
+ for (const height of [undefined, null, 0, 321, "640", 320, 480, 640, 800]) {
+ const view = table([]);
+ Object.assign(view.map, {height});
+ const before = JSON.stringify(view);
+ assert.equal(getMapSettings(view).height, [320, 480, 640, 800].includes(height as number) ? height : 480);
+ assert.equal(JSON.stringify(view), before);
+ }
});
test("unconfigured maps derive the first location in view order without persisting it", () => {
diff --git a/app/src/protyle/render/av/map/state.ts b/app/src/protyle/render/av/map/state.ts
index 21035206da..9b40dd341c 100644
--- a/app/src/protyle/render/av/map/state.ts
+++ b/app/src/protyle/render/av/map/state.ts
@@ -2,9 +2,12 @@ import {hasAVLocationCoordinates, validateAVLocation} from "../locationValue";
import type {AVMapPoint} from "./protocol";
import {isAVMapIdentifier, isAVMapProjectionSupported} from "./protocol";
+export const AV_MAP_HEIGHTS = [320, 480, 640, 800] as const;
+
// 未配置时按视图顺序派生默认值;读取不写入配置,失效的显式绑定仍由用户修复。
export const getMapSettings = (view: IAVTable): IAVMapSettings => ({
locationKeyID: view.map?.locationKeyID || view.columns?.find(column => column.type === "location")?.id || "",
+ height: AV_MAP_HEIGHTS.includes(view.map?.height) ? view.map.height : 480,
});
// 只使用选定字段的已加载行,WGS84 坐标不会被裁切或改写。
diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts
index 0321e4f769..a1bfce4c9b 100644
--- a/app/src/protyle/render/av/view.ts
+++ b/app/src/protyle/render/av/view.ts
@@ -571,7 +571,7 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {
}
});
addMenu.addItem({
- icon: "iconGlobe",
+ icon: "iconMap",
label: window.siyuan.languages.mapView,
click() {
addVisibleView();
@@ -591,7 +591,7 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {
export const getViewIcon = (type: string) => {
switch (type) {
case "map":
- return "iconGlobe";
+ return "iconMap";
case "calendar":
return "iconCalendar";
case "table":
diff --git a/app/src/types/api/index.d.ts b/app/src/types/api/index.d.ts
index d3460abebd..1a90c9b78d 100644
--- a/app/src/types/api/index.d.ts
+++ b/app/src/types/api/index.d.ts
@@ -362,9 +362,9 @@ export type AVLayoutMap = { "columns": Array<AVViewTableColumn | null> | null; "
export type AVLayoutTable = { "columns": Array<AVViewTableColumn | null> | null; "filters"?: Array<AVViewFilter | null>; "id": string; "pageSize"?: number; "rowIds": Array<string> | null; "showIcon": boolean; "sorts"?: Array<AVViewSort | null>; "spec": number; "wrapField": boolean; } | ({ "columns": Array<AVViewTableColumn | null> | null; "rowIds": Array<string> | null; } & { "filters"?: never; "id"?: never; "pageSize"?: never; "showIcon"?: never; "sorts"?: never; "spec"?: never; "wrapField"?: never; });
-export type AVMapSettings = { "locationKeyID": string; };
+export type AVMapSettings = { "height"?: 320 | 480 | 640 | 800; "locationKeyID": string; };
-export type AVMapSettingsInput = { "locationKeyID": string; };
+export type AVMapSettingsInput = { "height"?: 320 | 480 | 640 | 800; "locationKeyID": string; };
export type AVMapUnplacedData = { "rows": Array<AVTableRow | null> | null; "total": number; };
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 00783d3086..8e2235a073 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -1296,6 +1296,8 @@ interface IAVCalendarRange {
interface IAVMapSettings {
/** 位置字段引用;空值按视图顺序使用首个位置字段而不写回;显式字段缺失或类型变化时保留,不自动改绑。 */
locationKeyID: string;
+ /** 按视图保存的地图高度(CSS px);省略时为 480,显式 0 和 null 无效。 */
+ height?: 320 | 480 | 640 | 800;
}
interface IAVTable extends IAVView {
diff --git a/app/tests/fixtures/map-webview-boundary/harnessSupport.cjs b/app/tests/fixtures/map-webview-boundary/harnessSupport.cjs
index 01f26b2ebb..44456c3273 100644
--- a/app/tests/fixtures/map-webview-boundary/harnessSupport.cjs
+++ b/app/tests/fixtures/map-webview-boundary/harnessSupport.cjs
@@ -84,6 +84,70 @@ const waitFor = async (predicate, label, timeout = 5000) => {
}
};
+// 编译实际业务样式和可见性函数,避免夹具自行重写圆角规则或命中判断。
+const readMapCornerAssets = () => {
+ const ts = require("typescript");
+ const source = fs.readFileSync(path.join(appDir, "src/protyle/render/av/map/host.ts"), "utf8");
+ const parsed = ts.createSourceFile("host.ts", source, ts.ScriptTarget.Latest, true);
+ const visibility = parsed.statements.find(statement => ts.isVariableStatement(statement) &&
+ statement.declarationList.declarations.some(declaration => declaration.name.getText(parsed) === "getAVMapVisibility"));
+ assert.ok(visibility, "production visibility function exists");
+ const theme = fs.readFileSync(path.join(appDir, "appearance/themes/daylight/theme.css"), "utf8");
+ const radius = theme.match(/--b3-border-radius:\s*([^;]+);/);
+ assert.ok(radius, "production theme defines the shared corner radius");
+ return {css: require("sass").compile(path.join(appDir, "src/assets/scss/business/_av.scss")).css,
+ radius: radius[1].trim(), visibility: ts.transpileModule(visibility.getText(parsed), {
+ compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020},
+ }).outputText};
+};
+
+const verifyMapCorners = async harness => {
+ const {owner, guest, win} = harness;
+ const assets = readMapCornerAssets();
+ const evaluate = source => owner.executeJavaScript(source);
+ const before = await evaluate(`(() => {
+ const rect = document.getElementById("map-slot").getBoundingClientRect();
+ return {x: rect.x, y: rect.y, width: rect.width, height: rect.height};
+ })()`);
+ await owner.insertCSS(assets.css);
+ await evaluate(`document.documentElement.style.setProperty("--b3-border-radius", ${JSON.stringify(assets.radius)});
+ document.getElementById("map-slot").classList.add("av__map-canvas");`);
+ const state = await evaluate(`(() => {
+ const exports = {};
+ ${assets.visibility}
+ const slot = document.getElementById("map-slot");
+ const rect = slot.getBoundingClientRect();
+ return {bounds: {x: rect.x, y: rect.y, width: rect.width, height: rect.height},
+ visibility: exports.getAVMapVisibility(slot)};
+ })()`);
+ assert.deepEqual(state.bounds, before, "production child clipping preserves the map position and height");
+ assert.deepEqual(state.visibility, {visible: true, viewport: {x: 0, y: 0, width: before.width, height: before.height}},
+ "rounded guest corners retain the rectangular owner hit region and attribution viewport");
+ // 移除合成文案,确保内侧采样不会碰到字形;不改变生产 guest 的隔离配置。
+ const caption = await guest.executeJavaScript('document.getElementById("map").textContent');
+ await guest.executeJavaScript('document.getElementById("map").textContent = ""');
+ try {
+ const pixel = async (x, y) => {
+ const shot = await win.webContents.capturePage({x: Math.round(before.x + x), y: Math.round(before.y + y), width: 1, height: 1});
+ const bitmap = shot.toBitmap();
+ return [bitmap[2], bitmap[1], bitmap[0]].join();
+ };
+ for (const x of [0, before.width - 1]) {
+ for (const y of [0, before.height - 1]) {
+ await waitFor(async () => await pixel(x, y) === "255,255,255", "owner background is visible at every clipped guest corner");
+ }
+ }
+ const inset = Math.ceil(parseFloat(assets.radius)) + 2;
+ for (const x of [inset, before.width - inset - 1]) {
+ for (const y of [inset, before.height - inset - 1]) {
+ await waitFor(async () => await pixel(x, y) === "25,119,145", "the guest remains painted inside every rounded corner");
+ }
+ }
+ } finally {
+ await guest.executeJavaScript(`document.getElementById("map").textContent = ${JSON.stringify(caption)}`);
+ }
+};
+
const createHarness = async ({profile, mode = "real", automate = false} = {}) => {
if (typeof profile !== "string" || !path.isAbsolute(profile) || !["real", "synthetic"].includes(mode)) {
throw new Error("An isolated profile and fixed fixture mode are required");
@@ -251,6 +315,7 @@ const verifyHarness = async harness => {
await new Promise(resolve => setTimeout(resolve, 100));
assert.equal(guest.getURL(), src);
assert.equal(evidence.privateRequests, 0);
+ await verifyMapCorners(harness);
const identity = guest.id;
const before = await inspect("JSON.stringify({fits:mapFixture.fits,revisions:mapFixture.revisions,visible:mapFixture.visible})");
const pixel = async () => {
@@ -313,4 +378,4 @@ const verifyHarness = async harness => {
};
module.exports = {createHarness, createTemporaryProfile, verifyHarness, checkRealAssets,
- createSyntheticFiles, ownerPreferences, guestPreferences, verifyIsolation};
+ createSyntheticFiles, ownerPreferences, guestPreferences, verifyIsolation, readMapCornerAssets};
diff --git a/app/tests/mapWebviewBoundary.test.js b/app/tests/mapWebviewBoundary.test.js
index fb1693da41..e656fa0c24 100644
--- a/app/tests/mapWebviewBoundary.test.js
+++ b/app/tests/mapWebviewBoundary.test.js
@@ -5,7 +5,7 @@ const {promisify} = require("node:util");
const fs = require("node:fs");
const os = require("node:os");
const path = require("node:path");
-const {ownerPreferences, guestPreferences, createSyntheticFiles, checkRealAssets, verifyIsolation} =
+const {ownerPreferences, guestPreferences, createSyntheticFiles, checkRealAssets, verifyIsolation, readMapCornerAssets} =
require("./fixtures/map-webview-boundary/harnessSupport.cjs");
const {createMapSessionRouter} = require("../electron/mapHostManager");
const {createMapContentSecurityPolicy} = require("../electron/mapHostPolicy");
@@ -83,7 +83,14 @@ test("synthetic mode bundles the existing runtime while real mode fails explicit
finally { fs.rmSync(empty, {recursive: true, force: true}); }
});
-test("real Electron webview retains isolation and ordinary DOM menus cover its live surface without hide or refit", {
+test("corner fixture compiles production styles and visibility logic without a GUI", () => {
+ const assets = readMapCornerAssets();
+ assert.match(assets.css, /\.av__map-canvas > webview/);
+ assert.match(assets.radius, /^\d+(?:\.\d+)?px$/);
+ assert.doesNotThrow(() => new Function("exports", assets.visibility));
+});
+
+test("real Electron webview clips rounded corners, retains attribution visibility and isolation, and stays behind DOM menus", {
skip: process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY
? "Real Electron verification requires DISPLAY or WAYLAND_DISPLAY; no unsafe startup fallback is allowed" : false,
}, async () => {
diff --git a/kernel/api/av_contract_map.go b/kernel/api/av_contract_map.go
index 542a2135ed..62ef19c0df 100644
--- a/kernel/api/av_contract_map.go
+++ b/kernel/api/av_contract_map.go
@@ -9,7 +9,7 @@ func toContractAVMapSettings(value *av.MapSettings) *apicontract.AVMapSettings {
if value == nil {
return nil
}
- return &apicontract.AVMapSettings{LocationKeyID: value.LocationKeyID}
+ return &apicontract.AVMapSettings{LocationKeyID: value.LocationKeyID, Height: apicontract.AVMapHeight(value.Height)}
}
func toContractAVLayoutMap(value *av.LayoutMap) *apicontract.AVLayoutMap {
diff --git a/kernel/api/contract_av_map_test.go b/kernel/api/contract_av_map_test.go
index 7d20efc20f..2cd7f449a8 100644
--- a/kernel/api/contract_av_map_test.go
+++ b/kernel/api/contract_av_map_test.go
@@ -19,7 +19,7 @@ import (
)
func TestAVContractMapMapping(t *testing.T) {
- table := &av.Table{Map: &av.MapSettings{LocationKeyID: "20261009000000-abcdefg"},
+ table := &av.Table{Map: &av.MapSettings{LocationKeyID: "20261009000000-abcdefg", Height: 640},
MapMarkerScope: "page", Columns: []*av.TableColumn{}, Rows: []*av.TableRow{}, RowCount: 120}
assertAVContractJSONEqual(t, &av.Map{Table: table}, avContractView(&av.Map{Table: table}))
layout := &av.LayoutMap{LayoutTable: av.NewLayoutTable(), Settings: *table.Map}
@@ -307,7 +307,7 @@ func TestAVContractMapPublishFiltersTargetsAndPreservesSource(t *testing.T) {
}
view.ItemIDs = []string{hiddenID, visibleID}
view.LayoutType = av.LayoutTypeMap
- view.Map = &av.LayoutMap{LayoutTable: view.Table, Settings: av.MapSettings{LocationKeyID: ast.NewNodeID()}}
+ view.Map = &av.LayoutMap{LayoutTable: view.Table, Settings: av.MapSettings{LocationKeyID: ast.NewNodeID(), Height: 800}}
view.Table = nil
if err := av.SaveAttributeView(database); err != nil {
t.Fatal(err)
@@ -350,6 +350,9 @@ func TestAVContractMapPublishFiltersTargetsAndPreservesSource(t *testing.T) {
result.Data.Target.Status != want || result.Data.Target.Index != 0 || result.Data.Target.Offset != 0 {
t.Fatalf("publish leaked map count or target: %s", body)
}
+ if result.Data.View.Map == nil || result.Data.View.Map.Height != 800 {
+ t.Fatalf("publish lost map height: %s", body)
+ }
}
after, _ := os.ReadFile(path)
if !bytes.Equal(before, after) {
diff --git a/kernel/apicontract/av_map.go b/kernel/apicontract/av_map.go
index 0799d58a85..55e22ed534 100644
--- a/kernel/apicontract/av_map.go
+++ b/kernel/apicontract/av_map.go
@@ -1,5 +1,8 @@
package apicontract
+// AVMapHeight 是按视图保存的地图高度档位,单位为 CSS px。
+type AVMapHeight int
+
// AVMapSettings 是 setAttrViewMap 事务的完整设置和地图渲染响应中的设置。
// 地图只显示本次返回行页的标记,沿用普通视图的筛选、排序和分页。
// 分组设置保留但不参与地图渲染;普通导出和发布展示记录,不加载地图服务。
@@ -8,6 +11,8 @@ type AVMapSettings struct {
// 位置字段 ID;空字符串按视图顺序派生首个位置字段,不写回设置。显式字段缺失或类型变化时保留绑定,记录仍然返回。
// 隐藏的字段仍包含在 columns 和 rows.cells 中,客户端仅为有效 WGS84 坐标绘制标记。
LocationKeyID string `json:"locationKeyID"`
+ // 可选高度为 320、480、640 或 800px;省略按 480px 展示,不写回旧设置。显式 0 和 null 无效。
+ Height AVMapHeight `json:"height,omitempty" api:"optional"`
}
type AVLayoutMap struct {
diff --git a/kernel/apicontract/av_map_test.go b/kernel/apicontract/av_map_test.go
index 2321d6315c..397c1c97d0 100644
--- a/kernel/apicontract/av_map_test.go
+++ b/kernel/apicontract/av_map_test.go
@@ -46,6 +46,15 @@ func TestAVMapTransactionContract(t *testing.T) {
}{
{`{"locationKeyID":"20261009000000-abcdefg"}`, true},
{`{"locationKeyID":""}`, true},
+ {`{"locationKeyID":"","height":320}`, true},
+ {`{"locationKeyID":"","height":480}`, true},
+ {`{"locationKeyID":"","height":640}`, true},
+ {`{"locationKeyID":"","height":800}`, true},
+ {`{"locationKeyID":"","height":0}`, false},
+ {`{"locationKeyID":"","height":null}`, false},
+ {`{"locationKeyID":"","height":400}`, false},
+ {`{"locationKeyID":"","height":480.5}`, false},
+ {`{"locationKeyID":"","height":"480"}`, false},
{`{}`, false},
{`{"locationKeyID":false}`, false},
{`{"serviceID":"","locationKeyID":""}`, false},
diff --git a/kernel/apicontract/av_union.go b/kernel/apicontract/av_union.go
index 655b8c71db..fcff453c2d 100644
--- a/kernel/apicontract/av_union.go
+++ b/kernel/apicontract/av_union.go
@@ -31,6 +31,9 @@ func (value AVViewInstance) MarshalJSON() ([]byte, error) {
}
func avPayloadSchema(b *schemaBuilder, t reflect.Type, input bool) (*Schema, error) {
+ if t == reflect.TypeFor[AVMapHeight]() {
+ return &Schema{Type: "integer", Enum: []any{320, 480, 640, 800}}, nil
+ }
if t == reflect.TypeFor[*AVValueLocation]() {
schema, err := b.schema(t.Elem(), input)
return nullable(schema), err
diff --git a/kernel/apicontract/schema.json b/kernel/apicontract/schema.json
index 1d494cc745..cb13bffc4c 100644
--- a/kernel/apicontract/schema.json
+++ b/kernel/apicontract/schema.json
@@ -9996,6 +9996,15 @@
"AVMapSettings": {
"type": "object",
"properties": {
+ "height": {
+ "type": "integer",
+ "enum": [
+ 320,
+ 480,
+ 640,
+ 800
+ ]
+ },
"locationKeyID": {
"type": "string"
}
@@ -10008,6 +10017,15 @@
"AVMapSettingsInput": {
"type": "object",
"properties": {
+ "height": {
+ "type": "integer",
+ "enum": [
+ 320,
+ 480,
+ 640,
+ 800
+ ]
+ },
"locationKeyID": {
"type": "string"
}
diff --git a/kernel/av/layout_map.go b/kernel/av/layout_map.go
index fbde765471..c8d362fc0e 100644
--- a/kernel/av/layout_map.go
+++ b/kernel/av/layout_map.go
@@ -12,21 +12,37 @@ import (
"github.com/88250/lute/ast"
)
-// MapSettings 只保存位置字段绑定,底图固定为 OpenFreeMap。
+// MapSettings 保存位置字段绑定和视图高度,底图固定为 OpenFreeMap。
type MapSettings struct {
LocationKeyID string `json:"locationKeyID"`
+ Height int `json:"height,omitempty"` // 缺省为 480px;0 仅表示未保存此选项。
}
// UnmarshalJSON 拒绝额外设置,避免把不支持的地图结构静默保存为新结构。
func (settings *MapSettings) UnmarshalJSON(data []byte) error {
type plainSettings MapSettings
- var next plainSettings
+ var next struct {
+ plainSettings
+ Height json.RawMessage `json:"height"`
+ }
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
if err := decoder.Decode(&next); err != nil {
return err
}
- *settings = MapSettings(next)
+ if next.Height != nil {
+ if err := json.Unmarshal(next.Height, &next.plainSettings.Height); err != nil {
+ return err
+ }
+ if next.plainSettings.Height == 0 {
+ return fmt.Errorf("invalid map height")
+ }
+ }
+ parsed := MapSettings(next.plainSettings)
+ if err := parsed.Validate(); err != nil {
+ return err
+ }
+ *settings = parsed
return nil
}
@@ -35,6 +51,11 @@ func (settings MapSettings) Validate() error {
if settings.LocationKeyID != "" && !ast.IsNodeIDPattern(settings.LocationKeyID) {
return fmt.Errorf("invalid map location field ID")
}
+ switch settings.Height {
+ case 0, 320, 480, 640, 800:
+ default:
+ return fmt.Errorf("invalid map height")
+ }
return nil
}
diff --git a/kernel/av/layout_map_test.go b/kernel/av/layout_map_test.go
index 0d62796cf8..7dad632596 100644
--- a/kernel/av/layout_map_test.go
+++ b/kernel/av/layout_map_test.go
@@ -73,6 +73,32 @@ func TestMapSettingsValidation(t *testing.T) {
}
}
+func TestMapSettingsHeight(t *testing.T) {
+ for _, height := range []int{0, 320, 480, 640, 800} {
+ settings := MapSettings{Height: height}
+ data, err := json.Marshal(settings)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var restored MapSettings
+ if err = json.Unmarshal(data, &restored); err != nil || restored != settings {
+ t.Fatalf("height roundtrip %d: %+v, %v", height, restored, err)
+ }
+ if height == 0 && bytes.Contains(data, []byte("height")) {
+ t.Fatal("omitted height must remain omitted")
+ }
+ }
+ for _, height := range []string{"0", "null", "-1", "400", "480.5", `"480"`, "true", "{}"} {
+ settings := MapSettings{Height: 640}
+ if err := json.Unmarshal([]byte(`{"locationKeyID":"","height":`+height+`}`), &settings); err == nil {
+ t.Fatalf("invalid height accepted: %s", height)
+ }
+ if settings.Height != 640 {
+ t.Fatal("invalid height mutated settings")
+ }
+ }
+}
+
func TestMapSettingsJSONRejectsLegacyFieldsWithoutMutation(t *testing.T) {
for _, payload := range []string{
`{"locationKeyID":"","serviceID":"openfreemap"}`,
diff --git a/kernel/model/attribute_view_map.go b/kernel/model/attribute_view_map.go
index 43febb66a3..2fd9a64ca1 100644
--- a/kernel/model/attribute_view_map.go
+++ b/kernel/model/attribute_view_map.go
@@ -183,9 +183,10 @@ func setAttrViewMap(operation *Operation) error {
if err != nil {
return err
}
- // 设置只包含位置字段,拒绝其他内容进入数据库事务。
+ // 设置只包含位置字段和高度,拒绝其他内容进入数据库事务。
var settings struct {
- LocationKeyID *string `json:"locationKeyID"`
+ LocationKeyID *string `json:"locationKeyID"`
+ Height json.RawMessage `json:"height"`
}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
@@ -196,6 +197,14 @@ func setAttrViewMap(operation *Operation) error {
return fmt.Errorf("complete map settings are required")
}
next := av.MapSettings{LocationKeyID: *settings.LocationKeyID}
+ if settings.Height != nil {
+ if err = json.Unmarshal(settings.Height, &next.Height); err != nil {
+ return err
+ }
+ if next.Height == 0 {
+ return fmt.Errorf("invalid map height")
+ }
+ }
if err = next.Validate(); err != nil {
return err
}
diff --git a/kernel/model/attribute_view_map_fts5_test.go b/kernel/model/attribute_view_map_fts5_test.go
index 125f17529f..17f0b441b1 100644
--- a/kernel/model/attribute_view_map_fts5_test.go
+++ b/kernel/model/attribute_view_map_fts5_test.go
@@ -52,7 +52,7 @@ func TestAttributeViewMapSettingsUndoAndEncryptedReplay(t *testing.T) {
}
}
before := view.Map.Settings
- after := av.MapSettings{LocationKeyID: ast.NewNodeID()}
+ after := av.MapSettings{LocationKeyID: ast.NewNodeID(), Height: 800}
operation := func(settings av.MapSettings) *Operation {
return &Operation{Action: "setAttrViewMap", AvID: database.ID, ViewID: view.ID, Data: settings}
}
diff --git a/kernel/model/attribute_view_map_test.go b/kernel/model/attribute_view_map_test.go
index e66cdbc30f..7921be14dc 100644
--- a/kernel/model/attribute_view_map_test.go
+++ b/kernel/model/attribute_view_map_test.go
@@ -35,6 +35,7 @@ func TestAttributeViewMapSettingsFieldsAndClone(t *testing.T) {
key := av.NewKey(ast.NewNodeID(), "Place", "", av.KeyTypeLocation)
addAttributeViewKey(attrView, view, key, "")
view.Map.Settings.LocationKeyID = key.ID
+ view.Map.Settings.Height = 800
view.Group = &av.ViewGroup{Field: attrView.KeyValues[1].Key.ID}
if getAttributeViewField(view, key.ID) == nil || view.IsGroupView() {
t.Fatal("map field or grouping state is incorrect")
@@ -64,6 +65,9 @@ func TestAttributeViewMapSettingsFieldsAndClone(t *testing.T) {
t.Fatal("map database clone failed")
}
copySettings := copy.Views[0].Map.Settings
+ if cloned.Map.Settings.Height != 800 || copySettings.Height != 800 {
+ t.Fatal("cloning lost map height")
+ }
copyKey, err := copy.GetKey(copySettings.LocationKeyID)
if err != nil || copyKey.Type != av.KeyTypeLocation || copyKey.ID == key.ID {
t.Fatal("clone did not remap its own location field")
@@ -90,6 +94,7 @@ func TestAttributeViewMapFilterSortPageTargetAndExport(t *testing.T) {
key := av.NewKey(ast.NewNodeID(), "Place", "", av.KeyTypeLocation)
addAttributeViewKey(attrView, view, key, "")
view.Map.Settings.LocationKeyID = key.ID
+ view.Map.Settings.Height = 320
view.PageSize = 10
for _, column := range view.Map.Columns {
if column.ID == key.ID {
@@ -118,7 +123,7 @@ func TestAttributeViewMapFilterSortPageTargetAndExport(t *testing.T) {
t.Fatal(err)
}
if len(mapped.Rows) != 10 || mapped.RowCount != 120 || mapped.Rows[0].ID != view.ItemIDs[129-page*10] ||
- mapped.MapMarkerScope != "page" || mapped.Map.LocationKeyID != key.ID {
+ mapped.MapMarkerScope != "page" || mapped.Map.LocationKeyID != key.ID || mapped.Map.Height != 320 {
t.Fatalf("page %d did not follow ordinary filtered/sorted rows: %+v", page, mapped.Table)
}
if value := mapped.Rows[0].GetValue(key.ID); value == nil || value.Location == nil || *value.Location.Latitude != 0 {
@@ -146,6 +151,9 @@ func TestAttributeViewMapInvalidSavePreservesSource(t *testing.T) {
path := av.GetAttributeViewDataPath(attrView.ID)
before, _ := os.ReadFile(path)
for _, malformed := range []any{nil, map[string]any{}, map[string]any{"serviceID": "", "locationKeyID": "", "showRecordList": true, "apiKey": "not-allowed"},
+ map[string]any{"locationKeyID": "", "height": 0}, map[string]any{"locationKeyID": "", "height": nil},
+ map[string]any{"locationKeyID": "", "height": 400}, map[string]any{"locationKeyID": "", "height": 480.5},
+ map[string]any{"locationKeyID": "", "height": "480"},
map[string]any{"locationKeyID": "", "serviceID": "openfreemap"}, map[string]any{"locationKeyID": "", "showRecordList": false}, av.MapSettings{LocationKeyID: "invalid"}} {
if err := setAttrViewMap(&Operation{AvID: attrView.ID, ViewID: view.ID, Data: malformed}); err == nil {
t.Fatalf("invalid settings accepted: %#v", malformed)
@@ -168,6 +176,29 @@ func TestAttributeViewMapInvalidSavePreservesSource(t *testing.T) {
}
}
+func TestAttributeViewMapHeightIsPerView(t *testing.T) {
+ attrView, view := setupMapTest(t)
+ other := av.NewMapView()
+ attrView.Views = append(attrView.Views, other)
+ if err := av.SaveAttributeView(attrView); err != nil {
+ t.Fatal(err)
+ }
+ for _, height := range []int{320, 480, 640, 800, 0} {
+ settings := av.MapSettings{Height: height}
+ if err := setAttrViewMap(&Operation{AvID: attrView.ID, ViewID: view.ID, Data: settings}); err != nil {
+ t.Fatal(err)
+ }
+ cache.ClearAVCache()
+ stored, err := av.ParseAttributeView(attrView.ID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if stored.Views[0].Map.Settings.Height != height || stored.Views[1].Map.Settings.Height != 0 {
+ t.Fatal("height change did not stay within its view")
+ }
+ }
+}
+
func TestAttributeViewMapImportAndHistoryPreserveBindings(t *testing.T) {
t.Run("empty", func(t *testing.T) { testAttributeViewMapImportAndHistoryPreserveBindings(t, false) })
t.Run("populated", func(t *testing.T) { testAttributeViewMapImportAndHistoryPreserveBindings(t, true) })
@@ -178,7 +209,7 @@ func testAttributeViewMapImportAndHistoryPreserveBindings(t *testing.T, populate
oldHistory := util.HistoryDir
util.HistoryDir = t.TempDir()
t.Cleanup(func() { util.HistoryDir = oldHistory })
- view.Map.Settings = av.MapSettings{LocationKeyID: ast.NewNodeID()}
+ view.Map.Settings = av.MapSettings{LocationKeyID: ast.NewNodeID(), Height: 640}
if populated {
primary := attrView.GetBlockKeyValues()
itemID := ast.NewNodeID()