mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
fixed focus #346
This commit is contained in:
@@ -18,12 +18,15 @@ app.vault.getFiles().forEach((f)=>
|
||||
|
||||
f = Array.from(folders);
|
||||
folder = await utils.suggester(f,f);
|
||||
folder = folder??""; //if exiting suggester with ESC
|
||||
folder = folder === "" ? folder : folder + "/";
|
||||
|
||||
elements = ea.getViewSelectedElements().filter((el)=>el.type==="text");
|
||||
|
||||
elements.forEach((el)=>{
|
||||
el.rawText = "[["+folder+el.rawText+"|"+el.rawText+"]]";
|
||||
el.text = "[["+folder+el.text+"|"+el.text+"]]";
|
||||
el.originalText = "[["+folder+el.originalText+"|"+el.originalText+"]]";
|
||||
})
|
||||
ea.copyViewElementsToEAforEditing(elements);
|
||||
ea.addElementsToView();
|
||||
@@ -211,7 +211,7 @@ export interface ExcalidrawAutomate {
|
||||
b: readonly [number, number],
|
||||
gap?: number, //if given, element is inflated by this value
|
||||
): Point[];
|
||||
|
||||
|
||||
//See OCR plugin for example on how to use scriptSettings
|
||||
activeScript: string; //Set automatically by the ScriptEngine
|
||||
getScriptSettings(): {}; //Returns script settings. Saves settings in plugin settings, under the activeScript key
|
||||
@@ -1182,7 +1182,7 @@ export async function initExcalidrawAutomate(
|
||||
return false;
|
||||
}
|
||||
const elements = this.getElements();
|
||||
return await this.targetView.addElements(
|
||||
return await this.targetView.addElements(
|
||||
elements,
|
||||
repositionToCursor,
|
||||
save,
|
||||
|
||||
@@ -345,7 +345,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
return;
|
||||
}
|
||||
this.contentEl.requestFullscreen(); //{navigationUI: "hide"});
|
||||
this.excalidrawWrapperRef.current.focus();
|
||||
this.excalidrawWrapperRef.current.firstElementChild?.focus();
|
||||
this.contentEl.setAttribute("style", "padding:0px;margin:0px;");
|
||||
|
||||
this.fullscreenModalObserver = new MutationObserver((m) => {
|
||||
@@ -837,7 +837,8 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.app.workspace.activeLeaf === this.leaf &&
|
||||
this.excalidrawWrapperRef
|
||||
) {
|
||||
this.excalidrawWrapperRef.current.focus();
|
||||
//.firstElmentChild solves this issue: https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/346
|
||||
this.excalidrawWrapperRef.current?.firstElementChild?.focus();
|
||||
}
|
||||
//debug({where:"ExcalidrawView.loadDrawing",file:this.file.name,before:"this.loadSceneFiles"});
|
||||
this.loadSceneFiles();
|
||||
@@ -1326,7 +1327,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.excalidrawAPI.addFiles(files);
|
||||
}
|
||||
if (save) {
|
||||
this.save(false);
|
||||
await this.save(false); //preventReload=false will ensure that markdown links are paresed and displayed correctly
|
||||
} else {
|
||||
this.dirty = this.file?.path;
|
||||
}
|
||||
@@ -2003,7 +2004,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
return React.createElement(React.Fragment, null, excalidrawDiv);
|
||||
});
|
||||
ReactDOM.render(reactElement, this.contentEl, () => {
|
||||
this.excalidrawWrapperRef.current.focus();
|
||||
this.excalidrawWrapperRef.current.firstElementChild?.focus();
|
||||
this.addFullscreenchangeEvent();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user