# Wijmo.Clipboard

## Content

<div class="content__tsd">
						<div style="display:flex;justify-content:space-between;align-items:center">
							<h1>
								Clipboard Class
							</h1>
						</div>
						<section class="tsd-comment">
							<div class="tsd-comment">
								<div class="lead">
									<p>Static class that provides utility methods for clipboard operations.</p>
								</div>
								<p>The <a href="wijmo.clipboard.html">Clipboard</a> class provides static <a href="wijmo.clipboard.html#copy">copy</a> and <a href="wijmo.clipboard.html#paste">paste</a> methods
									that can be used by controls to customize the clipboard content during
								clipboard operations.</p>
								<p>For example, the code below shows how a control could intercept the
								clipboard shortcut keys and provide custom clipboard handling:</p>
								<pre><code class="language-typescript">rootElement.addEventListener(<span class="hljs-string">'keydown'</span>, (e: KeyboardEvent) {

    <span class="hljs-comment">// copy: ctrl+c or ctrl+Insert</span>
    <span class="hljs-keyword">if</span> (e.ctrlKey &amp;&amp; (e.keyCode == <span class="hljs-number">67</span> || e.keyCode == <span class="hljs-number">45</span>)) {
        <span class="hljs-keyword">let</span> text = <span class="hljs-keyword">this</span>.getClipString();
        Clipboard.copy(text);
        <span class="hljs-keyword">return</span>;
    }

    <span class="hljs-comment">// paste: ctrl+v or shift+Insert</span>
    <span class="hljs-keyword">if</span> ((e.ctrlKey &amp;&amp; e.keyCode == <span class="hljs-number">86</span>) || (e.shiftKey &amp;&amp; e.keyCode == <span class="hljs-number">45</span>)) {
        Clipboard.paste(<span class="hljs-function"><span class="hljs-params">text</span> =&gt;</span> {
            <span class="hljs-keyword">this</span>.setClipString(text);
        });
        <span class="hljs-keyword">return</span>;
     }
});</code></pre>
								<p>The example below shows how you can customize the behavior of the clipboard
								paste command when the target is a <a href="wijmo_grid.flexgrid.html">FlexGrid</a> control:</p>
								<p><a href="/wijmo/demos/Core/Clipboard" target="_blank">Example</a></p>
							</div>
						</section>
						<section class="tsd-hierarchy">
							<h3>Heirarchy</h3>
							<ul class="tsd-hierarchy">
								<li>
									<span class="target">Clipboard</span>
								</li>
							</ul>
						</section>
						<section class="tsd-index-group">
							<section class="tsd-index-panel">
								<div class="tsd-index-content">
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Methods
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="wijmo.clipboard.html#copy" class="tsd-kind-icon">copy</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="wijmo.clipboard.html#paste" class="tsd-kind-icon">paste</a></li>
										</ul>
									</section>
								</div>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Methods</h2>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a name="copy" class="tsd-anchor"></a>
								<h3><span class="tsd-flag ts-flagStatic">Static</span> copy</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
									<li class="tsd-signature tsd-kind-icon">copy<span class="tsd-signature-symbol">(</span>text<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Copies a string to the clipboard.</p>
											</div>
											<p>This method only works if invoked immediately after the user
											pressed a clipboard copy command (such as ctrl+c).</p>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5>text: <span class="tsd-signature-type">string</span></h5>
												<div class="tsd-comment">
													<p>Text to copy to the clipboard.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a name="paste" class="tsd-anchor"></a>
								<h3><span class="tsd-flag ts-flagStatic">Static</span> paste</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
									<li class="tsd-signature tsd-kind-icon">paste<span class="tsd-signature-symbol">(</span>callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Gets a string from the clipboard.</p>
											</div>
											<p>This method only works if invoked immediately after the user
											pressed a clipboard paste command (such as ctrl+v).</p>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5>callback: <span class="tsd-signature-type">Function</span></h5>
												<div class="tsd-comment">
													<p>Function called when the clipboard content
														has been retrieved. The function receives the clipboard
													content as a parameter.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
									</li>
								</ul>
							</section>
						</section>
					</div>