This commit is contained in:
parent
4fd844f48c
commit
b73fa77f2b
10 changed files with 41 additions and 23 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"emptyPlaceholder": "Write something, ' / ' for commands",
|
||||
"publish": "Publish",
|
||||
"publishService": "Publish service",
|
||||
"publishServiceNotStarted": "Publish Service Not Started",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"emptyPlaceholder": "Escribe algo, ' / ' para los comandos",
|
||||
"publish": "Publicar",
|
||||
"publishService": "Publicar servicio",
|
||||
"publishServiceNotStarted": "Servicio de publicación no iniciado",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"emptyPlaceholder": "Écrivez quelque chose, ' / ' pour les commandes",
|
||||
"publish": "Publier",
|
||||
"publishService": "Publier le service",
|
||||
"publishServiceNotStarted": "Service de publication non démarré",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"emptyPlaceholder": "何か書いてください。コマンドの場合は「/」",
|
||||
"publish": "公開する",
|
||||
"publishService": "サービスを公開",
|
||||
"publishServiceNotStarted": "サービスが開始されていません",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"emptyPlaceholder": "寫點什麼,或按下 ' / ' 查看指令",
|
||||
"publish": "發布",
|
||||
"publishService": "發布服務",
|
||||
"publishServiceNotStarted": "發布服務未啟動",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"emptyPlaceholder": "写点什么,或按下 ' / ' 查看命令",
|
||||
"publish": "发布",
|
||||
"publishService": "发布服务",
|
||||
"publishServiceNotStarted": "发布服务未启动",
|
||||
|
|
|
@ -475,15 +475,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
html .protyle-wysiwyg [data-node-id]:last-child [spellcheck][contenteditable="true"]:empty:before {
|
||||
content: "Enter text";
|
||||
color: var(--b3-empty-color);
|
||||
}
|
||||
|
||||
html[lang="zh_CN"] .protyle-wysiwyg [data-node-id]:last-child [spellcheck][contenteditable="true"]:empty:before {
|
||||
content: "键入文字";
|
||||
}
|
||||
|
||||
.av__views .block__icon {
|
||||
opacity: 1;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
user-select: auto;
|
||||
overflow-x: clip;
|
||||
|
||||
&--empty:empty:before {
|
||||
color: var(--b3-empty-color);
|
||||
content: attr(placeholder);
|
||||
}
|
||||
|
||||
.protyle-breadcrumb__bar {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import {isMac, readText, writeText} from "../util/compatibility";
|
|||
import * as dayjs from "dayjs";
|
||||
import {openFileById} from "../../editor/util";
|
||||
import {setTitle} from "../../dialog/processSystem";
|
||||
import {getNoContainerElement} from "../wysiwyg/getBlock";
|
||||
import {getContenteditableElement, getNoContainerElement} from "../wysiwyg/getBlock";
|
||||
import {commonHotkey} from "../wysiwyg/commonHotkey";
|
||||
import {code160to32} from "../util/code160to32";
|
||||
import {genEmptyElement} from "../../block/util";
|
||||
|
@ -115,19 +115,25 @@ export class Title {
|
|||
event.stopPropagation();
|
||||
}
|
||||
} else if (event.key === "Enter") {
|
||||
const newId = Lute.NewNodeID();
|
||||
const newElement = genEmptyElement(false, true, newId);
|
||||
protyle.wysiwyg.element.insertAdjacentElement("afterbegin", newElement);
|
||||
focusByWbr(newElement, protyle.toolbar.range || getEditorRange(newElement));
|
||||
transaction(protyle, [{
|
||||
action: "insert",
|
||||
data: newElement.outerHTML,
|
||||
id: newId,
|
||||
parentID: protyle.block.parentID
|
||||
}], [{
|
||||
action: "delete",
|
||||
id: newId,
|
||||
}]);
|
||||
const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild)
|
||||
if (editElment && editElment.textContent === "") {
|
||||
// 配合提示文本使用,避免提示文本挤压到第二个块中
|
||||
focusBlock(protyle.wysiwyg.element.firstElementChild, protyle.wysiwyg.element);
|
||||
} else {
|
||||
const newId = Lute.NewNodeID();
|
||||
const newElement = genEmptyElement(false, true, newId);
|
||||
protyle.wysiwyg.element.insertAdjacentElement("afterbegin", newElement);
|
||||
focusByWbr(newElement, protyle.toolbar.range || getEditorRange(newElement));
|
||||
transaction(protyle, [{
|
||||
action: "insert",
|
||||
data: newElement.outerHTML,
|
||||
id: newId,
|
||||
parentID: protyle.block.parentID
|
||||
}], [{
|
||||
action: "delete",
|
||||
id: newId,
|
||||
}]);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} else if (matchHotKey(window.siyuan.config.keymap.editor.general.attr.custom, event)) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import {avRender} from "../render/av/render";
|
|||
import {hideTooltip} from "../../dialog/tooltip";
|
||||
import {stickyRow} from "../render/av/row";
|
||||
import {updateReadonly as updateReadonlyMethod} from "../breadcrumb/action";
|
||||
import {getContenteditableElement} from "../wysiwyg/getBlock";
|
||||
|
||||
export const onGet = (options: {
|
||||
data: IWebSocketData,
|
||||
|
@ -180,6 +181,15 @@ const setHTML = (options: {
|
|||
} else {
|
||||
protyle.wysiwyg.element.innerHTML = options.content;
|
||||
}
|
||||
// https://github.com/siyuan-note/siyuan/issues/10528
|
||||
if (!protyle.block.showAll && protyle.wysiwyg.element.childElementCount === 1 && protyle.wysiwyg.element.firstElementChild.classList.contains("p")) {
|
||||
const editElement = getContenteditableElement(protyle.wysiwyg.element.firstElementChild);
|
||||
if (editElement && editElement.textContent === "") {
|
||||
editElement.classList.add("protyle-wysiwyg--empty");
|
||||
editElement.setAttribute("placeholder", window.siyuan.languages.emptyPlaceholder);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.action.includes(Constants.CB_GET_BACKLINK)) {
|
||||
foldPassiveType(options.expand, protyle.wysiwyg.element);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue