Sn1per has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/328696 )
Change subject: Add button to copy share/embed text to clipboard ...................................................................... Add button to copy share/embed text to clipboard Clipboard icon adapted from modules/tools/images/pasting.svg from the ContentTranslation extension. Bug: T77295 Change-Id: Ic7a11eab6ecc767ad4d80b94a7b62578d535d047 --- A resources/mmv/ui/img/pasting.svg M resources/mmv/ui/mmv.ui.reuse.dialog.less M resources/mmv/ui/mmv.ui.reuse.embed.js M resources/mmv/ui/mmv.ui.reuse.share.js 4 files changed, 98 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer refs/changes/96/328696/1 diff --git a/resources/mmv/ui/img/pasting.svg b/resources/mmv/ui/img/pasting.svg new file mode 100644 index 0000000..4d21242 --- /dev/null +++ b/resources/mmv/ui/img/pasting.svg @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + width="18.244141" + height="22.457031" + viewBox="0 0 18.244141 22.457031" + id="Layer_1" + xml:space="preserve" + sodipodi:docname="pasting.svg" + inkscape:version="0.92pre3 r"><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1012" + id="namedview9" + showgrid="false" + showguides="false" + inkscape:guide-bbox="true" + inkscape:snap-bbox="true" + inkscape:bbox-nodes="true" + inkscape:object-paths="false" + inkscape:snap-center="true" + inkscape:zoom="11.313709" + inkscape:cx="22.688172" + inkscape:cy="23.452284" + inkscape:window-x="0" + inkscape:window-y="32" + inkscape:window-maximized="1" + inkscape:current-layer="Layer_1" + inkscape:snap-smooth-nodes="true" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /><metadata + id="metadata1113"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs + id="defs1111" /><g + transform="matrix(1.4181234,0,0,1.4181234,-793.35706,-221.27829)" + id="g317"><path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#bbbbbb;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.80299997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + d="M 2.7734375 1.9355469 C 1.2094812 2.236981 0 3.6118835 0 5.2558594 L 0 19.054688 C 0 20.914868 1.5402096 22.457031 3.4003906 22.457031 L 14.84375 22.457031 C 16.703945 22.457031 18.244141 20.914868 18.244141 19.054688 L 18.244141 5.2558594 C 18.244141 3.6118835 17.034668 2.236981 15.470703 1.9355469 C 15.599513 2.2668096 15.677734 2.6218425 15.677734 2.9941406 L 15.677734 3.1699219 C 15.677734 3.7614633 15.493769 4.3149859 15.1875 4.7832031 C 15.336398 4.8859833 15.441406 5.0413526 15.441406 5.2558594 L 15.441406 19.054688 C 15.441406 19.410494 15.199571 19.652344 14.84375 19.652344 L 3.4003906 19.652344 C 3.0445836 19.652344 2.8027344 19.410494 2.8027344 19.054688 L 2.8027344 5.2558594 C 2.8027344 5.0413526 2.9077445 4.8859831 3.0566406 4.7832031 C 2.7500427 4.3150348 2.5664062 3.7623232 2.5664062 3.1699219 L 2.5664062 2.9941406 C 2.5664062 2.6219843 2.6449195 2.2664332 2.7734375 1.9355469 z " + transform="matrix(0.70515725,0,0,0.70515725,559.44148,156.03599)" + id="rect3680" /><path + style="fill:#bbbbbb;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.80299997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 29.324219,-6.5390625 c -0.831,0 -1.5,0.669 -1.5,1.5 v 0.00391 h -1.039063 c -0.824906,0 -1.490234,0.6653284 -1.490234,1.4902343 v 0.1757813 c 0,0.8249059 0.665328,1.4882812 1.490234,1.4882812 h 2.539063 2.054687 2.539063 c 0.824906,0 1.488281,-0.6633753 1.488281,-1.4882812 v -0.1757813 c 0,-0.8249059 -0.663375,-1.4902343 -1.488281,-1.4902343 h -1.039063 v -0.00391 c 0,-0.831 -0.669,-1.5 -1.5,-1.5 z" + transform="matrix(0.70515725,0,0,0.70515725,544.47204,160.64706)" + id="rect4501" + inkscape:connector-curvature="0" /></g></svg> \ No newline at end of file diff --git a/resources/mmv/ui/mmv.ui.reuse.dialog.less b/resources/mmv/ui/mmv.ui.reuse.dialog.less index 1521406..02f4a91 100644 --- a/resources/mmv/ui/mmv.ui.reuse.dialog.less +++ b/resources/mmv/ui/mmv.ui.reuse.dialog.less @@ -54,6 +54,23 @@ &.active { display: block; } + + .mw-mmv-reuse-copy { + // style rules based on .mw-mmv-share-page-link + float: right; + width: 1.5em; + height: 1.5em; + + // position approximately to the middle - probably fragile but couldn't find a better way as the + // height of OOJS-UI input widget has both em and px parts and not possible to calculate exactly + margin: 8px 0.5em 8px 0; + padding: 0 0 0 5px; + + background-image: url( img/pasting.svg ); + background-size: contain; + background-position: right center; + background-repeat: no-repeat; + } } .mw-mmv-dialog-down-arrow { diff --git a/resources/mmv/ui/mmv.ui.reuse.embed.js b/resources/mmv/ui/mmv.ui.reuse.embed.js index 0aeacec..94d9d08 100644 --- a/resources/mmv/ui/mmv.ui.reuse.embed.js +++ b/resources/mmv/ui/mmv.ui.reuse.embed.js @@ -143,10 +143,18 @@ mw.mmv.actionLogger.log( 'embed-wikitext-copied' ); } ); + this.$copyButton = $( '<a>' ) + .addClass( 'mw-mmv-reuse-copy' ) + .click( function () { + $( this ).parent().find('.active > textarea')[0].select(); + document.execCommand("copy"); + } ); + $( '<p>' ) .append( this.embedTextHtml.$element, - this.embedTextWikitext.$element + this.embedTextWikitext.$element, + this.$copyButton ) .appendTo( $container ); }; diff --git a/resources/mmv/ui/mmv.ui.reuse.share.js b/resources/mmv/ui/mmv.ui.reuse.share.js index 340f358..e755945 100644 --- a/resources/mmv/ui/mmv.ui.reuse.share.js +++ b/resources/mmv/ui/mmv.ui.reuse.share.js @@ -65,6 +65,14 @@ mw.mmv.actionLogger.log( 'share-page' ); } ); + var pane = this; + this.$copyButton = $( '<a>' ) + .addClass( 'mw-mmv-reuse-copy' ) + .click( function () { + pane.pageInput.$input[0].select(); + document.execCommand("copy"); + } ).appendTo( this.$pane ); + this.pageInput.$element.appendTo( this.$pane ); this.$explanation = $( '<div>' ) -- To view, visit https://gerrit.wikimedia.org/r/328696 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic7a11eab6ecc767ad4d80b94a7b62578d535d047 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MultimediaViewer Gerrit-Branch: master Gerrit-Owner: Sn1per <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
