Compare commits

..

9 Commits

Author SHA1 Message Date
Zsolt Viczian
7f45dad610 Merge branch 'master' of https://github.com/zsviczian/obsidian-excalidraw-plugin 2022-08-24 23:21:21 +02:00
Zsolt Viczian
0e1ee0dde2 1.7.16 2022-08-24 23:21:04 +02:00
zsviczian
6c7b63cbdf Merge pull request #762 from axelson/update-convert-text-to-sticky-script-default-value
Change the default sticky note to have transparent border
2022-08-23 08:17:38 +02:00
Jason Axelson
bca7010394 Change the default sticky note to have transparent border
In this video: https://youtu.be/fXGcOWycgG4?t=1923
it is mentioned that the default border color for the "Convert selected
text elements to sticky notes" script is a transparent border, however
that is not the current default value.

I think setting `transparent` as the default is more useful than
`#000000` because `transparent` can only be set via a script (at least
without affecting the text color) while `#000000` can be set since it is
also a common color for text.
2022-08-21 11:27:46 -10:00
zsviczian
3565a5bf94 Merge pull request #761 from axelson/update-script-docs
Update script installation instructions
2022-08-21 21:33:55 +02:00
Zsolt Viczian
f089911e02 Merge branch 'master' of https://github.com/zsviczian/obsidian-excalidraw-plugin 2022-08-21 21:17:12 +02:00
Zsolt Viczian
992af2b5ca 1.7.15 2022-08-21 21:16:50 +02:00
Jason Axelson
f85fc124d9 Update script installation instructions
The script installation instructions were out of date and the scripts
did not show up until I fully restarted Obsidian, just opening a new
Excalidraw drawing was not enough (perhaps because I had excalibrain
open in a pop-out window?)
2022-08-21 09:13:28 -10:00
zsviczian
961e75a12d Update README.md 2022-08-21 14:58:06 +02:00
8 changed files with 50 additions and 11 deletions

View File

