only paste Japanese text from clipboard
This commit is contained in:
parent
db4a303365
commit
29c38b06b2
@ -248,7 +248,7 @@ class DisplaySearch extends Display {
|
|||||||
} else if (IS_FIREFOX === false) {
|
} else if (IS_FIREFOX === false) {
|
||||||
curText = (await apiClipboardGet()).trim();
|
curText = (await apiClipboardGet()).trim();
|
||||||
}
|
}
|
||||||
if (curText && (curText !== this.clipboardPrevText)) {
|
if (curText && (curText !== this.clipboardPrevText) && jpIsJapaneseText(curText)) {
|
||||||
if (this.isWanakanaEnabled()) {
|
if (this.isWanakanaEnabled()) {
|
||||||
this.query.value = window.wanakana.toKana(curText);
|
this.query.value = window.wanakana.toKana(curText);
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,6 +26,15 @@ function jpIsKana(c) {
|
|||||||
return wanakana.isKana(c);
|
return wanakana.isKana(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function jpIsJapaneseText(text) {
|
||||||
|
for (const c of text) {
|
||||||
|
if (jpIsKanji(c) || jpIsKana(c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function jpKatakanaToHiragana(text) {
|
function jpKatakanaToHiragana(text) {
|
||||||
let result = '';
|
let result = '';
|
||||||
for (const c of text) {
|
for (const c of text) {
|
||||||
|
Loading…
Reference in New Issue
Block a user