mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 07:48:49 +01:00
This commit is contained in:
parent
00cbc80b91
commit
11a94d45cf
3 changed files with 45 additions and 22 deletions
|
|
@ -292,7 +292,6 @@
|
|||
}
|
||||
|
||||
&-cover {
|
||||
height: 168px;
|
||||
border-bottom: 1px solid var(--b3-border-color);
|
||||
background-color: var(--b3-theme-surface);
|
||||
border-radius: var(--b3-border-radius) var(--b3-border-radius) 0 0;
|
||||
|
|
@ -300,6 +299,28 @@
|
|||
transition: background 100ms ease-out;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
||||
&--0 {
|
||||
aspect-ratio: 16/9;
|
||||
}
|
||||
&--1 {
|
||||
aspect-ratio: 9/16;
|
||||
}
|
||||
&--2 {
|
||||
aspect-ratio: 4/3;
|
||||
}
|
||||
&--3 {
|
||||
aspect-ratio: 3/4;
|
||||
}
|
||||
&--4 {
|
||||
aspect-ratio: 3/2;
|
||||
}
|
||||
&--5 {
|
||||
aspect-ratio: 2/3;
|
||||
}
|
||||
&--6 {
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&-img {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export const renderGallery = (options: {
|
|||
} else if (item.coverContent) {
|
||||
galleryHTML += `<div class="${coverClass}"><div class="av__gallery-content">${item.coverContent}</div><div></div></div>`;
|
||||
} else {
|
||||
galleryHTML += '<div class="${coverClass}"></div>';
|
||||
galleryHTML += `<div class="${coverClass}"></div>`;
|
||||
}
|
||||
}
|
||||
galleryHTML += `<div class="av__gallery-fields${editIds.includes(item.id) ? " av__gallery-fields--edit" : ""}${view.wrapField ? " av__gallery-fields--wrap" : ""}">`;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ export const getCardAspectRatio = (ratio: number) => {
|
|||
case 4:
|
||||
return "3:2";
|
||||
case 5:
|
||||
return "3:2";
|
||||
return "2:3";
|
||||
case 6:
|
||||
return "1:1";
|
||||
}
|
||||
|
|
@ -197,25 +197,27 @@ export const setGalleryRatio = (options: {
|
|||
const avID = options.nodeElement.getAttribute("data-av-id");
|
||||
const blockID = options.nodeElement.getAttribute("data-node-id");
|
||||
const targetNameElement = options.target.querySelector(".b3-menu__accelerator");
|
||||
menu.addItem({
|
||||
iconHTML: "",
|
||||
checked: options.view.cardAspectRatio === 0,
|
||||
label: "16:9",
|
||||
click() {
|
||||
transaction(options.protyle, [{
|
||||
action: "setAttrViewCardAspectRatio",
|
||||
avID,
|
||||
blockID,
|
||||
data: 0
|
||||
}], [{
|
||||
action: "setAttrViewCardAspectRatio",
|
||||
avID,
|
||||
blockID,
|
||||
data: options.view.cardSize
|
||||
}]);
|
||||
options.view.cardAspectRatio = 0;
|
||||
targetNameElement.textContent = getCardAspectRatio(0);
|
||||
}
|
||||
[0, 1, 2, 3, 4, 5, 6].forEach(ratio => {
|
||||
menu.addItem({
|
||||
iconHTML: "",
|
||||
checked: options.view.cardAspectRatio === ratio,
|
||||
label: getCardAspectRatio(ratio),
|
||||
click() {
|
||||
transaction(options.protyle, [{
|
||||
action: "setAttrViewCardAspectRatio",
|
||||
avID,
|
||||
blockID,
|
||||
data: ratio
|
||||
}], [{
|
||||
action: "setAttrViewCardAspectRatio",
|
||||
avID,
|
||||
blockID,
|
||||
data: options.view.cardAspectRatio
|
||||
}]);
|
||||
options.view.cardAspectRatio = ratio;
|
||||
targetNameElement.textContent = getCardAspectRatio(ratio);
|
||||
}
|
||||
});
|
||||
});
|
||||
const rect = options.target.getBoundingClientRect();
|
||||
menu.open({x: rect.left, y: rect.bottom});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue