From: Vincent Vanwaelscappel Date: Fri, 17 Mar 2023 08:55:07 +0000 (+0100) Subject: wait #5447 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fe1a7cab558c285e616216e79e096ef0194cd043;p=fluidbook-toolbox.git wait #5447 @1 --- diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index 32e73799d..170e81877 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -228,6 +228,29 @@ LinkeditorLinks.prototype = { }; } } + if (hasSelection && !multiple) { + res.items = $.extend(res.items, { + 'sep_extends': '---------', + 'cover_1': { + isHtmlName: true, + name: TRANSLATIONS.cover_page_1, + callback: function () { + $this.coverPage(1); + }, + } + }); + if (!$this.linkeditor.single) { + res.items = $.extend(res.items, { + 'cover_double_1': { + isHtmlName: true, + name: TRANSLATIONS.cover_doublepage_1, + callback: function () { + $this.coverPage(1, true); + }, + } + }); + } + } if (hasSelection) { res.items = $.extend(res.items, { 'sep0': '---------', @@ -991,6 +1014,30 @@ LinkeditorLinks.prototype = { max = Math.max(max, parseFloat($(this).attr('fb-' + b)) + parseFloat($(this).attr('fb-' + l))); }); return {min: min, max: max, side: b, length: l}; + }, + + coverPage(margin, double) { + if (double === undefined) { + double = true; + } + if (margin === undefined) { + margin = 0; + } + var link = this.getCurrentSelection().eq(0); + var rect = { + 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) { + rect.x = this.linkeditor.pw - margin; + } + rect.width = this.linkeditor.pw + margin * 2; + } + link.attr('fb-left', rect.x).attr('fb-top', rect.y).attr('fb-width', rect.width).attr('fb-height', rect.height); + this.linkeditor.hasChanged(); } }; diff --git a/resources/views/fluidbook_publication/link_editor.blade.php b/resources/views/fluidbook_publication/link_editor.blade.php index d03cb146a..1618fadee 100644 --- a/resources/views/fluidbook_publication/link_editor.blade.php +++ b/resources/views/fluidbook_publication/link_editor.blade.php @@ -56,6 +56,8 @@ 'cut'=>__('Couper'), 'paste_here'=>__('Coller ici'), 'paste_in_place'=>__('Coller en place'), + 'cover_page_1'=>__('Recouvrir la page avec une marge de :margin',['margin'=>'1px']), + 'cover_doublepage_1'=>__('Recouvrir la double-page avec une marge de :margin',['margin'=>'1px']), ]; $rulers=!count($rulers)?'{}':json_encode($rulers);