@@ -17,9 +17,7 @@ Please upgrade to Obsidian v0.12.19 or higher to get the latest release.
|[![fourtfont](https://user-images.githubusercontent.com/14358394/149659524-2a4e0a24-40c9-4e66-a6b1-c92f3b88ecd5.jpg)](https://youtu.be/eKFmrSQhFA4)|[![thumbnail](https://user-images.githubusercontent.com/14358394/151705333-54e9ffd2-0bd7-4d02-b99e-0bd4e4708d4d.jpg)](https://youtu.be/qbPIAZguJeo)|[![Thumbnail](https://user-images.githubusercontent.com/14358394/152585752-7eb0371f-0bab-40f6-a194-3b48e5811735.jpg)](https://youtu.be/2Y8OhkGiTHg)|
|[![Thumbnail](https://user-images.githubusercontent.com/14358394/153676009-6f86b2d7-c248-49a2-b802-be21c6999e4f.jpg)](https://youtu.be/2v9TZmQNO8c)|[![Thumbnail](https://user-images.githubusercontent.com/14358394/154821232-a404b6cf-72fb-4ce4-9d53-619132dce491.jpg)](https://youtu.be/xHPGWR3m0c8)|[![Thumbnail](https://user-images.githubusercontent.com/14358394/156931428-b2269fd9-87bd-43ab-8558-5572f40dff93.jpg)](https://youtu.be/gMIKXyhS-dM)|
|[![thumbnail](https://user-images.githubusercontent.com/14358394/156931461-0979b821-315a-41dd-86f1-31d169b7c127.jpg)](https://youtu.be/Etskjw7a5zo)|[![Thumbnail](https://user-images.githubusercontent.com/14358394/158008902-12c6a851-237e-4edd-a631-d48e81c904b2.jpg)](https://youtu.be/4N6efq1DtH0)|[![thumbnail](https://user-images.githubusercontent.com/14358394/159369910-6371f08d-b5fa-454d-9c6c-948f7e7a7d26.jpg)](https://youtu.be/U2LkBRBk4LY)|
| [![6 strategies for linking your visual thoughts v4](https://user-images.githubusercontent.com/14358394/171635214-30533c45-94fa-436e-83a9-b2ec99f190e2.jpg)](https://youtu.be/qiKuqMcNWgU)| | |
| [![6 strategies for linking your visual thoughts v4](https://user-images.githubusercontent.com/14358394/171635214-30533c45-94fa-436e-83a9-b2ec99f190e2.jpg)](https://youtu.be/qiKuqMcNWgU)|[![Video thumbnail small](https://user-images.githubusercontent.com/14358394/185791706-3d9983ab-7cb1-4b27-a016-30c039d84e34.jpg)](https://youtu.be/yZQoJg2RCKI)| |
# Key features
@@ -59,6 +57,12 @@ Please upgrade to Obsidian v0.12.19 or higher to get the latest release.
- On iOS and Android you can add images from your camera by pressing the add image button in Excalidraw.
- You can copy/paste images into your drawing. Images will be saved in your vault.
- You can drag and drop images as explained above.
- Block referencing parts of images
- When referencing an element on the canvas in a link pointing to an Excalidraw file using the elementId or the section header (i.e. a Text Element containing the `# <Section title>`) - e.g. `[[file#^elementID]]`, you can add the `group=` prefix, e.g. `[[file#^group=elementID]]` or the `area=` prefix, e.g. `[[file#area=Section heading]]`.
- If the `group=` prefix is found Excalidraw will select the group of elements in the same group as the element referenced by the elementID (block reference) or the section heading.
- If the `area=` prefix is found Excalidraw will insert a cutout of the image around the referenced element.
- Note that the `area=` selector is not supported when embedding Excalidraw as PNG into your markdown documents.
- Referencing the elementID of a text element without the `group=` or `area=` prefix will transclude the element as plain text. Referencing a non-Text Element (e.g. rectangle, ellipse, etc.) without the `group=` or `area=` prefix will result in an Obsidian error since these elementIds are not present in the Excalidraw markdown file as block references.
- Since 1.2.0 Drawing files are stored in Markdown files
- You can add tags to drawings
- You can add metadata to the YAML front matter of drawings

View File

@@ -15,7 +15,7 @@ settings = ea.getScriptSettings();
if(!settings["Border color"]) {
settings = {
"Border color" : {
value: "#000000",
value: "transparent",
description: "Any legal HTML color (#000000, rgb, color-name, etc.). Set to 'transparent' for transparent color."
},
"Background color" : {

View File

@@ -3,13 +3,28 @@ Click to watch the intro video:
[![Script Engine](https://user-images.githubusercontent.com/14358394/145684531-8d9c2992-59ac-4ebc-804a-4cce1777ded2.jpg)](https://youtu.be/hePJcObHIso)
> **Warning**
> There is an easier way to install/manage scripts than what is shown in this video
See the [Excalidraw Script Engine](https://zsviczian.github.io/obsidian-excalidraw-plugin/ExcalidrawScriptsEngine.html) documentation for more details.
## How to install scripts into your Obsidian Vault
To install one of the built-in scripts:
- Open up an excalidraw drawing in Obsidian
- In the pane dropdown menu select "Install or update Excalidraw Scripts"
- Click on one of the available scripts
- Click on "Install this script" (note if the script is already installed you will instead see an option to update it)
- Restart Obsidian so the script will be picked up
Note: By default this will install the script into your vault in the `Excalidraw/Scripts/Downloaded` folder
<details><summary>Manual installation of scripts</summary>
Open the script you are interested in and save it to your Obsidian Vault including the first line `/*`, or open it in "Raw" and copy the entire contents to Obsidian.
![](https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-download-raw.jpg)
</details>
## List of available scripts
|Title|Description|Icon|Contributor|

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "1.7.14",
"version": "1.7.16",
"minAppVersion": "0.15.6",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",

View File

@@ -18,7 +18,7 @@
"license": "MIT",
"dependencies": {
"@types/lz-string": "^1.3.34",
"@zsviczian/excalidraw": "0.12.0-obsidian-5",
"@zsviczian/excalidraw": "0.12.0-obsidian-7",
"clsx": "^1.1.1",
"lz-string": "^1.4.4",
"monkey-around": "^2.3.0",

View File

@@ -3012,6 +3012,14 @@ export default class ExcalidrawView extends TextFileView {
originalText: string,
isDeleted: boolean,
): [string, string, string] => {
const FORBIDDEN_TEXT = `{"type":"excalidraw/clipboard","elements":[{"`;
if(text.startsWith(FORBIDDEN_TEXT)) {
return [
"PASTING EXCALIDRAW ELEMENTS AS A TEXT ELEMENT IS NOT ALLOWED",
"PASTING EXCALIDRAW ELEMENTS AS A TEXT ELEMENT IS NOT ALLOWED",
null
];
}
const api = this.excalidrawAPI;
if (!api) {
return [null, null, null];
@@ -3240,6 +3248,7 @@ export default class ExcalidrawView extends TextFileView {
const observer = React.useRef(
new ResizeObserver((entries) => {
if(!toolsPanelRef || !toolsPanelRef.current) return;
const { width, height } = entries[0].contentRect;
const dx = toolsPanelRef.current.onRightEdge
? toolsPanelRef.current.previousWidth - width
@@ -3251,7 +3260,7 @@ export default class ExcalidrawView extends TextFileView {
}),
);
React.useEffect(() => {
if (toolsPanelRef.current) {
if (toolsPanelRef?.current) {
observer.current.observe(toolsPanelRef.current.containerRef.current);
}
return () => {

View File

@@ -17,6 +17,17 @@ I develop this plugin as a hobby, spending most of my free time doing this. If y
<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.7.16":`
# Fixed
- Excalidraw canvas is empty after saving the drawing and re-opening it at a later time. If you accidentally paste Excalidraw elements from the clipboard as the contents of a text element, in certain situations this can corrupt the Excalidraw file and as a result, Excalidraw will load an empty-looking drawing the next time. Changing to markdown view, these files can be repaired, however, to avoid accidental data loss, I have prevented pasting of excalidraw clipboard contents as text elements. [#768](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/768)
# New
- Add zoom % display in tray-mode [737](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/737)
`,
"1.7.15":`
# Fixed
- Canvas turns white when adding point for curved line [#760](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/760), [#738](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/738), [#5602](https://github.com/excalidraw/excalidraw/issues/5602)
`,
"1.7.14": `
<div class="excalidraw-videoWrapper"><div>
<iframe src="https://www.youtube.com/embed/yZQoJg2RCKI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

View File

@@ -2216,10 +2216,10 @@
dependencies:
"@zerollup/ts-helpers" "^1.7.18"
"@zsviczian/excalidraw@0.12.0-obsidian-5":
"integrity" "sha512-AZQzqlxNbwk+BoKn3R10Xo/V+JoYwJ1mJ9+khUTSsavS7s41xRmA+6k+tKAPa+ce4PSEzZnXg8ZrxTUuNQBxxA=="
"resolved" "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.12.0-obsidian-5.tgz"
"version" "0.12.0-obsidian-5"
"@zsviczian/excalidraw@0.12.0-obsidian-7":
"integrity" "sha512-U/2FvzZdzSJp5Aurs3wMYp4dSC5BZpa6Yv0L6pXlEfaMVuLMFPp+mrJBt+d7xhGHRREd/o/tjxHdt3vIjHmAXA=="
"resolved" "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.12.0-obsidian-7.tgz"
"version" "0.12.0-obsidian-7"
"abab@^2.0.3", "abab@^2.0.5":
"integrity" "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q=="