【技巧】如何让 RoamEdit 也能使用 Grammarly 插件检查语法?

Hardy 2021-6-9 953

英文语法检测,是很多同学的刚需。有好几个小伙伴向我反馈在 RE 上 Grammarly 浏览器插件用不了,今天和 @Innis 研究了一下,发现这几个问题:

1、Grammarly 在 RR 上能用,不过貌似是这插件对 RR 做了针对性的优化。

2、Grammarly 有一些触发要求:Bullet 的文本框宽度要大于301px,高度要大于38px。

3、RE 和 RR 都不是所见即所得的编辑模式,这些语法检查插件如果直接修改渲染的文本,是没办法保存到 Bullet 的原文(渲染前的文字)。

所以,如果确定要用 Grammarly 等语法检查插件的同学,在 RE 上可以这样试一下:


安装以下CSS,让 Bullet 的最小高度大于38px

.spellcheck .node-text:focus {
    min-height: 40px;
    padding-bottom: 20px;
}


安装以下JS 关闭 RE 的渲染模式,这会在左上角增加一个图标,点击图标之后则会切换模式:

NHook.add({
    after_systabs_run() {
        plugin.systabs.add("spellcheck", "<span class='icon-fire' title='语法检测模式'></span>", function() {
             
            window.spellCheckMode = !window.spellCheckMode;
            if (window.spellCheckMode) {
                $(document.body).addClass("spellcheck");
                jSmallMsg("语法检测模式开启");
            } else {
                $(document.body).removeClass("spellcheck");
                jSmallMsg("语法检测模式关闭");
            }
        });
    },
     
    before_nodeView_setText(text) {
        if (window.spellCheckMode) {
            return {ARGS: [this.data.ori]};
        }
    }
});

用以上代码来应付一下哈

快速回复
最新回复 (1)
  • Innis 2021-6-9
    1 2

    最好还是grammarly可以支持下re。我已经向grammarly提交了issue 工单,希望大家可以和我一起提交,引起grammarly的重视,加快优化速度。


    工单提交地址:https://support.grammarly.com/hc/en-us/requests/new#/

    工单提交步骤:





    tell us more 示例:

    (最好稍微改一下下 ( •̀ ω •́ )y

    Hi, grammarly,
    
    I'm glad to give you this feedback.
    
    I'm using an online note software named Roamedit(https://roamedit.com/).
    It's a very popular note software, there are a large number of users using Roamedit, 
    but grammar doesn't work normally on it. That is very pity, so I hope to give you this feedback.
    
    The issue is: when the number of characters is less than two lines, 
    the grammarly will not work, yet when it is equal to or more than two lines, 
    it can work normally. That's very strange.
    
    I hope you guys can fix it. You can contact me at xxxxxxx@gmail.com.
    
    I am looking forward to your reply, thank you.
    
    Yours sincerely,
    xxxxx.


    ------------

    ps: languagetool的工单提交地址是这个,用这个语法纠错的也可以去提交一下。

    https://languagetooler.freshdesk.com/en/support/tickets/new

返回