Skip to content

Commit

Permalink
Feat: 현재 열려있는 pdf와 다른 pdf의 근거를 클릭할 때
Browse files Browse the repository at this point in the history
reload후 0.8초 대기 후에 select할 수 있음
  • Loading branch information
coddingyun committed Oct 20, 2023
1 parent 402c36d commit 36ce807
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/common/annotation-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { postApi } from '../custom/utils/apiFetch'

let api = '';
if (process.env.NODE_ENV === 'development'){
api = 'https://be.yeondoo.net'
//api = 'https://virtserver.swaggerhub.com/SYLEELSW_1/Yeondoo/2.0'
//api = 'https://be.yeondoo.net'
api = 'https://virtserver.swaggerhub.com/SYLEELSW_1/Yeondoo/2.0'
}
else if (process.env.NODE_ENV === 'production'){
api = `${process.env.VITE_REACT_APP_AWS_SERVER}`
Expand Down Expand Up @@ -141,7 +141,6 @@ class AnnotationManager {
}

updateAnnotations(annotations) {
console.log(annotations)
if (this._readOnly) {
throw new Error('Cannot update annotation for read-only file');
}
Expand Down Expand Up @@ -214,7 +213,6 @@ class AnnotationManager {
this._unsavedAnnotations = this._unsavedAnnotations.filter(x => !ids.includes(x.id));
this._onDelete(ids);
this.render();
console.log(ids)
}

// Note: Keep in sync with Zotero client
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/view/selection-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function SelectionPopup(props) {
// 추가: Push to Chat 버튼 클릭시 드래그한 텍스트 전송
function handleAddToNote() {
// props.onAddToNote([props.params.annotation]);
window.parent.postMessage({selectedText: props.params.annotation.text}, '*')
window.parent.postMessage({selectedText: props.params.annotation.text, position: props.params.annotation.position}, '*')
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/common/context-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export function createAnnotationContextMenu(reader, params) {
disabled: !reader._state.enableAddToNote,
persistent: true,
// 추가: Push to Chat 버튼 클릭시 드래그한 텍스트 전송
onCommand: () => window.parent.postMessage({selectedText: annotations[0].text}, '*')
onCommand: () => window.parent.postMessage({selectedText: annotations[0].text, position: annotations[0].position}, '*')
}
],
ANNOTATION_COLORS.map(([label, color]) => ({
Expand Down
13 changes: 6 additions & 7 deletions src/index.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ window.dev = true;
// 추가: api 연결
let api = '';
if (process.env.NODE_ENV === 'development'){
api = 'https://be.yeondoo.net'
//api = 'https://virtserver.swaggerhub.com/SYLEELSW_1/Yeondoo/2.0'
//api = 'https://be.yeondoo.net'
api = 'https://virtserver.swaggerhub.com/SYLEELSW_1/Yeondoo/2.0'
}
else if (process.env.NODE_ENV === 'production'){
api = `${process.env.VITE_REACT_APP_AWS_SERVER}`
Expand Down Expand Up @@ -53,14 +53,14 @@ const receiveBasicInfo = async(e) => {
return changeItem})
sessionStorage.setItem('paperItemsWithTag', JSON.stringify(paperItemsWithTag))
if (window._reader) {
console.log(e.data.paperId)
const res = await fetch(`https://browse.arxiv.org/pdf/${e.data.paperId}.pdf`);
const newData = {
buf: new Uint8Array(await res.arrayBuffer()),
url: new URL('/', window.location).toString()
}
reader.changePaper(paperItemsWithTag)
reader.reload(newData)
await reader.changePaper(paperItemsWithTag)
await reader.reload(newData)
window.parent.postMessage({isUpdatedDone: true}, '*')
} else {
createReader(e.data.paperId, paperItemsWithTag);
}
Expand All @@ -79,7 +79,6 @@ const receiveBasicInfo = async(e) => {
}
else if (e.data.isExportClicked) {
const annotations = reader._state.annotations
console.log(annotations)
window.parent.postMessage({annotations: annotations}, '*')
}
else if (e.data.proof) {
Expand All @@ -90,8 +89,8 @@ const receiveBasicInfo = async(e) => {
noPreview: true
}
reader.updateSettings(payload)
reader.setSelectedAnnotations([e.data.proof.id])
reader.deletePaperProof([proofId])
reader.setSelectedAnnotations([e.data.proof.id])
}
}

Expand Down

0 comments on commit 36ce807

Please sign in to comment.