Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/static/js/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
21 changes: 18 additions & 3 deletions src/static/js/ace2_inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -3729,7 +3729,7 @@ function Ace2Inner(){
thisKeyDoesntTriggerNormalize = true;
}

if ((!specialHandled) && (!thisKeyDoesntTriggerNormalize) && (!window.parent.parent.inInternationalComposition))
if ((!specialHandled) && (!thisKeyDoesntTriggerNormalize) && (!inInternationalComposition))
{
if (type != "keyup" || !incorpIfQuick())
{
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/static/js/collab_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;

Expand Down
16 changes: 0 additions & 16 deletions src/static/js/pad.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down