mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
563cca7e4e
commit
e1ea1516c7
3 changed files with 54 additions and 4 deletions
|
|
@ -143,33 +143,65 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.callout {
|
.callout {
|
||||||
padding: 8px;
|
position: relative;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
width: .25em;
|
||||||
|
border-radius: var(--b3-border-radius);
|
||||||
|
position: absolute;
|
||||||
|
left: 2px;
|
||||||
|
top: 6px;
|
||||||
|
bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
padding-left: calc(0.25em + 6px);
|
||||||
|
color: var(--b3-theme-on-surface);
|
||||||
|
background-color: var(--b3-bq-background);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
&[data-subtype="NOTE"] {
|
&[data-subtype="NOTE"] {
|
||||||
|
&::before {
|
||||||
|
background-color: var(--b3-theme-primary);
|
||||||
|
}
|
||||||
|
|
||||||
.callout-info {
|
.callout-info {
|
||||||
color: var(--b3-theme-primary);
|
color: var(--b3-theme-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-subtype="WARNING"] {
|
&[data-subtype="WARNING"] {
|
||||||
|
&::before {
|
||||||
|
background-color: var(--b3-callout-warning);
|
||||||
|
}
|
||||||
.callout-info {
|
.callout-info {
|
||||||
color: var(--b3-callout-warning);
|
color: var(--b3-callout-warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-subtype="TIP"] {
|
&[data-subtype="TIP"] {
|
||||||
|
&::before {
|
||||||
|
background-color: var(--b3-theme-success);
|
||||||
|
}
|
||||||
.callout-info {
|
.callout-info {
|
||||||
color: var(--b3-theme-success);
|
color: var(--b3-theme-success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-subtype="IMPORTANT"] {
|
&[data-subtype="IMPORTANT"] {
|
||||||
|
&::before {
|
||||||
|
background-color: var(--b3-callout-important);
|
||||||
|
}
|
||||||
.callout-info {
|
.callout-info {
|
||||||
color: var(--b3-callout-important);
|
color: var(--b3-callout-important);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-subtype="CAUTION"] {
|
&[data-subtype="CAUTION"] {
|
||||||
|
&::before {
|
||||||
|
background-color: var(--b3-theme-error);
|
||||||
|
}
|
||||||
.callout-info {
|
.callout-info {
|
||||||
color: var(--b3-theme-error);
|
color: var(--b3-theme-error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1249,6 +1249,17 @@ export class Gutter {
|
||||||
nodeElement,
|
nodeElement,
|
||||||
type: "CancelBlockquote"
|
type: "CancelBlockquote"
|
||||||
}));
|
}));
|
||||||
|
} else if (type === "NodeCallout" && !protyle.disabled) {
|
||||||
|
turnIntoSubmenu.push(this.turnsOneInto({
|
||||||
|
menuId: "paragraph",
|
||||||
|
id,
|
||||||
|
icon: "iconParagraph",
|
||||||
|
label: window.siyuan.languages.paragraph,
|
||||||
|
accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom,
|
||||||
|
protyle,
|
||||||
|
nodeElement,
|
||||||
|
type: "CancelCallout"
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
if (turnIntoSubmenu.length > 0 && !protyle.disabled) {
|
if (turnIntoSubmenu.length > 0 && !protyle.disabled) {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
|
@ -2444,7 +2455,7 @@ export class Gutter {
|
||||||
}
|
}
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
// 不单独显示,要不然在块的间隔中,gutter 会跳来跳去的
|
// 不单独显示,要不然在块的间隔中,gutter 会跳来跳去的
|
||||||
if (["NodeBlockquote", "NodeList", "NodeSuperBlock"].includes(type)) {
|
if (["NodeBlockquote", "NodeCallout", "NodeList", "NodeSuperBlock"].includes(type)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const topElement = getTopAloneElement(nodeElement);
|
const topElement = getTopAloneElement(nodeElement);
|
||||||
|
|
@ -2498,7 +2509,7 @@ data-type="fold" style="cursor:inherit;"><svg style="width: 10px${fold && fold =
|
||||||
if (type === "NodeHeading") {
|
if (type === "NodeHeading") {
|
||||||
html = html + foldHTML;
|
html = html + foldHTML;
|
||||||
}
|
}
|
||||||
if (type === "NodeBlockquote") {
|
if (["NodeBlockquote", "NodeCallout"].includes(type)) {
|
||||||
space += 8;
|
space += 8;
|
||||||
}
|
}
|
||||||
if (nodeElement.previousElementSibling && nodeElement.previousElementSibling.getAttribute("data-node-id")) {
|
if (nodeElement.previousElementSibling && nodeElement.previousElementSibling.getAttribute("data-node-id")) {
|
||||||
|
|
@ -2509,7 +2520,7 @@ data-type="fold" style="cursor:inherit;"><svg style="width: 10px${fold && fold =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 列表项中的引述块中的第二个段落块块标和引述块左侧样式重叠
|
// 列表项中的引述块中的第二个段落块块标和引述块左侧样式重叠
|
||||||
if (parentElement && parentElement.getAttribute("data-type") === "NodeBlockquote") {
|
if (parentElement && ["NodeBlockquote", "NodeCallout"].includes(parentElement.getAttribute("data-type"))) {
|
||||||
space += 8;
|
space += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1390,6 +1390,13 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
id: selectsElement[0].getAttribute("data-node-id"),
|
id: selectsElement[0].getAttribute("data-node-id"),
|
||||||
type: "CancelBlockquote",
|
type: "CancelBlockquote",
|
||||||
});
|
});
|
||||||
|
} else if (type === "NodeCallout") {
|
||||||
|
turnsOneInto({
|
||||||
|
protyle,
|
||||||
|
nodeElement: selectsElement[0],
|
||||||
|
id: selectsElement[0].getAttribute("data-node-id"),
|
||||||
|
type: "CancelCallout",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue