Add ignore code tag option
This commit is contained in:
parent
a1ffd7a44a
commit
16f423028d
|
@ -98,6 +98,12 @@
|
||||||
"isDisabledInTextFieldsCaptionLabel": {
|
"isDisabledInTextFieldsCaptionLabel": {
|
||||||
"message": "Don't display translation button or panel when selecting text in a text field."
|
"message": "Don't display translation button or panel when selecting text in a text field."
|
||||||
},
|
},
|
||||||
|
"isDisabledInCodeElementLabel": {
|
||||||
|
"message": "Disable translation in code tags"
|
||||||
|
},
|
||||||
|
"isDisabledInCodeElementCaptionLabel": {
|
||||||
|
"message": "Don't display translation button or panel when selecting text in code tag."
|
||||||
|
},
|
||||||
"ifOnlyTranslateWhenModifierKeyPressedLabel": {
|
"ifOnlyTranslateWhenModifierKeyPressedLabel": {
|
||||||
"message": "Translate on modifier key pressed"
|
"message": "Translate on modifier key pressed"
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,8 +27,8 @@ const handleMouseUp = async e => {
|
||||||
const isInPasswordField = e.target.tagName === "INPUT" && e.target.type === "password";
|
const isInPasswordField = e.target.tagName === "INPUT" && e.target.type === "password";
|
||||||
if (isInPasswordField) return;
|
if (isInPasswordField) return;
|
||||||
|
|
||||||
const inCodeElement = e.target.tagName === 'CODE' || !!e.target.closest('code')
|
const inCodeElement = e.target.tagName === 'CODE' || !!e.target.closest('code');
|
||||||
if (inCodeElement) return;
|
if (inCodeElement && getSettings("isDisabledInCodeElement")) return;
|
||||||
|
|
||||||
const isInThisElement =
|
const isInThisElement =
|
||||||
document.querySelector("#simple-translate") &&
|
document.querySelector("#simple-translate") &&
|
||||||
|
|
|
@ -147,6 +147,14 @@ export default [
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "isDisabledInCodeElement",
|
||||||
|
title: "isDisabledInCodeElementLabel",
|
||||||
|
captions: ["isDisabledInCodeElementCaptionLabel"],
|
||||||
|
type: "checkbox",
|
||||||
|
default: false,
|
||||||
|
new: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "ignoredDocumentLang",
|
id: "ignoredDocumentLang",
|
||||||
title: "ignoredDocumentLangLabel",
|
title: "ignoredDocumentLangLabel",
|
||||||
|
|
Loading…
Reference in a new issue