/// #if !BROWSER import {shell} from "electron"; /// #endif import {getDockByType} from "../layout/util"; import {confirmDialog} from "../dialog/confirmDialog"; import {getSearch, isMobile} from "../util/functions"; import {isLocalPath, movePathTo, moveToPath, pathPosix} from "../util/pathName"; import {MenuItem} from "./Menu"; import {hasClosestByClassName} from "../protyle/util/hasClosest"; import {saveExport} from "../protyle/export"; import {openByMobile, writeText} from "../protyle/util/compatibility"; import {fetchPost} from "../util/fetch"; import {hideMessage, showMessage} from "../dialog/message"; import {Dialog} from "../dialog"; import {focusBlock, focusByRange, getEditorRange} from "../protyle/util/selection"; import {updateTransaction} from "../protyle/wysiwyg/transaction"; /// #if !MOBILE import {getAllModels} from "../layout/getAll"; import {Bookmark} from "../layout/dock/Bookmark"; import {openAsset, openBy} from "../editor/util"; /// #endif import {rename} from "../editor/rename"; import {matchHotKey} from "../protyle/util/hotKey"; import * as dayjs from "dayjs"; import {Constants} from "../constants"; import {exportImage} from "../protyle/export/util"; const bindAttrInput = (inputElement: HTMLInputElement, confirmElement: Element) => { inputElement.addEventListener("keydown", (event) => { if (event.isComposing) { return; } if (matchHotKey("⌘↩", event)) { confirmElement.dispatchEvent(new CustomEvent("click")); event.stopPropagation(); event.preventDefault(); } }); }; const genCardItem = (item: { id: string, name: string }) => { return `
` } export const openDiffCard = (nodeElement: Element[]) => { const range = getEditorRange(nodeElement[0]); fetchPost("/api/riff/getRiffDecks", {}, (response) => { let html = '' const ids: string[] = [] nodeElement.forEach(item => { ids.push(item.getAttribute("data-node-id")) }) response.data.forEach((item: { id: string, name: string }) => { html += genCardItem(item) }) const dialog = new Dialog({ width: isMobile() ? "80vw" : "50vw", height: "70vh", title: window.siyuan.languages.riffCard, content: `