mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-11-27 06:32:42 +00:00
fix back-of-the-note card placement
This commit is contained in:
1 parent
f7676b4102
commit
2eef8d0151
4 files changed
+17
-10
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.15.2",
|
||||
"version": "2.15.3-beta-1",
|
||||
"minAppVersion": "1.5.7",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
Generated
+4
-4
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@zsviczian/colormaster": "^1.2.2",
|
||||
"@zsviczian/excalidraw": "0.18.0-31",
|
||||
"@zsviczian/excalidraw": "0.18.0-37",
|
||||
"chroma-js": "^3.1.2",
|
||||
"clsx": "^2.0.0",
|
||||
"es6-promise-pool": "2.5.0",
|
||||
@@ -3494,9 +3494,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@zsviczian/excalidraw": {
|
||||
"version": "0.18.0-31",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.0-31.tgz",
|
||||
"integrity": "sha512-A1wyp8EVOhCdoxdX7middc8LoLpjPLtxiSTeBbdMtungl8VQzAcQ2tSGCkncK/8RBcBaUk44Hr6KcWjezHnQew==",
|
||||
"version": "0.18.0-37",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.0-37.tgz",
|
||||
"integrity": "sha512-SC4a6wj6IzE9HucxImDoOPcojojW/8FSry1hSA+hXfU350DhY6VlpFQ1DHJMPqVgIkFHB/hbCHt3klV+66+ouw==",
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "6.0.2",
|
||||
"@excalidraw/random-username": "1.1.0",
|
||||
|
||||
@@ -17,6 +17,10 @@ I build this plugin in my free time, as a labor of love. Curious about the philo
|
||||
|
||||
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
|
||||
`,
|
||||
"2.15.3":`
|
||||
## Fixed
|
||||
- When adding a back-of-the-note card using the context menu, the card got placed at the absolute 0,0 position in the scene instead of the current pointer position. [#9949](https://github.com/excalidraw/excalidraw/issues/9949)
|
||||
`,
|
||||
"2.15.2":`
|
||||
## Fixed:
|
||||
- Pressing enter on a text element erroneously activated all markdown embeddables in the scene. [discord](https://discord.com/channels/1026825302900494357/1412683408424833045)
|
||||
|
||||
@@ -8,6 +8,8 @@ import { addBackOfTheNoteCard } from "src/utils/excalidrawViewUtils";
|
||||
|
||||
export class SelectCard extends FuzzySuggestModal<string> {
|
||||
private center: boolean = false;
|
||||
private x: number = 0;
|
||||
private y: number = 0;
|
||||
|
||||
constructor(
|
||||
public app: App,
|
||||
@@ -49,17 +51,16 @@ export class SelectCard extends FuzzySuggestModal<string> {
|
||||
|
||||
onChooseItem(item: string): void {
|
||||
const ea = getEA(this.view) as ExcalidrawAutomate;
|
||||
let x,y = 0;
|
||||
if(this.center) {
|
||||
const centerPos = ea.getViewCenterPosition();
|
||||
if(centerPos) {
|
||||
x = centerPos.x - (CARD_WIDTH / 2);
|
||||
y = centerPos.y - (CARD_HEIGHT / 2);
|
||||
this.x = centerPos.x - (CARD_WIDTH / 2);
|
||||
this.y = centerPos.y - (CARD_HEIGHT / 2);
|
||||
}
|
||||
}
|
||||
|
||||
const id = ea.addEmbeddable(
|
||||
x,y,CARD_WIDTH,CARD_HEIGHT,
|
||||
this.x,this.y,CARD_WIDTH,CARD_HEIGHT,
|
||||
`[[${this.view.file.path}#${item}]]`
|
||||
);
|
||||
(async () => {
|
||||
@@ -70,7 +71,9 @@ export class SelectCard extends FuzzySuggestModal<string> {
|
||||
}
|
||||
|
||||
public start(center: boolean = false): void {
|
||||
this.center = center;
|
||||
this.x = this.view.currentPosition.x;
|
||||
this.y = this.view.currentPosition.y;
|
||||
this.center = !!center;
|
||||
this.emptyStateText = t("EMPTY_SECTION_MESSAGE");
|
||||
this.setPlaceholder(t("SELECT_SECTION_OR_TYPE_NEW"));
|
||||
this.open();
|
||||
|
||||
Reference in new issue
Block a user