Skip to content

Commit

Permalink
Display highlight popup in the web build. zotero/web-library#570
Browse files Browse the repository at this point in the history
  • Loading branch information
tnajdek committed Nov 26, 2024
1 parent 0f15a7f commit 876842c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ui/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function Editor(props) {
{refReady && !props.disableUI && <Fragment>
{['ios', 'web'].includes(props.viewMode) && !editorState.link?.popup.active && editorState.table.isTableSelected() && <TablePopup parentRef={editorRef} tableState={editorState.table} /> }
{editorState.link && <LinkPopup parentRef={editorRef} pluginState={editorState.link.popup}/>}
{!['web'].includes(props.viewMode) && editorState.highlight && <HighlightPopup parentRef={editorRef} highlightState={editorState.highlight} citationState={editorState.citation}/>}
{editorState.highlight && <HighlightPopup parentRef={editorRef} highlightState={editorState.highlight} citationState={editorState.citation} viewMode={props.viewMode} />}
{!['web'].includes(props.viewMode) && editorState.image && <ImagePopup parentRef={editorRef} imageState={editorState.image} citationState={editorState.citation}/>}
{editorState.citation && <CitationPopup
parentRef={editorRef}
Expand Down
12 changes: 7 additions & 5 deletions src/ui/popups/highlight-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import IconBlockquote from '../../../res/icons/16/cite.svg';
import IconDocument from '../../../res/icons/16/page.svg';
import IconUnlink from '../../../res/icons/16/unlink.svg';

function HighlightPopup({ parentRef, highlightState, citationState }) {
function HighlightPopup({ parentRef, highlightState, citationState, viewMode }) {
function handleOpen() {
highlightState.popup.open();
}
Expand All @@ -28,10 +28,12 @@ function HighlightPopup({ parentRef, highlightState, citationState }) {
<div className="icon"><IconDocument/></div>
<div className="title"><FormattedMessage id="noteEditor.showOnPage"/></div>
</button>
<button onClick={handleUnlink}>
<div className="icon"><IconUnlink/></div>
<div className="title"><FormattedMessage id="noteEditor.unlink"/></div>
</button>
{!['web'].includes(viewMode) && (
<button onClick={handleUnlink}>
<div className="icon"><IconUnlink/></div>
<div className="title"><FormattedMessage id="noteEditor.unlink"/></div>
</button>
)}
{citationState.canAddCitationAfter() && <button onClick={handleAdd}>
<div className="icon"><IconBlockquote/></div>
<div className="title"><FormattedMessage id="noteEditor.addCitation"/></div>
Expand Down

0 comments on commit 876842c

Please sign in to comment.