Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #149 from friendsofagape/copyfix
Browse files Browse the repository at this point in the history
added malfunction fix
  • Loading branch information
joelthe1 committed Nov 22, 2019
2 parents 6d68a09 + 0fde708 commit b463c2a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "autographa-lite",
"description": "A Bible translation editor for everyone.",
"version": "1.3.3",
"version": "1.3.4",
"main": "public/electron.js",
"author": "Friends of Agape <mail@joelmath.io>",
"license": "MIT",
Expand Down
31 changes: 19 additions & 12 deletions src/components/ReferencePanel.js
@@ -1,43 +1,50 @@
import React from 'react';
import { observer } from "mobx-react"
import AutographaStore from "./AutographaStore"
const session = require('electron').remote.session;
const session = require('electron').remote.session;

@observer
class ReferencePanel extends React.Component {
constructor(props) {
super(props);
this.state = { verses: [], refContent: '', refList: [], scriptDir: "LTR" }
session.defaultSession.cookies.get({ url: 'http://refs.autographa.com' }, (error, refCookie) => {
if(refCookie.length > 0){
if (refCookie.length > 0) {
AutographaStore.refId = refCookie[0].value;
}
});
session.defaultSession.cookies.get({ url: 'http://book.autographa.com' }, (error, bookCookie) => {
if(bookCookie.length > 0){
if (bookCookie.length > 0) {
AutographaStore.bookId = bookCookie[0].value;
}
});
session.defaultSession.cookies.get({ url: 'http://chapter.autographa.com' }, (error, chapterCookie) => {
if(chapterCookie.length > 0){
if (chapterCookie.length > 0) {
AutographaStore.chapterId = chapterCookie[0].value;
}
});
}
render (){
const {tIns, tDel} = this.props;
return (
copiedSelection = () => {
document.addEventListener('copy', (event) => {
const selection = document.getSelection();
event.clipboardData.setData('text/plain', selection.toString());
event.preventDefault();
});
}
render() {
const { tIns, tDel } = this.props;
return (
<div className="container-fluid">
<div className="row row-col-fixed rmvflex" style={{display: 'flex'}}>
<div className="col-sm-12 col-fixed" id="section-0">
{tIns || tDel ? <div style={{textAlign: 'center'}}><span style={{color: '#27b97e', fontWeight: 'bold'}}>(+) {tIns}</span> | <span style={{color: '#f50808', fontWeight: 'bold'}}> (-) {tDel}</span></div> : ""}
<div className="row row-col-fixed rmvflex" style={{ display: 'flex' }}>
<div className="col-sm-12 col-fixed" onClick={this.copiedSelection} id="section-0">
{tIns || tDel ? <div style={{ textAlign: 'center' }}><span style={{ color: '#27b97e', fontWeight: 'bold' }}>(+) {tIns}</span> | <span style={{ color: '#f50808', fontWeight: 'bold' }}> (-) {tDel}</span></div> : ""}
<div className="row">
<div dangerouslySetInnerHTML={{__html: this.props.refContent}} className="col-12 col-ref"></div>
<div dangerouslySetInnerHTML={{ __html: this.props.refContent }} className="col-12 col-ref"></div>
</div>
</div>
</div>
</div>
)
)
}
}
module.exports = ReferencePanel
10 changes: 5 additions & 5 deletions src/components/TranslationPanel.js
Expand Up @@ -39,11 +39,11 @@ class TranslationPanel extends React.Component {
$('div[data-verse="r' + (limits[1] + 1) + '"]').css({ "border-radius": "0px 0px 10px 10px" });
}
}*/}
document.getElementById(vId).addEventListener("paste", function (e) {
e.preventDefault();
var text = e.clipboardData.getData("text/plain");
document.execCommand("insertHTML", false, text);
})
// document.getElementById(vId).addEventListener("paste", function (e) {
// e.preventDefault();
// var text = e.clipboardData.getData("text/plain");
// document.execCommand("insertHTML", false, text);
// })
let refContent = document.getElementsByClassName('ref-contents');
for(let l=0; l<AutographaStore.layout; l++){
let ref = refContent[l] ? refContent[l].querySelectorAll('div[data-verse^="r"]') : [];
Expand Down

0 comments on commit b463c2a

Please sign in to comment.