mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
bugfix(docs_links): open external URL in browser window, remove deprecated method in electron, refactor to index.tsx
This commit is contained in:
parent
dc39538d02
commit
56a456a9b6
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"jsx": "react",
|
||||||
"target": "es2017",
|
"target": "es2017",
|
||||||
"allowSyntheticDefaultImports": false,
|
"allowSyntheticDefaultImports": false,
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'github-markdown-css/github-markdown.css';
|
import 'github-markdown-css/github-markdown.css';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import { updateRequestDocs } from 'providers/ReduxStore/slices/collections';
|
import { updateRequestDocs } from 'providers/ReduxStore/slices/collections';
|
||||||
import { useTheme } from 'providers/Theme/index';
|
import { useTheme } from 'providers/Theme';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
import { saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
|
// @ts-ignore
|
||||||
import MarkdownIt from 'markdown-it';
|
import MarkdownIt from 'markdown-it';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
const md = new MarkdownIt();
|
const md = new MarkdownIt();
|
||||||
|
|
||||||
const Markdown = ({ onDoubleClick, content }) => {
|
const Markdown = ({ onDoubleClick, content }: { onDoubleClick: () => void; content?: string }) => {
|
||||||
const handleOnDoubleClick = (event) => {
|
const handleOnDoubleClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
||||||
switch (event.detail) {
|
console.log(event);
|
||||||
case 2: {
|
if (event?.detail === 2) {
|
||||||
onDoubleClick();
|
onDoubleClick();
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
const htmlFromMarkdown = md.render(content || '');
|
const htmlFromMarkdown = md.render(content || '');
|
||||||
|
|
@ -98,9 +98,16 @@ app.on('ready', async () => {
|
|||||||
mainWindow.on('maximize', () => saveMaximized(true));
|
mainWindow.on('maximize', () => saveMaximized(true));
|
||||||
mainWindow.on('unmaximize', () => saveMaximized(false));
|
mainWindow.on('unmaximize', () => saveMaximized(false));
|
||||||
|
|
||||||
mainWindow.webContents.on('new-window', function (e, url) {
|
mainWindow.webContents.on('will-redirect', (event, url) => {
|
||||||
e.preventDefault();
|
event.preventDefault();
|
||||||
require('electron').shell.openExternal(url);
|
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
|
// register all ipc handlers
|
||||||
|
Loading…
Reference in New Issue
Block a user