mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-29 19:56:10 +01:00
This commit is contained in:
parent
299437d751
commit
748d7f1585
2 changed files with 21 additions and 1 deletions
|
|
@ -83,6 +83,14 @@ export class Title {
|
|||
if (commonHotkey(protyle, event)) {
|
||||
return true;
|
||||
}
|
||||
if (matchHotKey("⇧⌘V", event)) {
|
||||
navigator.clipboard.readText().then(textPlain => {
|
||||
textPlain = textPlain.replace(/</g, ";;;lt;;;").replace(/>/g, ";;;gt;;;");
|
||||
const content = protyle.lute.BlockDOM2EscapeMarkerContent(protyle.lute.Md2BlockDOM(textPlain));
|
||||
document.execCommand("insertText", false, replaceFileName(content));
|
||||
this.rename(protyle);
|
||||
});
|
||||
}
|
||||
if (matchHotKey(window.siyuan.config.keymap.general.enterBack.custom, event)) {
|
||||
const ids = protyle.path.split("/");
|
||||
if (ids.length > 2) {
|
||||
|
|
@ -211,6 +219,7 @@ export class Title {
|
|||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.paste,
|
||||
icon: "iconPaste",
|
||||
accelerator: "⌘V",
|
||||
click: async () => {
|
||||
focusByRange(getEditorRange(this.editElement));
|
||||
|
|
@ -220,6 +229,18 @@ export class Title {
|
|||
this.rename(protyle);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.pasteAsPlainText,
|
||||
accelerator: "⇧⌘V",
|
||||
click: async () => {
|
||||
navigator.clipboard.readText().then(textPlain => {
|
||||
textPlain = textPlain.replace(/</g, ";;;lt;;;").replace(/>/g, ";;;gt;;;");
|
||||
const content = protyle.lute.BlockDOM2EscapeMarkerContent(protyle.lute.Md2BlockDOM(textPlain));
|
||||
document.execCommand("insertText", false, replaceFileName(content));
|
||||
this.rename(protyle);
|
||||
});
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.selectAll,
|
||||
accelerator: "⌘A",
|
||||
|
|
|
|||
|
|
@ -169,7 +169,6 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
|
|||
// Inline-level elements support pasted as plain text https://github.com/siyuan-note/siyuan/issues/8010
|
||||
navigator.clipboard.readText().then(textPlain => {
|
||||
// 对 HTML 标签进行内部转移,避免被 Lute 解析以后变为小写 https://github.com/siyuan-note/siyuan/issues/10620
|
||||
// 在
|
||||
textPlain = textPlain.replace(/</g, ";;;lt;;;").replace(/>/g, ";;;gt;;;");
|
||||
const content = protyle.lute.BlockDOM2EscapeMarkerContent(protyle.lute.Md2BlockDOM(textPlain));
|
||||
insertHTML(content, protyle);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue