Support for goto scene break from toc

This commit is contained in:
DrMint 2024-03-15 22:20:27 +01:00
parent f02aac1b22
commit 6a8cb6f778
3 changed files with 28 additions and 24 deletions

View File

@ -21,11 +21,11 @@ const { node } = Astro.props;
<br /> <br />
</> </>
) : node.fields.type === BreakBlockType.sceneBreak ? ( ) : node.fields.type === BreakBlockType.sceneBreak ? (
<p>***</p> <p id={node.anchorHash}>***</p>
) : node.fields.type === BreakBlockType.dottedLine ? ( ) : node.fields.type === BreakBlockType.dottedLine ? (
<hr class="dotted" /> <hr id={node.anchorHash} class="dotted" />
) : node.fields.type === BreakBlockType.solidLine ? ( ) : node.fields.type === BreakBlockType.solidLine ? (
<hr class="solid" /> <hr id={node.anchorHash} class="solid" />
) : ( ) : (
<ErrorMessage <ErrorMessage
title={`Unknown break block type: ${node.fields.type}`} title={`Unknown break block type: ${node.fields.type}`}
@ -41,12 +41,14 @@ const { node } = Astro.props;
font-size: 2em; font-size: 2em;
color: var(--color-base-600); color: var(--color-base-600);
letter-spacing: 1em; letter-spacing: 1em;
scroll-margin-block: 4rem;
} }
hr { hr {
border: none; border: none;
border-top-color: var(--color-base-500); border-top-color: var(--color-base-500);
width: 100%; width: 100%;
margin-block: 4rem; margin-block: 4rem;
scroll-margin-block: 4rem;
&.dotted { &.dotted {
border-top-style: dotted; border-top-style: dotted;

View File

@ -13,28 +13,28 @@ const { node, context } = Astro.props;
{ {
context.depth < 2 ? ( context.depth < 2 ? (
<h2 id={node.fields.anchorHash}> <h2 id={node.anchorHash}>
<span>{`${node.fields.anchorHash} `}</span> <span>{`${node.anchorHash} `}</span>
{node.fields.blockName} {node.fields.blockName}
</h2> </h2>
) : context.depth === 2 ? ( ) : context.depth === 2 ? (
<h3 id={node.fields.anchorHash}> <h3 id={node.anchorHash}>
<span>{`${node.fields.anchorHash} `}</span> <span>{`${node.anchorHash} `}</span>
{node.fields.blockName} {node.fields.blockName}
</h3> </h3>
) : context.depth === 3 ? ( ) : context.depth === 3 ? (
<h4 id={node.fields.anchorHash}> <h4 id={node.anchorHash}>
<span>{`${node.fields.anchorHash} `}</span> <span>{`${node.anchorHash} `}</span>
{node.fields.blockName} {node.fields.blockName}
</h4> </h4>
) : context.depth === 4 ? ( ) : context.depth === 4 ? (
<h5 id={node.fields.anchorHash}> <h5 id={node.anchorHash}>
<span>{`${node.fields.anchorHash} `}</span> <span>{`${node.anchorHash} `}</span>
{node.fields.blockName} {node.fields.blockName}
</h5> </h5>
) : ( ) : (
<h6 id={node.fields.anchorHash}> <h6 id={node.anchorHash}>
<span>{`${node.fields.anchorHash} `}</span> <span>{`${node.anchorHash} `}</span>
{node.fields.blockName} {node.fields.blockName}
</h6> </h6>
) )

View File

@ -795,6 +795,16 @@ export interface CueBlock {
}; };
blockType: 'cueBlock'; blockType: 'cueBlock';
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "TranscriptBlock".
*/
export interface TranscriptBlock {
lines: (LineBlock | CueBlock)[];
id?: string | null;
blockName?: string | null;
blockType: 'transcriptBlock';
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "BreakBlock". * via the `definition` "BreakBlock".
@ -805,16 +815,6 @@ export interface BreakBlock {
blockName?: string | null; blockName?: string | null;
blockType: 'breakBlock'; blockType: 'breakBlock';
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "TranscriptBlock".
*/
export interface TranscriptBlock {
lines: (LineBlock | CueBlock | BreakBlock)[];
id?: string | null;
blockName?: string | null;
blockType: 'transcriptBlock';
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "SectionBlock". * via the `definition` "SectionBlock".
@ -1041,7 +1041,8 @@ export interface RichTextBlockNode extends RichTextNode {
} }
export interface RichTextSectionBlock extends RichTextBlockNode { export interface RichTextSectionBlock extends RichTextBlockNode {
fields: SectionBlock & { anchorHash: string }; fields: SectionBlock;
anchorHash: string;
} }
export interface RichTextTranscriptBlock extends RichTextBlockNode { export interface RichTextTranscriptBlock extends RichTextBlockNode {
@ -1050,6 +1051,7 @@ export interface RichTextTranscriptBlock extends RichTextBlockNode {
export interface RichTextBreakBlock extends RichTextBlockNode { export interface RichTextBreakBlock extends RichTextBlockNode {
fields: BreakBlock; fields: BreakBlock;
anchorHash: string;
} }
export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode => export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode =>