From 0fa75ec71acc64840e4d41d2485beca6555c1c4e Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 15 May 2024 17:01:48 +0800 Subject: [PATCH 1/2] :art: fix https://github.com/siyuan-note/siyuan/issues/11403 --- app/src/assets/scss/business/_av.scss | 4 ++++ app/src/assets/scss/protyle/_wysiwyg.scss | 4 ++++ app/src/protyle/render/av/action.ts | 3 +++ app/src/protyle/render/av/cell.ts | 5 +++-- app/src/protyle/util/onGet.ts | 7 ------- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss index da05a889e18..33d31cca859 100644 --- a/app/src/assets/scss/business/_av.scss +++ b/app/src/assets/scss/business/_av.scss @@ -282,6 +282,10 @@ white-space: nowrap; } + &[data-block-id] > .block__icon[data-type="copy"] { + display: none; + } + &.dragover__right { border-right-color: var(--b3-theme-primary-lighter); } diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scss index ac0171106e7..2803a98796d 100644 --- a/app/src/assets/scss/protyle/_wysiwyg.scss +++ b/app/src/assets/scss/protyle/_wysiwyg.scss @@ -670,5 +670,9 @@ .av__cell--header:hover { background-color: transparent; } + + .av__cell[data-block-id] > .block__icon[data-type="copy"] { + display: block; + } } } diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 34047664a12..5c72b4b6764 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -30,6 +30,7 @@ import {addView, openViewMenu} from "./view"; import {isOnlyMeta, writeText} from "../../util/compatibility"; import {openSearchAV} from "./relation"; import {Constants} from "../../../constants"; +import {hideElements} from "../../ui/hideElements"; export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => { if (isOnlyMeta(event)) { @@ -164,6 +165,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle event.stopPropagation(); return true; } else if (type === "block-more") { + window.siyuan.menus.menu.remove(); protyle.toolbar.range = document.createRange(); protyle.toolbar.range.selectNodeContents(target); focusByRange(protyle.toolbar.range); @@ -231,6 +233,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle }; export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, position: IPosition) => { + hideElements(["hint"], protyle); if (rowElement.classList.contains("av__row--header")) { return false; } diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index f4f5b20b55f..714db18ca9c 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -732,8 +732,9 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0) => { } } - if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated", "lineNumber"].includes(cellValue.type) && - (cellValue.type === "lineNumber" || (cellValue && cellValue[cellValue.type as "url"].content))) { + if ((["text", "template", "url", "email", "phone", "number", "date", "created", "updated"].includes(cellValue.type) && cellValue[cellValue.type as "url"]?.content) || + cellValue.type === "lineNumber" || + (cellValue.type === "block" && cellValue.block?.content)) { text += ``; } return text; diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index 0225c51ed31..f347cd58c7d 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -321,13 +321,6 @@ export const disabledProtyle = (protyle: IProtyle) => { protyle.wysiwyg.element.querySelectorAll('.protyle-action[draggable="true"]').forEach(item => { item.setAttribute("draggable", "false"); }); - protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => { - const headerElement = item.querySelector(".av__row--header") as HTMLElement; - if (headerElement) { - headerElement.style.transform = ""; - (item.querySelector(".av__row--footer") as HTMLElement).style.transform = ""; - } - }); if (protyle.breadcrumb) { protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"] use').setAttribute("xlink:href", "#iconLock"); protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"]').setAttribute("aria-label", window.siyuan.config.editor.readOnly ? window.siyuan.languages.tempUnlock : window.siyuan.languages.unlockEdit); From 2f05df493539a8ee122dd4cd2538187f8e419354 Mon Sep 17 00:00:00 2001 From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com> Date: Wed, 15 May 2024 20:54:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/appearance/langs/en_US.json | 3 +++ app/appearance/langs/es_ES.json | 3 +++ app/appearance/langs/fr_FR.json | 3 +++ app/appearance/langs/ja_JP.json | 3 +++ app/appearance/langs/zh_CHT.json | 3 +++ app/appearance/langs/zh_CN.json | 3 +++ app/src/protyle/preview/index.ts | 6 +++--- 7 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 0829f969fa1..7e3b04d726b 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1180,6 +1180,9 @@ "spellcheckTip": "After enabling, the browser's built-in spell check function will be used. Currently, only English spell check is supported", "over": "over", "preview": "Export Preview", + "copyToWechatMP": "Copy to Wechat MP", + "copyToZhihu": "Copy to Zhihu", + "copyToYuque": "Copy to Yuque", "quote": "Blockquote", "startRecord": "Start Record", "endRecord": "End Record", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index f51e5ac7891..be762e88b2f 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1180,6 +1180,9 @@ "spellcheckTip": "Después de habilitar, se utilizará la función de revisión ortográfica integrada del navegador. Actualmente, solo se admite la revisión ortográfica en inglés", "over": "sobre", "preview": "Vista previa de la exportación", + "copyToWechatMP": "复制到公众号", + "copyToZhihu": "复制到知乎", + "copyToYuque": "复制到语雀", "quote": "Párrafo cita", "startRecord": "Iniciar grabación", "endRecord": "Finalizar grabación", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index be36b03194d..f5a95736f01 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1180,6 +1180,9 @@ "spellcheckTip": "Après l'activation, la fonction de vérification orthographique intégrée du navigateur sera utilisée. Actuellement, seule la vérification orthographique en anglais est prise en charge", "over": "over", "preview": "Aperçu de l'exportation", + "copyToWechatMP": "复制到公众号", + "copyToZhihu": "复制到知乎", + "copyToYuque": "复制到语雀", "quote": "Citation de bloc", "startRecord": "Début d'enregistrement", "endRecord": "fin d'enregistrement", diff --git a/app/appearance/langs/ja_JP.json b/app/appearance/langs/ja_JP.json index 94cccf84c1a..d0693abf5a8 100644 --- a/app/appearance/langs/ja_JP.json +++ b/app/appearance/langs/ja_JP.json @@ -1180,6 +1180,9 @@ "spellcheckTip": "ブラウザの組み込みスペルチェック機能を使用します。現時点では英語のスペルチェックのみがサポートされています", "over": "以上", "preview": "プレビュー", + "copyToWechatMP": "复制到公众号", + "copyToZhihu": "复制到知乎", + "copyToYuque": "复制到语雀", "quote": "引用", "startRecord": "録音開始", "endRecord": "録音停止", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index a5e97290577..0f8c9bd9bda 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -1180,6 +1180,9 @@ "spellcheckTip": "啟用後將使用瀏覽器內置的拼寫檢查功能,目前僅支持英文拼寫檢查", "over": "超過", "preview": "匯出預覽", + "copyToWechatMP": "复制到公众号", + "copyToZhihu": "复制到知乎", + "copyToYuque": "复制到语雀", "quote": "引述", "startRecord": "開始錄音", "endRecord": "結束錄音", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 37560b441ff..860849cc0d8 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1180,6 +1180,9 @@ "spellcheckTip": "启用后将使用浏览器内置的拼写检查功能,目前仅支持英文拼写检查", "over": "超过", "preview": "导出预览", + "copyToWechatMP": "复制到公众号", + "copyToZhihu": "复制到知乎", + "copyToYuque": "复制到语雀", "quote": "引述", "startRecord": "开始录音", "endRecord": "结束录音", diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts index 8dcad4db004..a740da9834b 100644 --- a/app/src/protyle/preview/index.ts +++ b/app/src/protyle/preview/index.ts @@ -56,13 +56,13 @@ export class Preview { actionHtml.push(''); break; case "mp-wechat": - actionHtml.push(''); + actionHtml.push(''); break; case "zhihu": - actionHtml.push(''); + actionHtml.push(''); break; case "yuque": - actionHtml.push(''); + actionHtml.push(''); break; } }