MCPcopy
hub / github.com/wavetermdev/waveterm / openLink

Function openLink

frontend/app/store/global.ts:536–548  ·  view source on GitHub ↗

* Open a link in a new window, or in a new web widget. The user can set all links to open in a new web widget using the `web:openlinksinternally` setting. * @param uri The link to open. * @param forceOpenInternally Force the link to open in a new web widget.

(uri: string, forceOpenInternally = false)

Source from the content-addressed store, hash-verified

534 * @param forceOpenInternally Force the link to open in a new web widget.
535 */
536async function openLink(uri: string, forceOpenInternally = false) {
537 if (forceOpenInternally || globalStore.get(atoms.settingsAtom)?.["web:openlinksinternally"]) {
538 const blockDef: BlockDef = {
539 meta: {
540 view: "web",
541 url: uri,
542 },
543 };
544 await createBlock(blockDef);
545 } else {
546 getApi().openExternal(uri);
547 }
548}
549
550function registerBlockComponentModel(blockId: string, bcm: BlockComponentModel) {
551 blockComponentModelMap.set(blockId, bcm);

Callers 3

onClickFunction · 0.90
constructorMethod · 0.90
newWindowHandlerFunction · 0.90

Calls 3

createBlockFunction · 0.85
getMethod · 0.80
getApiFunction · 0.70

Tested by

no test coverage detected