mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
1.8.7
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "1.8.6",
|
||||
"version": "1.8.7",
|
||||
"minAppVersion": "1.0.0",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
@@ -55,6 +55,7 @@ export const initializeMarkdownPostProcessor = (p: ExcalidrawPlugin) => {
|
||||
*/
|
||||
const getIMG = async (
|
||||
imgAttributes: imgElementAttributes,
|
||||
onCanvas: boolean = false,
|
||||
): Promise<HTMLElement> => {
|
||||
let file = imgAttributes.file;
|
||||
if (!imgAttributes.file) {
|
||||
@@ -83,7 +84,7 @@ const getIMG = async (
|
||||
if (imgAttributes.fheight) {
|
||||
style += `height:${imgAttributes.fheight}px;`;
|
||||
}
|
||||
img.setAttribute("style", style);
|
||||
if(!onCanvas) img.setAttribute("style", style);
|
||||
img.addClass(imgAttributes.style);
|
||||
|
||||
const theme =
|
||||
@@ -187,8 +188,9 @@ const getIMG = async (
|
||||
|
||||
const createImgElement = async (
|
||||
attr: imgElementAttributes,
|
||||
onCanvas: boolean = false,
|
||||
) :Promise<HTMLElement> => {
|
||||
const img = await getIMG(attr);
|
||||
const img = await getIMG(attr,onCanvas);
|
||||
img.setAttribute("fileSource", attr.fname);
|
||||
if (attr.fwidth) {
|
||||
img.setAttribute("w", attr.fwidth);
|
||||
@@ -196,6 +198,8 @@ const createImgElement = async (
|
||||
if (attr.fheight) {
|
||||
img.setAttribute("h", attr.fheight);
|
||||
}
|
||||
img.setAttribute("draggable","false");
|
||||
img.setAttribute("onCanvas",onCanvas?"true":"false");
|
||||
|
||||
let timer:NodeJS.Timeout;
|
||||
const clickEvent = (ev:PointerEvent) => {
|
||||
@@ -236,15 +240,18 @@ const createImgElement = async (
|
||||
const imgMaxWidth = img.style.maxWidth;
|
||||
const imgMaxHeigth = img.style.maxHeight;
|
||||
const fileSource = img.getAttribute("fileSource");
|
||||
const onCanvas = img.getAttribute("onCanvas") === "true";
|
||||
const newImg = await createImgElement({
|
||||
fname: fileSource,
|
||||
fwidth: img.getAttribute("w"),
|
||||
fheight: img.getAttribute("h"),
|
||||
style: img.getAttribute("class"),
|
||||
});
|
||||
}, onCanvas);
|
||||
parent.empty();
|
||||
newImg.style.maxHeight = imgMaxHeigth;
|
||||
newImg.style.maxWidth = imgMaxWidth;
|
||||
if(!onCanvas) {
|
||||
newImg.style.maxHeight = imgMaxHeigth;
|
||||
newImg.style.maxWidth = imgMaxWidth;
|
||||
}
|
||||
newImg.setAttribute("fileSource",fileSource);
|
||||
parent.append(newImg);
|
||||
});
|
||||
@@ -253,8 +260,9 @@ const createImgElement = async (
|
||||
|
||||
const createImageDiv = async (
|
||||
attr: imgElementAttributes,
|
||||
onCanvas: boolean = false
|
||||
): Promise<HTMLDivElement> => {
|
||||
const img = await createImgElement(attr);
|
||||
const img = await createImgElement(attr, onCanvas);
|
||||
return createDiv(attr.style, (el) => el.append(img));
|
||||
};
|
||||
|
||||
@@ -408,15 +416,20 @@ const tmpObsidianWYSIWYG = async (
|
||||
return;
|
||||
}
|
||||
internalEmbedDiv.empty();
|
||||
const imgDiv = await createImageDiv(attr);
|
||||
const onCanvas = internalEmbedDiv.hasClass("canvas-node-content");
|
||||
const imgDiv = await createImageDiv(attr, onCanvas);
|
||||
if(markdownEmbed) {
|
||||
internalEmbedDiv.addClass("markdown-embed");
|
||||
if(imgDiv.firstChild instanceof HTMLElement) {
|
||||
if(onCanvas) {
|
||||
internalEmbedDiv.removeClass("markdown-embed");
|
||||
internalEmbedDiv.addClass("media-embed");
|
||||
internalEmbedDiv.addClass("image-embed");
|
||||
}
|
||||
if(!onCanvas && imgDiv.firstChild instanceof HTMLElement) {
|
||||
imgDiv.firstChild.style.maxHeight = "100%";
|
||||
imgDiv.firstChild.style.maxWidth = null;
|
||||
internalEmbedDiv.appendChild(imgDiv.firstChild);
|
||||
return;
|
||||
}
|
||||
internalEmbedDiv.appendChild(imgDiv.firstChild);
|
||||
return;
|
||||
}
|
||||
internalEmbedDiv.appendChild(imgDiv);
|
||||
return;
|
||||
|
||||
@@ -17,6 +17,22 @@ I develop this plugin as a hobby, spending my free time doing this. If you find
|
||||
|
||||
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" height=45></a></div>
|
||||
`,
|
||||
"1.8.7":`
|
||||
## New from Excalidraw.com
|
||||
- Support shrinking text containers to their original height when text is removed [#6025](https://github.com/excalidraw/excalidraw/pull/6025)
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://user-images.githubusercontent.com/14358394/209404092-579d54e9-7003-48ef-8b82-84be08ba6246.mp4" title="Demo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
|
||||
## Fixed
|
||||
- removed the white background when editing arrow-label [#6033](https://github.com/excalidraw/excalidraw/pull/6033)
|
||||
- Minor style tweaks
|
||||
- for embedding Excalidraw into Obsidian Canvas. e.g. dragging no longer accidentally creates an image copy of the drawing, and
|
||||
- style tweaks on the Excalidraw canvas
|
||||
|
||||
## New
|
||||
- If you set a different text color and sticky note border color, now if you change the border color, the text color will not be changed.
|
||||
`,
|
||||
"1.8.6":`
|
||||
## New from Excalidraw.com:
|
||||
- Better default radius for rectangles [#5553](https://github.com/excalidraw/excalidraw/pull/5553). Existing drawings will look unchanged, this applies only to new rectangles.
|
||||
|
||||
Reference in New Issue
Block a user