Skip to content

Commit fc471d2

Browse files
committed
Alter link
1 parent 8cee3d4 commit fc471d2

File tree

1 file changed

+7
-3
lines changed
  • src/main/webapp/ui/src/tinyMCE/pyrat

1 file changed

+7
-3
lines changed

src/main/webapp/ui/src/tinyMCE/pyrat/Pyrat.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function Pyrat() {
5151
const pyratUrl = useDeploymentProperty("pyrat.url");
5252
useEffect(() => {
5353
FetchingData.getSuccessValue(pyratUrl).do((p) => {
54-
PYRAT_URL = new URL(p);
54+
PYRAT_URL = p;
5555
});
5656
}, [pyratUrl]);
5757

@@ -488,12 +488,16 @@ function createTinyMceTable() {
488488
const pyratTable = document.createElement("table");
489489
pyratTable.setAttribute("data-tableSource", "pyrat");
490490

491+
if (!PYRAT_URL) throw new Error("PYRAT_URL is not known");
492+
493+
const link = PYRAT_URL.slice(0, PYRAT_URL.lastIndexOf("/api/"));
494+
491495
const linkRow = document.createElement("tr");
492496
const linkCell = document.createElement("th");
493497
linkCell.appendChild(document.createTextNode("Imported from "));
494498
const anchor = document.createElement("a");
495-
anchor.href = PYRAT_URL?.origin ?? "";
496-
anchor.appendChild(document.createTextNode(PYRAT_URL?.origin ?? ""));
499+
anchor.href = link;
500+
anchor.appendChild(document.createTextNode(link));
497501
anchor.setAttribute("rel", "noreferrer");
498502
linkCell.appendChild(anchor);
499503
linkCell.appendChild(document.createTextNode(" on "));

0 commit comments

Comments
 (0)