diff --git a/.eslintignore b/.eslintignore
index 8a8c3a213..3a259c106 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -12,4 +12,5 @@ plugins/*
!plugins/coral-plugin-love
!plugins/coral-plugin-viewing-options
!plugins/coral-plugin-comment-content
+!plugins/talk-plugin-permalink
node_modules
diff --git a/.gitignore b/.gitignore
index b3e0eaa73..0be1266c6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,5 +25,6 @@ plugins/*
!plugins/coral-plugin-love
!plugins/coral-plugin-viewing-options
!plugins/coral-plugin-comment-content
+!plugins/talk-plugin-permalink
**/node_modules/*
diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js
index 754f44558..4fa7d234b 100644
--- a/client/coral-embed-stream/src/components/Comment.js
+++ b/client/coral-embed-stream/src/components/Comment.js
@@ -1,6 +1,5 @@
import React, {PropTypes} from 'react';
-import PermalinkButton from 'coral-plugin-permalinks/PermalinkButton';
import AuthorName from 'coral-plugin-author-name/AuthorName';
import TagLabel from 'coral-plugin-tag-label/TagLabel';
import PubDate from 'coral-plugin-pubdate/PubDate';
@@ -509,19 +508,18 @@ export default class Comment extends React.Component {
currentUserId={currentUser && currentUser.id}
/>
}
+
+
-
-
-
-
-
{
- this.setState({popoverOpen: false});
- }
-
- copyPermalink () {
- this.permalinkInput.select();
- try {
- document.execCommand('copy');
- this.setState({copySuccessful: true, copyFailure: null});
- } catch (err) {
- this.setState({copyFailure: true, copySuccessful: null});
- }
-
- setTimeout(() => {
- this.setState({copyFailure: null, copySuccessful: null});
- }, 3000);
- }
-
- render () {
- const {copySuccessful, copyFailure} = this.state;
- return (
-
-
-
-
this.popover = ref}
- className={`${name}-popover ${styles.container} ${this.state.popoverOpen ? 'active' : ''}`}>
- this.permalinkInput = input}
- value={`${this.props.articleURL}#${this.props.commentId}`}
- onChange={() => {}} />
-
-
-
-
- );
- }
-}
diff --git a/client/coral-plugin-permalinks/styles.css b/client/coral-plugin-permalinks/styles.css
deleted file mode 100644
index a4671c685..000000000
--- a/client/coral-plugin-permalinks/styles.css
+++ /dev/null
@@ -1,67 +0,0 @@
-.container {
- border-radius: 3px;
- padding: 15px 10px;
- box-sizing: border-box;
- /* box-shadow: 3px 3px 5px 0 rgba(0, 0, 0, 0.3); */
- border: solid 1px rgba(153, 153, 153, 0.33);
- left: 0;
- width: 100%;
-
- &::before {
- content: '';
- border: 10px solid transparent;
- border-top-color: white;
- position: absolute;
- right: 7em;
- bottom: -20px;
- z-index: 2;
- }
-
- &::after{
- content: '';
- border: 10px solid transparent;
- border-top-color: rgba(153, 153, 153, 0.33);
- position: absolute;
- right: 7em;
- bottom: -21px;
- z-index: 1;
- }
-
- input {
- display: inline-block;
- width: calc(100% - 78px);
- padding: 8px;
- border-radius: 3px;
- border: solid 1px #e0e0e0;
- height: 32px;
- box-sizing: border-box;
- font-size: 1em;
- }
-
- button {
- display: inline-block;
- float: right;
- box-sizing: border-box;
- margin: 0;
- background-color: #e0e0e0;
- font-size: 1em;
- width: auto;
- height: auto;
- padding: 2px;
- transition: background-color 0.4s ease;
-
- &:hover{
- color: black;
- }
-
- &.success {
- background-color: #00897B;
- color: white;
- }
-
- &.failure {
- background-color: #FF5252;
- color: white;
- }
- }
-}
diff --git a/plugin-api/beta/client/components/index.js b/plugin-api/beta/client/components/index.js
index 5d76732fc..6466b9ffc 100644
--- a/plugin-api/beta/client/components/index.js
+++ b/plugin-api/beta/client/components/index.js
@@ -1 +1,2 @@
export {Slot} from 'coral-framework/components';
+export {default as ClickOutside} from 'coral-framework/components/ClickOutside';
diff --git a/plugins/talk-plugin-permalink/client/.babelrc b/plugins/talk-plugin-permalink/client/.babelrc
new file mode 100644
index 000000000..60be246eb
--- /dev/null
+++ b/plugins/talk-plugin-permalink/client/.babelrc
@@ -0,0 +1,14 @@
+{
+ "presets": [
+ "es2015"
+ ],
+ "plugins": [
+ "add-module-exports",
+ "transform-class-properties",
+ "transform-decorators-legacy",
+ "transform-object-assign",
+ "transform-object-rest-spread",
+ "transform-async-to-generator",
+ "transform-react-jsx"
+ ]
+}
\ No newline at end of file
diff --git a/plugins/talk-plugin-permalink/client/.eslintrc.json b/plugins/talk-plugin-permalink/client/.eslintrc.json
new file mode 100644
index 000000000..9fe56bd14
--- /dev/null
+++ b/plugins/talk-plugin-permalink/client/.eslintrc.json
@@ -0,0 +1,23 @@
+{
+ "env": {
+ "browser": true,
+ "es6": true,
+ "mocha": true
+ },
+ "parserOptions": {
+ "sourceType": "module",
+ "ecmaFeatures": {
+ "experimentalObjectRestSpread": true,
+ "jsx": true
+ }
+ },
+ "parser": "babel-eslint",
+ "plugins": [
+ "react"
+ ],
+ "rules": {
+ "react/jsx-uses-react": "error",
+ "react/jsx-uses-vars": "error",
+ "no-console": ["warn", { "allow": ["warn", "error"] }]
+ }
+}
diff --git a/plugins/talk-plugin-permalink/client/components/PermalinkButton.js b/plugins/talk-plugin-permalink/client/components/PermalinkButton.js
new file mode 100644
index 000000000..68406472e
--- /dev/null
+++ b/plugins/talk-plugin-permalink/client/components/PermalinkButton.js
@@ -0,0 +1,107 @@
+import React from 'react';
+import cn from 'classnames';
+import styles from './styles.css';
+import {t} from 'plugin-api/beta/client/services';
+import {ClickOutside} from 'plugin-api/beta/client/components';
+import {Icon, Button} from 'plugin-api/beta/client/components/ui';
+
+const name = 'talk-plugin-permalink';
+
+export default class PermalinkButton extends React.Component {
+ constructor (props) {
+ super(props);
+
+ this.state = {
+ popoverOpen: false,
+ copySuccessful: null,
+ copyFailure: null
+ };
+
+ }
+
+ toggle = () => {
+ this.popover.style.top = `${this.linkButton.offsetTop - 80}px`;
+
+ this.setState({
+ popoverOpen: !this.state.popoverOpen
+ });
+ }
+
+ handleClickOutside = () => {
+ this.setState({
+ popoverOpen: false
+ });
+ }
+
+ copyPermalink = () => {
+ this.permalinkInput.select();
+ try {
+ document.execCommand('copy');
+ this.setState({
+ copySuccessful: true,
+ copyFailure: null
+ });
+ } catch (err) {
+ this.setState({
+ copyFailure: true,
+ copySuccessful: null
+ });
+ }
+
+ this.timeout = window.setTimeout(() => {
+ this.setState({
+ copyFailure: null,
+ copySuccessful: null
+ });
+ }, 3000);
+ }
+
+ componentWillUnmount() {
+ window.clearTimeout(this.timeout);
+ }
+
+ render () {
+ const {copySuccessful, copyFailure, popoverOpen} = this.state;
+ const {asset} = this.props;
+ return (
+
+
+
+
+
+
this.popover = ref}
+ className={cn([`${name}-popover`, styles.popover, {[styles.active]: popoverOpen}])}>
+
+ this.permalinkInput = input}
+ defaultValue={`${asset.url}#${this.props.commentId}`}
+ />
+
+
+
+
+
+
+ );
+ }
+}
diff --git a/plugins/talk-plugin-permalink/client/components/styles.css b/plugins/talk-plugin-permalink/client/components/styles.css
new file mode 100644
index 000000000..56d069755
--- /dev/null
+++ b/plugins/talk-plugin-permalink/client/components/styles.css
@@ -0,0 +1,77 @@
+.popover {
+ display: none;
+ background-color: white;
+ position: absolute;
+ border-radius: 3px;
+ padding: 15px 10px;
+ box-sizing: border-box;
+ border: solid 1px rgba(153, 153, 153, 0.33);
+ left: 0;
+ width: 100%;
+ z-index: 10;
+}
+.popover::before {
+ content: '';
+ border: 10px solid transparent;
+ border-top-color: white;
+ position: absolute;
+ right: 7em;
+ bottom: -20px;
+ z-index: 2;
+}
+
+.popover::after{
+ content: '';
+ border: 10px solid transparent;
+ border-top-color: rgba(153, 153, 153, 0.33);
+ position: absolute;
+ right: 7em;
+ bottom: -21px;
+ z-index: 1;
+}
+
+.input {
+ display: inline-block;
+ width: calc(100% - 78px);
+ padding: 8px;
+ border-radius: 3px;
+ border: solid 1px #e0e0e0;
+ height: 32px;
+ box-sizing: border-box;
+ font-size: 1em;
+}
+
+.button {
+ display: inline-block;
+ float: right;
+ box-sizing: border-box;
+ margin: 0;
+ background-color: #e0e0e0;
+ font-size: 1em;
+ width: auto;
+ height: auto;
+ padding: 2px;
+ transition: background-color 0.4s ease;
+}
+
+.button:hover{
+ color: black;
+}
+
+.button.success {
+ background-color: #00897B;
+ color: white;
+}
+
+.button.failure {
+ background-color: #FF5252;
+ color: white;
+}
+
+.container {
+ z-index: 2;
+}
+
+.active {
+ display: block;
+}
\ No newline at end of file
diff --git a/plugins/talk-plugin-permalink/client/index.js b/plugins/talk-plugin-permalink/client/index.js
new file mode 100644
index 000000000..d413da870
--- /dev/null
+++ b/plugins/talk-plugin-permalink/client/index.js
@@ -0,0 +1,7 @@
+import PermalinkButton from './components/PermalinkButton';
+
+export default {
+ slots: {
+ commentActions: [PermalinkButton]
+ }
+};
diff --git a/plugins/talk-plugin-permalink/index.js b/plugins/talk-plugin-permalink/index.js
new file mode 100644
index 000000000..f053ebf79
--- /dev/null
+++ b/plugins/talk-plugin-permalink/index.js
@@ -0,0 +1 @@
+module.exports = {};
diff --git a/plugins/talk-plugin-permalink/package.json b/plugins/talk-plugin-permalink/package.json
new file mode 100644
index 000000000..fefeb9f16
--- /dev/null
+++ b/plugins/talk-plugin-permalink/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "talk-plugin-permalink",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "author": "",
+ "license": "ISC"
+}