Added copy to clipboard tool

This commit is contained in:
Camerin Figueroa 2021-12-23 16:35:56 -05:00
parent e835ac96b5
commit e87a3b4981
2 changed files with 31 additions and 0 deletions

View File

@ -12,8 +12,19 @@ const ArticleEditor = (props) => {
"contents": content
};
let copyToClipboard = () => {
navigator.clipboard.writeText(content).then(function() {
console.log('Async: Copying to clipboard was successful!');
}, function(err) {
console.error('Async: Could not copy text: ', err);
});
};
return (
<div className="ArticleEditor">
<div id="toolbar" className="toolbar">
<div className="btn" onClick={copyToClipboard()}>Copy to Clipboard</div>
</div>
<Article article={article}/>
<textarea onInput={e=>{setContent(e.target.value)}}></textarea>
</div>

View File

@ -9,6 +9,26 @@
text-align: left;
}
.ArticleEditor .toolbar {
width: 100%;
height: 56px;
display: flex;
}
.ArticleEditor .toolbar .btn {
color: white;
background-color: darkgreen;
text-align: center;
align-items:center;
justify-content: center;
display: flex;
padding-left: 3px;
padding-right: 3px;
}
.ArticleEditor .toolbar .btn:hover{
background-color: #005400
}
.article .open {
max-height:100vh;
}