feat: 支持 uTools list 模板

This commit is contained in:
muwoo
2021-07-09 12:37:35 +08:00
parent f34d93691d
commit b08f4fab54
11 changed files with 144 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ if (location.href.indexOf('targetFile') > -1) {
} else {
filePath = location.pathname.replace('file://', '');
}
const {ipcRenderer, nativeImage, clipboard, remote} = require('electron');
const {ipcRenderer, nativeImage, clipboard, remote, shell} = require('electron');
const currentWindow = remote.getCurrentWindow();
const winId = currentWindow.id;
@@ -281,8 +281,13 @@ window.utools = window.rubick = {
}
}
},
},
shellOpenExternal(url) {
shell.openExternal(url);
}
}
require(path.join(filePath, '../preload.js'));
window.exports && ipcRenderer.sendToHost('templateConfig', {config: window.exports});
const preloadPath = getQueryVariable('preloadPath') || './preload.js';
require(path.join(filePath, '../', preloadPath));
window.exports && ipcRenderer.sendToHost('templateConfig', {config: JSON.parse(JSON.stringify(window.exports))});
window.ipcRenderer = ipcRenderer;