Merge pull request #3 from ayokura/fix-international-composition

fix Pita/etherpad-lite #1032 (International composition (e.g. Japanese Input))
pull/1059/head
lepidum 2012-10-11 09:20:28 -07:00
commit 250901bef5
4 changed files with 25 additions and 21 deletions

View File

@ -122,6 +122,11 @@ function Ace2Editor()
return info.ace_getDebugProperty(prop);
};
editor.getInInternationalComposition = function()
{
return info.ace_getInInternationalComposition();
};
// prepareUserChangeset:
// Returns null if no new changes or ACE not ready. Otherwise, bundles up all user changes
// to the latest base text into a Changeset, which is returned (as a string if encodeAsString).

View File

@ -1173,7 +1173,7 @@ function Ace2Inner(){
//if (! top.BEFORE) top.BEFORE = [];
//top.BEFORE.push(magicdom.root.dom.innerHTML);
//if (! isEditable) return; // and don't reschedule
if (window.parent.parent.inInternationalComposition)
if (inInternationalComposition)
{
// don't do idle input incorporation during international input composition
idleWorkTimer.atLeast(500);
@ -3729,7 +3729,7 @@ function Ace2Inner(){
thisKeyDoesntTriggerNormalize = true;
}
if ((!specialHandled) && (!thisKeyDoesntTriggerNormalize) && (!window.parent.parent.inInternationalComposition))
if ((!specialHandled) && (!thisKeyDoesntTriggerNormalize) && (!inInternationalComposition))
{
if (type != "keyup" || !incorpIfQuick())
{
@ -4589,9 +4589,24 @@ function Ace2Inner(){
}
}
var inInternationalComposition = false;
function handleCompositionEvent(evt)
{
window.parent.parent.handleCompositionEvent(evt);
// international input events, fired in FF3, at least; allow e.g. Japanese input
if (evt.type == "compositionstart")
{
inInternationalComposition = true;
}
else if (evt.type == "compositionend")
{
inInternationalComposition = false;
}
}
editorInfo.ace_getInInternationalComposition = function ()
{
return inInternationalComposition;
}
function bindTheEventHandlers()

View File

@ -111,7 +111,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
function handleUserChanges()
{
if (window.parent.parent.inInternationalComposition) return;
if (editor.getInInternationalComposition()) return;
if ((!getSocket()) || channelState == "CONNECTING")
{
if (channelState == "CONNECTING" && (((+new Date()) - initialStartConnectTime) > 20000))
@ -288,7 +288,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
var apool = msg.apool;
// When inInternationalComposition, msg pushed msgQueue.
if (msgQueue.length > 0 || window.parent.parent.inInternationalComposition) {
if (msgQueue.length > 0 || editor.getInInternationalComposition()) {
if (msgQueue.length > 0) oldRev = msgQueue[msgQueue.length - 1].newRev;
else oldRev = rev;

View File

@ -51,22 +51,6 @@ var randomString = require('./pad_utils').randomString;
var hooks = require('./pluginfw/hooks');
window.inInternationalComposition = false;
var inInternationalComposition = window.inInternationalComposition;
window.handleCompositionEvent = function handleCompositionEvent(evt)
{
// international input events, fired in FF3, at least; allow e.g. Japanese input
if (evt.type == "compositionstart")
{
this.inInternationalComposition = true;
}
else if (evt.type == "compositionend")
{
this.inInternationalComposition = false;
}
}
function createCookie(name, value, days, path)
{
if (days)