Forge UI Kit "Link"-Function to open Apps

Hi,

small disclaimer: I am not a developer, just someone who learned basics a few years ago. Our company does not employ any developers aswell.

To explain the problem area, I briefly explain the goal of our app (confluence macro).

We need a macro that

  • allows users to embed a string into a hyperlink, that is not a link to a web page but a link to a file in our document management system (e.g.: DMS:11df923a-f6b8-47c5-b3f5-0626638a0ddf)
  • give it a custom name (e. g.: annual end result 2022)

In our confluence server version we achieved this with a custom macro:

@param 0:title=Link|type=string|required=true|desc=Status to display
@param 1:title=name|type=stringrequired=true|desc=Status to display
<a href=$param0 target="_blank"> $param1</a>

Since custom macros died in the cloud-era, we now need a new solution.

I tried it the easy way with creating a custom macro with forge using the UI kit.

Basic idea:

  • User input defines variables for (a) string to our document and (b) description.
  • Marco shows a Link with href = (a) and titel = (b).
  • The link opens a new tab and passes (a) as URL. The browser then asks for permission to open dokorg.exe.

Macro configuration:

const Config = () => {
  return (
    <MacroConfig>
      <TextField name="link" label="Verknüpfung zum DMS Dokument hier eingeben." defaultValue={defaultConfig.link} />
      <TextField name="beschreibung" label="Anzuzeigenden Text hier eingeben." defaultValue={defaultConfig.beschreibung} />
    </MacroConfig>
  );
};

Core functionality:

const App = () => {
  // Retrieve the configuration
  const config = useConfig() || defaultConfig;

  // Use the configuration values
  return <Text>
    <Link href={config.link} target="blank" openNewTab="true">{config.beschreibung}</Link>;
  </Text>
};

Result: Basic idea works for links to web pages but not for our type of strings. Blank page opens but the it does seem that our string is not parsed. Maybe because of some sort of validation within the “Link”-functionality.

Main question:

  • Is there a way to use the UI kit component “link” (functionality of text method) as a tool to push a string in the browser? Or is it mandatory that it is a functioning link?

If not: Which solution could work? Thought about diving into the Custom UI functions (e.g. router) or just plain JavaScript with good 'ol link functionality… But since my practical experience is more than rusty, I would like to avoid that.

Thank you in advance.
Nils

1 Like