Skip to content

Commit 28f1cc4

Browse files
author
saxumcordis
committed
squash
1 parent 10a4c80 commit 28f1cc4

5 files changed

Lines changed: 25 additions & 20 deletions

File tree

packages/editor/src/bundle/types.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import type {ReactNode} from 'react';
55
import type {MarkupString} from '../common';
66
import type {EscapeConfig, Extension} from '../core';
77
import type {Logger2} from '../logger';
8-
import type {CreateCodemirrorParams, LineRange, YfmLangOptions} from '../markup';
8+
import type {CreateCodemirrorParams} from '../markup/codemirror/create';
9+
import type {MarkupLineNumbersConfig} from '../markup/codemirror/line-highlight/types';
10+
import type {YfmLangOptions} from '../markup/codemirror/yfm';
911
import type {FileUploadHandler} from '../utils';
1012
import type {DirectiveSyntaxContext, DirectiveSyntaxOption} from '../utils/directive';
1113
import type {ParseInsertedUrlAsImage} from '../utils/upload';
@@ -117,19 +119,7 @@ export type MarkdownEditorExperimentalOptions = {
117119
*/
118120
preserveMarkupFormatting?: boolean;
119121
};
120-
121-
export interface MarkupLineNumbersConfig {
122-
/** Show line numbers in the gutter. Default: false */
123-
enabled?: boolean;
124-
/** Enable line highlighting (clickable line numbers + highlight decoration). Default: false */
125-
highlightLines?: boolean;
126-
/** Initial line range to highlight on mount (0-based, inclusive) */
127-
initialSelectedLines?: LineRange;
128-
/** Called when user clicks on a line number (only when highlightLines is true). 0-based line number. */
129-
onLineClick?: (line: number) => void;
130-
/** 0-based line number to scroll to on mount in markup mode */
131-
scrollToLine?: number;
132-
}
122+
export type {MarkupLineNumbersConfig};
133123

134124
export type MarkdownEditorMarkupConfig = {
135125
/**

packages/editor/src/markup/codemirror/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {InputState} from 'src/utils/input-state';
2323

2424
import {ActionName} from '../../bundle/config/action-names';
2525
import type {EventMap} from '../../bundle/events';
26-
import type {MarkupLineNumbersConfig} from '../../bundle/types';
2726
import type {ReactRenderStorage} from '../../extensions';
2827
import {type Logger2, globalLogger} from '../../logger';
2928
import {Action as A, formatter as f} from '../../shortcuts';
@@ -57,6 +56,7 @@ import {FilesUploadPlugin} from './files-upload-plugin';
5756
import {gravityHighlightStyle, gravityTheme} from './gravity';
5857
import {MarkdownConverter} from './html-to-markdown/converters';
5958
import {lineHighlight} from './line-highlight';
59+
import type {MarkupLineNumbersConfig} from './line-highlight/types';
6060
import {LoggerFacet} from './logger-facet';
6161
import {PairingCharactersExtension} from './pairing-chars';
6262
import {ReactRendererFacet} from './react-facet';

packages/editor/src/markup/codemirror/line-highlight/extension.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ import {
1515
lineNumbers,
1616
} from '@codemirror/view';
1717

18-
export interface LineRange {
19-
from: number;
20-
to: number;
21-
}
18+
import type {LineRange} from './types';
2219

2320
export interface LineHighlightOptions {
2421
initialRange?: LineRange;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
export type {LineRange, LineHighlightOptions} from './extension';
1+
export type {LineRange} from './types';
2+
export type {LineHighlightOptions} from './extension';
23
export {lineHighlight, setHighlightedLine} from './extension';
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export interface LineRange {
2+
from: number;
3+
to: number;
4+
}
5+
6+
export interface MarkupLineNumbersConfig {
7+
/** Show line numbers in the gutter. Default: false */
8+
enabled?: boolean;
9+
/** Enable line highlighting (clickable line numbers + highlight decoration). Default: false */
10+
highlightLines?: boolean;
11+
/** Initial line range to highlight on mount (0-based, inclusive) */
12+
initialSelectedLines?: LineRange;
13+
/** Called when user clicks on a line number (only when highlightLines is true). 0-based line number. */
14+
onLineClick?: (line: number) => void;
15+
/** 0-based line number to scroll to on mount in markup mode */
16+
scrollToLine?: number;
17+
}

0 commit comments

Comments
 (0)