include uid in cursor data for animal avatars

pull/1/head
ansuz 3 years ago
parent 7bb3bc167c
commit 68efd54917

@ -388,7 +388,9 @@ define([
var andThen2 = function (editor, CodeMirror, framework, isPresentMode) { var andThen2 = function (editor, CodeMirror, framework, isPresentMode) {
var common = framework._.sfCommon; var common = framework._.sfCommon;
var privateData = common.getMetadataMgr().getPrivateData(); var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
CodeMirror.uid = metadataMgr.getUserData().uid;
var previewPane = mkPreviewPane(editor, CodeMirror, framework, isPresentMode); var previewPane = mkPreviewPane(editor, CodeMirror, framework, isPresentMode);
var markdownTb = mkMarkdownTb(editor, framework); var markdownTb = mkMarkdownTb(editor, framework);

@ -43,9 +43,15 @@ define([
}); });
}; };
var animal_avatars = {};
MT.getCursorAvatar = function (cursor) { MT.getCursorAvatar = function (cursor) {
var uid = cursor.uid;
var html = '<span class="cp-cursor-avatar">'; var html = '<span class="cp-cursor-avatar">';
if (cursor.avatar && avatars[cursor.avatar]) {
html += (cursor.avatar && avatars[cursor.avatar]) || ''; html += (cursor.avatar && avatars[cursor.avatar]) || '';
} else if (animal_avatars[uid]) {
html += animal_avatars[uid] + ' ';
}
html += Util.fixHTML(cursor.name) + '</span>'; html += Util.fixHTML(cursor.name) + '</span>';
return html; return html;
}; };
@ -109,7 +115,6 @@ define([
return text; return text;
}; };
var animal_avatars = {};
MT.displayAvatar = function (common, $container, href, name, _cb, uid) { MT.displayAvatar = function (common, $container, href, name, _cb, uid) {
var cb = Util.once(Util.mkAsync(_cb || function () {})); var cb = Util.once(Util.mkAsync(_cb || function () {}));
var displayDefault = function () { var displayDefault = function () {

@ -509,6 +509,7 @@ define([
var cursor = {}; var cursor = {};
cursor.selectionStart = cursorToPos(editor.getCursor('from'), doc); cursor.selectionStart = cursorToPos(editor.getCursor('from'), doc);
cursor.selectionEnd = cursorToPos(editor.getCursor('to'), doc); cursor.selectionEnd = cursorToPos(editor.getCursor('to'), doc);
cursor.uid = exp.uid; // FIXME this is inefficient for the network but it's unlikely to trigger errors
return cursor; return cursor;
}; };

@ -459,7 +459,9 @@ define([
var andThen2 = function (editor, CodeMirror, framework, isPresentMode) { var andThen2 = function (editor, CodeMirror, framework, isPresentMode) {
var common = framework._.sfCommon; var common = framework._.sfCommon;
var privateData = common.getMetadataMgr().getPrivateData(); var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
CodeMirror.uid = metadataMgr.getUserData().uid;
var $contentContainer = $('#cp-app-slide-editor'); var $contentContainer = $('#cp-app-slide-editor');
var $modal = $('#cp-app-slide-modal'); var $modal = $('#cp-app-slide-modal');

Loading…
Cancel
Save