Merge pull request #1176 from bpoulaindev/bugfix/docs_links

bugfix(docs_links): open external URL in browser window, remove depre…
This commit is contained in:
Anoop M D 2023-12-20 00:23:02 +05:30 committed by GitHub
commit ed6f91533b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 13 deletions

BIN
bun.lockb Executable file

Binary file not shown.

View File

@ -1,5 +1,6 @@
{
"compilerOptions": {
"jsx": "react",
"target": "es2017",
"allowSyntheticDefaultImports": false,
"baseUrl": "./",

View File

@ -1,7 +1,7 @@
import 'github-markdown-css/github-markdown.css';
import get from 'lodash/get';
import { updateRequestDocs } from 'providers/ReduxStore/slices/collections';
import { useTheme } from 'providers/Theme/index';
import { useTheme } from 'providers/Theme';
import { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { saveRequest } from 'providers/ReduxStore/slices/collections/actions';

View File

@ -1,19 +1,13 @@
import MarkdownIt from 'markdown-it';
import StyledWrapper from './StyledWrapper';
import * as React from 'react';
const md = new MarkdownIt();
const Markdown = ({ onDoubleClick, content }) => {
const handleOnDoubleClick = (event) => {
switch (event.detail) {
case 2: {
if (event?.detail === 2) {
onDoubleClick();
break;
}
case 1:
default: {
break;
}
}
};
const htmlFromMarkdown = md.render(content || '');

View File

@ -98,9 +98,16 @@ app.on('ready', async () => {
mainWindow.on('maximize', () => saveMaximized(true));
mainWindow.on('unmaximize', () => saveMaximized(false));
mainWindow.webContents.on('new-window', function (e, url) {
e.preventDefault();
mainWindow.webContents.on('will-redirect', (event, url) => {
event.preventDefault();
if (/^(http:\/\/|https:\/\/)/.test(url)) {
require('electron').shell.openExternal(url);
}
});
mainWindow.webContents.setWindowOpenHandler((details) => {
require('electron').shell.openExternal(details.url);
return { action: 'allow' };
});
// register all ipc handlers