diff --git a/electron.js b/electron.js index 75d577e48a..921dbc7386 100644 --- a/electron.js +++ b/electron.js @@ -19,6 +19,7 @@ let userPath = app.getPath('userData'); let waitLibraryPromise; let useGRPC = !process.env.ANYTYPE_USE_ADDON && (process.env.ANYTYPE_USE_GRPC || (process.platform == "win32") || is.development); let defaultChannel = version.match('alpha') ? 'alpha' : 'latest'; +let timeoutUpdate = 0; let service, server; @@ -400,8 +401,10 @@ function configSet (obj, callBack) { function checkUpdate () { if (!isUpdating) { - Util.log('info', 'checkForUpdatesAndNotify'); + Util.log('info', 'checkUpdate'); autoUpdater.checkForUpdatesAndNotify(); + clearTimeout(timeoutUpdate); + timeoutUpdate = setTimeout(checkUpdate, 600 * 1000); }; }; @@ -413,7 +416,6 @@ function autoUpdaterInit () { autoUpdater.channel = config.channel; checkUpdate(); - setInterval(checkUpdate, 600 * 1000); autoUpdater.on('checking-for-update', () => { Util.log('info', 'Checking for update'); @@ -422,6 +424,7 @@ function autoUpdaterInit () { autoUpdater.on('update-available', (info) => { Util.log('info', 'Update available'); isUpdating = true; + clearTimeout(timeoutUpdate); win.webContents.send('update'); }); diff --git a/src/ts/component/block/image.tsx b/src/ts/component/block/image.tsx index 44c473f4b1..be0478b1ed 100644 --- a/src/ts/component/block/image.tsx +++ b/src/ts/component/block/image.tsx @@ -27,8 +27,6 @@ class BlockImage extends React.Component { this.onChangeUrl = this.onChangeUrl.bind(this); this.onChangeFile = this.onChangeFile.bind(this); this.onClick = this.onClick.bind(this); - this.onMenuDown = this.onMenuDown.bind(this); - this.onMenuClick = this.onMenuClick.bind(this); }; render () { @@ -63,7 +61,6 @@ class BlockImage extends React.Component {
{ e.preventDefault(); }} onClick={this.onClick} /> { this.onResizeStart(e, false); }} /> -
); break; @@ -232,49 +229,10 @@ class BlockImage extends React.Component { }); }; - onMenuDown (e: any) { - const { dataset } = this.props; - const { selection } = dataset || {}; - const win = $(window); - - if (selection) { - selection.preventClear(true); - - win.unbind('mouseup.selectionBlock').on('mouseup.selectionBlock', () => { - selection.preventClear(false); - win.unbind('mouseup.selectionBlock'); - }); - }; - }; - - onMenuClick (e: any) { - const { dataset, rootId, block } = this.props; - const { id } = block; - const { selection } = dataset || {}; - - commonStore.menuOpen('blockAction', { - element: '#block-image-menu-' + id, - type: I.MenuType.Vertical, - offsetX: 0, - offsetY: 4, - vertical: I.MenuDirection.Bottom, - horizontal: I.MenuDirection.Right, - data: { - blockId: id, - blockIds: DataUtil.selectionGet(id, this.props), - rootId: rootId, - dataset: dataset, - }, - onClose: () => { - selection.preventClear(false); - } - }); - }; - getUrl () { const { block } = this.props; const { content } = block; - const { state, hash } = content; + const { hash } = content; return commonStore.imageUrl(hash, Constant.size.image); }; diff --git a/src/ts/component/block/index.tsx b/src/ts/component/block/index.tsx index ab73486465..ea24b09241 100644 --- a/src/ts/component/block/index.tsx +++ b/src/ts/component/block/index.tsx @@ -354,9 +354,7 @@ class Block extends React.Component { dataset: dataset, }, onClose: () => { - selection.preventClear(false); - selection.clear(); - + selection.clear(true); focus.apply(); } }); diff --git a/src/ts/component/block/title.tsx b/src/ts/component/block/title.tsx index a3bdb8a79d..5ddc7c511c 100644 --- a/src/ts/component/block/title.tsx +++ b/src/ts/component/block/title.tsx @@ -40,11 +40,7 @@ class BlockTitle extends React.Component { const details = blockStore.getDetails(rootId, rootId); const { id } = block; - let { name } = details; - if (name == Constant.default.name) { - name = ''; - }; - + const name = this.checkName(); const cv = [ 'value', 'focusable', 'c' + id ]; return ( @@ -231,7 +227,6 @@ class BlockTitle extends React.Component { onKeyUp (e: any) { e.persist(); - //this.onChange(e); this.placeHolderCheck(); }; @@ -303,10 +298,23 @@ class BlockTitle extends React.Component { save () { const { rootId } = this.props; const value = this.getValue(); + const name = this.checkName(); - DataUtil.pageSetName(rootId, value); + if (value != name) { + DataUtil.pageSetName(rootId, value); + }; }; - + + checkName () { + const { rootId } = this.props; + const details = blockStore.getDetails(rootId, rootId); + let { name } = details; + if (name == Constant.default.name) { + name = ''; + }; + return name; + }; + }; export default BlockTitle; \ No newline at end of file diff --git a/src/ts/component/block/video.tsx b/src/ts/component/block/video.tsx index 028af7d61a..ae64449904 100644 --- a/src/ts/component/block/video.tsx +++ b/src/ts/component/block/video.tsx @@ -28,8 +28,6 @@ class BlockVideo extends React.Component { this.onResize = this.onResize.bind(this); this.onResizeEnd = this.onResizeEnd.bind(this); this.onResizeInit = this.onResizeInit.bind(this); - this.onMenuDown = this.onMenuDown.bind(this); - this.onMenuClick = this.onMenuClick.bind(this); this.onPlay = this.onPlay.bind(this); }; @@ -67,7 +65,6 @@ class BlockVideo extends React.Component {