linguabot commited on
Commit
ed58cbe
·
verified ·
1 Parent(s): acf13d9

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/components/Refinity.tsx +5 -65
client/src/components/Refinity.tsx CHANGED
@@ -815,65 +815,9 @@ const Refinity: React.FC = () => {
815
  ref={(el)=>{ textRefs.current[v.id]=el; }}
816
  className={`text-gray-900 whitespace-pre-wrap break-words leading-relaxed flex-1 overflow-hidden pr-1 relative`}
817
  style={{ maxHeight: 'calc(100% - 10.5rem)', paddingBottom: '0.25rem' }}
818
- onMouseUp={(e)=>{
819
- if (!showAnnotations) return;
820
- const el = textRefs.current[v.id];
821
- if (!el) return;
822
- const sel = window.getSelection();
823
- if (!sel || sel.rangeCount===0) return;
824
- const range = sel.getRangeAt(0);
825
- if (!el.contains(range.startContainer) || !el.contains(range.endContainer)) return;
826
- const text = v.content || '';
827
- const offsets = rangeToOffsets(el, range, text);
828
- if (offsets.end - offsets.start <= 0) {
829
- // caret: open if inside an existing annotation
830
- const inside = (annoForVersion(v.id) || []).find(a => offsets.start >= a.start && offsets.start <= a.end);
831
- if (inside) {
832
- setEditingAnnotation(inside);
833
- setModalCategory(inside.category);
834
- setModalComment(inside.comment || '');
835
- setAnnotationModalOpen(true);
836
- }
837
- setAnnotationPopover(null);
838
- return;
839
- }
840
- const pos = getSelectionPopoverPosition(range, el);
841
- setAnnotationPopover({ left: pos.left, top: pos.top, versionId: v.id, range: offsets });
842
- }}
843
- onClick={(e)=>{
844
- if (!showAnnotations) return;
845
- const target = e.target as HTMLElement;
846
- const id = target?.dataset?.annoId;
847
- if (id) {
848
- e.preventDefault(); e.stopPropagation();
849
- const found = (annoForVersion(v.id) || []).find(a => a.id === id);
850
- if (found) {
851
- setEditingAnnotation(found);
852
- setModalCategory(found.category);
853
- setModalComment(found.comment || '');
854
- setAnnotationModalOpen(true);
855
- }
856
- }
857
- }}
858
- dangerouslySetInnerHTML={{ __html: renderAnnotatedHtml(v.content || '', v.id, showAnnotations) }}
859
- />
860
- {annotationPopover && annotationPopover.versionId===v.id && (
861
- <div className="absolute z-[3500]" style={{ left: annotationPopover.left, top: annotationPopover.top }}>
862
- <button
863
- type="button"
864
- onClick={(e)=>{
865
- e.preventDefault(); e.stopPropagation();
866
- setEditingAnnotation(null);
867
- setModalCategory('distortion');
868
- setModalComment('');
869
- setAnnotationModalOpen(true);
870
- }}
871
- className="inline-flex items-center gap-2 px-2.5 py-1.5 text-xs rounded-full text-white bg-emerald-600 hover:bg-emerald-700 shadow ring-1 ring-white/50"
872
- >
873
- + Comment
874
- </button>
875
- </div>
876
- )}
877
  {overflowMap[v.id] && (
878
  <div className="pointer-events-none absolute text-gray-700" style={{ left: '1.5rem', bottom: '6rem', zIndex: 2000 }}>…</div>
879
  )}
@@ -1612,12 +1556,8 @@ const PreviewPane: React.FC<{ version: Version | null; onBack: ()=>void; onEdit:
1612
  };
1613
  return (
1614
  <div>
1615
- <div className="mb-3 text-gray-700 text-sm">Original: {version.originalAuthor} · Revised by: {version.revisedBy || '—'} (v{version.versionNumber})</div>
1616
- <div className="relative rounded-xl">
1617
- <div className="absolute inset-0 rounded-xl bg-gradient-to-r from-indigo-200/45 via-indigo-100/40 to-indigo-300/45" />
1618
- <div className="relative rounded-xl bg-white/10 backdrop-blur-md ring-1 ring-inset ring-white/30 shadow-[inset_0_0.5px_0_rgba(255,255,255,0.5),inset_0_-1px_1.5px_rgba(0,0,0,0.12)] p-6">
1619
- <div className="pointer-events-none absolute inset-0 rounded-xl opacity-50 [background:linear-gradient(to_bottom,rgba(255,255,255,0.3),rgba(255,255,255,0)_28%),linear-gradient(to_right,rgba(255,255,255,0.28),rgba(255,255,255,0)_28%)]" />
1620
- <div className="pointer-events-none absolute inset-0 rounded-xl bg-gradient-to-tr from-white/30 via-white/10 to-transparent opacity-45" />
1621
  {!showDiff && (
1622
  <div className="relative whitespace-pre-wrap text-gray-900 min-h-[220px]">{version.content}</div>
1623
  )}
 
815
  ref={(el)=>{ textRefs.current[v.id]=el; }}
816
  className={`text-gray-900 whitespace-pre-wrap break-words leading-relaxed flex-1 overflow-hidden pr-1 relative`}
817
  style={{ maxHeight: 'calc(100% - 10.5rem)', paddingBottom: '0.25rem' }}
818
+ >
819
+ {v.content || ''}
820
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  {overflowMap[v.id] && (
822
  <div className="pointer-events-none absolute text-gray-700" style={{ left: '1.5rem', bottom: '6rem', zIndex: 2000 }}>…</div>
823
  )}
 
1556
  };
1557
  return (
1558
  <div>
1559
+ <div className="relative rounded-xl ring-1 ring-gray-200 bg-stone-50 shadow-sm">
1560
+ <div className="relative rounded-xl p-6">
 
 
 
 
1561
  {!showDiff && (
1562
  <div className="relative whitespace-pre-wrap text-gray-900 min-h-[220px]">{version.content}</div>
1563
  )}