theacodes / kicanvas

The KiCAD web viewer
https://kicanvas.org
Other
644 stars 33 forks source link

Any plan for adding the "Inline source" support ? #55

Open XiangYyang opened 1 year ago

XiangYyang commented 1 year ago

The document Inline source described a feature called inline source but it has not been implemented yet.

Do you have any plans to add this feature?

It's useful for custom rendering such as Gitea. We can echo the sources into HTML and import kicanvas.js, and the file will be rendered.

A possible implementation

I found a possible implementation for this feature. The HTML tag was processed in the file src/kicanvas/elements/kicanvas-embed.ts. And all src attributes will be appended to a list. Then, FetchFileSystem will load them. Finally, they were converted to File objects.

So a simple way is changing the KiCanvasEmbedElement.load_src and FetchFileSystem in vfs.ts to implement the creation of File objects from the inline text.

I'm trying implementing it. If that is possible, I will create a pull request later.

theacodes commented 1 year ago

Yes, I do plan on implementing it. There are no timelines. If you'd like to try it, go for it.

On Thu, Nov 9, 2023, 9:38 PM 向阳 @.***> wrote:

The document Inline source https://kicanvas.org/embedding/#inline-source described a feature called inline source but it has not been implemented yet.

Do you have any plans to add this feature?

It's useful for custom rendering such as Gitea. We can echo the sources into HTML and import kicanvas.js, and the file will be rendered. A possible implementation

I found a possible implementation for this feature. The HTML tag was processed in the file src/kicanvas/elements/kicanvas-embed.ts. And all src attributes will be appended to a list. Then, FetchFileSystem will load them. Finally, they were converted to File objects.

So a simple way is changing the KiCanvasEmbedElement.load_src and FetchFileSystem in vfs.ts to implement the creation of File objects from the inline text.

I'm trying implementing it. If that is possible, I will create a pull request later.

— Reply to this email directly, view it on GitHub https://github.com/theacodes/kicanvas/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB5I4ZZ2MF5QT3A6FCOF5DYDWHRBAVCNFSM6AAAAAA7FQQLHOVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4DMNZUGE4DMOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>