]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5997 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 Jun 2023 09:31:36 +0000 (11:31 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 Jun 2023 09:31:36 +0000 (11:31 +0200)
app/SubForms/Link/Base.php
package-lock.json
package.json
resources/linkeditor/js/linkeditor.js
resources/linkeditor/js/linkeditor.layers.js
resources/linkeditor/style/inc/_layers.sass
resources/views/fluidbook_publication/link_editor.blade.php

index f617139def45b647d5b5732d678050821e45ef24..6d9241a5bc078fdf4c84046822159f4556eb07bc 100644 (file)
@@ -288,7 +288,7 @@ class Base extends Form
      */
     public static function getDepths(FluidbookPublication $fluidbook)
     {
-        $options = ['interactive', 'inline'];
+        $options = ['interactive', 'inline', 'target'];
         $combi = [];
         $configs = [];
         foreach (self::types() as $type) {
index 097f0ab097e71df2867dcac49c4b7342f78a2d09..793ac3c7537dd5eb356ace85ebbd0379694fdbe8 100644 (file)
@@ -1,5 +1,5 @@
 {
-    "name": "FluidbookToolboxDev",
+    "name": "FluidbookToolbox",
     "lockfileVersion": 3,
     "requires": true,
     "packages": {
@@ -24,6 +24,7 @@
                 "select2": "^4.1.0-rc.0",
                 "select2-bootstrap-theme": "^0.1.0-beta.10",
                 "spectrum-colorpicker": "^1.8.1",
+                "tippy": "^0.0.0",
                 "tippy.js": "^6.3.7"
             },
             "devDependencies": {
                 "node": ">=0.6.0"
             }
         },
+        "node_modules/tippy": {
+            "version": "0.0.0",
+            "resolved": "https://registry.npmjs.org/tippy/-/tippy-0.0.0.tgz",
+            "integrity": "sha512-GOrE/mzoeL4t7Q2Bky+7efOZJKH3W95DZIUez+nUns37jHf8R9PEupuEx9F7HolxX+0fzzpKfas2N+LIlYHXAA=="
+        },
         "node_modules/tippy.js": {
             "version": "6.3.7",
             "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",
index f31ff870456404f4c34634f8bc720fe645e9ef65..f44c93facbb0e7618f2f9269958b0aeab51ceee9 100644 (file)
@@ -46,6 +46,7 @@
         "select2": "^4.1.0-rc.0",
         "select2-bootstrap-theme": "^0.1.0-beta.10",
         "spectrum-colorpicker": "^1.8.1",
+        "tippy": "^0.0.0",
         "tippy.js": "^6.3.7"
     }
 }
index 1e91c3efa7b625a702798d9c4f45d691bae35b16..c16fba7f41a7736d019eb7f127884d802b2e9b89 100644 (file)
@@ -120,9 +120,10 @@ LinkEditor.prototype = {
 
     initTooltips: function () {
         $('[data-tooltip]:not(.init-tooltip)').each(function () {
-            tippy($(this).get(0), {content: $(this).data('tooltip')});
+            let i = tippy($(this).get(0), {content: $(this).data('tooltip')});
+            $(this).addClass('init-tooltip');
+            $(this).data('tippyinstance', i)
         });
-        $(this).addClass('init-tooltip');
     },
 
     initEvents: function () {
index d3aa4926488f8e98d33956c8c7afc6976e9523ae..a154ad41510150b48d298745ed7878f7b4b66dfb 100644 (file)
@@ -22,6 +22,15 @@ LinkeditorLayers.prototype = {
             $this.linkeditor.form.updateLinkForm();
         });
 
+        $(document).on('click', '#linkeditor-panel-layers label span.uid', function () {
+            navigator.clipboard.writeText($(this).attr('fb-uid'));
+            let tippy=$(this).data('tippyinstance');
+            console.log(tippy);
+            tippy.setContent(TRANSLATIONS.id_copied);
+            tippy.show();
+            return false;
+        });
+
         this.update();
     },
 
@@ -41,7 +50,7 @@ LinkeditorLayers.prototype = {
             if (dest === '') {
                 dest = '<em>' + TRANSLATIONS.empty + '</em>';
             }
-            var l = '<label class="layer" fb-type="' + type + '"><input name="' + $(this).attr('fb-uid') + '" type="checkbox"> ' + dest + '</label>';
+            var l = '<label class="layer" fb-type="' + type + '"><input name="' + $(this).attr('fb-uid') + '" type="checkbox"> ' + dest + '<span data-tooltip="' + TRANSLATIONS.click_to_copy_id + '" data-uid="' + $(this).attr('fb-uid') + '" class="uid">#' + $(this).attr('fb-uid') + '</span></label>';
             let level = Math.floor(parseInt($(this).attr('fb-calc-depth')) / 10);
             layers.push({
                 level: level,
@@ -63,6 +72,7 @@ LinkeditorLayers.prototype = {
 
 
         this.updateSelection();
+        this.linkeditor.initTooltips();
     },
 
     updateSelection() {
index 9506bca511b0b3bc9176936d283f0d6ca4960f2b..ac571857cd41f3015d7671a5b3bb88e82af103b1 100644 (file)
@@ -9,10 +9,10 @@
         padding: 3px 10px
         font-style: italic
         font-weight: 500
-        background-color: rgba(0,0,0,0.45)
+        background-color: rgba(0, 0, 0, 0.45)
         color: $color-dark
         @include dark-theme
-            background-color: rgba(255,255,255,0.45)
+            background-color: rgba(255, 255, 255, 0.45)
             color: $color
 
     label
         border-bottom: 1px solid currentColor
         padding: 5px 10px
         cursor: pointer
+        position: relative
+
+        span
+            display: inline-block
+            position: absolute
+            right: 4px
+            background-color: rgba(255, 255, 255, 0.5)
+            color: #000
+            border-radius: 2px
+            padding: 2px
+            font-family: "Courier New", Courier, monospace
 
         input
             color: #fff
index 7d4000ce25fc7443c1cc8e1758578bf5479e84a6..b14fc69f60101841f28de202fca18f7356980686 100644 (file)
@@ -65,6 +65,8 @@
         'cover_doublepage_1'=>__('Recouvrir la double-page avec une marge de :margin',['margin'=>'1px']),
         'n_links_copied'=>__('%nb% liens copiés'),
         'n_links_cut'=>__('%nb% liens coupés'),
+        'click_to_copy_id'=>__('Cliquer pour copier l\'identifiant du lien'),
+        'id_copied'=>__('Identifiant copié !'),
     ];
 
     $rulers=!count($rulers)?'{}':json_encode($rulers);