From: Vincent Vanwaelscappel Date: Wed, 22 Mar 2023 15:05:29 +0000 (+0100) Subject: wip #5818 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=5cd661141c5fc7e8529cc65304798747cea50d64;p=fluidbook-toolbox.git wip #5818 @0.5 --- diff --git a/resources/linkeditor/js/linkeditor.js b/resources/linkeditor/js/linkeditor.js index 0ad755f52..bbae23742 100644 --- a/resources/linkeditor/js/linkeditor.js +++ b/resources/linkeditor/js/linkeditor.js @@ -289,6 +289,7 @@ LinkEditor.prototype = { if (push === true) { this.undo.pushState(); } + this.layers.update(); this.updateFBElements(true); }, diff --git a/resources/linkeditor/js/linkeditor.layers.js b/resources/linkeditor/js/linkeditor.layers.js index bea434fe1..9092c976e 100644 --- a/resources/linkeditor/js/linkeditor.layers.js +++ b/resources/linkeditor/js/linkeditor.layers.js @@ -39,14 +39,7 @@ LinkeditorLayers.prototype = { var layers = []; $('#linkeditor-links .link:not(.pendingCreate)').each(function () { let type = $(this).attr('fb-type'); - let dest; - switch (type) { - case '6': - dest = $(this).attr('fb-alternative'); - break; - default: - dest = $(this).attr('fb-to'); - } + let dest = $(this).attr('fb-to'); if (dest === '') { dest = '' + TRANSLATIONS.empty + ''; } diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index d7ed6fac4..d061aa784 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -139,8 +139,15 @@ LinkeditorLinks.prototype = { e.originalEvent.dataTransfer.dropEffect = "copy"; e.preventDefault(); } + $(document).on('dragenter', '#linkeditor-main', function (e) { - $(document).on('dragententer dragover', '#linkeditor-main', function (e) { + // Prevent canvas being scrolled at the begining of the drag + $("#linkeditor-canvas").addClass('noscroll'); + setTimeout(function () { + $("#linkeditor-canvas").removeClass('noscroll'); + }, 2000); + commonDragAndDropEvent(e); + }).on('dragover', '#linkeditor-main', function (e) { $('#linkeditor-main').addClass('dropfile'); commonDragAndDropEvent(e); }).on('dragleave', '#linkeditor-main', function (e) { @@ -177,6 +184,8 @@ LinkeditorLinks.prototype = { success: function (response) { $(link).attr('fb-to', response[0]); $this.selectLink(link); + LINKS[uid].to = response[0]; + $this.linkeditor.hasChanged(true); } }); $(this).removeClass('dragging'); @@ -725,7 +734,9 @@ LinkeditorLinks.prototype = { $(l).addClass('selected'); this.linkeditor.form.updateLinkForm(); - this.lastSelectedLink = l; + if ($(l).is(':visible') && !$(l).is('.pendingCreate') && parseFloat($(l).attr('fb-width')) > 2 && parseFloat($(l).attr('fb-height')) > 2) { + this.lastSelectedLink = l; + } this.updateSelection(); }, diff --git a/resources/linkeditor/style/inc/_links.sass b/resources/linkeditor/style/inc/_links.sass index 35ccca966..ff5cb9a12 100644 --- a/resources/linkeditor/style/inc/_links.sass +++ b/resources/linkeditor/style/inc/_links.sass @@ -9,7 +9,6 @@ border: currentColor solid 1px cursor: cell - #linkeditor-main.dropfile &.dropfile border-style: dashed diff --git a/resources/linkeditor/style/style.sass b/resources/linkeditor/style/style.sass index 59f1648f6..7f8543d1c 100644 --- a/resources/linkeditor/style/style.sass +++ b/resources/linkeditor/style/style.sass @@ -103,6 +103,9 @@ body, #linkeditor, html @include tinyscrollbars + &.noscroll + overflow: hidden + #linkeditor-fluidbook transform-origin: 0 0 position: absolute