mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-21 21:49:55 +03:00
Restore usage of @babel/code-frame
This commit is contained in:
parent
451e1adfd0
commit
6e805db8a3
|
@ -12,7 +12,7 @@ import { absolutifyCaret } from '../utils/dom/absolutifyCaret';
|
|||
import { ScriptLine } from '../utils/stack-frame';
|
||||
import generateAnsiHTML from '../utils/generateAnsiHTML';
|
||||
|
||||
// import { codeFrameColumns } from '@babel/code-frame';
|
||||
import { codeFrameColumns } from '@babel/code-frame';
|
||||
import { nicinabox as theme } from 'redux-devtools-themes';
|
||||
|
||||
interface StackFrameCodeBlockPropsType {
|
||||
|
@ -48,25 +48,24 @@ function StackFrameCodeBlock(props: StackFrameCodeBlockPropsType) {
|
|||
}
|
||||
sourceCode[line - 1] = text;
|
||||
});
|
||||
// const ansiHighlight = codeFrameColumns(
|
||||
// sourceCode.join('\n'),
|
||||
// {
|
||||
// start: {
|
||||
// line: lineNum,
|
||||
// column:
|
||||
// columnNum == null
|
||||
// ? 0
|
||||
// : columnNum - (isFinite(whiteSpace) ? whiteSpace : 0),
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// forceColor: true,
|
||||
// linesAbove: contextSize,
|
||||
// linesBelow: contextSize,
|
||||
// }
|
||||
// );
|
||||
// const htmlHighlight = generateAnsiHTML(ansiHighlight);
|
||||
const htmlHighlight = generateAnsiHTML(sourceCode.join('\n'));
|
||||
const ansiHighlight = codeFrameColumns(
|
||||
sourceCode.join('\n'),
|
||||
{
|
||||
start: {
|
||||
line: lineNum,
|
||||
column:
|
||||
columnNum == null
|
||||
? 0
|
||||
: columnNum - (isFinite(whiteSpace) ? whiteSpace : 0),
|
||||
},
|
||||
},
|
||||
{
|
||||
forceColor: true,
|
||||
linesAbove: contextSize,
|
||||
linesBelow: contextSize,
|
||||
}
|
||||
);
|
||||
const htmlHighlight = generateAnsiHTML(ansiHighlight);
|
||||
const code = document.createElement('code');
|
||||
code.innerHTML = htmlHighlight;
|
||||
absolutifyCaret(code);
|
||||
|
|
Loading…
Reference in New Issue
Block a user