Skip to content

Update the Kroki host server from the JavaScript #126

@vibrog

Description

@vibrog

Update the Kroki server base URL from the JavaScript together with the token path and data-clipboard-text objects.
The purpose of the request is to make the HTML easier to reuse.

Suggested solution: Read the host part of the URL from the HTML.

@@ -96 +96,2 @@ document.addEventListener('DOMContentLoaded', function () {
-      var url = 'https://kroki.io/' + urlPath
+      var urlHost = diagramUrlHostElement.innerText
+      var url = urlHost + '/' + urlPath
@@ -146,0 +148 @@ document.addEventListener('DOMContentLoaded', function () {
+    var diagramUrlHostElement = diagramUrlElement.querySelector("pre > code > span.host")

One can even allow the user to change the host directly using content editable:

<span class="token host" contenteditable="true">https://kroki.io</span>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions