From 0a18e0944077cdcfc9ca1a7f3533b1d3d79e7428 Mon Sep 17 00:00:00 2001 From: Genma Date: Mon, 18 Sep 2017 15:11:17 +0200 Subject: [PATCH 01/31] Cryptad version in Readme.md added Because this information was lacking and I need to find it quickly (and probably other people). Don't forget to update this part at each new released. --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index 956077d15..5d88db1c8 100644 --- a/readme.md +++ b/readme.md @@ -16,6 +16,10 @@ Installing CryptPad is pretty straightforward. You can read all about it in the It also contains information on keeping your instance of CryptPad up to date. +## Current version + +CryptPad v1.15.0 (Poukai) released the 12th September 2017 + ## Setup using Docker See [Cryptpad-Docker](docs/cryptpad-docker.md) From 2ceb925d9bcf28ffca8e2cf48bff5cf3758374ac Mon Sep 17 00:00:00 2001 From: Genma Date: Mon, 18 Sep 2017 16:11:40 +0200 Subject: [PATCH 02/31] Link to cryptad releases documentation added. --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 5d88db1c8..2d46155af 100644 --- a/readme.md +++ b/readme.md @@ -19,6 +19,7 @@ It also contains information on keeping your instance of CryptPad up to date. ## Current version CryptPad v1.15.0 (Poukai) released the 12th September 2017 +See [Cryptad-Releases](docs/releases) ## Setup using Docker From 0a99478d9f12cd4fc1218e0b4e23a1ef4905c7e1 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 28 Sep 2017 11:50:35 +0200 Subject: [PATCH 03/31] catch diffdom errors and plow through --- www/slide/slide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/slide/slide.js b/www/slide/slide.js index 3477a6a32..4bfcacc4f 100644 --- a/www/slide/slide.js +++ b/www/slide/slide.js @@ -83,7 +83,7 @@ define([ var c = Slide.content; var m = ''+DiffMd.render(c).replace(separatorReg, '')+''; - DiffMd.apply(m, $content); + try { DiffMd.apply(m, $content); } catch (e) { return console.error(e); } var length = getNumberOfSlides(); $modal.find('style.cp-app-slide-style').remove(); From aa744567ed8aaa853e30886ce5af2dbe3f4eaeb0 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 9 Oct 2017 11:52:34 +0200 Subject: [PATCH 04/31] Fix thumbnails in sframe apps --- www/common/common-file.js | 1 + www/common/cryptpad-common.js | 4 +-- www/common/sframe-common-file.js | 43 ++++++++++++++++++++++---------- www/file/inner.js | 2 +- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/www/common/common-file.js b/www/common/common-file.js index 0c3eadd36..6b1f33505 100644 --- a/www/common/common-file.js +++ b/www/common/common-file.js @@ -76,6 +76,7 @@ define([ common.renamePad(title || "", href, function (err) { if (err) { return void console.error(err); } onComplete(href); + common.setPadAttribute('fileType', metadata.type, null, href); }); }); }; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 863d97d07..a6f830354 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -489,8 +489,8 @@ define([ }; // STORAGE - common.setPadAttribute = function (attr, value, cb) { - var href = getRelativeHref(window.location.href); + common.setPadAttribute = function (attr, value, cb, href) { + href = getRelativeHref(href || window.location.href); getStore().setPadAttribute(href, attr, value, cb); }; common.setDisplayName = function (value, cb) { diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index 10bb8fbac..a2abd006a 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -1,8 +1,9 @@ define([ 'jquery', '/file/file-crypto.js', + '/common/common-thumbnail.js', '/bower_components/tweetnacl/nacl-fast.min.js', -], function ($, FileCrypto) { +], function ($, FileCrypto, Thumb) { var Nacl = window.nacl; var module = {}; @@ -220,30 +221,46 @@ define([ var handleFile = File.handleFile = function (file, e, thumbnail) { var thumb; - var finish = function (arrayBuffer) { + var file_arraybuffer; + var finish = function () { var metadata = { name: file.name, type: file.type, }; if (thumb) { metadata.thumbnail = thumb; } queue.push({ - blob: arrayBuffer, + blob: file_arraybuffer, metadata: metadata, dropEvent: e }); }; - var processFile = function () { - blobToArrayBuffer(file, function (e, buffer) { - finish(buffer); - }); - }; - - if (!thumbnail) { return void processFile(); } - blobToArrayBuffer(thumbnail, function (e, buffer) { + blobToArrayBuffer(file, function (e, buffer) { if (e) { console.error(e); } - thumb = arrayBufferToString(buffer); - processFile(); + file_arraybuffer = buffer; + if (thumbnail) { // there is already a thumbnail + return blobToArrayBuffer(thumbnail, function (e, buffer) { + if (e) { console.error(e); } + thumb = arrayBufferToString(buffer); + finish(); + }); + } + + if (!Thumb.isSupportedType(file.type)) { return finish(); } + // make a resized thumbnail from the image.. + Thumb.fromImageBlob(file, function (e, thumb_blob) { + if (e) { console.error(e); } + if (!thumb_blob) { return finish(); } + + blobToArrayBuffer(thumb_blob, function (e, buffer) { + if (e) { + console.error(e); + return finish(); + } + thumb = arrayBufferToString(buffer); + finish(); + }); + }); }); }; diff --git a/www/file/inner.js b/www/file/inner.js index 55e7487a1..df5ba854f 100644 --- a/www/file/inner.js +++ b/www/file/inner.js @@ -77,7 +77,7 @@ define([ sfCommon: common, }; if (uploadMode) { - displayed.push('pageTitle'); //TODO in toolbar + displayed.push('pageTitle'); configTb.pageTitle = Messages.upload_title; } var toolbar = APP.toolbar = Toolbar.create(configTb); From dd141b5c9f087747bdc1e6e44ac01d62629d9c88 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 9 Oct 2017 14:08:54 +0200 Subject: [PATCH 05/31] Disable comments when a poll is not published --- customize.dist/pages.js | 3 +- customize.dist/translations/messages.fr.js | 2 ++ customize.dist/translations/messages.js | 2 ++ www/poll/app-poll.less | 32 ++++++++++++++++------ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 5fac0939b..f120a628f 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -679,7 +679,8 @@ define([ ]), h('h2#cp-app-poll-comments-list-title', Msg.poll_comment_list), h('div#cp-app-poll-comments-list') - ]) + ]), + h('div#cp-app-poll-nocomments', Msg.poll_comment_disabled) ]) ]) ]) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 91bba1fbf..c33616a40 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -267,6 +267,8 @@ define(function () { out.poll_comment_submit = "Envoyer"; out.poll_comment_remove = "Supprimer ce commentaire"; + out.poll_comment_disabled = "Publiez ce sondage en utilisant le bouton ✓ afin d'activer les commentaires."; + // Canvas out.canvas_clear = "Nettoyer"; out.canvas_delete = "Supprimer la sélection"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index f7bb3ffca..2d41b4dc2 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -271,6 +271,8 @@ define(function () { out.poll_comment_submit = "Send"; out.poll_comment_remove = "Delete this comment"; + out.poll_comment_disabled = "Publish this poll using the ✓ button to enable the comments."; + // Canvas out.canvas_clear = "Clear"; out.canvas_delete = "Delete selection"; diff --git a/www/poll/app-poll.less b/www/poll/app-poll.less index 1b58841e3..526d1b2af 100644 --- a/www/poll/app-poll.less +++ b/www/poll/app-poll.less @@ -125,6 +125,7 @@ table#cp-app-poll-table { min-width: 80%; width: 80%; min-height: 200px; + height: 200px; border: 1px solid black; .CodeMirror-placeholder { color: #777; @@ -149,18 +150,26 @@ table#cp-app-poll-table { max-height: 20em; } } -.cp-app-poll-published { - #cp-app-poll-description { - display: none; - &~ .CodeMirror { +div.cp-app-poll-published { + div.cp-app-poll-realtime { + #cp-app-poll-description { display: none; + &~ .CodeMirror { + display: none; + } } - } - #cp-app-poll-description-published { - display: block; - &:empty { + #cp-app-poll-description-published { + display: block; + &:empty { + display: none; + } + } + #cp-app-poll-nocomments { display: none; } + #cp-app-poll-comments { + display: block; + } } } @@ -490,11 +499,18 @@ div.cp-app-poll-realtime { display: none; } } + #cp-app-poll-nocomments { + color: #999; + text-align: center; + margin: 20px; + font: @colortheme_app-font; + } #cp-app-poll-comments { width: 50%; margin: 20px auto; min-width: 400px; padding-bottom: 5px; + display: none; button { border-radius: 0; } From a12239405bcbc80edf84d41ffe1608b3f2900804 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 9 Oct 2017 15:10:38 +0200 Subject: [PATCH 06/31] fix toolbar 'home link' to visit home page from drive --- www/common/toolbar3.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 6433906d6..69429f760 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -657,9 +657,10 @@ define([ // We need to override the "a" tag action here because it is inside the iframe! var inDrive = /^\/drive/; - var origin = config.metadataMgr.getPrivateData().origin; - - var href = inDrive.test(origin) ? origin+'/index.html' : origin+'/drive/'; + var privateData = config.metadataMgr.getPrivateData(); + var origin = privateData.origin; + var pathname = privateData.pathname; + var href = inDrive.test(pathname) ? origin+'/index.html' : origin+'/drive/'; var buttonTitle = inDrive ? Messages.header_homeTitle : Messages.header_logoTitle; var $aTag = $('', { From 4c19375f4dfdc9646a39b4badef7ec17ea967878 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 9 Oct 2017 15:11:02 +0200 Subject: [PATCH 07/31] Avoid missing characters in poll's inputs --- www/poll/inner.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/www/poll/inner.js b/www/poll/inner.js index 5586beb04..c2da2e8ea 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -464,11 +464,13 @@ define([ Render.updateTable(table, displayedObj, conf); // Fix autocomplete bug: displayedObj.content.rowsOrder.forEach(function (rowId) { + if (f.id === rowId) { return; } $('input[data-rt-id="' + rowId +'"]').val(displayedObj.content.rows[rowId] || ''); }); - displayedObj.content.colsOrder.forEach(function (rowId) { - $('input[data-rt-id="' + rowId +'"]') - .val(displayedObj.content.cols[rowId] || ''); + displayedObj.content.colsOrder.forEach(function (colId) { + if (f.id === colId) { return; } + $('input[data-rt-id="' + colId +'"]') + .val(displayedObj.content.cols[colId] || ''); }); updateDisplayedTable(); setFocus(f); @@ -512,7 +514,7 @@ define([ case 'text': debug("text[rt-id='%s'] [%s]", id, input.value); Render.setValue(object, id, input.value); - change(null, null, null, 250); + change(null, null, null, 1000); break; case 'number': debug("checkbox[tr-id='%s'] %s", id, input.value); @@ -630,6 +632,7 @@ define([ switch (nodeName) { case 'INPUT': + if ($(target).is('[type="text"]') && !isKeyup) { return; } if (isKeyup && (e.keyCode === 13 || e.keyCode === 27)) { var id = target.getAttribute('data-rt-id'); if ($(target).parents('.cp-app-poll-table-uncommitted').length From f751554f8226409f6ca838f19e1aa021920b213e Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 9 Oct 2017 15:15:04 +0200 Subject: [PATCH 08/31] update footer and package.json for upcoming version --- customize.dist/pages.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index f120a628f..588358851 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -76,7 +76,7 @@ define([ ]) ]) ]), - h('div.cp-version-footer', "CryptPad v1.16.0 (Qalupalik)") + h('div.cp-version-footer', "CryptPad v1.17.0 (Ratatoskr)") ]); }; diff --git a/package.json b/package.json index 3dc9fca3b..df7b3bd79 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cryptpad", "description": "realtime collaborative visual editor with zero knowlege server", - "version": "1.16.0", + "version": "1.17.0", "dependencies": { "chainpad-server": "^1.0.1", "express": "~4.10.1", From 484e216054d21cf54c76d28732beca2f454e649d Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 9 Oct 2017 15:37:37 +0200 Subject: [PATCH 09/31] Fix hashtag button in the toolbar --- www/common/sframe-common-interface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/sframe-common-interface.js b/www/common/sframe-common-interface.js index 0a128b31d..6e6b4539d 100644 --- a/www/common/sframe-common-interface.js +++ b/www/common/sframe-common-interface.js @@ -216,7 +216,7 @@ define([ title: Messages.tags_title, }) .click(common.prepareFeedback(type)) - .click(function () { UI.updateTags(null); }); + .click(function () { UI.updateTags(common, null); }); break; default: button = $('