(parentNode, host)
| 1888 | var USE_IE_MIME_TYPE = useragent.isIE; |
| 1889 | |
| 1890 | var TextInput = function(parentNode, host) { |
| 1891 | var text = dom.createElement("textarea"); |
| 1892 | text.className = "ace_text-input"; |
| 1893 | |
| 1894 | if (useragent.isTouchPad) |
| 1895 | text.setAttribute("x-palm-disable-auto-cap", true); |
| 1896 | |
| 1897 | text.setAttribute("wrap", "off"); |
| 1898 | text.setAttribute("autocorrect", "off"); |
| 1899 | text.setAttribute("autocapitalize", "off"); |
| 1900 | text.setAttribute("spellcheck", false); |
| 1901 | |
| 1902 | text.style.opacity = "0"; |
| 1903 | if (useragent.isOldIE) text.style.top = "-1000px"; |
| 1904 | parentNode.insertBefore(text, parentNode.firstChild); |
| 1905 | |
| 1906 | var PLACEHOLDER = "\x01\x01"; |
| 1907 | |
| 1908 | var copied = false; |
| 1909 | var pasted = false; |
| 1910 | var inComposition = false; |
| 1911 | var tempStyle = ''; |
| 1912 | var isSelectionEmpty = true; |
| 1913 | try { var isFocused = document.activeElement === text; } catch(e) {} |
| 1914 | |
| 1915 | event.addListener(text, "blur", function(e) { |
| 1916 | host.onBlur(e); |
| 1917 | isFocused = false; |
| 1918 | }); |
| 1919 | event.addListener(text, "focus", function(e) { |
| 1920 | isFocused = true; |
| 1921 | host.onFocus(e); |
| 1922 | resetSelection(); |
| 1923 | }); |
| 1924 | this.focus = function() { |
| 1925 | text.style.position = "fixed"; |
| 1926 | text.style.top = "-1000px"; |
| 1927 | text.focus(); |
| 1928 | setTimeout(function() { |
| 1929 | text.style.position = ""; |
| 1930 | }, 0); |
| 1931 | }; |
| 1932 | this.blur = function() { text.blur(); }; |
| 1933 | this.isFocused = function() { |
| 1934 | return isFocused; |
| 1935 | }; |
| 1936 | var syncSelection = lang.delayedCall(function() { |
| 1937 | isFocused && resetSelection(isSelectionEmpty); |
| 1938 | }); |
| 1939 | var syncValue = lang.delayedCall(function() { |
| 1940 | if (!inComposition) { |
| 1941 | text.value = PLACEHOLDER; |
| 1942 | isFocused && resetSelection(); |
| 1943 | } |
| 1944 | }); |
| 1945 | |
| 1946 | function resetSelection(isEmpty) { |
| 1947 | if (inComposition) |
nothing calls this directly
no test coverage detected