From 09323e38fa4ae54d2317b4378fbb6bb0ead99a44 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 14 May 2020 11:11:13 +0200 Subject: [PATCH] Merge file upload and image embed button in whiteboard --- customize.dist/src/less2/include/toolbar.less | 12 +++++------ www/whiteboard/inner.js | 21 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index a27255758..32af1cf3b 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -512,11 +512,6 @@ .cp-toolbar-title-hoverable { width: 100%; } - .cp-toolbar-title-value-page { - padding: 5px; - line-height: unset; - border: 0; - } .cp-toolbar-title-editable, .cp-toolbar-title-value-page { max-width: ~"calc(100vw - 26px)"; display: inline-block; @@ -527,6 +522,11 @@ box-sizing: border-box; line-height: @toolbar_line-height; } + .cp-toolbar-title-value-page { + padding: 5px; + line-height: @toolbar_line-height - 10px; + border: 0; + } .cp-toolbar-title-edit, .cp-toolbar-title-save { box-sizing: border-box; height: @toolbar_line-height; @@ -1029,7 +1029,7 @@ .cp-toolbar-appmenu { order: 3; } - .cp-toolbar-mediatag { + .cp-toolbar-mediatag, .cp-toolbar-icon-mediatag { order: 5; } .cp-toolbar-tools { diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index d4c9bf458..8fbfd965b 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -368,16 +368,6 @@ define([ reader.readAsDataURL(file); }; - Messages.canvas_insertImage = "Insert local image"; // XXX - framework._.sfCommon.createButton('', true, { - title: Messages.canvas_imageEmbed, - text: Messages.canvas_insertImage, - icon: 'fa-upload', - name: 'embedImage' - }).click(function () { - $('', {type:'file'}).on('change', onUpload).click(); - }).appendTo($drawer); - if (framework._.sfCommon.isLoggedIn()) { framework.setMediaTagEmbedder(function ($mt) { framework._.sfCommon.displayMediatagImage($mt, function (err, $image) { @@ -400,6 +390,17 @@ define([ APP.upload(name); }); }).appendTo($drawer); + } else { + Messages.toolbar_insert = "Insert"; // XXX duplicate key from common-ui-elements + framework._.sfCommon.createButton('', true, { + title: Messages.canvas_imageEmbed, + text: Messages.toolbar_insert, + drawer: false, + icon: 'fa-picture-o', + name: 'mediatag' + }).click(function () { + $('', {type:'file'}).on('change', onUpload).click(); + }).appendTo(framework._.toolbar.$bottomL); } if (framework.isReadOnly()) {