|
|
@@ -29,8 +29,6 @@ window.path = require('path');
|
|
|
window.url = require('url');
|
|
|
global.log4js = window.log4js = moeApp.getLog4js();
|
|
|
global.log = window.log = log4js.getLogger('Front');
|
|
|
-// TODO-ly 引入平台判断库
|
|
|
-const platform = require('electron-platform');
|
|
|
|
|
|
$(() => {
|
|
|
const dialog = require('electron').remote.dialog;
|
|
|
@@ -168,13 +166,6 @@ $(() => {
|
|
|
require('electron').ipcRenderer.on('set-title', (e, fileName) => {
|
|
|
document.getElementsByTagName('title')[0].innerText = 'HexoEditor - ' + path.basename(fileName);
|
|
|
});
|
|
|
- // TODO-ly 解决第一次图片保存地址不对的问题
|
|
|
- require('electron').ipcRenderer.on('open-newfile', () => {
|
|
|
- let fileName = path.basename(hexoWindow.fileName, path.extname(hexoWindow.fileName));
|
|
|
- if(fileName !== imgManager.postName){
|
|
|
- imgManager.renameDirPath(fileName);
|
|
|
- }
|
|
|
- });
|
|
|
|
|
|
//加载填图功能
|
|
|
const ImgManager = require('./hexo-image');
|
|
|
@@ -291,7 +282,8 @@ $(() => {
|
|
|
})
|
|
|
} else {
|
|
|
// TODO-ly 解决图片路径不对的问题
|
|
|
- imgManager.renameDirPath(nameNew);
|
|
|
+ if(nameNew !== imgManager.postName)
|
|
|
+ imgManager.renameDirPath(nameNew);
|
|
|
}
|
|
|
}
|
|
|
if (force) {
|
|
|
@@ -390,11 +382,9 @@ $(() => {
|
|
|
}, true);
|
|
|
document.getElementById("editor").addEventListener("click", e => {
|
|
|
// TODO-ly 判断按下的按键
|
|
|
- let key = platform.isDarwin ? e.metaKey : e.ctrlKey;
|
|
|
- if (key) {
|
|
|
+ if ( (process.platform === 'darwin' ? e.metaKey : e.ctrlKey) ) {
|
|
|
$('span.cm-string.cm-url').unbind('click').click(e => {
|
|
|
- key = platform.isDarwin ? e.metaKey : e.ctrlKey;
|
|
|
- if (key) {
|
|
|
+ if ( (process.platform === 'darwin' ? e.metaKey : e.ctrlKey) ) {
|
|
|
e.stopPropagation();
|
|
|
// e.defaultPrevented();
|
|
|
const innerLink = e.target.innerText.replace(/^\((.*)\)$/, '$1');
|