Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #661: v3: code first for easy editing and then display result #678

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions src/components/ArticleV3/ArticleCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const ArticleCell = ({
(d) => typeof d.metadata === 'object' && d.metadata['text/html']?.isolated,
)
const renderUsingThebe = type === CellTypeCode && !figure?.isSound; //tags.includes('data');
const isCover = isFigure && figure?.isCover;

// const ref = useCallback(
// (node) => {
Expand Down Expand Up @@ -97,6 +98,25 @@ const ArticleCell = ({
return (
<div className={`ArticleCell ${layer}`} onClick={onClick}>
<Container fluid={layer === LayerData} className={containerClassNames.join(' ')}>
{type === CellTypeCode && !isCover && renderUsingThebe && (
<Row>
<Col xs={7} className="code">
<React.Suspense fallback={<div>loading...</div>}>
<ArticleCellSourceCodeWrapper
cellIdx={idx}
toggleVisibility={false}
visible={false}
readOnly={!ready}
/>
</React.Suspense>
</Col>

<Col xs={5} className="p-2">
<ArticleCellCodeTools cellIdx={idx} source={source} />
</Col>
</Row>
)}

{(outputs.length > 0 || errors) && (
<Row>
<Col
Expand Down Expand Up @@ -172,24 +192,18 @@ const ArticleCell = ({
</Row>
)}

{type === CellTypeCode && (!isFigure || !figure?.isCover) && (
{type === CellTypeCode && !isCover && !renderUsingThebe && (
<Row>
<Col xs={!renderUsingThebe ? 12 : 7} className="code">
<Col xs={12} className="code">
<React.Suspense fallback={<div>loading...</div>}>
<ArticleCellSourceCodeWrapper
cellIdx={idx}
toggleVisibility={!renderUsingThebe}
toggleVisibility={true}
visible={false}
readOnly={!ready}
/>
</React.Suspense>
</Col>

{renderUsingThebe && (
<Col xs={5} className="p-2">
<ArticleCellCodeTools cellIdx={idx} source={source} />
</Col>
)}
</Row>
)}
</Container>
Expand Down
Loading