Update ACE Editor to version 1.2.9

The new ACE editor introduces full support for emojis (and, thereby, UTF-16 characters with high- and low-surrogates). Hence, we can remove our custom fix.

Further, this update will allow emojis to be used in pair programming sessions.
This commit is contained in:
Sebastian Serth
2023-09-12 18:45:47 +02:00
parent 13bd68d760
commit 60656443e2
210 changed files with 66466 additions and 33266 deletions

View File

@ -341,9 +341,6 @@ var CodeOceanEditor = {
return;
}
App.synchronized_editor?.editor_change(deltaObject, this.active_file);
// TODO: This is a workaround for a bug in Ace. Remove when upgrading Ace.
this.handleUTF16Surrogates(deltaObject, session);
this.resetSaveTimer();
}.bind(this, editor));
}.bind(this));
@ -355,53 +352,6 @@ var CodeOceanEditor = {
}.bind(this));
},
handleUTF16Surrogates: function (AceDeltaObject, AceSession) {
if (_.isEmpty(AceDeltaObject.lines) || AceDeltaObject.action !== "remove") {
return;
}
const firstCodePoint = AceDeltaObject.lines[0].codePointAt(0);
if (0xDC00 <= firstCodePoint && firstCodePoint <= 0xDFFF) {
// The text contains a UTF-16 surrogate pair, and the only the lower part is removed.
// We need to remove the high surrogate pair as well.
const previousCharacter = {
start: {
row: AceDeltaObject.start.row,
column: AceDeltaObject.start.column - 1
},
end: {
row: AceDeltaObject.start.row,
column: AceDeltaObject.start.column
}
}
const previousCharacterCodePoint = AceSession.getTextRange(previousCharacter).codePointAt(0);
if (0xD800 <= previousCharacterCodePoint && previousCharacterCodePoint <= 0xDBFF) {
AceSession.remove(previousCharacter);
}
}
const lastLine = AceDeltaObject.lines.slice(-1)[0];
const lastCodePoint = lastLine.codePointAt(lastLine.length - 1);
if (0xD800 <= lastCodePoint && lastCodePoint <= 0xDBFF) {
// The text contains a UTF-16 surrogate pair, and the only the higher part is removed.
// We need to remove the high surrogate pair as well.
const nextCharacter = {
start: {
row: AceDeltaObject.end.row,
column: AceDeltaObject.end.column - 1
},
end: {
row: AceDeltaObject.end.row,
column: AceDeltaObject.end.column
}
}
const nextCharacterCodePoint = AceSession.getTextRange(nextCharacter).codePointAt(0);
if (0xDC00 <= nextCharacterCodePoint && nextCharacterCodePoint <= 0xDFFF) {
AceSession.remove(nextCharacter);
}
}
},
initializeEventHandlers: function () {
$(document).on('click', '#results a', this.showOutput.bind(this));
$(document).on('keydown', this.handleKeyPress.bind(this));