From 40868a50f9a400db767d9943da33968a91373b49 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 18 Sep 2022 17:51:19 +0800 Subject: [PATCH] :memo: https://github.com/siyuan-note/siyuan/issues/174 --- .../20200924093441-ft2rhps.sy | 35 +++++++++++++++++-- .../20200825162036-4dx365o.sy | 35 +++++++++++++++++-- .../20211226121319-emrk2yy.sy | 35 +++++++++++++++++-- app/src/protyle/export/index.ts | 2 +- app/src/protyle/toolbar/index.ts | 8 ++--- app/src/protyle/wysiwyg/index.ts | 16 ++++----- 6 files changed, 112 insertions(+), 19 deletions(-) diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy index 174749fd6..2e9738c9c 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy @@ -3,11 +3,12 @@ "Spec": "1", "Type": "NodeDocument", "Properties": { + "icon": "1f4f0", "id": "20200924093441-ft2rhps", "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": "20220916200115" + "updated": "20220918174924" }, "Children": [ { @@ -31,7 +32,7 @@ "ListData": {}, "Properties": { "id": "20210104091509-8csaq4j", - "updated": "20220916200115" + "updated": "20220918174924" }, "Children": [ { @@ -505,6 +506,36 @@ } ] }, + { + "ID": "20220918174910-8q5x3x0", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20220918174910-8q5x3x0", + "updated": "20220918174924" + }, + "Children": [ + { + "ID": "20220918174910-p5i5ltq", + "Type": "NodeParagraph", + "Properties": { + "id": "20220918174910-p5i5ltq", + "updated": "20220918174924" + }, + "Children": [ + { + "Type": "NodeTextMark", + "TextMarkType": "inline-memo", + "TextMarkInlineMemoContent": "This is a memo.", + "TextMarkTextContent": "Memo" + } + ] + } + ] + }, { "ID": "20210604224724-pa2a6tz", "Type": "NodeListItem", diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy index 4102681a2..f23a997bc 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy @@ -3,11 +3,12 @@ "Spec": "1", "Type": "NodeDocument", "Properties": { + "icon": "1f4f0", "id": "20200825162036-4dx365o", "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": "20210604222204" + "updated": "20220918174723" }, "Children": [ { @@ -31,7 +32,7 @@ "ListData": {}, "Properties": { "id": "20210104091228-ttcj9nm", - "updated": "20210604222204" + "updated": "20220918174723" }, "Children": [ { @@ -509,6 +510,36 @@ } ] }, + { + "ID": "20220918172212-57nf6j0", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20220918172212-57nf6j0", + "updated": "20220918174723" + }, + "Children": [ + { + "ID": "20220918172212-xvd14ba", + "Type": "NodeParagraph", + "Properties": { + "id": "20220918172212-xvd14ba", + "updated": "20220918174723" + }, + "Children": [ + { + "Type": "NodeTextMark", + "TextMarkType": "inline-memo", + "TextMarkInlineMemoContent": "这是一个行级备注", + "TextMarkTextContent": "备注" + } + ] + } + ] + }, { "ID": "20210604221118-nprm47c", "Type": "NodeListItem", diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy index 99d4dd7f2..ce1ccd0a2 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy @@ -3,10 +3,11 @@ "Spec": "1", "Type": "NodeDocument", "Properties": { + "icon": "1f4f0", "id": "20211226121319-emrk2yy", "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);", - "updated": "20220916195925" + "updated": "20220918174803" }, "Children": [ { @@ -30,7 +31,7 @@ "ListData": {}, "Properties": { "id": "20211226122008-1e014nh", - "updated": "20220916195740" + "updated": "20220918174803" }, "Children": [ { @@ -512,6 +513,36 @@ } ] }, + { + "ID": "20220918172637-u4ckqgh", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20220918172637-u4ckqgh", + "updated": "20220918174803" + }, + "Children": [ + { + "ID": "20220918172637-x9l2igm", + "Type": "NodeParagraph", + "Properties": { + "id": "20220918172637-x9l2igm", + "updated": "20220918174803" + }, + "Children": [ + { + "Type": "NodeTextMark", + "TextMarkType": "inline-memo", + "TextMarkInlineMemoContent": "這是一個行級備註", + "TextMarkTextContent": "備註" + } + ] + } + ] + }, { "ID": "20211226122008-hd9rbv6", "Type": "NodeListItem", diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index b4f2ed609..31661e3b7 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -80,7 +80,7 @@ const renderPDF = (id: string) => { width: 1032, resizable: false, frame: "darwin" === window.siyuan.config.system.os, - icon: path.join(window.siyuan.config.system.appDir, 'stage', 'icon-large.png'), + icon: path.join(window.siyuan.config.system.appDir, "stage", "icon-large.png"), titleBarStyle: "hidden", webPreferences: { contextIsolation: false, diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 95d4d245c..15f119122 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -310,7 +310,7 @@ export class Toolbar { } spanElement.innerHTML = item.textContent; item.replaceWith(spanElement); - }) + }); } const actionBtn = action === "toolbar" ? this.element.querySelector(`[data-type="${type}"]`) : undefined; const newNodes: Node[] = []; @@ -457,8 +457,8 @@ export class Toolbar { this.range.collapse(true); } for (let i = 0; i < newNodes.length; i++) { - const currentNewNode = newNodes[i] as HTMLElement - const nextNewNode = newNodes[i + 1] as HTMLElement + const currentNewNode = newNodes[i] as HTMLElement; + const nextNewNode = newNodes[i + 1] as HTMLElement; if (currentNewNode.nodeType !== 3 && nextNewNode && nextNewNode.nodeType !== 3 && isArrayEqual(nextNewNode.getAttribute("data-type").split(" "), currentNewNode.getAttribute("data-type").split(" ")) && currentNewNode.style.color === nextNewNode.style.color && @@ -514,7 +514,7 @@ export class Toolbar { } nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss")); updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html); - const wbrElement = nodeElement.querySelector("wbr") + const wbrElement = nodeElement.querySelector("wbr"); if (wbrElement) { wbrElement.remove(); } diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index eb8822b31..f4612ef3c 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -28,7 +28,7 @@ import { getLastBlock, getNextBlock, getPreviousHeading, getTopAloneElement, - hasNextSibling, hasPreviousSibling, + hasNextSibling, isNotEditBlock } from "./getBlock"; import {transaction, updateTransaction} from "./transaction"; @@ -112,7 +112,7 @@ export class WYSIWYG { const inputData = event.data; protyle.toolbar.range = range; const inlineElement = range.startContainer.parentElement; - const currentTypes = protyle.toolbar.getCurrentType() + const currentTypes = protyle.toolbar.getCurrentType(); if (// 表格行内公式之前无法插入文字 https://github.com/siyuan-note/siyuan/issues/3908 inlineElement.tagName==="SPAN" && range.toString() === "" && range.startContainer.nodeType === 3 && @@ -237,12 +237,12 @@ export class WYSIWYG { } else if (selectTypes.length > 0 && range.startContainer.nodeType === 3 && range.startContainer.parentElement.tagName === "SPAN" && range.startContainer.parentElement.isSameNode(range.endContainer.parentElement)) { // 复制粗体等字体中的一部分 - const attributes = range.startContainer.parentElement.attributes + const attributes = range.startContainer.parentElement.attributes; const spanElement = document.createElement("span"); for (let i = 0; i < attributes.length; i++) { spanElement.setAttribute(attributes[i].name, attributes[i].value); } - spanElement.textContent = range.toString() + spanElement.textContent = range.toString(); html = spanElement.outerHTML; } else { tempElement.append(range.cloneContents()); @@ -1731,7 +1731,7 @@ export class WYSIWYG { const emptyEditElement = getContenteditableElement(emptyElement) as HTMLInputElement; range.selectNodeContents(emptyEditElement); range.collapse(true); - focusByRange(range) + focusByRange(range); } else if (lastEditElement) { range.selectNodeContents(lastEditElement); range.collapse(false); @@ -1752,7 +1752,7 @@ export class WYSIWYG { } if (getSelection().rangeCount === 0) { // https://github.com/siyuan-note/siyuan/issues/5901 - focusByRange(newRange) + focusByRange(newRange); } /// #if !MOBILE pushBack(protyle, newRange); @@ -1800,12 +1800,12 @@ export class WYSIWYG { let hasJump = false; while (currentElement) { if (currentElement && !currentElement.classList.contains("protyle-attr")) { - const currentRect = currentElement.getBoundingClientRect() + const currentRect = currentElement.getBoundingClientRect(); if (startRect.top === endRect.top ? (currentRect.right <= endTop) : (currentRect.top <= endTop)) { if (hasJump) { // 父节点的下个节点在选中范围内才可使用父节点作为选中节点 if (currentElement.nextElementSibling && !currentElement.nextElementSibling.classList.contains("protyle-attr")) { - const currentNextRect = currentElement.nextElementSibling.getBoundingClientRect() + const currentNextRect = currentElement.nextElementSibling.getBoundingClientRect(); if (startRect.top === endRect.top ? (currentNextRect.right <= endTop) : (currentNextRect.top <= endTop)) { selectElements = [currentElement]; currentElement = currentElement.nextElementSibling as HTMLElement;