Comments (6)
The fix worked perfectly. Thanks. Perhaps you can incorporate this change into the code.
from el-easydraw.
nxtruongさんこんにちは。
ご報告ありがとうございます。
小さな白い箱が表示されるということはオーバーレイの作成はうまくいっていて、しかしオーバーレイのdisplayプロパティに問題がある可能性が高いです。
edraw-org-link-image-create がdisplayプロパティ(画像)を構築している関数です。この関数の中において、create-imageの引数(file-or-data変数)に問題があるとたいてい小さな白い箱が表示されます。
file-or-dataの値はedraw-org-link-props-image-data-or-file関数で作成します。
データはgzipされた後base64エンコードされたSVGです。なのでこの関数はbase64-decode-stringを呼び出して……この関数がgzipを展開していないのは私の環境ではそのままで表示できたからです。gzipされたSVGはsvgzと呼ばれています。ひょっとしたらこのsvgzが表示できないのでしょうか?
だとすれば次の変更で表示できるようになるかもしれません。
- (ignore-errors (cons (base64-decode-string data) t))
+ (ignore-errors (cons (edraw-decode-svg data t) t))
edraw-decode-svgはedraw.elに含まれています。edraw-org.elは編集開始までedraw.elの読み込みを先送りしているので、上の変更は読み込み前はエラーになる可能性があります。読み込み時間を気にしないなら最初から(require 'edraw)すれば回避できます。
また、速度は変更前の方が速いと思うので恒久的にこの変更をするかは迷います。
Google Translate:
Hello nxtruong.
Thank you for your report.
If you see a small white box, the overlay was created successfully, but it is likely that there is a problem with the overlay's display property.
edraw-org-link-image-create is the function that builds the display property (image). Inside this function, if there is a problem with the create-image argument (file-or-data variable), you will usually see a small white box.
The value of file-or-data is created by the edraw-org-link-props-image-data-or-file function.
The data is gzipped and then base64 encoded SVG. So this function calls base64-decode-string ... This function doesn't ungzip because it could be displayed as is in my environment. The gzipped SVG is called svgz. Maybe this svgz can't be displayed?
If so, it may be possible to display it with the next change. I'm sorry. see next comment.
- (ignore-errors (cons (base64-decode-string data) t))
+ (ignore-errors (cons (edraw-decode-svg data t) t))
edraw-decode-svg is included in edraw.el. Since edraw-org.el postpones loading edraw.el until the start of editing, the above changes may result in an error before loading. If you don't care about loading time, you can avoid it by (require 'edraw) from the beginning.
Also, I think the speed is faster before the change, so I'm wondering whether to make this change permanently.
from el-easydraw.
すみません、上の変更はダメです。xmlをパースしてしまうので。
次のような関数を作って試してみてください。
I'm sorry, the above change is useless. Because it parses xml.
Create a function like the following and try it out.
(defun edraw-decode-svg-string (data base64-p)
(with-temp-buffer
(insert data)
(when base64-p
(base64-decode-region (point-min) (point-max))
(unless (edraw-buffer-gzip-p)
(decode-coding-region (point-min) (point-max) 'utf-8)))
(when (edraw-buffer-gzip-p)
(edraw-gunzip-buffer))
(buffer-string)))
- (ignore-errors (cons (base64-decode-string data) t))
+ (ignore-errors (cons (edraw-decode-svg-string data t) t))
from el-easydraw.
確認して頂いてありがとうございます。動いたようで良かったです。
今旅行に出ているので帰ったら組み込んでみようと思います。
デフォルトでgunzipして、オプションでgunzipしないようにするのが安全かもしれません。
Thank you for checking. I'm glad it worked.
I'm on a trip now, so I'll try to incorporate it when I get home.
It may be safe to gunzip by default and optionally not gunzip.
from el-easydraw.
I reopened this issue because the same problem reappeared when [[edraw:]]
was used with a file name instead of embedded data (i.e., [[edraw:file=filename.svg]]
). I tracked the problem to the file edraw-org.el
, function edraw-org-link-props-image-data-or-file
, line (if (file-exists-p file) (cons file nil)))))
. The file name is used with create-image
, however, the docs of create-image
states that:
Image file names that are not absolute are searched for in the "images" sub-directory of ‘data-directory’ and ‘x-bitmap-file-path’ (in that order).
It turns out that the relative file name used is not an absolute path, therefore it's not found by create-image
. I fixed this problem by converting the relative path to an absolute path so that create-image
can find the file. I changed the above line to: (if (file-exists-p file) (cons (expand-file-name file) nil)))))
where expand-file-name
does the conversion. It now works properly for both embedded SVG data ([[edraw:data=...]]
) and file name ([[edraw:file=...]]
).
from el-easydraw.
create-image を何度も使用してきましたが、そのことを知りませんでした。動いていたのは x-bitmap-file-path が (".")だからだったのですね! 教えて頂きありがとうございます。
Pull Requestもありがとうございます。マージしました。
Google Translate:
I've used create-image many times, but didn't know that. It worked because x-bitmap-file-path was (".")! Thank you for telling me.
Thank you for Pull Request. Merged.
from el-easydraw.
Related Issues (19)
- Can it run on Windows or Mac? HOT 5
- Thank you so much for this package! I have a question regarding future plans HOT 3
- Converting edraw to svg HOT 3
- Publish to (Non-GNU) ELPA? HOT 5
- Unable to resolve link "edraw:file ..." HOT 3
- clicking on image to edit removes the image HOT 41
- Improve path smoothing in the free hand tool HOT 2
- Make hand writing possible ? HOT 9
- emacs29 on linux and mac don't work HOT 2
- Release to melpa? HOT 2
- edraw context menu interferes with context-menu-mode HOT 3
- comma/whitespace separators in svg path descriptors arguments are optional HOT 5
- Scrolling & Zooming not working for SVG imported from dvisvgm HOT 6
- Native compilation HOT 3
- Colour panel not showing on Ubuntu pgtk native comp Emacs HOT 4
- Cannot save edits from blank image HOT 3
- Click position offset HOT 2
- feature request: able to draw free stroke with cursor or stylus HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from el-easydraw.