{"action":"created","comment":{"url":"https://api.github.com/repos/dockyard/reefpoints/pulls/comments/32329293","id":32329293,"diff_hunk":"@@ -0,0 +1,67 @@\n+---\n+layout: post\n+title: \"Copy to Clipboard without Using Flash!\"\n+comments: true\n+social: true\n+author: Marin Abernethy\n+twitter: \"maabernethy\"\n+github: maabernethy\n+summary: \"`document.execCommand()` has now added support for `copy` in some browsers\"\n+published: true\n+tags: javascript\n+---\n+\n+For a long time we've had to rely on Flash plugins like [ZeroClipboard](https://github.com/zeroclipboard/zeroclipboard) \n+to copy text to the clipboard. While Flash still remains the only cross-browser solution for copying to a user’s clipboard, \n+some browsers have recently added the ability to trigger `cut` and `copy` using `Document.execCommand()`! Specifically, \n+[IE10+, Chrome 43+, and Opera29+](http://caniuse.com/#search=clipboard%20API). Firefox seems to have some\n+[options](http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard) that allow users to grant permissions \n+to certain sites to access the clipboard, but I haven't tried it out myself.\n+\n+For those of you not familiar with `execCommand()`, it is  more than just `cut` and `copy`! It is one of the core methods\n+of rich-text editing in browsers. You can manipulate the contents of the current document, current selection, or a \n+specified range through various commands. Some other common commands include: `bold`, `delete`,  `createLink`, and \n+`indent`.\n+\n+**`execCommand(commandName [, showUI [, value]])`**\n+\n+  * `commandName` (String): the property that you are validating.\n+  * `showUI` (Boolean) *optional*: Display a user interface if the command supports one. Defaults to false.\n+  * `value` (DOMString) *optional*: Specifies the string, number, or other value to assign. Possible values\n+depend on the command. Pass an argument of null if no argument is needed.\n+\n+However, take note that, like `cut` and `copy`, not all commands are enabled across all browsers. I created \n+an [Ember JSBin](http://emberjs.jsbin.com/hagupu/3/edit?html,js,output) with a simple WISYWIG","path":"source/posts/execcommand-blog-post.md","position":34,"original_position":34,"commit_id":"723bdaddae116c1b66645b27b2fc28293888bcbc","original_commit_id":"723bdaddae116c1b66645b27b2fc28293888bcbc","user":{"login":"duggiefresh","id":1206678,"avatar_url":"https://avatars.githubusercontent.com/u/1206678?v=3","gravatar_id":"","url":"https://api.github.com/users/duggiefresh","html_url":"https://github.com/duggiefresh","followers_url":"https://api.github.com/users/duggiefresh/followers","following_url":"https://api.github.com/users/duggiefresh/following{/other_user}","gists_url":"https://api.github.com/users/duggiefresh/gists{/gist_id}","starred_url":"https://api.github.com/users/duggiefresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duggiefresh/subscriptions","organizations_url":"https://api.github.com/users/duggiefresh/orgs","repos_url":"https://api.github.com/users/duggiefresh/repos","events_url":"https://api.github.com/users/duggiefresh/events{/privacy}","received_events_url":"https://api.github.com/users/duggiefresh/received_events","type":"User","site_admin":false},"body":"Do you `WYSIWYG`?","created_at":"2015-06-12T16:05:44Z","updated_at":"2015-06-12T16:05:44Z","html_url":"https://github.com/dockyard/reefpoints/pull/355#discussion_r32329293","pull_request_url":"https://api.github.com/repos/dockyard/reefpoints/pulls/355","_links":{"self":{"href":"https://api.github.com/repos/dockyard/reefpoints/pulls/comments/32329293"},"html":{"href":"https://github.com/dockyard/reefpoints/pull/355#discussion_r32329293"},"pull_request":{"href":"https://api.github.com/repos/dockyard/reefpoints/pulls/355"}}},"pull_request":{"url":"https://api.github.com/repos/dockyard/reefpoints/pulls/355","id":37578408,"html_url":"https://github.com/dockyard/reefpoints/pull/355","diff_url":"https://github.com/dockyard/reefpoints/pull/355.diff","patch_url":"https://github.com/dockyard/reefpoints/pull/355.patch","issue_url":"https://api.github.com/repos/dockyard/reefpoints/issues/355","number":355,"state":"open","locked":false,"title":"document.execCommand() uses, including copy!","user":{"login":"maabernethy","id":4601777,"avatar_url":"https://avatars.githubusercontent.com/u/4601777?v=3","gravatar_id":"","url":"https://api.github.com/users/maabernethy","html_url":"https://github.com/maabernethy","followers_url":"https://api.github.com/users/maabernethy/followers","following_url":"https://api.github.com/users/maabernethy/following{/other_user}","gists_url":"https://api.github.com/users/maabernethy/gists{/gist_id}","starred_url":"https://api.github.com/users/maabernethy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maabernethy/subscriptions","organizations_url":"https://api.github.com/users/maabernethy/orgs","repos_url":"https://api.github.com/users/maabernethy/repos","events_url":"https://api.github.com/users/maabernethy/events{/privacy}","received_events_url":"https://api.github.com/users/maabernethy/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-12T16:02:28Z","updated_at":"2015-06-12T16:05:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"05a983ea74924b17efabc9976f3c351b0855ea5c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dockyard/reefpoints/pulls/355/commits","review_comments_url":"https://api.github.com/repos/dockyard/reefpoints/pulls/355/comments","review_comment_url":"https://api.github.com/repos/dockyard/reefpoints/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dockyard/reefpoints/issues/355/comments","statuses_url":"https://api.github.com/repos/dockyard/reefpoints/statuses/723bdaddae116c1b66645b27b2fc28293888bcbc","head":{"label":"dockyard:maabernethy-patch-2","ref":"maabernethy-patch-2","sha":"723bdaddae116c1b66645b27b2fc28293888bcbc","user":{"login":"dockyard","id":873981,"avatar_url":"https://avatars.githubusercontent.com/u/873981?v=3","gravatar_id":"","url":"https://api.github.com/users/dockyard","html_url":"https://github.com/dockyard","followers_url":"https://api.github.com/users/dockyard/followers","following_url":"https://api.github.com/users/dockyard/following{/other_user}","gists_url":"https://api.github.com/users/dockyard/gists{/gist_id}","starred_url":"https://api.github.com/users/dockyard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dockyard/subscriptions","organizations_url":"https://api.github.com/users/dockyard/orgs","repos_url":"https://api.github.com/users/dockyard/repos","events_url":"https://api.github.com/users/dockyard/events{/privacy}","received_events_url":"https://api.github.com/users/dockyard/received_events","type":"Organization","site_admin":false},"repo":{"id":2262874,"name":"reefpoints","full_name":"dockyard/reefpoints","owner":{"login":"dockyard","id":873981,"avatar_url":"https://avatars.githubusercontent.com/u/873981?v=3","gravatar_id":"","url":"https://api.github.com/users/dockyard","html_url":"https://github.com/dockyard","followers_url":"https://api.github.com/users/dockyard/followers","following_url":"https://api.github.com/users/dockyard/following{/other_user}","gists_url":"https://api.github.com/users/dockyard/gists{/gist_id}","starred_url":"https://api.github.com/users/dockyard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dockyard/subscriptions","organizations_url":"https://api.github.com/users/dockyard/orgs","repos_url":"https://api.github.com/users/dockyard/repos","events_url":"https://api.github.com/users/dockyard/events{/privacy}","received_events_url":"https://api.github.com/users/dockyard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dockyard/reefpoints","description":"DockYard Blog","fork":false,"url":"https://api.github.com/repos/dockyard/reefpoints","forks_url":"https://api.github.com/repos/dockyard/reefpoints/forks","keys_url":"https://api.github.com/repos/dockyard/reefpoints/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dockyard/reefpoints/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dockyard/reefpoints/teams","hooks_url":"https://api.github.com/repos/dockyard/reefpoints/hooks","issue_events_url":"https://api.github.com/repos/dockyard/reefpoints/issues/events{/number}","events_url":"https://api.github.com/repos/dockyard/reefpoints/events","assignees_url":"https://api.github.com/repos/dockyard/reefpoints/assignees{/user}","branches_url":"https://api.github.com/repos/dockyard/reefpoints/branches{/branch}","tags_url":"https://api.github.com/repos/dockyard/reefpoints/tags","blobs_url":"https://api.github.com/repos/dockyard/reefpoints/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dockyard/reefpoints/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dockyard/reefpoints/git/refs{/sha}","trees_url":"https://api.github.com/repos/dockyard/reefpoints/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dockyard/reefpoints/statuses/{sha}","languages_url":"https://api.github.com/repos/dockyard/reefpoints/languages","stargazers_url":"https://api.github.com/repos/dockyard/reefpoints/stargazers","contributors_url":"https://api.github.com/repos/dockyard/reefpoints/contributors","subscribers_url":"https://api.github.com/repos/dockyard/reefpoints/subscribers","subscription_url":"https://api.github.com/repos/dockyard/reefpoints/subscription","commits_url":"https://api.github.com/repos/dockyard/reefpoints/commits{/sha}","git_commits_url":"https://api.github.com/repos/dockyard/reefpoints/git/commits{/sha}","comments_url":"https://api.github.com/repos/dockyard/reefpoints/comments{/number}","issue_comment_url":"https://api.github.com/repos/dockyard/reefpoints/issues/comments{/number}","contents_url":"https://api.github.com/repos/dockyard/reefpoints/contents/{+path}","compare_url":"https://api.github.com/repos/dockyard/reefpoints/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dockyard/reefpoints/merges","archive_url":"https://api.github.com/repos/dockyard/reefpoints/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dockyard/reefpoints/downloads","issues_url":"https://api.github.com/repos/dockyard/reefpoints/issues{/number}","pulls_url":"https://api.github.com/repos/dockyard/reefpoints/pulls{/number}","milestones_url":"https://api.github.com/repos/dockyard/reefpoints/milestones{/number}","notifications_url":"https://api.github.com/repos/dockyard/reefpoints/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dockyard/reefpoints/labels{/name}","releases_url":"https://api.github.com/repos/dockyard/reefpoints/releases{/id}","created_at":"2011-08-24T16:55:40Z","updated_at":"2015-04-24T12:54:57Z","pushed_at":"2015-06-12T16:02:28Z","git_url":"git://github.com/dockyard/reefpoints.git","ssh_url":"git@github.com:dockyard/reefpoints.git","clone_url":"https://github.com/dockyard/reefpoints.git","svn_url":"https://github.com/dockyard/reefpoints","homepage":"http://reefpoints.dockyard.com","size":92614,"stargazers_count":33,"watchers_count":33,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":64,"mirror_url":null,"open_issues_count":15,"forks":64,"open_issues":15,"watchers":33,"default_branch":"master"}},"base":{"label":"dockyard:master","ref":"master","sha":"0c40784cce501a610a40106e386fcf3bddee7ece","user":{"login":"dockyard","id":873981,"avatar_url":"https://avatars.githubusercontent.com/u/873981?v=3","gravatar_id":"","url":"https://api.github.com/users/dockyard","html_url":"https://github.com/dockyard","followers_url":"https://api.github.com/users/dockyard/followers","following_url":"https://api.github.com/users/dockyard/following{/other_user}","gists_url":"https://api.github.com/users/dockyard/gists{/gist_id}","starred_url":"https://api.github.com/users/dockyard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dockyard/subscriptions","organizations_url":"https://api.github.com/users/dockyard/orgs","repos_url":"https://api.github.com/users/dockyard/repos","events_url":"https://api.github.com/users/dockyard/events{/privacy}","received_events_url":"https://api.github.com/users/dockyard/received_events","type":"Organization","site_admin":false},"repo":{"id":2262874,"name":"reefpoints","full_name":"dockyard/reefpoints","owner":{"login":"dockyard","id":873981,"avatar_url":"https://avatars.githubusercontent.com/u/873981?v=3","gravatar_id":"","url":"https://api.github.com/users/dockyard","html_url":"https://github.com/dockyard","followers_url":"https://api.github.com/users/dockyard/followers","following_url":"https://api.github.com/users/dockyard/following{/other_user}","gists_url":"https://api.github.com/users/dockyard/gists{/gist_id}","starred_url":"https://api.github.com/users/dockyard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dockyard/subscriptions","organizations_url":"https://api.github.com/users/dockyard/orgs","repos_url":"https://api.github.com/users/dockyard/repos","events_url":"https://api.github.com/users/dockyard/events{/privacy}","received_events_url":"https://api.github.com/users/dockyard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dockyard/reefpoints","description":"DockYard Blog","fork":false,"url":"https://api.github.com/repos/dockyard/reefpoints","forks_url":"https://api.github.com/repos/dockyard/reefpoints/forks","keys_url":"https://api.github.com/repos/dockyard/reefpoints/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dockyard/reefpoints/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dockyard/reefpoints/teams","hooks_url":"https://api.github.com/repos/dockyard/reefpoints/hooks","issue_events_url":"https://api.github.com/repos/dockyard/reefpoints/issues/events{/number}","events_url":"https://api.github.com/repos/dockyard/reefpoints/events","assignees_url":"https://api.github.com/repos/dockyard/reefpoints/assignees{/user}","branches_url":"https://api.github.com/repos/dockyard/reefpoints/branches{/branch}","tags_url":"https://api.github.com/repos/dockyard/reefpoints/tags","blobs_url":"https://api.github.com/repos/dockyard/reefpoints/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dockyard/reefpoints/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dockyard/reefpoints/git/refs{/sha}","trees_url":"https://api.github.com/repos/dockyard/reefpoints/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dockyard/reefpoints/statuses/{sha}","languages_url":"https://api.github.com/repos/dockyard/reefpoints/languages","stargazers_url":"https://api.github.com/repos/dockyard/reefpoints/stargazers","contributors_url":"https://api.github.com/repos/dockyard/reefpoints/contributors","subscribers_url":"https://api.github.com/repos/dockyard/reefpoints/subscribers","subscription_url":"https://api.github.com/repos/dockyard/reefpoints/subscription","commits_url":"https://api.github.com/repos/dockyard/reefpoints/commits{/sha}","git_commits_url":"https://api.github.com/repos/dockyard/reefpoints/git/commits{/sha}","comments_url":"https://api.github.com/repos/dockyard/reefpoints/comments{/number}","issue_comment_url":"https://api.github.com/repos/dockyard/reefpoints/issues/comments{/number}","contents_url":"https://api.github.com/repos/dockyard/reefpoints/contents/{+path}","compare_url":"https://api.github.com/repos/dockyard/reefpoints/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dockyard/reefpoints/merges","archive_url":"https://api.github.com/repos/dockyard/reefpoints/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dockyard/reefpoints/downloads","issues_url":"https://api.github.com/repos/dockyard/reefpoints/issues{/number}","pulls_url":"https://api.github.com/repos/dockyard/reefpoints/pulls{/number}","milestones_url":"https://api.github.com/repos/dockyard/reefpoints/milestones{/number}","notifications_url":"https://api.github.com/repos/dockyard/reefpoints/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dockyard/reefpoints/labels{/name}","releases_url":"https://api.github.com/repos/dockyard/reefpoints/releases{/id}","created_at":"2011-08-24T16:55:40Z","updated_at":"2015-04-24T12:54:57Z","pushed_at":"2015-06-12T16:02:28Z","git_url":"git://github.com/dockyard/reefpoints.git","ssh_url":"git@github.com:dockyard/reefpoints.git","clone_url":"https://github.com/dockyard/reefpoints.git","svn_url":"https://github.com/dockyard/reefpoints","homepage":"http://reefpoints.dockyard.com","size":92614,"stargazers_count":33,"watchers_count":33,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":64,"mirror_url":null,"open_issues_count":15,"forks":64,"open_issues":15,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dockyard/reefpoints/pulls/355"},"html":{"href":"https://github.com/dockyard/reefpoints/pull/355"},"issue":{"href":"https://api.github.com/repos/dockyard/reefpoints/issues/355"},"comments":{"href":"https://api.github.com/repos/dockyard/reefpoints/issues/355/comments"},"review_comments":{"href":"https://api.github.com/repos/dockyard/reefpoints/pulls/355/comments"},"review_comment":{"href":"https://api.github.com/repos/dockyard/reefpoints/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dockyard/reefpoints/pulls/355/commits"},"statuses":{"href":"https://api.github.com/repos/dockyard/reefpoints/statuses/723bdaddae116c1b66645b27b2fc28293888bcbc"}}}}