mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
This commit is contained in:
parent
bb52da5bbc
commit
28bae43925
4 changed files with 9 additions and 39 deletions
|
|
@ -383,11 +383,6 @@
|
|||
min-height: 23px;
|
||||
padding: 5px 4px;
|
||||
|
||||
&--wrap {
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.av__cell {
|
||||
padding: 2px 4px;
|
||||
border-right: 0;
|
||||
|
|
|
|||
|
|
@ -184,9 +184,14 @@ export const getEditHTML = (options: {
|
|||
<input data-type="fillCreated" type="checkbox" class="b3-switch b3-switch--menu" ${colData.date?.autoFillNow ? "checked" : ""}>
|
||||
</label>`;
|
||||
}
|
||||
if (colData.type !== "block") {
|
||||
html += `<button class="b3-menu__separator" data-id="separator_3"></button>
|
||||
<button class="b3-menu__item" data-type="${colData.hidden ? "showCol" : "hideCol"}">
|
||||
<label class="b3-menu__item">
|
||||
<span class="fn__flex-center">${window.siyuan.languages.wrap}</span>
|
||||
<span class="fn__space fn__flex-1"></span>
|
||||
<input type="checkbox" data-type="wrap" class="b3-switch b3-switch--menu"${colData.wrap ? " checked" : ""}>
|
||||
</label>`;
|
||||
if (colData.type !== "block") {
|
||||
html += `<button class="b3-menu__item" data-type="${colData.hidden ? "showCol" : "hideCol"}">
|
||||
<svg class="b3-menu__icon" style=""><use xlink:href="#icon${colData.hidden ? "Eye" : "Eyeoff"}"></use></svg>
|
||||
<span class="b3-menu__label">${colData.hidden ? window.siyuan.languages.showCol : window.siyuan.languages.hideCol}</span>
|
||||
</button>
|
||||
|
|
@ -1052,29 +1057,6 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
});
|
||||
menu.addSeparator({id: "separator_3"});
|
||||
}
|
||||
menu.addItem({
|
||||
id: "wrap",
|
||||
label: `<label class="fn__flex"><span class="fn__flex-center">${window.siyuan.languages.wrap}</span><span class="fn__space fn__flex-1"></span>
|
||||
<input type="checkbox" class="b3-switch b3-switch--menu"${cellElement.dataset.wrap === "true" ? " checked" : ""}></label>`,
|
||||
bind(element) {
|
||||
const inputElement = element.querySelector("input") as HTMLInputElement;
|
||||
inputElement.addEventListener("change", () => {
|
||||
transaction(protyle, [{
|
||||
action: "setAttrViewColWrap",
|
||||
id: colId,
|
||||
avID,
|
||||
data: inputElement.checked,
|
||||
blockID
|
||||
}], [{
|
||||
action: "setAttrViewColWrap",
|
||||
id: colId,
|
||||
avID,
|
||||
data: !inputElement.checked,
|
||||
blockID
|
||||
}]);
|
||||
});
|
||||
}
|
||||
});
|
||||
const cellRect = cellElement.getBoundingClientRect();
|
||||
menu.open({
|
||||
x: cellRect.left,
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export const renderGallery = (options: {
|
|||
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" : ""}">`;
|
||||
galleryHTML += `<div class="av__gallery-fields${editIds.includes(item.id) ? " av__gallery-fields--edit" : ""}">`;
|
||||
item.values.forEach((cell, fieldsIndex) => {
|
||||
if (view.fields[fieldsIndex].hidden) {
|
||||
return;
|
||||
|
|
@ -96,7 +96,7 @@ export const renderGallery = (options: {
|
|||
if (view.fields[fieldsIndex].desc) {
|
||||
ariaLabel += escapeAttr(`<div class="ft__on-surface">${view.fields[fieldsIndex].desc}</div>`);
|
||||
}
|
||||
galleryHTML += `<div class="av__cell${checkClass} ariaLabel"
|
||||
galleryHTML += `<div class="av__cell${checkClass} ariaLabel" data-wrap="${view.fields[fieldsIndex].wrap}"
|
||||
data-empty="${isEmpty}"
|
||||
aria-label="${ariaLabel}"
|
||||
data-position="5west"
|
||||
|
|
|
|||
|
|
@ -508,13 +508,6 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
|||
});
|
||||
} else if (operation.action === "setAttrViewWrapField") {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
|
||||
item.querySelectorAll(".av__gallery-fields").forEach(fieldItem => {
|
||||
if (operation.data) {
|
||||
fieldItem.classList.add("av__gallery-fields--wrap");
|
||||
} else {
|
||||
fieldItem.classList.remove("av__gallery-fields--wrap");
|
||||
}
|
||||
});
|
||||
item.querySelectorAll(".av__cell").forEach(fieldItem => {
|
||||
fieldItem.setAttribute("data-wrap", operation.data.toString());
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue