Fix XXX in kanban

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

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

@ -56,12 +56,6 @@ define([
var onCursorUpdate = Util.mkEvent();
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) {
if (!input) { return; }
var $input = $(input);
@ -102,9 +96,7 @@ define([
}
html += cursor.name + '</span>';
// XXX breaks on "😶"
// 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 l = UIElements.getFirstCharacter(cursor.name || Messages.anonymous);
var text = '';
if (cursor.color) {
@ -735,6 +727,9 @@ define([
onCursorUpdate.fire({});
if (!$input.val()) { return; }
var id = Util.createRandomInteger();
while (kanban.getItemJSON(id)) {
id = Util.createRandomInteger();
}
var item = {
"id": id,
"title": $input.val(),
@ -788,8 +783,10 @@ define([
var boardExists = function (b) { return b.id === "board" + 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();
while (kanban.getBoardJSON(id)) {
id = Util.createRandomInteger();
}
kanban.addBoard({
"id": id,

Loading…
Cancel
Save