geeeeeeeeek / electronic-wechat

:speech_balloon: A better WeChat on macOS and Linux. Built with Electron by Zhongyi Tong.
MIT License
13.93k stars 2.72k forks source link

希望能加上cmd+return发送或者return发送消息的设置 #145

Open hologerry opened 8 years ago

hologerry commented 8 years ago

Feature request 希望能加上cmd+return发送或者return发送消息的设置

geeyan commented 8 years ago

同求。 Mac下用了一个tricky的办法,在本地改了代码实现。 image

文件:

/Applications/Electronic WeChat.app/Contents/Resources/app/src/inject-preload.js

增加:

// change to cmd+enter send message
injectBundle.updateBindingOfSendingMessage = () => {
  var bind_sending_message = () => {
    $('.action>[ng-if="isMacOS"]').html('Cmd+Enter to Send :)');
    $('#editArea').off('keydown').on('keydown', function(e) {
      if (e.which === 13) {
        if (e.metaKey) {
          $('.btn_send').trigger('click');
        }

        e.preventDefault();
      }
    });
  };
  var bind_textarea_focus = () => {
    $('#editArea').off('focus').on('focus', function(e) {
      bind_sending_message();
    });
  }

  // 当页面点击的时候,执行
  $('body').on('click', function() {
    // bind_sending_message();
    bind_textarea_focus();
  });
};

文件:

/Applications/Electronic WeChat.app/Contents/Resources/app/src/main.js
在
    browserWindow.webContents.executeJavaScript(`injectBundle.getBadgeJS()`);
下面增加一行:
    browserWindow.webContents.executeJavaScript(`injectBundle.updateBindingOfSendingMessage()`);
geeeeeeeeek commented 8 years ago

不是实现功能的问题…要等到Control Panel写出来之后才可以添加…

ricardolee commented 8 years ago

同求哈

geekplux commented 8 years ago

同求 +1