Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a settings to allow editing textarea with spellcheck disabled. #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions fancy-settings/source/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ this.manifest = {
"type": "checkbox",
"label": "Allow double click on textarea to invoke editor"
},
{
"tab": "Configuration",
"group": "Interface",
"name": "enable_for_no_spellcheck",
"type": "checkbox",
"label": "Allow editing textareas where spell check has been disabled"
},
{
"tab": "Test",
"group": "Test",
Expand Down
15 changes: 10 additions & 5 deletions javascript/textareas.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var pageTextAreas = [];
var enable_button = true;
var enable_dblclick = false;
var enable_debug = false;
var enable_for_no_spellcheck = false;

// Decorate console.log so that it only logs
// when the enable_debug setting is true
Expand Down Expand Up @@ -194,11 +195,14 @@ function tagTextArea(text)
}

// If spellcheck is turned off, usually it's just for quick editing, e.g. To: fields in gmail
var spellcheck = t.attr("spellcheck");
if (spellcheck && spellcheck == "false" &&
t.prop("tagName") === "TEXTAREA") {
console.log("tagTextArea: skipping spellcheck disabled textarea");
return;
if (!enable_for_no_spellcheck) {
var spellcheck = t.attr("spellcheck");

if (spellcheck && spellcheck == "false" &&
t.prop("tagName") === "TEXTAREA") {
console.log("tagTextArea: skipping spellcheck disabled textarea");
return;
}
}

// No edit for read-only text
Expand Down Expand Up @@ -381,6 +385,7 @@ function localMessageHandler(msg, port) {
enable_button = msg.enable_button;
enable_dblclick = msg.enable_dblclick;
enable_debug = msg.enable_debug;
enable_for_no_spellcheck = msg.enable_for_no_spellcheck;

var all = editable_selectors.join(",");
$(all).each(function() {
Expand Down
6 changes: 4 additions & 2 deletions javascript/xmlcomms.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ var settings = new Store("settings", {
"edit_server_disable_settings": false,
"enable_button": true,
"enable_dblclick": false,
"enable_debug": false
"enable_debug": false,
"enable_for_no_spellcheck": false
});

// Decorate console.log so that it only logs
Expand Down Expand Up @@ -250,7 +251,8 @@ function handleConfigMessages(msg, tab_port)
msg: "config",
enable_button: settings.get("enable_button"),
enable_dblclick: settings.get("enable_dblclick"),
enable_debug: settings.get("enable_debug")
enable_debug: settings.get("enable_debug"),
enable_for_no_spellcheck: settings.get("enable_for_no_spellcheck")
};
tab_port.postMessage(config_msg);
}
Expand Down