Added automatic copying of field values to clipboard

v1.0.4-work
Giulio Cesare Solaroli 2017-01-21 15:03:42 +01:00
parent 228837da16
commit 0e70ab2c42
10 changed files with 1219 additions and 1154 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,28 +4,28 @@
{
"icon": {
"paths": [
"M108.018 534.899l148.392 76.747h576.168l-190.68-98.62h-385.488l-208.41-107.792v98.62l7.467 3.858z",
"M48.001 63.785v242.833l208.41 107.788h576.168l-536.16-277.295h593.28v768.365h-768.387v-166.462l135.098 69.865h576.168l-207.951-107.554h-368.217l-208.41-107.799v385.279h915.005v-915.020z"
"M429.696 257.6c54.88 0 68.608 27.424 105.152 22.848 36.576-4.576 4.576-68.576-27.424-114.272s-105.12-22.848-160 9.152c-54.848 32-346.272 209.152-346.272 209.152h254.848c0-0.032 118.848-126.88 173.696-126.88zM0 417.568v416c0 35.328 28.64 64 64 64 0 0 246.72 0 514.656 0 48.064 0 92-149.344 141.344-149.344 42.848 0 75.072 149.344 117.312 149.344 284.576 0 538.656 0 538.656 0 35.36 0 64.032-28.672 64.032-64v-416h-1440zM576 705.6c0 52.992-43.008 96-96 96h-288c-53.024 0-96-43.008-96-96v-96c0-53.024 42.976-96 96-96h288c52.992 0 96 42.976 96 96v96zM1344 705.6c0 52.992-43.008 96-96 96h-288c-53.024 0-96-43.008-96-96v-96c0-53.024 42.976-96 96-96h288c52.992 0 96 42.976 96 96v96zM905.12 280.448c36.576 4.576 50.272-22.848 105.152-22.848 54.848 0 173.728 126.848 173.728 126.848h254.848c0 0-291.424-177.152-346.272-209.152-54.88-32-128-54.848-160-9.152s-64 109.728-27.456 114.304z"
],
"attrs": [],
"isMulticolor": false,
"grid": 0,
"width": 1440,
"tags": [
"CLIPPERZ_SOLO_LOGO-nero"
"3d glasses",
"glasses"
],
"width": 1024
"grid": 32
},
"attrs": [],
"properties": {
"order": 42,
"id": 0,
"prevSize": 32,
"code": 59650,
"name": "CLIPPERZ_SOLO_LOGO-nero",
"ligatures": "clipperz"
"code": 59649,
"name": "3dglasses",
"ligatures": "preview"
},
"setIdx": 0,
"setId": 13,
"setIdx": 1,
"setId": 12,
"iconIdx": 0
},
{
@ -100,39 +100,12 @@
"prevSize": 32,
"code": 58884,
"name": "logo",
"ligatures": "qibberz"
"ligatures": "clipperz"
},
"setIdx": 8,
"setId": 4,
"iconIdx": 1
},
{
"icon": {
"paths": [
"M429.696 257.6c54.88 0 68.608 27.424 105.152 22.848 36.576-4.576 4.576-68.576-27.424-114.272s-105.12-22.848-160 9.152c-54.848 32-346.272 209.152-346.272 209.152h254.848c0-0.032 118.848-126.88 173.696-126.88zM0 417.568v416c0 35.328 28.64 64 64 64 0 0 246.72 0 514.656 0 48.064 0 92-149.344 141.344-149.344 42.848 0 75.072 149.344 117.312 149.344 284.576 0 538.656 0 538.656 0 35.36 0 64.032-28.672 64.032-64v-416h-1440zM576 705.6c0 52.992-43.008 96-96 96h-288c-53.024 0-96-43.008-96-96v-96c0-53.024 42.976-96 96-96h288c52.992 0 96 42.976 96 96v96zM1344 705.6c0 52.992-43.008 96-96 96h-288c-53.024 0-96-43.008-96-96v-96c0-53.024 42.976-96 96-96h288c52.992 0 96 42.976 96 96v96zM905.12 280.448c36.576 4.576 50.272-22.848 105.152-22.848 54.848 0 173.728 126.848 173.728 126.848h254.848c0 0-291.424-177.152-346.272-209.152-54.88-32-128-54.848-160-9.152s-64 109.728-27.456 114.304z"
],
"attrs": [],
"isMulticolor": false,
"width": 1440,
"tags": [
"3d glasses",
"glasses"
],
"grid": 32
},
"attrs": [],
"properties": {
"order": 1,
"id": 0,
"prevSize": 32,
"code": 59649,
"name": "3dglasses",
"ligatures": "preview"
},
"setIdx": 1,
"setId": 12,
"iconIdx": 0
},
{
"icon": {
"paths": [
@ -374,6 +347,36 @@
"setId": 0,
"iconIdx": 208
},
{
"icon": {
"paths": [
"M810 896v-598h-468v598h468zM810 214q34 0 60 25t26 59v598q0 34-26 60t-60 26h-468q-34 0-60-26t-26-60v-598q0-34 26-59t60-25h468zM682 42v86h-512v598h-84v-598q0-34 25-60t59-26h512z"
],
"attrs": [
{}
],
"isMulticolor": false,
"tags": [
"content_copy"
],
"defaultCode": 57457,
"grid": 24
},
"attrs": [
{}
],
"properties": {
"order": 43,
"id": 113,
"prevSize": 24,
"code": 57457,
"name": "content_copy",
"ligatures": "copy"
},
"setIdx": 4,
"setId": 9,
"iconIdx": 113
},
{
"icon": {
"paths": [

View File

@ -85,6 +85,7 @@ Clipperz_normalizedNewLine = '\x0d\x0a';
</div>
<span class="icon done" style="display:none">done</span>
<span class="icon failed" style="display:none">failed</span>
<span class="icon custom" style="display:none"></span>
<span class="progressBar" style="display:none"><span class="progress"></span></span>
<span class="title">loading</span>
<div class="mask hidden"></div>
@ -100,7 +101,7 @@ Clipperz_normalizedNewLine = '\x0d\x0a';
</script>
<!-- div class="testBlock">
<div class="testBlock">
<script>
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
</script>
@ -125,7 +126,7 @@ Clipperz_normalizedNewLine = '\x0d\x0a';
// Live Reload hoock
document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')
</script>
</div -->
</div>
</body>
</html>

View File

@ -306,6 +306,33 @@ Clipperz.PM.UI.Components.Cards.ViewClass = React.createClass({
return result;
},
onClickOnFieldValue: function (event) {
var succeeded;
var element;
element = event.target;
// event.target.focus();
// event.target.select();
// event.target.selectionStart = 0;
// event.target.selectionEnd = event.target.value.length;
// event.stopPropagation();
// event.preventDefault();
element.focus();
element.setSelectionRange(0, element.value.length);
event.stopPropagation();
event.preventDefault();
// selectedText = element.value;
succeeded = document.execCommand('copy');
if (succeeded === true) {
window.getSelection().removeAllRanges();
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'copyFieldValueFeedback');
}
},
//............................................................................
renderField: function (aField) {
@ -331,10 +358,10 @@ Clipperz.PM.UI.Components.Cards.ViewClass = React.createClass({
React.DOM.div({'className':'fieldValues'}, [
React.DOM.div({'className':'fieldLabel'}, aField['label']),
Clipperz.PM.UI.Components.Cards.TextArea({
// React.DOM.textarea({
'readOnly': true,
// 'onMouseUp': function(e) { e.target.focus(); e.target.select(); e.stopPropagation(); e.preventDefault();},
'onClick': function(e) { e.target.focus(); e.target.select(); e.target.selectionStart = 0; e.target.selectionEnd = e.target.value.length; e.stopPropagation(); e.preventDefault(); },
// 'onClick': function(e) { e.target.focus(); e.target.select(); e.target.selectionStart = 0; e.target.selectionEnd = e.target.value.length; e.stopPropagation(); e.preventDefault(); },
'onClick': this.onClickOnFieldValue,
'className':Clipperz.PM.UI.Components.classNames(cardFieldValueClasses),
'value': aField['value'],
'rows': 1

View File

@ -88,6 +88,17 @@ Clipperz.Base.extend(Clipperz.PM.UI.Components.Overlay, Object, {
this.completed(this.showDoneIcon, aMessage, aDelayBeforeHiding);
},
'setCustomResultIcon': function (anIcon) {
this.getElement('custom').innerHTML = anIcon;
MochiKit.Style.showElement(this.getElement('custom'));
},
'customResult': function (anIcon, aMessage, aDelayBeforeHiding) {
this.hideMask();
this.hideProgressBar();
this.completed(MochiKit.Base.method(this, 'setCustomResultIcon', anIcon), aMessage, aDelayBeforeHiding);
},
'failed': function (aMessage, aDelayBeforeHiding) {
this.completed(this.showFailIcon, aMessage, aDelayBeforeHiding);
},
@ -139,10 +150,20 @@ Clipperz.Base.extend(Clipperz.PM.UI.Components.Overlay, Object, {
'hide': function (withoutAnimationTime) {
var secondsBeforeHiding = withoutAnimationTime ? 0 : 1;
var element = this.element();
// this.getElement('custom').innerHTML = '';
// MochiKit.Style.hideElement(this.getElement('custom'));
this.hideProgressBar();
MochiKit.DOM.removeElementClass(element, 'ios-overlay-show');
MochiKit.DOM.addElementClass(element, 'ios-overlay-hide');
return MochiKit.Async.callLater(secondsBeforeHiding, MochiKit.Style.hideElement, element);
// return MochiKit.Async.callLater(secondsBeforeHiding, MochiKit.Style.hideElement, element);
return MochiKit.Async.callLater(secondsBeforeHiding, MochiKit.Base.method(this, 'hideElement'));
},
'hideElement': function () {
this.getElement('custom').innerHTML = '';
MochiKit.Style.hideElement(this.element())
},
'hideSpinner': function () {

View File

@ -83,7 +83,7 @@ Clipperz.PM.UI.MainController = function() {
'matchMediaQuery', 'unmatchMediaQuery',
'selectAllCards', 'selectRecentCards', 'selectCardsWithCertificate', 'selectCardsWithAttachments', 'selectUntaggedCards', 'tagSelected', 'search',
'refreshCardEditDetail',
'saveCardEdits', 'cancelCardEdits',
'saveCardEdits', 'cancelCardEdits', 'copyFieldValueFeedback',
'selectCard',
'addCardClick',
'deleteCard', 'toggleArchiveCard', 'cloneCard', 'editCard', // 'createCertificate',
@ -2620,6 +2620,13 @@ console.log("showCertificateCard_handler");
return deferredResult;
},
copyFieldValueFeedback_handler: function () {
// this.overlay().show("copy", true);
// MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.overlay(), 'hide', true));
this.overlay().show("copying …", true);
this.overlay().customResult('copy', "copied", 0.5);
},
uploadMessageCallback: function (someArguments, aProgressCallback) {
var deferredResult;

File diff suppressed because one or more lines are too long

View File

@ -101,6 +101,10 @@ div.overlay {
font-size: 96pt;
color: white;
text-shadow: none;
&.custom {
font-size: 80pt;
}
}
&.ios-overlay-show {

View File

@ -436,6 +436,7 @@ $cardViewBasePadding: 10px;
// line-height: 1em;
// height: 1.3em;
outline: none;
cursor: pointer;
}
}
}