forked from Mirrors/apostrophe
152 lines
5.0 KiB
HTML
152 lines
5.0 KiB
HTML
<!doctype html>
|
|
<html xmlns="http://www.w3.org/1999/html">
|
|
<head>
|
|
<meta charset='utf-8'>
|
|
<title>Copy/Paste in the Context Menu - Handsontable</title>
|
|
|
|
<!--
|
|
Loading Handsontable (full distribution that includes all dependencies)
|
|
-->
|
|
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/handsontable.full.css">
|
|
<script data-jsfiddle="common" src="../dist/handsontable.full.js"></script>
|
|
|
|
<!--
|
|
Loading demo dependencies. They are used here only to enhance the examples on this page
|
|
-->
|
|
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="css/samples.css?20140331">
|
|
<script src="js/samples.js"></script>
|
|
<script src="js/highlight/highlight.pack.js"></script>
|
|
<link rel="stylesheet" media="screen" href="js/highlight/styles/github.css">
|
|
<link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css">
|
|
|
|
<!--
|
|
Facebook open graph. Don't copy this to your project :)
|
|
-->
|
|
<meta property="og:title" content="Copy/Paste from theContext Menu">
|
|
<meta property="og:description"
|
|
content="This page shows how to use and configure Context Menu's Copy and Paste features in Handsontable.">
|
|
<meta property="og:url" content="http://handsontable.com/demo/contextmenucopypaste.html">
|
|
<meta property="og:image" content="http://handsontable.com/demo/image/og-image.png">
|
|
<meta property="og:image:type" content="image/png">
|
|
<meta property="og:image:width" content="409">
|
|
<meta property="og:image:height" content="164">
|
|
<link rel="canonical" href="http://handsontable.com/demo/contextmenucopypaste.html">
|
|
|
|
<!--
|
|
Google Analytics for GitHub Page. Don't copy this to your project :)
|
|
-->
|
|
<script src="js/ga.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
<div class="wrapper">
|
|
<div class="wrapper-row">
|
|
<div id="global-menu-clone">
|
|
<h1><a href="../index.html">Handsontable</a></h1>
|
|
|
|
</div>
|
|
|
|
<div id="container">
|
|
<div class="columnLayout">
|
|
|
|
<div class="rowLayout">
|
|
<div class="descLayout">
|
|
<div class="pad" data-jsfiddle="example1">
|
|
<a name="default"></a>
|
|
|
|
<h2>Copy/Paste in the Context Menu</h2>
|
|
|
|
<p>This page shows how to use and configure the Context Menu's Copy and Paste features in Handsontable.</p>
|
|
|
|
<p>Copy and Paste feature are available in Handsontable by default, but only as key shortcuts (<code>Ctrl (Cmd) + C</code> and <code>Ctrl (Cmd) + V</code> respectively).<br>
|
|
This plugin makes them available also as a clickable options in the context menu. Unfortunately, due to the browser's security restrictions, Handsontable is forced to use a third-party flash-based library. We chose to use <a rel="nofollow" title="Zero Clipboard library" href="https://github.com/zeroclipboard/zeroclipboard">ZeroClipboard</a> - it adds a small invisible flash clip to your website, allowing the user to click on it, and thus save data to the clipboard.</p>
|
|
<p>Please note, that our Copy/Paste Context Menu plugin requires some additional preparation:
|
|
<ul>
|
|
<li><code>ZeroClipboard.js</code> must be present on your server and included in your website's <code>script</code> tag.</li>
|
|
<li><code>ZeroClipboard.swf</code> must also be present at your server</li>
|
|
</ul>
|
|
</p>
|
|
|
|
<p>To configure Handsontable to use this plugin you need to add a <code>contextMenuCopyPaste</code> config item to your Hansontable instance.<br>
|
|
It can be set to:
|
|
<ul>
|
|
<li><code>true</code> - if the <code>ZeroClipboard.swf</code> file is placed in the same directory as the <code>ZeroClipboard.js</code>, or</li>
|
|
<li><code>{<br>
|
|
<b style="padding-left: 20px;">swfPath</b>: [path to the swf file],<br>
|
|
}</code></li>
|
|
</ul>
|
|
|
|
<br><br>
|
|
</p>
|
|
|
|
|
|
|
|
<div id="example1"></div>
|
|
|
|
<p>
|
|
<button name="dump" data-instance="hot1" data-dump="#example1" title="Prints current data source to Firebug/Chrome Dev Tools">Dump
|
|
data to console
|
|
</button>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="codeLayout">
|
|
<div class="pad">
|
|
<div class="jsFiddle">
|
|
<button class="jsFiddleLink" data-runfiddle="example1">Edit in jsFiddle</button>
|
|
</div>
|
|
|
|
<script data-jsfiddle="common">
|
|
function getData() {
|
|
return [
|
|
['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
|
|
['2008', 10, 11, 12, 13],
|
|
['2009', 20, 11, 14, 13],
|
|
['2010', 30, 15, 12, 13]
|
|
];
|
|
}
|
|
</script>
|
|
|
|
<script data-jsfiddle="example1">
|
|
var container = document.getElementById('example1'),
|
|
hot1;
|
|
|
|
hot1 = new Handsontable(container, {
|
|
data: getData(),
|
|
startRows: 5,
|
|
startCols: 5,
|
|
minRows: 5,
|
|
minCols: 5,
|
|
maxRows: 10,
|
|
maxCols: 10,
|
|
rowHeaders: true,
|
|
colHeaders: true,
|
|
minSpareRows: 1,
|
|
contextMenu: true,
|
|
contextMenuCopyPaste: {
|
|
swfPath: 'swf/ZeroClipboard.swf'
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="footer-text">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outside-links-wrapper"></div>
|
|
|
|
</body>
|
|
</html>
|