This commit is contained in:
parent
9d77953661
commit
59ebc59190
3 changed files with 13 additions and 4 deletions
|
@ -456,6 +456,11 @@ export class Toolbar {
|
|||
}
|
||||
inlineElement.setAttribute("data-type", [...new Set(rangeTypes)].join(" "));
|
||||
inlineElement.textContent = Constants.ZWSP;
|
||||
// 在 a 元素中 ctrl+m 需继承其链接,也许不需要?没有用户反馈之前先保持现装
|
||||
// if (type !== "a" && rangeTypes.includes("a") && nextElement.dataset.type.split(" ").includes("a") &&
|
||||
// nextElement.isSameNode(previousElement)) {
|
||||
// inlineElement.setAttribute("data-href", nextElement.getAttribute("data-href"));
|
||||
// }
|
||||
setFontStyle(inlineElement, textObj);
|
||||
newNodes.push(inlineElement);
|
||||
} else {
|
||||
|
@ -1478,7 +1483,7 @@ export class Toolbar {
|
|||
k: inputElement.value,
|
||||
}, (response) => {
|
||||
let searchHTML = "";
|
||||
response.data.blocks.forEach((item: { path: string, content: string,name:string }, index: number) => {
|
||||
response.data.blocks.forEach((item: { path: string, content: string, name: string }, index: number) => {
|
||||
searchHTML += `<div data-value="${item.path}" data-content="${item.content}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">
|
||||
${item.name}
|
||||
<span class="b3-list-item__meta">${item.content}</span>
|
||||
|
|
|
@ -1998,7 +1998,7 @@ export class WYSIWYG {
|
|||
const blockRefElement = hasClosestByAttribute(event.target, "data-type", "block-ref");
|
||||
const aElement = hasClosestByAttribute(event.target, "data-type", "a") ||
|
||||
hasClosestByClassName(event.target, "av__celltext--url"); // 数据库中资源文件、链接、电话、邮箱单元格
|
||||
let aLink = aElement ? aElement.getAttribute("data-href") : "";
|
||||
let aLink = aElement ? (aElement.getAttribute("data-href") || "") : "";
|
||||
if (aElement && !aLink && aElement.classList.contains("av__celltext--url")) {
|
||||
aLink = aElement.textContent.trim();
|
||||
if (aElement.dataset.type === "phone") {
|
||||
|
@ -2121,7 +2121,8 @@ export class WYSIWYG {
|
|||
return;
|
||||
}
|
||||
|
||||
if (aElement && range.toString() === "") {
|
||||
// 如果aLink 为空时,当 data-type="a inline-math" 可继续后续操作
|
||||
if (aElement && range.toString() === "" && aLink) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
let linkAddress = Lute.UnEscapeHTMLStr(aLink);
|
||||
|
|
|
@ -171,6 +171,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
nodeElement.querySelector("wbr").remove();
|
||||
// 光标位于引用结尾后 ctrl+b 偶尔会失效
|
||||
range = cloneRange;
|
||||
// 会导致 protyle.toolbar.range 和 range 不一致,先在有问题的地方重置一下 https://github.com/siyuan-note/siyuan/issues/10933
|
||||
}
|
||||
|
||||
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
|
||||
|
@ -594,6 +595,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
return;
|
||||
}
|
||||
const selectText = range.toString();
|
||||
|
||||
// 上下左右光标移动
|
||||
if (!event.altKey && !event.shiftKey && isNotCtrl(event) && !event.isComposing && (event.key.indexOf("Arrow") > -1)) {
|
||||
// 需使用 editabled,否则代码块会把语言字数算入
|
||||
|
@ -1242,7 +1244,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
return false;
|
||||
}
|
||||
if (matchHotKey(menuItem.hotkey, event)) {
|
||||
protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element);
|
||||
// 设置 lastHTMLs 会导致 protyle.toolbar.range 和 range 不一致,需重置一下 https://github.com/siyuan-note/siyuan/issues/10933
|
||||
protyle.toolbar.range = range;
|
||||
if (["block-ref"].includes(menuItem.name) && protyle.toolbar.range.toString() === "") {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue