]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5818 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 22 Mar 2023 15:05:29 +0000 (16:05 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 22 Mar 2023 15:05:29 +0000 (16:05 +0100)
resources/linkeditor/js/linkeditor.js
resources/linkeditor/js/linkeditor.layers.js
resources/linkeditor/js/linkeditor.links.js
resources/linkeditor/style/inc/_links.sass
resources/linkeditor/style/style.sass

index 0ad755f525de3ad1015c86d2cb826b319b1f1f72..bbae237421b30e2243e9901e66d9cfc1aebe0479 100644 (file)
@@ -289,6 +289,7 @@ LinkEditor.prototype = {
         if (push === true) {
             this.undo.pushState();
         }
+        this.layers.update();
         this.updateFBElements(true);
     },
 
index bea434fe1812ebcffe25af1e2c288b9bdda4f23a..9092c976e87d1e5a25774ced20ff2e77c2deffa0 100644 (file)
@@ -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 = '<em>' + TRANSLATIONS.empty + '</em>';
             }
index d7ed6fac4d96ac4b8acdecaf47c049b92fd57631..d061aa784ea965c3dd06cc392d48a176ef10c3ee 100644 (file)
@@ -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();
     },
 
index 35ccca9666a8cf70c30b4a9a15db4cd849e97efd..ff5cb9a121e8708af6c5e326c30db81c314393b2 100644 (file)
@@ -9,7 +9,6 @@
         border: currentColor solid 1px
         cursor: cell
 
-
         #linkeditor-main.dropfile  &.dropfile
             border-style: dashed
 
index 59f1648f6c75f32dacc9026e16ce07ca67c6f965..7f8543d1ccfc3356ee8e833a653b98f2cf68aaf7 100644 (file)
@@ -103,6 +103,9 @@ body, #linkeditor, html
 
                 @include tinyscrollbars
 
+                &.noscroll
+                    overflow: hidden
+
                 #linkeditor-fluidbook
                     transform-origin: 0 0
                     position: absolute