mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-12-03 06:43:35 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb2b782bd4 | ||
|
|
421f2ec21a | ||
|
|
1759cdffab | ||
|
|
e7af4b62ac |
No files matched your search
@@ -331,6 +331,7 @@ export declare class ExcalidrawAutomate {
|
||||
startArrowHead: string;
|
||||
endArrowHead: string;
|
||||
};
|
||||
setStyle(style: Partial<ExcalidrawAutomate["style"]>): void;
|
||||
canvas: {
|
||||
theme: string;
|
||||
viewBackgroundColor: string;
|
||||
@@ -1808,6 +1809,26 @@ export interface FrameRenderingOptions {
|
||||
clip: boolean;
|
||||
}
|
||||
export type PaneTarget = "active-pane" | "new-pane" | "popout-window" | "new-tab" | "md-properties";
|
||||
export interface NestedFileNode {
|
||||
file: TFile;
|
||||
/**
|
||||
* All distinct dependency paths from the root file down to this embedded file.
|
||||
* Each path is an ordered array of TFile objects starting with the `rootFile` at index 0.
|
||||
*
|
||||
* @example
|
||||
* If Root -> A -> B2.2 and Root -> B -> B2 -> B2.2
|
||||
* The paths for B2.2 will be:
|
||||
* [
|
||||
* [Root, A, B2.2],
|
||||
* [Root, B, B2, B2.2]
|
||||
* ]
|
||||
*
|
||||
* Usage: To find which top-level embeds to reload if this file changes,
|
||||
* you can map over `paths` and collect `path[1]`.
|
||||
*/
|
||||
paths: TFile[][];
|
||||
}
|
||||
export type NestedFileMap = Map<TFile, NestedFileNode>;
|
||||
|
||||
/* ************************************ */
|
||||
/* lib/types/exportUtilTypes.d.ts */
|
||||
@@ -1900,6 +1921,76 @@ export interface ExportSettings {
|
||||
frameRendering?: FrameRenderingOptions;
|
||||
skipInliningFonts?: boolean;
|
||||
}
|
||||
export interface PrintToPDFOptions {
|
||||
includeName: boolean;
|
||||
pageSize: string | {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
landscape: boolean;
|
||||
margins: {
|
||||
top: number;
|
||||
left: number;
|
||||
right: number;
|
||||
bottom: number;
|
||||
};
|
||||
scaleFactor: number;
|
||||
scale: number;
|
||||
open: boolean;
|
||||
filepath: string;
|
||||
preferCSSPageSize?: boolean;
|
||||
pageRanges?: string | {
|
||||
from: number;
|
||||
to: number;
|
||||
}[];
|
||||
}
|
||||
export interface SaveDialogOptions {
|
||||
defaultPath: string;
|
||||
filters: {
|
||||
name: string;
|
||||
extensions: string[];
|
||||
}[];
|
||||
properties: string[];
|
||||
}
|
||||
export interface SaveDialogReturnValue {
|
||||
canceled: boolean;
|
||||
filePath?: string;
|
||||
}
|
||||
type CaptureRect = {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
type NativeImageLike = {
|
||||
toPNG(): Uint8Array | Buffer;
|
||||
};
|
||||
interface ElectronWebContentsLike {
|
||||
capturePage(rect: CaptureRect): Promise<NativeImageLike>;
|
||||
getZoomFactor(): number;
|
||||
setZoomFactor(factor: number): void;
|
||||
}
|
||||
interface ElectronWebUtilsLike {
|
||||
getPathForFile(file: File): string;
|
||||
}
|
||||
export interface ElectronAPI {
|
||||
ipcRenderer: {
|
||||
send(channel: string, ...args: unknown[]): void;
|
||||
once(channel: string, func: (...args: unknown[]) => void): void;
|
||||
};
|
||||
remote: {
|
||||
dialog: {
|
||||
showSaveDialog(options: SaveDialogOptions): Promise<SaveDialogReturnValue>;
|
||||
};
|
||||
getCurrentWebContents(): ElectronWebContentsLike;
|
||||
};
|
||||
webUtils: ElectronWebUtilsLike;
|
||||
}
|
||||
declare global {
|
||||
interface Window {
|
||||
electron: ElectronAPI;
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************** */
|
||||
/* lib/types/embeddedFileLoaderTypes.d.ts */
|
||||
@@ -3383,6 +3474,23 @@ export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p:
|
||||
export declare const pointInsideBoundsInclusive: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
|
||||
export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
|
||||
export declare const boundsContainBounds: (outerBounds: Bounds, innerBounds: Bounds) => boolean;
|
||||
/**
|
||||
* High level helper to get elements overlapping a bounding box.
|
||||
* It can be used to get elements overlapping a selection box, for example.
|
||||
*
|
||||
*/
|
||||
export declare const elementsOverlappingBBox: ({ elements, elementsMap, bounds, type, excludeElementsInFrames, shouldIgnoreElementFromSelection, }: {
|
||||
elements: readonly NonDeletedExcalidrawElement[];
|
||||
elementsMap?: ElementsMap;
|
||||
bounds: Bounds | ExcalidrawElement;
|
||||
/**
|
||||
* - overlap: elements overlapping or inside bounds
|
||||
* - contain: elements inside bounds
|
||||
**/
|
||||
type: "contain" | "overlap";
|
||||
excludeElementsInFrames?: boolean;
|
||||
shouldIgnoreElementFromSelection?: (element: NonDeletedExcalidrawElement) => boolean;
|
||||
}) => NonDeletedExcalidrawElement[];
|
||||
export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
|
||||
|
||||
/* ************************************** */
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+100
-34
@@ -682,7 +682,7 @@ async function prepareTargetExcalidrawView(noteBWorkspaceLeaf) {
|
||||
}
|
||||
|
||||
// Injects the visual frame marker and template onto the target Note B
|
||||
async function injectVisualFormat(target_ea, targetX, targetY, sectionRawText, todayDNPBasename, isCurrentDNP, preGeneratedFrameID, embeddedElementId, ontologyAction, originFilePath) {
|
||||
async function injectVisualFormat(target_ea, targetX, targetY, sectionRawText, todayDNPBasename, isCurrentDNP, preGeneratedFrameID, embeddedElementId, ontologyAction, originFilePath, opt) {
|
||||
const fWidth = parseInt(settings.frameWidth) || 1920;
|
||||
const fHeight = parseInt(settings.frameHeight) || 1080;
|
||||
|
||||
@@ -715,9 +715,15 @@ async function injectVisualFormat(target_ea, targetX, targetY, sectionRawText, t
|
||||
}
|
||||
|
||||
let clonedTemplateElementIds = [];
|
||||
if (settings.visualTemplateJSON) {
|
||||
|
||||
// Resolve Visual Template details with fallback to global settings
|
||||
const visualTemplateJSON = opt?.visualTemplateJSON || settings.visualTemplateJSON;
|
||||
const visualTemplateHAlign = opt?.visualTemplateHAlign || settings.visualTemplateHAlign || "center";
|
||||
const visualTemplateVAlign = opt?.visualTemplateVAlign || settings.visualTemplateVAlign || "middle";
|
||||
|
||||
if (visualTemplateJSON) {
|
||||
try {
|
||||
const parsed = JSON.parse(settings.visualTemplateJSON);
|
||||
const parsed = JSON.parse(visualTemplateJSON);
|
||||
if (parsed.elements && parsed.elements.length > 0) {
|
||||
const clonedElements = ExcalidrawLib.restoreElements(
|
||||
target_ea.cloneElements(parsed.elements,
|
||||
@@ -735,17 +741,17 @@ async function injectVisualFormat(target_ea, targetX, targetY, sectionRawText, t
|
||||
let offsetX = 0;
|
||||
let offsetY = 0;
|
||||
|
||||
if (settings.visualTemplateHAlign === "left") {
|
||||
if (visualTemplateHAlign === "left") {
|
||||
offsetX = targetX - bounds[0] + FRAME_MARGIN;
|
||||
} else if (settings.visualTemplateHAlign === "right") {
|
||||
} else if (visualTemplateHAlign === "right") {
|
||||
offsetX = targetX + fWidth - bounds[2] - FRAME_MARGIN;
|
||||
} else {
|
||||
offsetX = targetX + (fWidth - boundsWidth) / 2 - bounds[0];
|
||||
}
|
||||
|
||||
if (settings.visualTemplateVAlign === "top") {
|
||||
if (visualTemplateVAlign === "top") {
|
||||
offsetY = targetY - bounds[1] + FRAME_MARGIN;
|
||||
} else if (settings.visualTemplateVAlign === "bottom") {
|
||||
} else if (visualTemplateVAlign === "bottom") {
|
||||
offsetY = targetY + fHeight - bounds[3] - FRAME_MARGIN;
|
||||
} else {
|
||||
offsetY = targetY + (fHeight - boundsHeight) / 2 - bounds[1];
|
||||
@@ -1131,6 +1137,11 @@ async function handleFinalActionFocus(actionType, originView, noteBWorkspaceLeaf
|
||||
target_ea.viewZoomToElements(format !== "Visual", targetElements, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// Set MMB view if Visual and mmAPI is available
|
||||
if (format === "Visual" && window.MindMapBuilderAPI && target_ea.targetView) {
|
||||
window.MindMapBuilderAPI.setView(target_ea.targetView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1434,7 +1445,7 @@ async function start() {
|
||||
// 11. Inject onto Target Note using preGeneratedFrameID
|
||||
let clonedTemplateElementIds = [];
|
||||
if (format === "Visual") {
|
||||
const visualRes = await injectVisualFormat(target_ea, targetX, targetY, sectionRawText, todayDNPBasename, isCurrentDNP, preGeneratedFrameID, embeddedElementId, ontologyAction, originView.file.path);
|
||||
const visualRes = await injectVisualFormat(target_ea, targetX, targetY, sectionRawText, todayDNPBasename, isCurrentDNP, preGeneratedFrameID, embeddedElementId, ontologyAction, originView.file.path, opt);
|
||||
clonedTemplateElementIds = visualRes.clonedTemplateElementIds;
|
||||
} else {
|
||||
await injectMarkdownFormat(file, target_ea, targetX, targetY, sectionRawText, sectionWithBrackets, todayDNPBasename, isCurrentDNP, preGeneratedFrameID, embeddedElementId, ontologyAction, originView.file.path);
|
||||
@@ -1601,28 +1612,49 @@ function buildCaptureSearchBox(contentEl, state, callbacks) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Tokenize the query into individual words for partial matching
|
||||
const q = query.toLowerCase().trim();
|
||||
const searchTerms = q.split(/\s+/);
|
||||
// Helper to escape regex special characters
|
||||
const escapeRegex = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const tokens = q.split(/\s+/);
|
||||
// Create an ordered regex pattern (e.g. "my.*search.*term")
|
||||
const fuzzyRegex = new RegExp(tokens.map(escapeRegex).join('.*'), 'i');
|
||||
|
||||
const uniqueItems = new Map();
|
||||
const scoredItems = new Map();
|
||||
|
||||
state.searchItems.forEach(item => {
|
||||
const searchableText = item.type === "alias" ? `${item.basename} ${item.alias}` : item.basename;
|
||||
const searchableTextLower = searchableText.toLowerCase();
|
||||
// Search against the full file path if available, otherwise fallback to basename
|
||||
const searchableText = item.file
|
||||
? item.file.path + (item.type === "alias" && item.alias ? " " + item.alias : "")
|
||||
: item.basename;
|
||||
|
||||
// Ensure all partial words are found
|
||||
const matches = searchTerms.every(term => searchableTextLower.includes(term));
|
||||
|
||||
if (matches) {
|
||||
if (fuzzyRegex.test(searchableText)) {
|
||||
// Evaluate if it's an exact match on either the basename or alias
|
||||
const isExactBasename = item.basename.toLowerCase() === q;
|
||||
const isExactAlias = item.type === "alias" && item.alias.toLowerCase() === q;
|
||||
const isExact = isExactBasename || isExactAlias;
|
||||
|
||||
const mtime = item.file?.stat?.mtime || 0;
|
||||
|
||||
// Include file path to differentiate identical basenames
|
||||
const pathSuffix = item.file ? `:${item.file.path}` : "";
|
||||
const key = item.type === "alias" ? `alias:${item.basename}:${item.alias}${pathSuffix}` : `${item.type}:${item.basename}${pathSuffix}`;
|
||||
if (!uniqueItems.has(key)) {
|
||||
uniqueItems.set(key, item);
|
||||
|
||||
const current = scoredItems.get(key);
|
||||
// Add to map if unique, or if it represents a higher scoring match instance
|
||||
if (!current || isExact > current.isExact || (isExact === current.isExact && mtime > current.mtime)) {
|
||||
scoredItems.set(key, { item, isExact, mtime });
|
||||
}
|
||||
}
|
||||
});
|
||||
matchedItems = Array.from(uniqueItems.values()).slice(0, 8);
|
||||
|
||||
// Sort exact matches to the top, then sort by most recently modified
|
||||
matchedItems = Array.from(scoredItems.values())
|
||||
.sort((a, b) => {
|
||||
if (a.isExact !== b.isExact) return a.isExact ? -1 : 1;
|
||||
return b.mtime - a.mtime;
|
||||
})
|
||||
.map(s => s.item)
|
||||
.slice(0, 8);
|
||||
|
||||
if (matchedItems.length > 0) {
|
||||
resultsDropdown.style.display = "block";
|
||||
@@ -2108,11 +2140,11 @@ function buildVisualSizingSection(contentEl) {
|
||||
.onChange(val => { settings.openNoteBBehavior = val; }));
|
||||
}
|
||||
|
||||
async function refreshTemplatePreview(previewDiv, alignSettingsDiv, refreshCallback) {
|
||||
async function refreshTemplatePreview(previewDiv, alignSettingsDiv, configObj, saveCallback, refreshCallback) {
|
||||
previewDiv.empty();
|
||||
alignSettingsDiv.empty();
|
||||
|
||||
if (!settings.visualTemplateJSON) {
|
||||
if (!configObj.visualTemplateJSON) {
|
||||
const pasteBtn = previewDiv.createEl("button", { text: "Paste Excalidraw Elements from Clipboard" });
|
||||
pasteBtn.addEventListener("click", async () => {
|
||||
try {
|
||||
@@ -2123,8 +2155,16 @@ async function refreshTemplatePreview(previewDiv, alignSettingsDiv, refreshCallb
|
||||
new Notice("Image elements are not supported in visual templates.");
|
||||
return;
|
||||
}
|
||||
settings.visualTemplateJSON = text;
|
||||
ea.setScriptSettings(settings);
|
||||
|
||||
// Run pasted elements through restoreElements
|
||||
parsed.elements = window.ExcalidrawLib.restoreElements(
|
||||
parsed.elements,
|
||||
null,
|
||||
{ refreshDimensions: true, repairBindings: true }
|
||||
);
|
||||
|
||||
configObj.visualTemplateJSON = JSON.stringify(parsed);
|
||||
saveCallback();
|
||||
refreshCallback();
|
||||
} else {
|
||||
new Notice("Clipboard does not contain valid Excalidraw elements.");
|
||||
@@ -2135,7 +2175,7 @@ async function refreshTemplatePreview(previewDiv, alignSettingsDiv, refreshCallb
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
const parsed = JSON.parse(settings.visualTemplateJSON);
|
||||
const parsed = JSON.parse(configObj.visualTemplateJSON);
|
||||
const svg = await ea.createViewSVG({
|
||||
elementsOverride: parsed.elements,
|
||||
withBackground: false,
|
||||
@@ -2152,8 +2192,8 @@ async function refreshTemplatePreview(previewDiv, alignSettingsDiv, refreshCallb
|
||||
const delBtn = headerRow.createEl("button", { cls: "clickable-icon" });
|
||||
delBtn.innerHTML = ea.obsidian.getIcon("trash-2").outerHTML;
|
||||
delBtn.addEventListener("click", () => {
|
||||
settings.visualTemplateJSON = "";
|
||||
ea.setScriptSettings(settings);
|
||||
configObj.visualTemplateJSON = "";
|
||||
saveCallback();
|
||||
refreshCallback();
|
||||
});
|
||||
|
||||
@@ -2163,8 +2203,8 @@ async function refreshTemplatePreview(previewDiv, alignSettingsDiv, refreshCallb
|
||||
.addOption("top", "Top")
|
||||
.addOption("middle", "Middle")
|
||||
.addOption("bottom", "Bottom")
|
||||
.setValue(settings.visualTemplateVAlign || "middle")
|
||||
.onChange(v => { settings.visualTemplateVAlign = v; ea.setScriptSettings(settings); })
|
||||
.setValue(configObj.visualTemplateVAlign || "middle")
|
||||
.onChange(v => { configObj.visualTemplateVAlign = v; saveCallback(); })
|
||||
);
|
||||
|
||||
new ea.obsidian.Setting(alignSettingsDiv)
|
||||
@@ -2173,12 +2213,12 @@ async function refreshTemplatePreview(previewDiv, alignSettingsDiv, refreshCallb
|
||||
.addOption("left", "Left")
|
||||
.addOption("center", "Center")
|
||||
.addOption("right", "Right")
|
||||
.setValue(settings.visualTemplateHAlign || "center")
|
||||
.onChange(v => { settings.visualTemplateHAlign = v; ea.setScriptSettings(settings); })
|
||||
.setValue(configObj.visualTemplateHAlign || "center")
|
||||
.onChange(v => { configObj.visualTemplateHAlign = v; saveCallback(); })
|
||||
);
|
||||
} catch (e) {
|
||||
settings.visualTemplateJSON = "";
|
||||
ea.setScriptSettings(settings);
|
||||
configObj.visualTemplateJSON = "";
|
||||
saveCallback();
|
||||
refreshCallback();
|
||||
new Notice("Failed to load visual template preview.");
|
||||
}
|
||||
@@ -2192,7 +2232,13 @@ function buildVisualTemplateSection(contentEl) {
|
||||
const previewDiv = templateSection.createDiv();
|
||||
const alignSettingsDiv = templateSection.createDiv();
|
||||
|
||||
const refreshCallback = () => refreshTemplatePreview(previewDiv, alignSettingsDiv, refreshCallback);
|
||||
const refreshCallback = () => refreshTemplatePreview(
|
||||
previewDiv,
|
||||
alignSettingsDiv,
|
||||
settings,
|
||||
() => ea.setScriptSettings(settings),
|
||||
refreshCallback
|
||||
);
|
||||
refreshCallback();
|
||||
}
|
||||
|
||||
@@ -2604,6 +2650,26 @@ function openEditNoteTypeModal(noteTypeKey, saveCallback) {
|
||||
});
|
||||
|
||||
renderChips();
|
||||
|
||||
// Note Type Specific Visual Template Elements
|
||||
const templateSection = contentEl.createEl("details", { cls: "setting-sub-section", attr: { style: "margin-top: 15px;" } });
|
||||
templateSection.createEl("summary", { text: "Note Type Specific Visual Template Elements" });
|
||||
templateSection.createEl("p", {
|
||||
text: "If defined, these elements will override the global visual template.",
|
||||
attr: { style: "color: var(--text-muted); font-size: 0.9em; margin-bottom: 10px;" }
|
||||
});
|
||||
|
||||
const previewDiv = templateSection.createDiv();
|
||||
const alignSettingsDiv = templateSection.createDiv();
|
||||
|
||||
const refreshVisualTemplateCallback = () => refreshTemplatePreview(
|
||||
previewDiv,
|
||||
alignSettingsDiv,
|
||||
typeConfig,
|
||||
() => {}, // Changes will be formally persisted when the modal "Save" button is clicked
|
||||
refreshVisualTemplateCallback
|
||||
);
|
||||
refreshVisualTemplateCallback();
|
||||
};
|
||||
|
||||
modal.onClose = () => {
|
||||
|
||||
@@ -349,6 +349,34 @@ const STRINGS = {
|
||||
MANUAL_JITTER_RANGE: "Manual-layout Jitter Range",
|
||||
DESC_LAYOUT_MANUAL_JITTER: "Random position offset when adding nodes while Auto-Layout is disabled.",
|
||||
|
||||
CALENDAR_DATE_INDEX: "Date {index} of {total}",
|
||||
CALENDAR_DATE_LABEL: "Date",
|
||||
CALENDAR_DATE_TYPE: "Date Type",
|
||||
CALENDAR_PRIORITY: "Priority",
|
||||
CALENDAR_RECURRENCE: "Recurrence",
|
||||
CALENDAR_RECURRENCE_PLACEHOLDER: "every day",
|
||||
CALENDAR_RECURRENCE_DESC: "e.g., 'every day', 'every 2 weeks' <br><a href=\"https://publish.obsidian.md/tasks/Getting+Started/Recurring+Tasks\" target=\"_blank\" tabindex=\"-1\">Tasks recurrence docs</a>",
|
||||
CALENDAR_INJECT_LINK: "Inject node link",
|
||||
CALENDAR_INJECT_LINK_DESC: "Adds a link to the node at the end of the task.",
|
||||
CALENDAR_ALIAS_PLACEHOLDER: "Alias",
|
||||
CALENDAR_BTN_CANCEL: "Cancel",
|
||||
CALENDAR_BTN_TASK_ONLY: "Task Only",
|
||||
CALENDAR_BTN_ADD_DATE_TASK: "Add Date & Task",
|
||||
|
||||
CALENDAR_PRIORITY_HIGHEST: "Highest",
|
||||
CALENDAR_PRIORITY_HIGH: "High",
|
||||
CALENDAR_PRIORITY_MEDIUM: "Medium",
|
||||
CALENDAR_PRIORITY_NORMAL: "Normal",
|
||||
CALENDAR_PRIORITY_LOW: "Low",
|
||||
CALENDAR_PRIORITY_LOWEST: "Lowest",
|
||||
|
||||
CALENDAR_DATETYPE_DUE: "Due",
|
||||
CALENDAR_DATETYPE_START: "Start",
|
||||
CALENDAR_DATETYPE_SCHEDULED: "Scheduled",
|
||||
CALENDAR_DATETYPE_CREATED: "Created",
|
||||
CALENDAR_DATETYPE_DONE: "Done",
|
||||
CALENDAR_DATETYPE_CANCELLED: "Cancelled",
|
||||
|
||||
// Misc
|
||||
INPUT_TITLE_PASTE_ROOT: "Mindmap Builder Paste",
|
||||
INSTRUCTIONS: "> [!Tip]\n" +
|
||||
@@ -598,6 +626,34 @@ addLocale("zh", {
|
||||
MANUAL_JITTER_RANGE: "手动布局抖动范围",
|
||||
DESC_LAYOUT_MANUAL_JITTER: "禁用自动布局时添加节点的随机位置偏移。",
|
||||
|
||||
CALENDAR_DATE_INDEX: "第 {index} 个日期,共 {total} 个",
|
||||
CALENDAR_DATE_LABEL: "日期",
|
||||
CALENDAR_DATE_TYPE: "日期类型",
|
||||
CALENDAR_PRIORITY: "优先级",
|
||||
CALENDAR_RECURRENCE: "重复",
|
||||
CALENDAR_RECURRENCE_PLACEHOLDER: "每天",
|
||||
CALENDAR_RECURRENCE_DESC: "例如,'every day'(每天),'every 2 weeks'(每两周)<br><a href=\"https://publish.obsidian.md/tasks/Getting+Started/Recurring+Tasks\" target=\"_blank\" tabindex=\"-1\">Tasks 插件重复任务文档</a>",
|
||||
CALENDAR_INJECT_LINK: "插入节点链接",
|
||||
CALENDAR_INJECT_LINK_DESC: "在任务末尾添加指向该节点的链接。",
|
||||
CALENDAR_ALIAS_PLACEHOLDER: "别名",
|
||||
CALENDAR_BTN_CANCEL: "取消",
|
||||
CALENDAR_BTN_TASK_ONLY: "仅任务",
|
||||
CALENDAR_BTN_ADD_DATE_TASK: "添加日期和任务",
|
||||
|
||||
CALENDAR_PRIORITY_HIGHEST: "最高",
|
||||
CALENDAR_PRIORITY_HIGH: "高",
|
||||
CALENDAR_PRIORITY_MEDIUM: "中",
|
||||
CALENDAR_PRIORITY_NORMAL: "普通",
|
||||
CALENDAR_PRIORITY_LOW: "低",
|
||||
CALENDAR_PRIORITY_LOWEST: "最低",
|
||||
|
||||
CALENDAR_DATETYPE_DUE: "截止",
|
||||
CALENDAR_DATETYPE_START: "开始",
|
||||
CALENDAR_DATETYPE_SCHEDULED: "计划",
|
||||
CALENDAR_DATETYPE_CREATED: "创建",
|
||||
CALENDAR_DATETYPE_DONE: "完成",
|
||||
CALENDAR_DATETYPE_CANCELLED: "取消",
|
||||
|
||||
// Misc
|
||||
INPUT_TITLE_PASTE_ROOT: "MindMap Builder 粘贴",
|
||||
INSTRUCTIONS: "> [!Tip]\n" +
|
||||
@@ -838,6 +894,34 @@ addLocale("zh-tw", {
|
||||
MANUAL_JITTER_RANGE: "手動佈局抖動範圍",
|
||||
DESC_LAYOUT_MANUAL_JITTER: "停用自動佈局時新增節點的隨機位置偏移。",
|
||||
|
||||
CALENDAR_DATE_INDEX: "第 {index} 個日期,共 {total} 個",
|
||||
CALENDAR_DATE_LABEL: "日期",
|
||||
CALENDAR_DATE_TYPE: "日期類型",
|
||||
CALENDAR_PRIORITY: "優先級",
|
||||
CALENDAR_RECURRENCE: "重複",
|
||||
CALENDAR_RECURRENCE_PLACEHOLDER: "每天",
|
||||
CALENDAR_RECURRENCE_DESC: "例如,'every day'(每天),'every 2 weeks'(每兩週)<br><a href=\"https://publish.obsidian.md/tasks/Getting+Started/Recurring+Tasks\" target=\"_blank\" tabindex=\"-1\">Tasks 外掛重複任務文件</a>",
|
||||
CALENDAR_INJECT_LINK: "插入節點連結",
|
||||
CALENDAR_INJECT_LINK_DESC: "在任務末尾新增指向該節點的連結。",
|
||||
CALENDAR_ALIAS_PLACEHOLDER: "別名",
|
||||
CALENDAR_BTN_CANCEL: "取消",
|
||||
CALENDAR_BTN_TASK_ONLY: "僅任務",
|
||||
CALENDAR_BTN_ADD_DATE_TASK: "新增日期和任務",
|
||||
|
||||
CALENDAR_PRIORITY_HIGHEST: "最高",
|
||||
CALENDAR_PRIORITY_HIGH: "高",
|
||||
CALENDAR_PRIORITY_MEDIUM: "中",
|
||||
CALENDAR_PRIORITY_NORMAL: "普通",
|
||||
CALENDAR_PRIORITY_LOW: "低",
|
||||
CALENDAR_PRIORITY_LOWEST: "最低",
|
||||
|
||||
CALENDAR_DATETYPE_DUE: "截止",
|
||||
CALENDAR_DATETYPE_START: "開始",
|
||||
CALENDAR_DATETYPE_SCHEDULED: "計畫",
|
||||
CALENDAR_DATETYPE_CREATED: "建立",
|
||||
CALENDAR_DATETYPE_DONE: "完成",
|
||||
CALENDAR_DATETYPE_CANCELLED: "取消",
|
||||
|
||||
// Misc
|
||||
INPUT_TITLE_PASTE_ROOT: "MindMap Builder 貼上",
|
||||
INSTRUCTIONS: "> [!Tip]\n" +
|
||||
@@ -941,6 +1025,17 @@ const K_PALETTE = "Custom Palette";
|
||||
const K_LAYOUT = "Layout Config";
|
||||
const K_ARROW_TYPE = "Arrow Type";
|
||||
const K_FILL_SWEEP = "Fill Sweep";
|
||||
const K_INJECT_LINK = "Inject Node Link";
|
||||
const K_LINK_ALIAS = "Node Link Alias";
|
||||
|
||||
let injectNodeLink = getVal(K_INJECT_LINK, true);
|
||||
let nodeLinkAlias = getVal(K_LINK_ALIAS, "(link)");
|
||||
|
||||
const isExcaliBrainView = () => {
|
||||
if (!ea.targetView || !ea.targetView.file) return false;
|
||||
const eb = app.plugins.plugins["excalibrain"];
|
||||
return eb && eb.settings?.excalibrainFilepath === ea.targetView.file.path;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Layout & Geometry Settings
|
||||
@@ -5408,6 +5503,14 @@ const addNode = async (text, follow = false, skipFinalLayout = false, batchModeA
|
||||
if (!isViewSet()) return;
|
||||
if (!text || text.trim() === "") return;
|
||||
|
||||
const preGenTextId = ea.generateElementId();
|
||||
if (text.includes("__NODE_LINK_PLACEHOLDER__")) {
|
||||
const file = app.workspace.getActiveFile();
|
||||
const fileName = file ? file.basename : "";
|
||||
const linkStr = `[[${fileName}#^group=${preGenTextId}|${nodeLinkAlias}]]`;
|
||||
text = text.replace("__NODE_LINK_PLACEHOLDER__", linkStr);
|
||||
}
|
||||
|
||||
const st = getAppState();
|
||||
const isBatchMode = batchModeAllElements !== null;
|
||||
|
||||
@@ -5553,7 +5656,7 @@ const addNode = async (text, follow = false, skipFinalLayout = false, batchModeA
|
||||
width: shouldWrap ? curMaxW : undefined,
|
||||
height: shouldWrap ? curMaxH : undefined,
|
||||
autoResize: !shouldWrap,
|
||||
});
|
||||
}, preGenTextId);
|
||||
ea.style.backgroundColor = "transparent";
|
||||
}
|
||||
|
||||
@@ -5721,7 +5824,7 @@ const addNode = async (text, follow = false, skipFinalLayout = false, batchModeA
|
||||
width: shouldWrap ? curMaxW : undefined,
|
||||
height: shouldWrap ? curMaxH : undefined,
|
||||
autoResize: !shouldWrap,
|
||||
});
|
||||
}, preGenTextId);
|
||||
}
|
||||
|
||||
if (depth === 1) {
|
||||
@@ -8951,6 +9054,11 @@ const updateUI = (sel) => {
|
||||
setButtonDisabled(focusBtn, false);
|
||||
setButtonDisabled(floatingZoomBtn, false);
|
||||
}
|
||||
// Enable task buttons if there's text input
|
||||
if (inputEl && inputEl.value.trim() !== "") {
|
||||
if (toggleCheckboxBtn) setButtonDisabled(toggleCheckboxBtn, false);
|
||||
if (calendarBtn) setButtonDisabled(calendarBtn, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9818,7 +9926,7 @@ const renderInput = (container, isFloating = false) => {
|
||||
ignoreFocusChanges = true;
|
||||
setTimeout(() => {
|
||||
ignoreFocusChanges = false;
|
||||
lastFocusedInput.focus();
|
||||
if (lastFocusedInput) lastFocusedInput.focus();
|
||||
}, 200);
|
||||
container.empty();
|
||||
|
||||
@@ -9839,7 +9947,6 @@ const renderInput = (container, isFloating = false) => {
|
||||
inputRow.controlEl.style.marginTop = "8px";
|
||||
} else {
|
||||
container.style.width = "85vw";
|
||||
// Updated max width limit to fit up to 18 icons long as requested
|
||||
container.style.maxWidth = "calc((var(--icon-size) + 2 * var(--size-2-3)) * 18)";
|
||||
inputRow.settingEl.style.border = "none";
|
||||
inputRow.settingEl.style.padding = "0";
|
||||
@@ -9852,28 +9959,27 @@ const renderInput = (container, isFloating = false) => {
|
||||
secondaryButtonContainer.style.flexWrap = "wrap";
|
||||
secondaryButtonContainer.style.gap = "0px";
|
||||
secondaryButtonContainer.style.marginTop = "6px";
|
||||
secondaryButtonContainer.style.flexWrap = "wrap";
|
||||
}
|
||||
|
||||
// Clear default control element to build custom two-input layout
|
||||
inputRow.controlEl.empty();
|
||||
|
||||
const wrapper = inputRow.controlEl.createDiv("mindmap-input-wrapper");
|
||||
|
||||
// --- Ontology Input ---
|
||||
ontologyEl = wrapper.createEl("input", {
|
||||
type: "text",
|
||||
cls: "mindmap-input-ontology",
|
||||
placeholder: t("ONTOLOGY_PLACEHOLDER")
|
||||
});
|
||||
|
||||
// --- Main Input ---
|
||||
inputEl = wrapper.createEl("input", {
|
||||
type: "text",
|
||||
cls: "mindmap-input-main",
|
||||
placeholder: t("INPUT_PLACEHOLDER")
|
||||
});
|
||||
|
||||
inputEl.addEventListener("input", () => updateUI());
|
||||
ontologyEl.addEventListener("input", () => updateUI());
|
||||
|
||||
const updateFocusState = (focusedElement) => {
|
||||
if (ignoreFocusChanges) return;
|
||||
isOntologyFocused = (focusedElement === ontologyEl);
|
||||
@@ -9928,7 +10034,6 @@ const renderInput = (container, isFloating = false) => {
|
||||
linkSuggester.modifyInput = (input) => input.replace(/\./g, " ");
|
||||
}
|
||||
|
||||
// Accessibility / ARIA labels
|
||||
const ariaHelp = [
|
||||
`${getActionLabel(ACTION_ADD)} (Enter)`,
|
||||
`${getActionLabel(ACTION_ADD_FOLLOW)} ${getActionHotkeyString(ACTION_ADD_FOLLOW)}`,
|
||||
@@ -9988,7 +10093,6 @@ const renderInput = (container, isFloating = false) => {
|
||||
btn.onClick(() => performAction(ACTION_TOGGLE_CHECKBOX));
|
||||
}, true);
|
||||
|
||||
// Added calendar task date ontologies button
|
||||
addButton((btn) => {
|
||||
calendarBtn = btn;
|
||||
btn.setIcon("calendar");
|
||||
@@ -10862,6 +10966,34 @@ const registerStyles = () => {
|
||||
".mindmap-input-main { flex: 17; transition: flex-grow 0.3s ease; min-width: 0; }",
|
||||
".mindmap-input-ontology.is-focused { flex: 17; }",
|
||||
".mindmap-input-main.is-shrunk { flex: 1; }",
|
||||
// Drag Handle Styles
|
||||
".excalidraw-mindmap-ui .mindmap-drag-handle {",
|
||||
" position: absolute;",
|
||||
" right: 0;",
|
||||
" top: 0;",
|
||||
" bottom: 0;",
|
||||
" width: 20px;",
|
||||
" cursor: grab;",
|
||||
" display: flex;",
|
||||
" align-items: center;",
|
||||
" justify-content: center;",
|
||||
" opacity: 0.4;",
|
||||
" color: var(--text-muted);",
|
||||
" transition: opacity 0.2s ease, color 0.2s ease;",
|
||||
" background: var(--background-secondary);",
|
||||
" border-left: 1px solid var(--background-modifier-border);",
|
||||
" border-top-right-radius: 6px;",
|
||||
" border-bottom-right-radius: 6px;",
|
||||
"}",
|
||||
".excalidraw-mindmap-ui:focus-within .mindmap-drag-handle,",
|
||||
".excalidraw-mindmap-ui .mindmap-drag-handle:hover,",
|
||||
".excalidraw-mindmap-ui .mindmap-drag-handle:active {",
|
||||
" opacity: 1;",
|
||||
" color: var(--text-normal);",
|
||||
"}",
|
||||
".excalidraw-mindmap-ui.is-dragging .mindmap-drag-handle {",
|
||||
" cursor: grabbing;",
|
||||
"}"
|
||||
].join("\n");
|
||||
document.head.appendChild(styleEl);
|
||||
};
|
||||
@@ -10970,12 +11102,61 @@ const toggleDock = async ({
|
||||
headerEl.style.display = "none";
|
||||
modalEl.style.opacity = `${FLOAT_MODAL_OPACITY}`;
|
||||
modalEl.style.padding = "6px";
|
||||
modalEl.style.paddingRight = "26px"; // Make room for the drag handle
|
||||
modalEl.style.minHeight = "0px";
|
||||
modalEl.style.width = "fit-content";
|
||||
modalEl.style.height = "auto";
|
||||
modalEl.style.maxHeight = FLOAT_MODAL_MAX_HEIGHT;
|
||||
|
||||
if (isExcaliBrainView()) {
|
||||
modalEl.style.display = "none";
|
||||
}
|
||||
|
||||
const container = floatingInputModal.contentEl.createDiv();
|
||||
renderInput(container, true);
|
||||
|
||||
// Setup Drag Handle
|
||||
const dragHandle = modalEl.createDiv("mindmap-drag-handle");
|
||||
dragHandle.innerHTML = ea.obsidian.getIcon("grip-vertical").outerHTML;
|
||||
|
||||
let isDragging = false;
|
||||
let startX, startY, initialLeft, initialTop;
|
||||
|
||||
dragHandle.addEventListener("pointerdown", (e) => {
|
||||
isDragging = true;
|
||||
startX = e.clientX;
|
||||
startY = e.clientY;
|
||||
const rect = modalEl.getBoundingClientRect();
|
||||
initialLeft = rect.left;
|
||||
initialTop = rect.top;
|
||||
dragHandle.setPointerCapture(e.pointerId);
|
||||
modalEl.classList.add("is-dragging");
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
dragHandle.addEventListener("pointermove", (e) => {
|
||||
if(!isDragging) return;
|
||||
const dx = e.clientX - startX;
|
||||
const dy = e.clientY - startY;
|
||||
modalEl.style.left = `${initialLeft + dx}px`;
|
||||
modalEl.style.top = `${initialTop + dy}px`;
|
||||
});
|
||||
|
||||
dragHandle.addEventListener("pointerup", (e) => {
|
||||
isDragging = false;
|
||||
dragHandle.releasePointerCapture(e.pointerId);
|
||||
modalEl.classList.remove("is-dragging");
|
||||
});
|
||||
|
||||
dragHandle.addEventListener("dblclick", (e) => {
|
||||
const { x, y } = ea.targetView.contentEl.getBoundingClientRect();
|
||||
const desktopShift = !!ea.targetView.contentEl.querySelector(".App-bottom-bar .App-toolbar") ?
|
||||
0 :
|
||||
(ea.targetView.contentEl.clientWidth < 1200 ? 36 : 0);
|
||||
modalEl.style.top = `${y + FLOAT_MODAL_OFFSET + desktopShift}px`;
|
||||
modalEl.style.left = `${x + FLOAT_MODAL_OFFSET}px`;
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
//the modalEl is repositioned after a delay
|
||||
//otherwise the event handlers in FloatingModal would override the move
|
||||
@@ -11419,7 +11600,7 @@ const openCalendarModal = async () => {
|
||||
};
|
||||
|
||||
leftNav.createSpan({
|
||||
text: `Date ${activeDateIndex + 1} of ${dates.length}`
|
||||
text: t("CALENDAR_DATE_INDEX", { index: activeDateIndex + 1, total: dates.length })
|
||||
});
|
||||
|
||||
const nextBtn = leftNav.createEl("button");
|
||||
@@ -11455,7 +11636,7 @@ const openCalendarModal = async () => {
|
||||
|
||||
// 1) Date picker input (Focus First)
|
||||
new ea.obsidian.Setting(contentEl)
|
||||
.setName("Date")
|
||||
.setName(t("CALENDAR_DATE_LABEL"))
|
||||
.addText(text => {
|
||||
dateInputComp = text;
|
||||
text.inputEl.type = "date";
|
||||
@@ -11482,7 +11663,7 @@ const openCalendarModal = async () => {
|
||||
|
||||
// 2) Field type configuration selector matching active schema ontology
|
||||
new ea.obsidian.Setting(contentEl)
|
||||
.setName("Date Type")
|
||||
.setName(t("CALENDAR_DATE_TYPE"))
|
||||
.addDropdown(dropdown => {
|
||||
typeDropdownComp = dropdown;
|
||||
if (uiOpts.mode === 'dataview') {
|
||||
@@ -11493,12 +11674,12 @@ const openCalendarModal = async () => {
|
||||
dropdown.addOption("done", "✅ [done:: ]");
|
||||
dropdown.addOption("cancelled", "❌ [cancelled:: ]");
|
||||
} else {
|
||||
dropdown.addOption("due", "📅 Due");
|
||||
dropdown.addOption("start", "🛫 Start");
|
||||
dropdown.addOption("scheduled", "⏳ Scheduled");
|
||||
dropdown.addOption("created", "➕ Created");
|
||||
dropdown.addOption("done", "✅ Done");
|
||||
dropdown.addOption("cancelled", "❌ Cancelled");
|
||||
dropdown.addOption("due", `📅 ${t("CALENDAR_DATETYPE_DUE")}`);
|
||||
dropdown.addOption("start", `🛫 ${t("CALENDAR_DATETYPE_START")}`);
|
||||
dropdown.addOption("scheduled", `⏳ ${t("CALENDAR_DATETYPE_SCHEDULED")}`);
|
||||
dropdown.addOption("created", `➕ ${t("CALENDAR_DATETYPE_CREATED")}`);
|
||||
dropdown.addOption("done", `✅ ${t("CALENDAR_DATETYPE_DONE")}`);
|
||||
dropdown.addOption("cancelled", `❌ ${t("CALENDAR_DATETYPE_CANCELLED")}`);
|
||||
}
|
||||
dropdown.setValue(activeDateObj.type);
|
||||
dropdown.onChange(val => {
|
||||
@@ -11508,14 +11689,14 @@ const openCalendarModal = async () => {
|
||||
|
||||
// 3) Priority selector mapped to native Tasks emojis
|
||||
new ea.obsidian.Setting(contentEl)
|
||||
.setName("Priority")
|
||||
.setName(t("CALENDAR_PRIORITY"))
|
||||
.addDropdown(dropdown => {
|
||||
dropdown.addOption("highest", "🔺 Highest");
|
||||
dropdown.addOption("high", "⏫ High");
|
||||
dropdown.addOption("medium", "🔼 Medium");
|
||||
dropdown.addOption("normal", " Normal");
|
||||
dropdown.addOption("low", "🔽 Low");
|
||||
dropdown.addOption("lowest", "⏬ Lowest");
|
||||
dropdown.addOption("highest", `🔺 ${t("CALENDAR_PRIORITY_HIGHEST")}`);
|
||||
dropdown.addOption("high", `⏫ ${t("CALENDAR_PRIORITY_HIGH")}`);
|
||||
dropdown.addOption("medium", `🔼 ${t("CALENDAR_PRIORITY_MEDIUM")}`);
|
||||
dropdown.addOption("normal", ` ${t("CALENDAR_PRIORITY_NORMAL")}`);
|
||||
dropdown.addOption("low", `🔽 ${t("CALENDAR_PRIORITY_LOW")}`);
|
||||
dropdown.addOption("lowest", `⏬ ${t("CALENDAR_PRIORITY_LOWEST")}`);
|
||||
dropdown.setValue(priority);
|
||||
dropdown.onChange(val => {
|
||||
priority = val;
|
||||
@@ -11524,15 +11705,44 @@ const openCalendarModal = async () => {
|
||||
|
||||
// 4) Recurrence free text input
|
||||
const recSetting = new ea.obsidian.Setting(contentEl)
|
||||
.setName("Recurrence")
|
||||
.setName(t("CALENDAR_RECURRENCE"))
|
||||
.addText(text => {
|
||||
text.setPlaceholder("every day")
|
||||
text.setPlaceholder(t("CALENDAR_RECURRENCE_PLACEHOLDER"))
|
||||
.setValue(recurrence)
|
||||
.onChange(val => {
|
||||
recurrence = val;
|
||||
});
|
||||
});
|
||||
recSetting.descEl.innerHTML = `e.g., 'every day', 'every 2 weeks' <br><a href="https://publish.obsidian.md/tasks/Getting+Started/Recurring+Tasks" target="_blank" tabindex="-1">Tasks recurrence docs</a>`;
|
||||
recSetting.descEl.innerHTML = t("CALENDAR_RECURRENCE_DESC");
|
||||
|
||||
// 5) Inject Node Link toggle
|
||||
const linkSettingsRow = new ea.obsidian.Setting(contentEl)
|
||||
.setName(t("CALENDAR_INJECT_LINK"))
|
||||
.setDesc(t("CALENDAR_INJECT_LINK_DESC"));
|
||||
|
||||
let aliasTextComp;
|
||||
linkSettingsRow.addToggle(toggle => {
|
||||
toggle.setValue(injectNodeLink)
|
||||
.onChange(val => {
|
||||
injectNodeLink = val;
|
||||
setVal(K_INJECT_LINK, val);
|
||||
dirty = true;
|
||||
aliasTextComp.inputEl.style.display = val ? "" : "none";
|
||||
});
|
||||
});
|
||||
linkSettingsRow.addText(text => {
|
||||
aliasTextComp = text;
|
||||
text.setPlaceholder(t("CALENDAR_ALIAS_PLACEHOLDER"))
|
||||
.setValue(nodeLinkAlias)
|
||||
.onChange(val => {
|
||||
nodeLinkAlias = val || "link";
|
||||
setVal(K_LINK_ALIAS, nodeLinkAlias);
|
||||
dirty = true;
|
||||
});
|
||||
text.inputEl.style.display = injectNodeLink ? "" : "none";
|
||||
text.inputEl.style.width = "100px";
|
||||
text.inputEl.style.marginLeft = "10px";
|
||||
});
|
||||
|
||||
// Controls button block
|
||||
const btnContainer = contentEl.createDiv({
|
||||
@@ -11542,15 +11752,20 @@ const openCalendarModal = async () => {
|
||||
});
|
||||
|
||||
const cancelBtn = btnContainer.createEl("button", {
|
||||
text: "Cancel"
|
||||
text: t("CALENDAR_BTN_CANCEL")
|
||||
});
|
||||
cancelBtn.onclick = () => modal.close();
|
||||
|
||||
const taskOnlyBtn = btnContainer.createEl("button", {
|
||||
text: t("CALENDAR_BTN_TASK_ONLY")
|
||||
});
|
||||
taskOnlyBtn.onclick = () => handleSave(false);
|
||||
|
||||
const saveBtn = btnContainer.createEl("button", {
|
||||
text: "Apply",
|
||||
text: t("CALENDAR_BTN_ADD_DATE_TASK"),
|
||||
cls: "mod-cta"
|
||||
});
|
||||
saveBtn.onclick = handleSave;
|
||||
saveBtn.onclick = () => handleSave(true);
|
||||
|
||||
// Date picker auto-open / focus
|
||||
setTimeout(() => {
|
||||
@@ -11565,66 +11780,83 @@ const openCalendarModal = async () => {
|
||||
}, 50);
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
const handleSave = async (includeDate = true) => {
|
||||
modal.close();
|
||||
|
||||
let tasksString = "";
|
||||
const validDates = dates.filter(d => d.date);
|
||||
|
||||
if (uiOpts.mode === 'dataview') {
|
||||
let priorityStr = "";
|
||||
const priorityMap = {
|
||||
'highest': '🔺',
|
||||
'high': '⏫',
|
||||
'medium': '🔼',
|
||||
'normal': '',
|
||||
'low': '🔽',
|
||||
'lowest': '⏬'
|
||||
};
|
||||
if (priority !== 'normal') priorityStr = priorityMap[priority];
|
||||
if (includeDate) {
|
||||
const validDates = dates.filter(d => d.date);
|
||||
if (uiOpts.mode === 'dataview') {
|
||||
let priorityStr = "";
|
||||
const priorityMap = {
|
||||
'highest': '🔺',
|
||||
'high': '⏫',
|
||||
'medium': '🔼',
|
||||
'normal': '',
|
||||
'low': '🔽',
|
||||
'lowest': '⏬'
|
||||
};
|
||||
if (priority !== 'normal') priorityStr = priorityMap[priority];
|
||||
|
||||
let dateStrs = validDates.map(d => `[${d.type}:: ${d.date}]`);
|
||||
let recStr = recurrence ? `[recurrence:: ${recurrence}]` : "";
|
||||
let dateStrs = validDates.map(d => `[${d.type}:: ${d.date}]`);
|
||||
let recStr = recurrence ? `[recurrence:: ${recurrence}]` : "";
|
||||
|
||||
const parts = [priorityStr, ...dateStrs, recStr].filter(Boolean);
|
||||
if (parts.length > 0) tasksString = " " + parts.join(" ");
|
||||
} else {
|
||||
let priorityStr = "";
|
||||
const priorityMap = {
|
||||
'highest': ' 🔺',
|
||||
'high': ' ⏫',
|
||||
'medium': ' 🔼',
|
||||
'normal': '',
|
||||
'low': ' 🔽',
|
||||
'lowest': ' ⏬'
|
||||
};
|
||||
priorityStr = priorityMap[priority] || "";
|
||||
const parts = [priorityStr, ...dateStrs, recStr].filter(Boolean);
|
||||
if (parts.length > 0) tasksString = " " + parts.join(" ");
|
||||
} else {
|
||||
let priorityStr = "";
|
||||
const priorityMap = {
|
||||
'highest': ' 🔺',
|
||||
'high': ' ⏫',
|
||||
'medium': ' 🔼',
|
||||
'normal': '',
|
||||
'low': ' 🔽',
|
||||
'lowest': ' ⏬'
|
||||
};
|
||||
priorityStr = priorityMap[priority] || "";
|
||||
|
||||
const emojiMap = {
|
||||
'due': '📅',
|
||||
'start': '🛫',
|
||||
'scheduled': '⏳',
|
||||
'created': '➕',
|
||||
'done': '✅',
|
||||
'cancelled': '❌'
|
||||
};
|
||||
let dateStrs = validDates.map(d => ` ${emojiMap[d.type]} ${d.date}`);
|
||||
let recStr = recurrence ? ` 🔁 ${recurrence}` : "";
|
||||
const emojiMap = {
|
||||
'due': '📅',
|
||||
'start': '🛫',
|
||||
'scheduled': '⏳',
|
||||
'created': '➕',
|
||||
'done': '✅',
|
||||
'cancelled': '❌'
|
||||
};
|
||||
let dateStrs = validDates.map(d => ` ${emojiMap[d.type]} ${d.date}`);
|
||||
let recStr = recurrence ? ` 🔁 ${recurrence}` : "";
|
||||
|
||||
tasksString = `${priorityStr}${dateStrs.join("")}${recStr}`;
|
||||
tasksString = `${priorityStr}${dateStrs.join("")}${recStr}`;
|
||||
}
|
||||
}
|
||||
|
||||
const taskRegex = /^- \[([ xX])\] (.*)/s;
|
||||
const match = targetText.match(taskRegex);
|
||||
|
||||
let cleanText = cleanTasksString(match ? match[2] : targetText);
|
||||
|
||||
// Ensure we don't duplicate an existing auto-generated link at the end
|
||||
const linkRegex = /\s*\(\[\[[^\]]+#\^group=[a-zA-Z0-9_-]+\|[^\]]+\]\]\)$/;
|
||||
if (linkRegex.test(cleanText)) {
|
||||
cleanText = cleanText.replace(linkRegex, "");
|
||||
}
|
||||
|
||||
let finalPrefix = match ? `- [${match[1]}] ` : "- [ ] ";
|
||||
|
||||
let newText = `${finalPrefix}${cleanText}${tasksString}`;
|
||||
|
||||
if (injectNodeLink) {
|
||||
if (isInputEl) {
|
||||
newText += ` __NODE_LINK_PLACEHOLDER__`;
|
||||
} else {
|
||||
const file = app.workspace.getActiveFile();
|
||||
const fileName = file ? file.basename : "";
|
||||
newText += ` ([[${fileName}#^group=${textElId}|${nodeLinkAlias}]])`;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInputEl) {
|
||||
inputEl.value = newText;
|
||||
debugger;
|
||||
updateUI();
|
||||
} else {
|
||||
const all = ea.getViewElements();
|
||||
@@ -11661,7 +11893,7 @@ const openCalendarModal = async () => {
|
||||
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleSave();
|
||||
handleSave(true);
|
||||
}
|
||||
// Prevent Escape from propagating to the underlying floating modal or canvas
|
||||
if (e.key === "Escape") {
|
||||
@@ -13148,6 +13380,7 @@ const handleCanvasPointerDown = (e) => {
|
||||
}, 50);
|
||||
};
|
||||
|
||||
/* --- Initialization Logic --- */
|
||||
/* --- Initialization Logic --- */
|
||||
ea.createSidepanelTab(t("DOCK_TITLE"), true, true).then((tab) => {
|
||||
|
||||
@@ -13279,9 +13512,15 @@ ea.createSidepanelTab(t("DOCK_TITLE"), true, true).then((tab) => {
|
||||
const {
|
||||
modalEl
|
||||
} = floatingInputModal
|
||||
if (modalEl.style.display === "none") {
|
||||
modalEl.style.display = "";
|
||||
|
||||
if (isExcaliBrainView()) {
|
||||
modalEl.style.display = "none";
|
||||
} else {
|
||||
if (modalEl.style.display === "none") {
|
||||
modalEl.style.display = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (ea.targetView && modalEl.ownerDocument !== ea.targetView.ownerDocument) {
|
||||
ea.targetView.ownerDocument.body.appendChild(modalEl);
|
||||
linkSuggester?.close();
|
||||
|
||||
+533
-499
File diff suppressed because it is too large.
Load diff
@@ -1 +1 @@
|
||||
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1767536720161},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
|
||||
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1767536720161},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
|
||||
Reference in new issue
Block a user