1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

#xf8hha: fixes

This commit is contained in:
Andrew Simachev 2022-04-05 19:03:19 +03:00
parent 27c73bc5cb
commit ebdbb404bc
3 changed files with 31 additions and 17 deletions

26
dist/js/export.js vendored
View file

@ -1,18 +1,24 @@
document.body.onload = function () {
$(function () {
var link = $('lnk');
var a = $('a');
var link = $('lnk, a');
var block = $('.block');
link.off('click').on('click', function (e) {
var bookmark = $('.block.blockBookmark .inner');
var onUrl = function (e) {
e.preventDefault();
window.open($(this).attr('href'));
});
const el = $(this);
const data = el.data();
const url = data.href || el.attr('href');
if (url) {
window.open(url);
};
};
a.off('click').on('click', function (e) {
e.preventDefault();
window.open($(this).attr('href'));
});
//a.off('click').on('click', onUrl);
link.off('click').on('click', onUrl);
bookmark.off('click').on('click', onUrl);
block.each(function (i, item) {
item = $(item);

View file

@ -1,5 +1,5 @@
const electron = require('electron');
const { app, BrowserWindow, ipcMain, shell, Menu, session, Tray, nativeImage, nativeTheme } = require('electron');
const { app, BrowserWindow, ipcMain, shell, Menu, session, Tray, nativeImage, nativeTheme, dialog } = require('electron');
const { is, fixPathForAsarUnpack } = require('electron-util');
const { autoUpdater } = require('electron-updater');
const { download } = require('electron-dl');
@ -46,7 +46,6 @@ let deeplinkingUrl = '';
let isUpdating = false;
let userPath = app.getPath('userData');
let tmpPath = path.join(userPath, 'tmp');
let exportPath = path.join(userPath, 'export');
let waitLibraryPromise;
let useGRPC = !process.env.ANYTYPE_USE_ADDON && (env.USE_GRPC || process.env.ANYTYPE_USE_GRPC || is.windows || is.development);
let defaultChannel = version.match('alpha') ? 'alpha' : 'latest';
@ -93,7 +92,6 @@ if (process.env.DATA_PATH) {
};
try { fs.mkdirSync(tmpPath); } catch (e) {};
try { fs.mkdirSync(exportPath); } catch (e) {};
if (useGRPC) {
server = require('./electron/server.js');
@ -379,7 +377,17 @@ function createWindow () {
break;
case 'saveAsHTML':
savePage(param.name);
dialog.showOpenDialog({
properties: [ 'openDirectory' ],
}).then((result) => {
const files = result.filePaths;
if ((files == undefined) || !files.length) {
send('command', 'saveAsHTMLSuccess');
return;
};
savePage(files[0], param.name);
});
break;
};
});
@ -880,8 +888,8 @@ function exit (relaunch) {
};
};
function savePage (name) {
name = String(name || 'untitled').replace(/[^a-z0-9]/gi, '-').toLowerCase();
function savePage (exportPath, name) {
name = String(name || 'untitled').replace(/[^\w -\._]/gi, '-').toLowerCase();
let fn = `${name}_files`;
let filesPath = path.join(exportPath, fn);

View file

@ -36,7 +36,7 @@ const BlockBookmark = observer(class BlockBookmark extends React.Component<Props
};
element = (
<div className={cn.join(' ')} onClick={this.onClick}>
<div className={cn.join(' ')} data-href={url} onClick={this.onClick}>
<div className="side left">
{title ? <div className="name">{title}</div> : ''}
{description ? <div className="descr">{description}</div> : ''}