* 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)
| 534 | * @param forceOpenInternally Force the link to open in a new web widget. |
| 535 | */ |
| 536 | async 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 | |
| 550 | function registerBlockComponentModel(blockId: string, bcm: BlockComponentModel) { |
| 551 | blockComponentModelMap.set(blockId, bcm); |
no test coverage detected