Skip to content

Commit

Permalink
Merge remote-tracking branch 'forke-siyuan/dev' into v0.35
Browse files Browse the repository at this point in the history
  • Loading branch information
Soltus committed Jul 3, 2024
2 parents 5c3c441 + 80851be commit 791edf7
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"title": "Formatting elements",
"title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;",
"type": "doc",
"updated": "20240506230853"
"updated": "20240702222031"
},
"Children": [
{
Expand All @@ -17,7 +17,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210104091509-sg4pt12",
"updated": "20210604224332"
"updated": "20240702222031"
},
"Children": [
{
Expand All @@ -32,7 +32,7 @@
"ListData": {},
"Properties": {
"id": "20210104091509-8csaq4j",
"updated": "20240506230853"
"updated": "20240702222031"
},
"Children": [
{
Expand Down Expand Up @@ -105,7 +105,7 @@
},
"Properties": {
"id": "20220916200111-8pnrqr2",
"updated": "20240225111211"
"updated": "20240702222031"
},
"Children": [
{
Expand Down Expand Up @@ -141,9 +141,13 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220916200115-rstez65",
"updated": "20240225111211"
"updated": "20240702222031"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeImage",
"Data": "span",
Expand Down Expand Up @@ -171,9 +175,6 @@
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"title": "排版元素",
"title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);",
"type": "doc",
"updated": "20240506230804"
"updated": "20240702222051"
},
"Children": [
{
Expand All @@ -17,7 +17,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210604182832-nm3hapx",
"updated": "20220916194920"
"updated": "20240702222051"
},
"Children": [
{
Expand All @@ -32,7 +32,7 @@
"ListData": {},
"Properties": {
"id": "20210104091228-ttcj9nm",
"updated": "20240506230804"
"updated": "20240702222051"
},
"Children": [
{
Expand Down Expand Up @@ -105,7 +105,7 @@
},
"Properties": {
"id": "20220916195046-bdzv6fy",
"updated": "20240225111151"
"updated": "20240702222051"
},
"Children": [
{
Expand Down Expand Up @@ -141,9 +141,13 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20210604222158-w17nnmy",
"updated": "20240225111151"
"updated": "20240702222051"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeImage",
"Data": "span",
Expand Down Expand Up @@ -173,7 +177,8 @@
]
},
{
"Type": "NodeText"
"Type": "NodeText",
"Data": ""
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/protyle/gutter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ export class Gutter {
turnIntoSubmenu.push(this.turnsOneInto({
icon: "iconParagraph",
label: window.siyuan.languages.paragraph,
accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom,
protyle,
nodeElement,
id,
Expand Down Expand Up @@ -1145,6 +1146,7 @@ export class Gutter {
turnIntoSubmenu.push(this.turnsOneInto({
icon: "iconParagraph",
label: window.siyuan.languages.paragraph,
accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom,
protyle,
nodeElement,
id,
Expand Down Expand Up @@ -2043,7 +2045,7 @@ data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" d
if (type === "NodeListItem" && nodeElement.childElementCount > 3 || type === "NodeHeading") {
const fold = nodeElement.getAttribute("fold");
foldHTML = `<button class="ariaLabel" data-position="right" aria-label="${window.siyuan.languages.fold}"
data-type="fold"><svg style="width:10px${fold && fold === "1" ? "" : ";transform:rotate(90deg)"}"><use xlink:href="#iconPlay"></use></svg></button>`;
data-type="fold" style="cursor:inherit;"><svg style="width:10px${fold && fold === "1" ? "" : ";transform:rotate(90deg)"}"><use xlink:href="#iconPlay"></use></svg></button>`;
}
if (type === "NodeListItem" || type === "NodeList") {
listItem = nodeElement;
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/header/Title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class Title {
}
} else if (event.key === "Enter") {
const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild)
if (editElment && editElment.textContent === "") {
if (editElment && editElment.textContent === "" && !protyle.wysiwyg.element.firstElementChild.classList.contains("av")) {
// 配合提示文本使用,避免提示文本挤压到第二个块中
focusBlock(protyle.wysiwyg.element.firstElementChild, protyle.wysiwyg.element);
} else {
Expand Down
43 changes: 37 additions & 6 deletions app/src/protyle/wysiwyg/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// 段末反向删除 https://github.com/siyuan-note/insider/issues/274
if (position.end === editElement.textContent.length ||
// 软换行后删除 https://github.com/siyuan-note/siyuan/issues/11118
(position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith("\n"))) {
(position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith("\n")) ||
// 图片后无内容删除 https://github.com/siyuan-note/siyuan/issues/11868
(position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith(Constants.ZWSP))) {
const nextElement = getNextBlock(getTopAloneElement(nodeElement));
if (nextElement) {
const nextRange = focusBlock(nextElement);
Expand Down Expand Up @@ -1185,11 +1187,40 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {

// h1 - h6 hotkey
if (matchHotKey(window.siyuan.config.keymap.editor.heading.paragraph.custom, event)) {
turnsIntoTransaction({
protyle,
nodeElement,
type: "Blocks2Ps",
});
const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))
if (selectsElement.length === 0) {
selectsElement.push(nodeElement);
}
if (selectsElement.length > 1) {
turnsIntoTransaction({
protyle,
nodeElement: selectsElement[0],
type: "Blocks2Ps",
});
} else {
const type = selectsElement[0].getAttribute("data-type");
if (type === "NodeHeading") {
turnsIntoTransaction({
protyle,
nodeElement: selectsElement[0],
type: "Blocks2Ps",
});
} else if (type === "NodeList") {
turnsOneInto({
protyle,
nodeElement: selectsElement[0],
id: selectsElement[0].getAttribute("data-node-id"),
type: "CancelList",
});
} else if (type === "NodeBlockquote") {
turnsOneInto({
protyle,
nodeElement: selectsElement[0],
id: selectsElement[0].getAttribute("data-node-id"),
type: "CancelBlockquote",
});
}
}
event.preventDefault();
event.stopPropagation();
return true;
Expand Down

0 comments on commit 791edf7

Please sign in to comment.