xiaodao-editor 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ import { PropType, VNode } from 'vue';
2
+ import { Extension } from '../core/extension/Extension';
3
+ import { Block, BlockId } from '../core/types';
4
+ import { Editor } from '../core/Editor';
5
+ export interface RenderResult {
6
+ /** KaTeX HTML output (safe to insert via v-html because trust:false). */
7
+ readonly html: string;
8
+ /** True when the source could not be parsed by KaTeX. */
9
+ readonly error: boolean;
10
+ }
11
+ /**
12
+ * Render a LaTeX expression to HTML. Always returns a result — parse failures
13
+ * surface as `error: true` with a KaTeX error span rather than throwing.
14
+ * Safe to call on the server (no `document` access).
15
+ */
16
+ export declare function renderEquation(expression: string): RenderResult;
17
+ export interface EquationAttrs {
18
+ readonly expression: string;
19
+ }
20
+ /** Paragraph/text block → Equation: the block's plain text becomes the LaTeX source. */
21
+ export declare function turnIntoEquation(editor: Editor, id: BlockId, expression: string): void;
22
+ /**
23
+ * Equation → Paragraph: the LaTeX source becomes the paragraph's text.
24
+ * (A plain convertBlock would drop the expression because the paragraph schema
25
+ * has no `expression` attr, so we restore it as text explicitly.)
26
+ */
27
+ export declare function turnEquationIntoParagraph(editor: Editor, id: BlockId): void;
28
+ export declare const EquationBlock: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
29
+ block: {
30
+ type: PropType<Block>;
31
+ required: true;
32
+ };
33
+ placeholder: {
34
+ type: StringConstructor;
35
+ default: undefined;
36
+ };
37
+ }>, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
38
+ [key: string]: any;
39
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
40
+ block: {
41
+ type: PropType<Block>;
42
+ required: true;
43
+ };
44
+ placeholder: {
45
+ type: StringConstructor;
46
+ default: undefined;
47
+ };
48
+ }>> & Readonly<{}>, {
49
+ placeholder: string;
50
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
51
+ export declare const EquationExtension: Extension;
@@ -10,6 +10,8 @@ export { TodoListExtension } from './TodoList';
10
10
  export { QuoteExtension } from './Quote';
11
11
  export { CodeBlockExtension } from './CodeBlock';
12
12
  export { ImageExtension } from './Image';
13
+ export { EquationExtension } from './Equation';
14
+ export type { EquationAttrs } from './Equation';
13
15
  export { TableExtension, createTableCommands } from './Table';
14
16
  export { DividerExtension } from './Divider';
15
17
  export { TableOfContentsExtension } from './TableOfContents';
Binary file
package/dist/index.d.ts CHANGED
@@ -21,6 +21,8 @@ export { KeymapExtension } from './extensions/Keymap';
21
21
  export { HistoryExtension } from './extensions/History';
22
22
  export { ImageExtension } from './extensions/Image';
23
23
  export type { ImageAttrs } from './extensions/Image';
24
+ export { EquationExtension } from './extensions/Equation';
25
+ export type { EquationAttrs } from './extensions/Equation';
24
26
  export { TableExtension } from './extensions/Table';
25
27
  export type { TableAttrs, TableCellData } from './extensions/tableModel';
26
28
  export { DividerExtension } from './extensions/Divider';