refactor: katex.d.ts -> typings-external.ts

This way the .d.ts will not be deleted when filse are deleted through
rimraf
This commit is contained in:
Tony Narlock 2024-03-16 06:26:49 -05:00
parent 7bd6a7f57c
commit 8b7c6354ea
5 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import type { KatexOptions } from './katex'; import type { KatexOptions } from './typings-external';
declare module '@ckeditor/ckeditor5-core' { declare module '@ckeditor/ckeditor5-core' {
interface EditorConfig { interface EditorConfig {

View File

@ -1,14 +1,17 @@
interface MathJax3 { /**
* Basic typings for third party, external libraries (KaTeX, MathJax).
*/
export interface MathJax3 {
version: string; version: string;
tex2chtmlPromise?: ( input: string, options: { display: boolean } ) => Promise<HTMLElement>; tex2chtmlPromise?: ( input: string, options: { display: boolean } ) => Promise<HTMLElement>;
tex2svgPromise?: ( input: string, options: { display: boolean } ) => Promise<HTMLElement>; tex2svgPromise?: ( input: string, options: { display: boolean } ) => Promise<HTMLElement>;
} }
interface MathJax2 { export interface MathJax2 {
Hub: { Queue: ( callback: [string, MathJax2['Hub'], string | HTMLElement] | ( () => void ) ) => void }; Hub: { Queue: ( callback: [string, MathJax2['Hub'], string | HTMLElement] | ( () => void ) ) => void };
} }
interface Katex { export interface Katex {
render( equation: string, el: HTMLElement, options: KatexOptions ): void; render( equation: string, el: HTMLElement, options: KatexOptions ): void;
} }

View File

@ -16,7 +16,7 @@ import { Locale, FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
import { extractDelimiters, hasDelimiters } from '../utils'; import { extractDelimiters, hasDelimiters } from '../utils';
import MathView from './mathview'; import MathView from './mathview';
import '../../theme/mathform.css'; import '../../theme/mathform.css';
import type { KatexOptions } from '../katex'; import type { KatexOptions } from '../typings-external';
const { check: checkIcon, cancel: cancelIcon } = icons; const { check: checkIcon, cancel: cancelIcon } = icons;

View File

@ -1,7 +1,7 @@
import { View } from 'ckeditor5/src/ui'; import { View } from 'ckeditor5/src/ui';
import type { KatexOptions } from '../typings-external';
import { renderEquation } from '../utils'; import { renderEquation } from '../utils';
import type { Locale } from 'ckeditor5/src/utils'; import type { Locale } from 'ckeditor5/src/utils';
import type { KatexOptions } from '../katex';
export default class MathView extends View { export default class MathView extends View {
public value: string; public value: string;

View File

@ -5,7 +5,7 @@ import type {
} from 'ckeditor5/src/engine'; } from 'ckeditor5/src/engine';
import { BalloonPanelView } from 'ckeditor5/src/ui'; import { BalloonPanelView } from 'ckeditor5/src/ui';
import { CKEditorError, type PositioningFunction } from 'ckeditor5/src/utils'; import { CKEditorError, type PositioningFunction } from 'ckeditor5/src/utils';
import type { KatexOptions, MathJax2, MathJax3 } from './katex'; import type { KatexOptions, MathJax2, MathJax3 } from './typings-external';
export function getSelectedMathModelWidget( export function getSelectedMathModelWidget(
selection: DocumentSelection selection: DocumentSelection