From a62ea391223e5d1b5e347899a0632b0b082c884c Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 5 Jun 2020 13:49:18 +0200 Subject: [PATCH] Fix colors and reload bugs in slides --- www/common/sframe-common-outer.js | 6 ++++++ www/slide/inner.js | 34 +++++++++++++++---------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 4c240a2ec..b5baf6301 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -1115,7 +1115,13 @@ define([ if (parsed.hashData) { currentPad.hash = parsed.hashData.getHash(opts); } // Rendered (maybe hidden) hash var hiddenParsed = Utils.Hash.parsePadUrl(window.location.href); + + // Update the hash in the address bar + var ohc = window.onhashchange; + window.onhashchange = function () {}; window.location.href = hiddenParsed.getUrl(opts); + window.onhashchange = ohc; + ohc({reset: true}); }); diff --git a/www/slide/inner.js b/www/slide/inner.js index b051724e2..71f25f4e7 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -348,7 +348,7 @@ define([ } if (back) { backColor = back; - //$modal.css('background-color', back); + $modal.find('.cp-app-slide-frame').css('background-color', back); $('#' + SLIDE_BACKCOLOR_ID).find('i').css('color', back); slideOptions.bgColor = back; } @@ -362,6 +362,10 @@ define([ framework.localChange(); }; + var $check = $("#cp-app-slide-colorpicker"); + var $backgroundPicker = $('', { type: 'color', value: backColor }) + .css({ display: 'none', }) + .on('change', function() { updateLocalColors(undefined, this.value); }); var $back = framework._.sfCommon.createButton(null, true, { icon: 'fa-square', text: Messages.slide_backCol, @@ -369,7 +373,14 @@ define([ hiddenReadOnly: true, name: 'background', id: SLIDE_BACKCOLOR_ID + }, function () { + $backgroundPicker.val(backColor); + $backgroundPicker.click(); }); + + var $foregroundPicker = $('', { type: 'color', value: textColor }) + .css({ display: 'none', }) + .on('change', function() { updateLocalColors(this.value, undefined); }); var $text = framework._.sfCommon.createButton(null, true, { icon: 'fa-i-cursor', text: Messages.slide_textCol, @@ -377,28 +388,15 @@ define([ hiddenReadOnly: true, name: 'color', id: SLIDE_COLOR_ID + }, function () { + $foregroundPicker.val(textColor); + $foregroundPicker.click(); }); var $testColor = $('', { type: 'color', value: '!' }); - var $check = $("#cp-app-slide-colorpicker"); if ($testColor.attr('type') !== "color" || $testColor.val() === '!') { return; } - var $backgroundPicker = $('', { type: 'color', value: backColor }) - .css({ display: 'none', }) - .on('change', function() { updateLocalColors(undefined, this.value); }); $check.append($backgroundPicker); - $back.on('click', function() { - $backgroundPicker.val(backColor); - $backgroundPicker.click(); - }); - - var $foregroundPicker = $('', { type: 'color', value: textColor }) - .css({ display: 'none', }) - .on('change', function() { updateLocalColors(this.value, undefined); }); $check.append($foregroundPicker); - $text.on('click', function() { - $foregroundPicker.val(textColor); - $foregroundPicker.click(); - }); framework._.toolbar.$theme.append($text).append($back); @@ -524,6 +522,8 @@ define([ if (newPad) { colors.updateLocalColors('#000', '#FFF'); + } else { + colors.updateLocalColors('#FFF', '#000'); } CodeMirror.setMode('markdown', function () { });