From 8d46bbf3b492b3a031f5a50bc6bfe7e2cf86db54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 15:39:33 +0000 Subject: [PATCH] update link preview in embed tab --- www/common/common-ui-elements.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index b501f5cd4..ab435d1e8 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1165,11 +1165,11 @@ define([ }); return ''; }; - var embedContent = h('div.cp-share-modal', [ + var embedContent = [ h('p', Messages.viewEmbedTag), h('br'), - UI.dialog.selectable(getEmbedValue()) - ]); + UI.dialog.selectable(getEmbedValue(), { id: 'cp-embed-link-preview', tabindex: 1 }) + ]; var embedButtons = [ makeCancelButton(), { className: 'primary', @@ -1181,7 +1181,16 @@ define([ }, keys: [13] }]; - var frameEmbed = UI.dialog.customModal(embedContent, { + + var embed = h('div.cp-share-modal', embedContent); + + // update values for link preview when radio btns change + $(embed).find('#cp-embed-link-preview').val(getEmbedValue()); + $(rights).find('input[type="radio"]').on('change', function () { + $(embed).find('#cp-embed-link-preview').val(getEmbedValue()); + }); + + var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons, onClose: config.onClose, });