diff --git a/forge.config.js b/forge.config.js index eb97f1c..ca8d8bf 100644 --- a/forge.config.js +++ b/forge.config.js @@ -39,7 +39,7 @@ module.exports = { productName: 'BingGPT', description: 'AI-powered copilot', productDescription: 'AI-powered copilot', - version: '0.3.3', + version: '0.3.4', categories: ['Utility'], maintainer: 'dice2o', homepage: 'https://github.com/dice2o/BingGPT', @@ -56,7 +56,7 @@ module.exports = { productName: 'BingGPT', description: 'AI-powered copilot', productDescription: 'AI-powered copilot', - version: '0.3.3', + version: '0.3.4', categories: ['Utility'], maintainer: 'dice2o', homepage: 'https://github.com/dice2o/BingGPT', diff --git a/main.js b/main.js index fdd842a..c0592e5 100644 --- a/main.js +++ b/main.js @@ -197,14 +197,9 @@ const createWindow = () => { label: 'Reset', visible: parameters.selectionText.trim().length === 0, click: () => { - const session = mainWindow.webContents.session - session - .clearStorageData({ - storages: ['localstorage', 'cookies'], - }) - .then(() => { - mainWindow.reload() - }) + mainWindow.webContents.session.clearStorageData().then(() => { + mainWindow.reload() + }) }, }, { @@ -219,7 +214,7 @@ const createWindow = () => { }, }, { - label: 'BingGPT v0.3.3', + label: 'BingGPT v0.3.4', visible: parameters.selectionText.trim().length === 0, click: () => { shell.openExternal('https://github.com/dice2o/BingGPT/releases') @@ -232,7 +227,7 @@ const createWindow = () => { isDarkMode ? 'dark' : 'light' }schemeovr=1&FORM=SHORUN&udscs=1&udsnav=1&setlang=${locale}&features=udssydinternal&clientscopes=windowheader,coauthor,chat,&udsframed=1` const userAgent = - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.0.0' + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.0.0' mainWindow.loadURL(bingUrl) // Open links in default browser mainWindow.webContents.setWindowOpenHandler(({ url }) => { diff --git a/package-lock.json b/package-lock.json index faa4118..6cc6382 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "binggpt", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "binggpt", - "version": "0.3.3", + "version": "0.3.4", "license": "Apache-2.0", "dependencies": { "electron-context-menu": "^3.6.1", diff --git a/package.json b/package.json index 8a3e989..f5e3198 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "binggpt", "productName": "BingGPT", - "version": "0.3.3", + "version": "0.3.4", "description": "AI-powered copilot", "author": "dice2o", "license": "Apache-2.0", diff --git a/preload.js b/preload.js index 12ef52a..73c9784 100644 --- a/preload.js +++ b/preload.js @@ -82,7 +82,7 @@ window.addEventListener('DOMContentLoaded', () => { const composeWrapper = document.getElementsByClassName( 'uds_coauthor_wrapper' )[0] - const composeMain = document.getElementsByClassName('main')[0] + const composeMain = document.getElementsByClassName('sidebar')[0] const insertBtn = document.getElementById('insert_button') const previewText = document.getElementById('preview_text') const previewOptions = document.getElementsByClassName('preview-options')[0] @@ -90,8 +90,7 @@ window.addEventListener('DOMContentLoaded', () => { composeWrapper.style.cssText = 'margin-top: -64px' } if (composeMain) { - composeMain.style.cssText = - 'height: calc(100% - 64px); margin-top: 64px; padding: 20px 10px' + composeMain.style.cssText = 'height: calc(100% - 64px); margin-top: 64px' } if (insertBtn) { insertBtn.style.cssText = 'display: none' @@ -338,9 +337,32 @@ const markdownHandler = (element) => { return `> **${content}**` }, }) + turndownService.addRule('latex', { + filter: (node) => { + return node.classList.contains('katex-block') + }, + replacement: (content, node) => { + return `$$${node.querySelector('annotation').innerHTML}$$` + }, + }) + turndownService.addRule('inlineLatex', { + filter: (node) => { + return node.classList.contains('katex') + }, + replacement: (content, node) => { + return `$${node.querySelector('annotation').innerHTML}$` + }, + }) const mdDataURL = Buffer.from( - turndownService.turndown(element), + turndownService.turndown(element) + '\n', 'utf-8' ).toString('base64') ipcRenderer.send('export-data', 'md', mdDataURL) } + +// Fix copy issue +window.addEventListener('copy', (event) => { + const selection = document.getSelection() + event.clipboardData.setData('text/plain', selection.toString()) + event.preventDefault() +})