Fix XXX in kanban

pull/1/head
yflory 5 years ago
parent 747657a559
commit abc27295ab

@ -2823,7 +2823,7 @@ define([
} }
return arr; return arr;
}; };
var getFirstEmojiOrCharacter = function (str) { var getFirstEmojiOrCharacter = UIElements.getFirstCharacter = function (str) {
if (!str || !str.trim()) { return '?'; } if (!str || !str.trim()) { return '?'; }
var emojis = emojiStringToArray(str); var emojis = emojiStringToArray(str);
return isEmoji(emojis[0])? emojis[0]: str[0]; return isEmoji(emojis[0])? emojis[0]: str[0];

@ -56,12 +56,6 @@ define([
var onCursorUpdate = Util.mkEvent(); var onCursorUpdate = Util.mkEvent();
var remoteCursors = {}; var remoteCursors = {};
// XXX
// Conflicts
// use cursor channel to tell others what you are editing
// add outline + warning inside the modal?
var setValueAndCursor = function (input, val, _cursor) { var setValueAndCursor = function (input, val, _cursor) {
if (!input) { return; } if (!input) { return; }
var $input = $(input); var $input = $(input);
@ -102,9 +96,7 @@ define([
} }
html += cursor.name + '</span>'; html += cursor.name + '</span>';
// XXX breaks on "😶" var l = UIElements.getFirstCharacter(cursor.name || Messages.anonymous);
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt#Getting_whole_characters
var l = (cursor.name || Messages.anonymous).slice(0,1).toUpperCase();
var text = ''; var text = '';
if (cursor.color) { if (cursor.color) {
@ -735,6 +727,9 @@ define([
onCursorUpdate.fire({}); onCursorUpdate.fire({});
if (!$input.val()) { return; } if (!$input.val()) { return; }
var id = Util.createRandomInteger(); var id = Util.createRandomInteger();
while (kanban.getItemJSON(id)) {
id = Util.createRandomInteger();
}
var item = { var item = {
"id": id, "id": id,
"title": $input.val(), "title": $input.val(),
@ -788,8 +783,10 @@ define([
var boardExists = function (b) { return b.id === "board" + counter; }; var boardExists = function (b) { return b.id === "board" + counter; };
while (kanban.options.boards.some(boardExists)) { counter++; } while (kanban.options.boards.some(boardExists)) { counter++; }
*/ */
// XXX confirm that it doesn't collide with an existing id? unlikely but possible
var id = Util.createRandomInteger(); var id = Util.createRandomInteger();
while (kanban.getBoardJSON(id)) {
id = Util.createRandomInteger();
}
kanban.addBoard({ kanban.addBoard({
"id": id, "id": id,

Loading…
Cancel
Save