Boost CJK 输入法回车上屏英文内容却直接发送的解决方案
- 内容介绍
- 文章标签
- 相关推荐
从私聊聊天优化建议继续讨论:
直接消息回车问题 - #7,来自 Haleclipse
// ==UserScript==
// @name Discourse Chat IME Guard
// @namespace https://linux.do/
// @version 0.5
// @description Block IME Enter & fix IME char-count for chat / DM / Boost
// @match https://linux.do/*
// @match https://*.discourse.org/*
// @run-at document-idle
// @inject-into content
// @grant none
// ==/UserScript==
(() => {
"use strict";
const TEXTAREA_SELECTORS = [
"textarea.chat-composer__input",
"textarea.chat-composer-input",
"textarea.d-chat-message-editor",
].join(",");
const DIV_SELECTORS = [
"div.discourse-boosts__input",
].join(",");
const protectTextarea = (ta) => {
if (ta.dataset.imeGuard) return;
ta.dataset.imeGuard = "true";
let composing = false;
ta.addEventListener("compositionstart", () => (composing = true), true);
ta.addEventListener("compositionend",
从私聊聊天优化建议继续讨论:
直接消息回车问题 - #7,来自 Haleclipse
// ==UserScript==
// @name Discourse Chat IME Guard
// @namespace https://linux.do/
// @version 0.5
// @description Block IME Enter & fix IME char-count for chat / DM / Boost
// @match https://linux.do/*
// @match https://*.discourse.org/*
// @run-at document-idle
// @inject-into content
// @grant none
// ==/UserScript==
(() => {
"use strict";
const TEXTAREA_SELECTORS = [
"textarea.chat-composer__input",
"textarea.chat-composer-input",
"textarea.d-chat-message-editor",
].join(",");
const DIV_SELECTORS = [
"div.discourse-boosts__input",
].join(",");
const protectTextarea = (ta) => {
if (ta.dataset.imeGuard) return;
ta.dataset.imeGuard = "true";
let composing = false;
ta.addEventListener("compositionstart", () => (composing = true), true);
ta.addEventListener("compositionend",

