qjebbs / vscode-plantuml

Rich PlantUML support for Visual Studio Code.
MIT License
1.1k stars 160 forks source link

Mod: make links in preview clickable #572

Closed moormaster closed 7 months ago

moormaster commented 8 months ago

Solves issue #516

The <img/> tag in the preview.html template was extended with an image map to enable links in plantuml diagram to become clickable with click in the preview panel.

qjebbs commented 7 months ago

Image map mismatch after zoomed, any idea how to fix it?

moormaster commented 7 months ago

Image maps are not responsive - thats why you need to recalculate them when the image changes its zoom. This should be done by the "image-map-resizer" library which I have added.

Did you do another "npm install" when trying to build this branch?

qjebbs commented 7 months ago

map areas good after zoom with latest commits.

but found another problem, please consider following:

@startuml
Bob -> Alice : [[http://a.com]] hello
newpage
Bob <- Alice : [[http://b.com]] hello
@enduml

the first page had no map areas, and not clickable.

qjebbs commented 7 months ago

And one more error (cmd+p => open webview developper tools)

Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.
imageMapResize('#image-map');
    new MutationObserver(() => {
            imageMapResize('#image-map');
    })
    .observe(
        document.getElementById('image'),
        {'attributes': true}
    );
moormaster commented 7 months ago

fixed the way image maps are transported to and processed by the preview-webview. This should fixe multi-page umls. fixed error: created MutationObserver only if the #image element already exists

qjebbs commented 7 months ago

Thanks! There is a map render issue on the plantuml server side, request to the following url get empty response.

https://www.plantuml.com/plantuml/map/1/SoWkIImgAStDuN9KqBLJS5AmKeYEpYWfAR3Irq_KIyxFZOtboaijBqXCJmMgiD55LP44LU6GcfS2D0C0

which is the 2nd map of diagram:

@startuml
A -> B : [[http://a.com]]
newpage
A <- B : [[http://b.com]]
@enduml
moormaster commented 7 months ago

Thanks! There is a map render issue on the plantuml server side, request to the following url get empty response.

The issue seems to only be present on plantuml.com. If one sets up an own plantuml server using the most recent docker container at https://github.com/plantuml/plantuml-server retreiving the map of a multipage uml works fine.