mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 08:48:49 +01:00
This commit is contained in:
parent
d0b2466019
commit
7f9ef304cf
2 changed files with 7 additions and 4 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import {getEventName} from "../util/compatibility";
|
||||
import {ToolbarItem} from "./ToolbarItem";
|
||||
|
||||
export class BlockRef extends ToolbarItem {
|
||||
public element: HTMLElement;
|
||||
|
||||
constructor(protyle: IProtyle, menuItem: IMenuItem) {
|
||||
super(protyle, menuItem);
|
||||
this.element.addEventListener(getEventName(), (event: MouseEvent & { changedTouches: MouseEvent[] }) => {
|
||||
// 不能用 getEventName,否则会导致光标位置变动到点击的文档中
|
||||
this.element.addEventListener("click", (event: MouseEvent & { changedTouches: MouseEvent[] }) => {
|
||||
protyle.toolbar.setInlineMark(protyle, "blockRef", "add");
|
||||
protyle.toolbar.element.classList.add("fn__none");
|
||||
event.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import {getEventName} from "../util/compatibility";
|
||||
import {ToolbarItem} from "./ToolbarItem";
|
||||
|
||||
export class Link extends ToolbarItem {
|
||||
|
|
@ -6,8 +5,10 @@ export class Link extends ToolbarItem {
|
|||
|
||||
constructor(protyle: IProtyle, menuItem: IMenuItem) {
|
||||
super(protyle, menuItem);
|
||||
this.element.addEventListener(getEventName(), (event: MouseEvent & { changedTouches: MouseEvent[] }) => {
|
||||
// 不能用 getEventName,否则会导致光标位置变动到点击的文档中
|
||||
this.element.addEventListener("click", (event: MouseEvent & { changedTouches: MouseEvent[] }) => {
|
||||
protyle.toolbar.setInlineMark(protyle, "link", "add");
|
||||
protyle.toolbar.element.classList.add("fn__none");
|
||||
event.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue