mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
This commit is contained in:
@@ -40,12 +40,14 @@ import {exportAsset} from "./util";
|
||||
import {removeLink} from "../protyle/toolbar/Link";
|
||||
import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey";
|
||||
import {renameTag} from "../util/noRelyPCFunction";
|
||||
import {hideElements} from "../protyle/ui/hideElements";
|
||||
|
||||
export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
||||
const nodeElement = hasClosestBlock(element);
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
hideElements(["util", "toolbar", "hint"], protyle);
|
||||
const refBlockId = element.getAttribute("data-id");
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
let oldHTML = nodeElement.outerHTML;
|
||||
@@ -494,6 +496,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
hideElements(["util", "toolbar", "hint"], protyle);
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
const imgElement = assetElement.querySelector("img");
|
||||
const titleElement = assetElement.querySelector(".protyle-action__title") as HTMLElement;
|
||||
@@ -680,6 +683,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
hideElements(["util", "toolbar", "hint"], protyle);
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
const html = nodeElement.outerHTML;
|
||||
const linkAddress = linkElement.getAttribute("data-href");
|
||||
@@ -854,6 +858,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
hideElements(["util", "toolbar", "hint"], protyle);
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
let html = nodeElement.outerHTML;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
|
||||
@@ -673,7 +673,7 @@ export class Gutter {
|
||||
}
|
||||
|
||||
public renderMenu(protyle: IProtyle, buttonElement: Element) {
|
||||
hideElements(["hint"], protyle);
|
||||
hideElements(["util", "toolbar", "hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
const id = buttonElement.getAttribute("data-node-id");
|
||||
const selectsElement = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
|
||||
|
||||
@@ -725,6 +725,8 @@ export class Toolbar {
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
hideElements(["hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
const html = nodeElement.outerHTML;
|
||||
this.subElement.style.width = isMobile() ? "80vw" : Math.min(480, window.innerWidth) + "px";
|
||||
@@ -798,6 +800,8 @@ export class Toolbar {
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
hideElements(["hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
const types = (renderElement.getAttribute("data-type") || "").split(" ");
|
||||
const html = oldHTML || protyle.lute.SpinBlockDOM(nodeElement.outerHTML);
|
||||
@@ -1173,6 +1177,8 @@ export class Toolbar {
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
hideElements(["hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
this.range = getEditorRange(nodeElement);
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
let oldHtml = nodeElement.outerHTML;
|
||||
@@ -1292,6 +1298,8 @@ export class Toolbar {
|
||||
|
||||
public showTpl(protyle: IProtyle, nodeElement: HTMLElement, range: Range) {
|
||||
this.range = range;
|
||||
hideElements(["hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
fetchPost("/api/search/searchTemplate", {
|
||||
k: "",
|
||||
}, (response) => {
|
||||
@@ -1420,6 +1428,8 @@ export class Toolbar {
|
||||
|
||||
public showWidget(protyle: IProtyle, nodeElement: HTMLElement, range: Range) {
|
||||
this.range = range;
|
||||
hideElements(["hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
fetchPost("/api/search/searchWidget", {
|
||||
k: "",
|
||||
}, (response) => {
|
||||
@@ -1480,6 +1490,8 @@ export class Toolbar {
|
||||
|
||||
public showAssets(protyle: IProtyle, nodeElement: HTMLElement, range: Range) {
|
||||
this.range = range;
|
||||
hideElements(["hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
fetchPost("/api/search/searchAsset", {
|
||||
k: "",
|
||||
}, (response) => {
|
||||
|
||||
Reference in New Issue
Block a user