$this.selectAll();
return false;
});
+
+ this.key('ctrl+c', function () {
+ $this.copy();
+ return false;
+ });
+ this.key('ctrl+x', function () {
+ $this.cut();
+ return false;
+ });
+ this.key('ctrl+v', function () {
+ $this.pasteInPlace();
+ return false;
+ });
this.key('del', function () {
$this.deleteSelection();
});
var selection = $(".link.selected");
var multiple = selection.length > 1;
var hasSelection = selection.length > 0;
+ var hasClipboard = $("#linkeditor-clipboard").find('.link').length > 0;
res.items = {
'select_all': {
};
}
}
+ if (hasSelection || hasClipboard) {
+ res.items.sep_clipboard = '---------';
+ if (hasSelection) {
+ res.items.copy_to_clipboad = {
+ 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 () {
+ $this.cut();
+ },
+ };
+ }
+ if (hasClipboard) {
+ res.items.paste_here = {
+ isHtmlName: true,
+ name: TRANSLATIONS.paste_here,
+ callback: function () {
+ $this.pasteHere();
+ },
+ };
+ res.items.paste_in_place = {
+ isHtmlName: true,
+ name: TRANSLATIONS.paste_in_place + ' <kbd>Ctrl+V</kbd>',
+ callback: function () {
+ $this.pasteInPlace();
+ },
+ };
+ }
+ }
if (hasSelection) {
res.items = $.extend(res.items, {
'sep0': '---------',
})
},
+ copy: function () {
+ this.copySelectionToClipboard(true);
+ },
+
+ cut: function () {
+ this.copySelectionToClipboard(false);
+ },
+
+ pasteInPlace: function () {
+ var linksInClipboard = $("#linkeditor-clipboard .link");
+ if (!linksInClipboard.length) {
+ return;
+ }
+ var $this = this;
+
+ $(linksInClipboard).each(function () {
+ var item = $(this).clone();
+ if ($this.hasUIDLink($(item).attr('fb-uid'))) {
+ var uid = $this.linkeditor.utils.generateUID();
+ $(item).attr('fb-uid', uid);
+ }
+ $("#linkeditor-links").append(item);
+ });
+ },
+
+ pasteHere: function () {
+ this.pasteInPlace();
+ },
+
+ hasUIDLink: function (uid) {
+ return true;
+ },
+
+ copySelectionToClipboard: function (clone) {
+ var selection = this.getCurrentSelection();
+ if (selection.length === 0) {
+ return;
+ }
+ this.emptyClipboard();
+ $.each(selection, function () {
+ var item = $(this);
+ if (clone) {
+ item = $(item).clone();
+ }
+ $("#linkeditor-clipboard").append(item);
+ });
+ },
+
+ emptyClipboard: function () {
+ $("#linkeditor-clipboard").html('');
+ },
fixDriftedLinks: function () {
var $this = this;
'copy_link_id'=>__('Copier l\'identifiant unique'),
'level'=>__('Niveau'),
'before_fix_drifted'=>__('Sauvegarde avant la correction de la dérive des liens'),
+ 'copy'=>__('Copier'),
+ 'cut'=>__('Couper'),
+ 'paste_here'=>__('Coller ici'),
+ 'paste_in_place'=>__('Coller en place'),
];
$rulers=!count($rulers)?'{}':json_encode($rulers);
<div class="handle"></div>
</aside>
</div>
+ <div id="linkeditor-clipboard"></div>
<div id="linkeditor-preload"></div>
<div id="linkeditor-form-templates">
@foreach(\App\SubForms\Link\Base::types() as $f)