Comparing version 3.1.0 to 3.1.1
@@ -27,2 +27,8 @@ # Change Log | ||
## [3.1.1] - 2017-03-26 | ||
### Fixed | ||
* some versions of Android GBoard English keyboard entering 'n' followed by a consonant would block further conversion | ||
## [3.1.0] - 2017-03-01 | ||
@@ -183,2 +189,3 @@ | ||
[3.1.1]: https://github.com/WaniKani/WanaKana/compare/3.1.0...3.1.1 | ||
[3.1.0]: https://github.com/WaniKani/WanaKana/compare/2.3.4...3.1.0 | ||
@@ -185,0 +192,0 @@ [2.3.4]: https://github.com/WaniKani/WanaKana/compare/2.3.3...2.3.4 |
@@ -1,2 +0,2 @@ | ||
export const VERSION = '3.1.0'; | ||
export const VERSION = '3.1.1'; | ||
@@ -3,0 +3,0 @@ export const TO_KANA_METHODS = { |
@@ -14,2 +14,3 @@ import isJapanese from '../isJapanese'; | ||
let prevInput; | ||
// Enforce IMEMode if not already specified | ||
const mergedConfig = Object.assign({}, mergeWithDefaultOptions(options), { | ||
@@ -31,4 +32,5 @@ IMEMode: options.IMEMode || true | ||
const convertedText = toKana(textToConvert, options, map); | ||
const changed = textToConvert !== convertedText; | ||
if (textToConvert !== convertedText) { | ||
if (changed) { | ||
const newCursor = head.length + convertedText.length; | ||
@@ -39,4 +41,8 @@ const newValue = head + convertedText + tail; | ||
// push later on event loop (otherwise mid-text insertion can be 1 char too far to the right) | ||
tail.length ? setTimeout(() => target.setSelectionRange(newCursor, newCursor), 1) : target.setSelectionRange(newCursor, newCursor); | ||
if (tail.length) { | ||
// push later on event loop (otherwise mid-text insertion can be 1 char too far to the right) | ||
setTimeout(() => target.setSelectionRange(newCursor, newCursor), 1); | ||
} else { | ||
target.setSelectionRange(newCursor, newCursor); | ||
} | ||
} else { | ||
@@ -48,8 +54,18 @@ prevInput = target.value; | ||
export function onComposition({ type, target, data }) { | ||
if (type === 'compositionupdate' && isJapanese(data)) { | ||
target.dataset.ignoreComposition = 'true'; | ||
} | ||
// navigator.platform is not 100% reliable for singling out all OS, | ||
// but for determining desktop "Mac OS" it is effective enough. | ||
const isMacOS = /Mac/.test(window.navigator && window.navigator.platform); | ||
// We don't want to ignore on Android: | ||
// https://github.com/WaniKani/WanaKana/issues/82 | ||
// But MacOS IME auto-closes if we don't ignore: | ||
// https://github.com/WaniKani/WanaKana/issues/71 | ||
// Other platform Japanese IMEs pass through happily | ||
if (isMacOS) { | ||
if (type === 'compositionupdate' && isJapanese(data)) { | ||
target.dataset.ignoreComposition = 'true'; | ||
} | ||
if (type === 'compositionend') { | ||
target.dataset.ignoreComposition = 'false'; | ||
if (type === 'compositionend') { | ||
target.dataset.ignoreComposition = 'false'; | ||
} | ||
} | ||
@@ -74,5 +90,5 @@ } | ||
// so we can handle non-terminal inserted input conversion: | ||
// Handle non-terminal inserted input conversion: | ||
// | -> わ| -> わび| -> わ|び -> わs|び -> わsh|び -> わshi|び -> わし|び | ||
// or multiple ambiguous positioning (IE select which "s" to work from) | ||
// or multiple ambiguous positioning (to select which "s" to work from) | ||
// こsこs|こsこ -> こsこso|こsこ -> こsこそ|こsこ | ||
@@ -79,0 +95,0 @@ export function splitInput(text = '', cursor = 0, triggers = []) { |
{ | ||
"name": "wanakana", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "homepage": "http://www.wanakana.com", |
@@ -171,1 +171,2 @@ <div align="center"> | ||
* Java ([MasterKale/WanaKanaJava](https://github.com/MasterKale/WanaKanaJava)) | ||
* Rust ([PSeitz/wana_kana_rust](https://github.com/PSeitz/wana_kana_rust)) |
@@ -59,3 +59,3 @@ 'use strict'; | ||
const VERSION = '3.1.0'; | ||
const VERSION = '3.1.1'; | ||
@@ -718,2 +718,3 @@ const TO_KANA_METHODS = { | ||
let prevInput; | ||
// Enforce IMEMode if not already specified | ||
const mergedConfig = Object.assign({}, mergeWithDefaultOptions(options), { | ||
@@ -735,4 +736,5 @@ IMEMode: options.IMEMode || true | ||
const convertedText = toKana(textToConvert, options, map); | ||
const changed = textToConvert !== convertedText; | ||
if (textToConvert !== convertedText) { | ||
if (changed) { | ||
const newCursor = head.length + convertedText.length; | ||
@@ -743,4 +745,8 @@ const newValue = head + convertedText + tail; | ||
// push later on event loop (otherwise mid-text insertion can be 1 char too far to the right) | ||
tail.length ? setTimeout(() => target.setSelectionRange(newCursor, newCursor), 1) : target.setSelectionRange(newCursor, newCursor); | ||
if (tail.length) { | ||
// push later on event loop (otherwise mid-text insertion can be 1 char too far to the right) | ||
setTimeout(() => target.setSelectionRange(newCursor, newCursor), 1); | ||
} else { | ||
target.setSelectionRange(newCursor, newCursor); | ||
} | ||
} else { | ||
@@ -752,8 +758,18 @@ prevInput = target.value; | ||
function onComposition({ type, target, data }) { | ||
if (type === 'compositionupdate' && isJapanese(data)) { | ||
target.dataset.ignoreComposition = 'true'; | ||
} | ||
// navigator.platform is not 100% reliable for singling out all OS, | ||
// but for determining desktop "Mac OS" it is effective enough. | ||
const isMacOS = /Mac/.test(window.navigator && window.navigator.platform); | ||
// We don't want to ignore on Android: | ||
// https://github.com/WaniKani/WanaKana/issues/82 | ||
// But MacOS IME auto-closes if we don't ignore: | ||
// https://github.com/WaniKani/WanaKana/issues/71 | ||
// Other platform Japanese IMEs pass through happily | ||
if (isMacOS) { | ||
if (type === 'compositionupdate' && isJapanese(data)) { | ||
target.dataset.ignoreComposition = 'true'; | ||
} | ||
if (type === 'compositionend') { | ||
target.dataset.ignoreComposition = 'false'; | ||
if (type === 'compositionend') { | ||
target.dataset.ignoreComposition = 'false'; | ||
} | ||
} | ||
@@ -778,5 +794,5 @@ } | ||
// so we can handle non-terminal inserted input conversion: | ||
// Handle non-terminal inserted input conversion: | ||
// | -> わ| -> わび| -> わ|び -> わs|び -> わsh|び -> わshi|び -> わし|び | ||
// or multiple ambiguous positioning (IE select which "s" to work from) | ||
// or multiple ambiguous positioning (to select which "s" to work from) | ||
// こsこs|こsこ -> こsこso|こsこ -> こsこそ|こsこ | ||
@@ -783,0 +799,0 @@ function splitInput(text = '', cursor = 0, triggers = []) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
826975
10136
172