]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6061 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 23 Oct 2023 11:35:55 +0000 (13:35 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 23 Oct 2023 11:35:55 +0000 (13:35 +0200)
resources/linkeditor/js/linkeditor.links.js

index 64c4e8d44193b11257f1896c03ece5ed6715f60c..a3eaa2fe0f63fc8c6be6ef43310cf4c5e62309f9 100644 (file)
@@ -83,16 +83,18 @@ LinkeditorLinks.prototype = {
         this.key('ctrl+alt+shift+f', function () {
             $this.fixDriftedLinks();
         });
-
         this.key('ctrl+a', function () {
             $this.selectAllExceptLocked();
             return false;
         });
-
         this.key('ctrl+c', function () {
             $this.copy();
             return false;
         });
+        this.key('ctrl+o', function () {
+            $this.locks.lockSelection();
+            return false;
+        });
         this.key('ctrl+x', function () {
             $this.cut();
             return false;
@@ -203,12 +205,10 @@ LinkeditorLinks.prototype = {
 
 
         $.contextMenu({
-            selector: '#linkeditor-canvas,.link,#linkeditor-panel-layers, #linkeditor-panel-layers label',
-            events: {
+            selector: '#linkeditor-canvas,.link,#linkeditor-panel-layers, #linkeditor-panel-layers label', events: {
                 show: function (e) {
                     $this.contextMenuPosition = {x: $this.linkeditor.mx, y: $this.linkeditor.my};
-                },
-                preShow: function (e) {
+                }, preShow: function (e) {
                     if ($(e).is('.link:not(.selected)')) {
                         $this.deselectAllLinks();
                         $this.selectLink(e);
@@ -221,8 +221,7 @@ LinkeditorLinks.prototype = {
                         }
                     }
                 },
-            },
-            build: function ($triggerElement, e) {
+            }, build: function ($triggerElement, e) {
                 var res = {
                     callback: function () {
 
@@ -235,20 +234,15 @@ LinkeditorLinks.prototype = {
 
                 res.items = {
                     'select_all': {
-                        isHtmlName: true,
-                        name: TRANSLATIONS.select_all + ' <kbd>Ctrl+A</kbd>',
-                        callback: function () {
+                        isHtmlName: true, name: TRANSLATIONS.select_all + ' <kbd>Ctrl+A</kbd>', callback: function () {
                             $this.selectAllExceptLocked();
                         },
                     }
                 };
                 if (hasSelection && !multiple) {
                     res.items = $.extend(res.items, {
-                        'sep_link': '---------',
-                        'copy_link_id': {
-                            isHtmlName: true,
-                            name: TRANSLATIONS.copy_link_id,
-                            callback: function () {
+                        'sep_link': '---------', 'copy_link_id': {
+                            isHtmlName: true, name: TRANSLATIONS.copy_link_id, callback: function () {
                                 navigator.clipboard.writeText(selection.attr('fb-uid'));
                             },
                         }
@@ -256,7 +250,8 @@ LinkeditorLinks.prototype = {
                     if (CAN_CONTAIN_LINKS[parseInt($(selection).attr('fb-type'))] !== undefined) {
                         res.items.image_link = {
                             isHtmlName: true,
-                            name: TRANSLATIONS.edit_image_link + ' <kbd>Ctrl+L</kbd>', callback: function () {
+                            name: TRANSLATIONS.edit_image_link + ' <kbd>Ctrl+L</kbd>',
+                            callback: function () {
                                 $this.openImageLink();
                             }
                         };
@@ -265,9 +260,7 @@ LinkeditorLinks.prototype = {
                 if (hasSelection) {
                     res.items.sep_lock = '---------';
                     res.items.lock = {
-                        isHtmlName: true,
-                        name: TRANSLATIONS.lock + ' <kbd>Ctrl+L</kbd>',
-                        callback: function () {
+                        isHtmlName: true, name: TRANSLATIONS.lock + ' <kbd>Ctrl+O</kbd>', callback: function () {
                             $this.locks.lockSelection();
                         },
                     };
@@ -276,25 +269,19 @@ LinkeditorLinks.prototype = {
                     res.items.sep_clipboard = '---------';
                     if (hasSelection) {
                         res.items.copy_to_clipboad = {
-                            isHtmlName: true,
-                            name: TRANSLATIONS.copy + ' <kbd>Ctrl+C</kbd>',
-                            callback: function () {
+                            isHtmlName: true, name: TRANSLATIONS.copy + ' <kbd>Ctrl+C</kbd>', callback: function () {
                                 $this.copy();
                             },
                         };
                         res.items.cut_to_clipboad = {
-                            isHtmlName: true,
-                            name: TRANSLATIONS.cut + ' <kbd>Ctrl+X</kbd>',
-                            callback: function () {
+                            isHtmlName: true, name: TRANSLATIONS.cut + ' <kbd>Ctrl+X</kbd>', callback: function () {
                                 $this.cut();
                             },
                         };
                     }
                     if (hasClipboard) {
                         res.items.paste_here = {
-                            isHtmlName: true,
-                            name: TRANSLATIONS.paste_here,
-                            callback: function () {
+                            isHtmlName: true, name: TRANSLATIONS.paste_here, callback: function () {
                                 $this.paste($this.contextMenuPosition);
                             },
                         };
@@ -309,18 +296,12 @@ LinkeditorLinks.prototype = {
                 }
                 if (hasSelection && !multiple) {
                     res.items = $.extend(res.items, {
-                        'sep_extends': '---------',
-                        'cover_1': {
-                            isHtmlName: true,
-                            name: TRANSLATIONS.cover_page_1,
-                            callback: function () {
+                        'sep_extends': '---------', 'cover_1': {
+                            isHtmlName: true, name: TRANSLATIONS.cover_page_1, callback: function () {
                                 $this.coverPage(1, false);
                             },
-                        },
-                        'cover_0': {
-                            isHtmlName: true,
-                            name: TRANSLATIONS.cover_page_0,
-                            callback: function () {
+                        }, 'cover_0': {
+                            isHtmlName: true, name: TRANSLATIONS.cover_page_0, callback: function () {
                                 $this.coverPage(0, false);
                             },
                         },
@@ -328,16 +309,11 @@ LinkeditorLinks.prototype = {
                     if (!$this.linkeditor.single) {
                         res.items = $.extend(res.items, {
                             'cover_double_1': {
-                                isHtmlName: true,
-                                name: TRANSLATIONS.cover_doublepage_1,
-                                callback: function () {
+                                isHtmlName: true, name: TRANSLATIONS.cover_doublepage_1, callback: function () {
                                     $this.coverPage(1, true);
                                 },
-                            },
-                            'cover_double_0': {
-                                isHtmlName: true,
-                                name: TRANSLATIONS.cover_doublepage_0,
-                                callback: function () {
+                            }, 'cover_double_0': {
+                                isHtmlName: true, name: TRANSLATIONS.cover_doublepage_0, callback: function () {
                                     $this.coverPage(0, true);
                                 },
                             },
@@ -346,8 +322,7 @@ LinkeditorLinks.prototype = {
                 }
                 if (hasSelection) {
                     res.items = $.extend(res.items, {
-                        'sep0': '---------',
-                        "delete": {
+                        'sep0': '---------', "delete": {
                             isHtmlName: true,
                             name: (multiple ? TRANSLATIONS.delete_selection : TRANSLATIONS.delete_link) + ' <kbd>Del</kbd>',
                             callback: function () {
@@ -1233,10 +1208,7 @@ LinkeditorLinks.prototype = {
         }
         var link = this.getCurrentSelection().eq(0);
         var rect = {
-            x: -margin,
-            y: -margin,
-            width: this.linkeditor.fw + margin * 2,
-            height: this.linkeditor.ph + margin * 2,
+            x: -margin, y: -margin, width: this.linkeditor.fw + margin * 2, height: this.linkeditor.ph + margin * 2,
         };
         if (!this.linkeditor.single && !double) {
             if (parseFloat($(link).attr('fb-left')) > this.linkeditor.pw) {
@@ -1490,11 +1462,7 @@ LinkeditorLinks.prototype = {
         $(link).attr('fb-polygon', jsonPolygon);
         if (updateData) {
             this.updateLinkData($(link).attr('fb-uid'), {
-                left: minx,
-                top: miny,
-                width: w,
-                height: h,
-                polygon: jsonPolygon
+                left: minx, top: miny, width: w, height: h, polygon: jsonPolygon
             });
         }
     },
@@ -1515,11 +1483,7 @@ LinkeditorLinks.prototype = {
         let link = this.getFirstLinkInSelection();
         let polygon = this.getOffsetPolygon(link);
         this.movePolygonPointPos = {
-            x: this.linkeditor.mx,
-            y: this.linkeditor.my,
-            ox: polygon[idx].x,
-            oy: polygon[idx].y,
-            index: idx
+            x: this.linkeditor.mx, y: this.linkeditor.my, ox: polygon[idx].x, oy: polygon[idx].y, index: idx
         };
         this.setDragOrigValues();
     },