2
0
forked from Wavyzz/dolibarr

Debug feature copy-paste on smarpthone

This commit is contained in:
Laurent Destailleur
2021-05-19 11:47:58 +02:00
parent 4d42235670
commit 78cf2b59c8
5 changed files with 26 additions and 6 deletions

View File

@@ -214,17 +214,17 @@ print '
print "\n/* JS CODE TO ENABLE ClipBoard copy paste*/\n"; print "\n/* JS CODE TO ENABLE ClipBoard copy paste*/\n";
print 'jQuery(\'.clipboardCPShowOnHover\').hover( print 'jQuery(\'.clipboardCPShowOnHover\').hover(
function() { function() {
console.log("We hover a value with a copy paste feature"); console.log("We hover a value with a copy paste feature");
$(this).children(".clipboardCPButton, .clipboardCPText").show(); $(this).children(".clipboardCPButton, .clipboardCPText").show();
}, },
function() { function() {
console.log("We hover out the value with a copy paste feature"); console.log("We hover out the value with a copy paste feature");
$(this).children(".clipboardCPButton, .clipboardCPText").hide(); $(this).children(".clipboardCPButton, .clipboardCPText").hide();
} }
);'; );';
print 'jQuery(\'.clipboardCPButton\').click(function() { print 'jQuery(\'.clipboardCPButton, .clipboardCPValueToPrint\').click(function() {
/* console.log(this.parentNode); */ /* console.log(this.parentNode); */
console.log("We click on a clipboardCPButton tag"); console.log("We click on a clipboardCPButton or clipboardCPValueToPrint class");
if (window.getSelection) { if (window.getSelection) {
selection = window.getSelection(); selection = window.getSelection();

View File

@@ -10236,7 +10236,8 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
} }
/** /**
* Create a button to copy $valuetocopy in the clipboard * Create a button to copy $valuetocopy in the clipboard.
* Code that handle the click is inside lib_foot.jsp.php
* *
* @param string $valuetocopy The value to print * @param string $valuetocopy The value to print
* @param int $showonlyonhover Show the copy-paste button only on hover * @param int $showonlyonhover Show the copy-paste button only on hover
@@ -10245,6 +10246,12 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
*/ */
function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '') function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '')
{ {
global $conf;
/*if (!empty($conf->dol_no_mouse_hover)) {
$showonlyonhover = 0;
}*/
if ($texttoshow) { if ($texttoshow) {
$result = '<span class="clipboardCP'.($showonlyonhover ? ' clipboardCPShowOnHover' : '').'"><span class="clipboardCPValue hidewithsize">'.$valuetocopy.'</span><span class="clipboardCPValueToPrint">'.$texttoshow.'</span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText opacitymedium"></span></span>'; $result = '<span class="clipboardCP'.($showonlyonhover ? ' clipboardCPShowOnHover' : '').'"><span class="clipboardCPValue hidewithsize">'.$valuetocopy.'</span><span class="clipboardCPValueToPrint">'.$texttoshow.'</span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText opacitymedium"></span></span>';
} else { } else {

View File

@@ -51,7 +51,12 @@ if (!empty($conf->global->THEME_DARKMODEENABLED)) {
}*/ }*/
div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete, div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete,
div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete, div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete,
div.tabsAction > div.divButAction > span.butAction { div.tabsAction > div.divButAction > span.butAction,
div.tabsAction > div.divButAction > span.butActionDelete,
div.tabsAction > div.divButAction > span.butActionRefused,
div.tabsAction > div.divButAction > a.butAction,
div.tabsAction > div.divButAction > a.butActionDelete,
div.tabsAction > div.divButAction > a.butActionRefused {
margin-bottom: 1.4em !important; margin-bottom: 1.4em !important;
margin-right: 0px !important; margin-right: 0px !important;
} }

View File

@@ -6770,10 +6770,14 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before
/* For copy-paste feature */ /* For copy-paste feature */
/* ============================================================================== */ /* ============================================================================== */
span.clipboardCPValueToPrint {
display: inline-block;
}
span.clipboardCPValue.hidewithsize { span.clipboardCPValue.hidewithsize {
width: 0 !important; width: 0 !important;
display: inline-block; display: inline-block;
color: transparent; color: transparent;
white-space: nowrap;
} }
.clipboardCPShowOnHover .clipboardCPButton { .clipboardCPShowOnHover .clipboardCPButton {

View File

@@ -6634,10 +6634,14 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before
/* For copy-paste feature */ /* For copy-paste feature */
/* ============================================================================== */ /* ============================================================================== */
span.clipboardCPValueToPrint {
display: inline-block;
}
span.clipboardCPValue.hidewithsize { span.clipboardCPValue.hidewithsize {
width: 0 !important; width: 0 !important;
display: inline-block; display: inline-block;
color: transparent; color: transparent;
white-space: nowrap;
} }
.clipboardCPShowOnHover .clipboardCPButton { .clipboardCPShowOnHover .clipboardCPButton {