This commit is contained in:
Vanessa 2023-08-20 12:26:36 +08:00
parent 2fae8a008a
commit e5c96b499d
2 changed files with 31 additions and 21 deletions

View file

@ -555,6 +555,23 @@
}
}
// 只读情况下列表前的圆点需要可以点击进行缩放
.protyle .protyle-wysiwyg {
.li[data-subtype="o"] > .protyle-action,
.li[data-subtype="u"] > .protyle-action,
&[contenteditable="true"] .li[data-subtype="t"] > .protyle-action {
cursor: pointer;
&:hover {
&:after {
background-color: var(--b3-theme-background-light);
}
color: var(--b3-theme-on-background);
}
}
}
// 导出 html 不需要编辑样式
.protyle-wysiwyg[contenteditable="true"] {
span[data-type~="inline-math"],
@ -563,7 +580,6 @@
span[data-type~="file-annotation-ref"],
.protyle-action__language,
.img > span:nth-child(2),
.li > .protyle-action,
.render-node {
cursor: pointer;
}
@ -577,14 +593,6 @@
opacity: 1;
}
.li > .protyle-action:hover {
&:after {
opacity: .68;
}
color: var(--b3-theme-on-background);
}
.code-block .protyle-action {
-webkit-user-modify: read-only;

View file

@ -1932,8 +1932,8 @@ export class WYSIWYG {
clientX: event.clientX + 4,
clientY: event.clientY
});
} else if (!protyle.disabled && actionElement.parentElement.classList.contains("li")) {
if (event.altKey) {
} else if (actionElement.parentElement.classList.contains("li")) {
if (event.altKey && !protyle.disabled) {
// 展开/折叠当前层级的所有列表项
if (actionElement.parentElement.parentElement.classList.contains("protyle-wysiwyg")) {
// 缩放列表项 https://ld246.com/article/1653123034794
@ -1961,22 +1961,24 @@ export class WYSIWYG {
updateTransaction(protyle, actionElement.parentElement.parentElement.getAttribute("data-node-id"), actionElement.parentElement.parentElement.outerHTML, oldHTML);
}
hideElements(["gutter"], protyle);
} else if (event.shiftKey) {
} else if (event.shiftKey && !protyle.disabled) {
openAttr(actionElement.parentElement);
} else if (ctrlIsPressed) {
zoomOut({protyle, id: actionElement.parentElement.getAttribute("data-node-id")});
} else {
if (actionElement.classList.contains("protyle-action--task")) {
const html = actionElement.parentElement.outerHTML;
if (actionElement.parentElement.classList.contains("protyle-task--done")) {
actionElement.querySelector("use").setAttribute("xlink:href", "#iconUncheck");
actionElement.parentElement.classList.remove("protyle-task--done");
} else {
actionElement.querySelector("use").setAttribute("xlink:href", "#iconCheck");
actionElement.parentElement.classList.add("protyle-task--done");
if (!protyle.disabled) {
const html = actionElement.parentElement.outerHTML;
if (actionElement.parentElement.classList.contains("protyle-task--done")) {
actionElement.querySelector("use").setAttribute("xlink:href", "#iconUncheck");
actionElement.parentElement.classList.remove("protyle-task--done");
} else {
actionElement.querySelector("use").setAttribute("xlink:href", "#iconCheck");
actionElement.parentElement.classList.add("protyle-task--done");
}
actionElement.parentElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, actionElement.parentElement.getAttribute("data-node-id"), actionElement.parentElement.outerHTML, html);
}
actionElement.parentElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, actionElement.parentElement.getAttribute("data-node-id"), actionElement.parentElement.outerHTML, html);
} else {
zoomOut({protyle, id: actionElement.parentElement.getAttribute("data-node-id")});
}