@ones-editor/editor 2.4.1 → 2.5.1-beta.2
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.
- package/@ones-editor/server-tools/package.json +22 -0
- package/@ones-editor/server-tools/src/fake-browser.d.ts +1 -0
- package/@ones-editor/server-tools/src/from-markdown/index.d.ts +1 -0
- package/@ones-editor/server-tools/src/index.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/code.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/index.d.ts +12 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/list.d.ts +14 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/table.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/text.d.ts +4 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/br.d.ts +1 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/date.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/file.d.ts +11 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/index.d.ts +16 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/known-link.d.ts +11 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/mathjax.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/mention.d.ts +7 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/task-link.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/convert-block.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/convert-box.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/drawio.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/file-list.d.ts +5 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/file.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/flowchart.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/hr.d.ts +1 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/image.d.ts +18 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/index.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/mathjax.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/media.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/mermaid.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/plantuml.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/sub-pages.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/task-list.d.ts +7 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/toc.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/webpage.d.ts +5 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/xmind.d.ts +8 -0
- package/@ones-editor/server-tools/src/to-markdown/index.d.ts +1 -0
- package/@ones-editor/server-tools/src/to-markdown/types.d.ts +7 -0
- package/@ones-editor/server-tools/src/tools.d.ts +1 -0
- package/@ones-editor/server-tools/src/utils/editor-doc.d.ts +22 -0
- package/@ones-editor/server-tools/src/utils/object.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +30 -20
- package/package.json +9 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ones-editor/server-tools",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build:dev": "webpack --mode development --devtool source-map",
|
|
6
|
+
"build": "webpack --mode production"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"css-loader": "^6.7.1",
|
|
10
|
+
"null-loader": "^4.0.1",
|
|
11
|
+
"sass-loader": "^13.1.0",
|
|
12
|
+
"style-loader": "^3.3.1",
|
|
13
|
+
"ts-loader": "^9.4.1",
|
|
14
|
+
"ts-node": "^10.9.1",
|
|
15
|
+
"tsc": "^2.0.4",
|
|
16
|
+
"typescript": "^5.0.4",
|
|
17
|
+
"webpack": "^5.88.0",
|
|
18
|
+
"webpack-cli": "^4.9.1",
|
|
19
|
+
"webpack-node-externals": "^3.0.0"
|
|
20
|
+
},
|
|
21
|
+
"types": "src/index.d.ts"
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function docFromMarkdownFile(mdPath: string): Promise<import("../utils/editor-doc").EditorDoc>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import TextConverter from './text';
|
|
2
|
+
import CodeConverter from './code';
|
|
3
|
+
import ListConverter from './list';
|
|
4
|
+
import TableConverter from './table';
|
|
5
|
+
import EmbedConverter from '../embeds';
|
|
6
|
+
export declare function getBlocks(): {
|
|
7
|
+
text: typeof TextConverter;
|
|
8
|
+
code: typeof CodeConverter;
|
|
9
|
+
list: typeof ListConverter;
|
|
10
|
+
table: typeof TableConverter;
|
|
11
|
+
embed: typeof EmbedConverter;
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BlockPath, DocBlock, DocBlockText, DocObject } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { Converters } from '../types';
|
|
3
|
+
export type ListBlockType = 'ordered' | 'unordered' | 'checked' | 'unchecked' | 'text-only';
|
|
4
|
+
export interface DocListBlock extends DocBlock {
|
|
5
|
+
text: DocBlockText;
|
|
6
|
+
level?: number;
|
|
7
|
+
start: number;
|
|
8
|
+
ordered: boolean;
|
|
9
|
+
groupId: string;
|
|
10
|
+
checkbox?: 'checked' | 'unchecked';
|
|
11
|
+
textOnly?: boolean;
|
|
12
|
+
viewAsMindmap?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export default function toMarkdown(converters: Converters, block: DocBlock, doc: DocObject, path: BlockPath): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DocBlock, DocObject } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { Converters } from '../types';
|
|
3
|
+
export declare function textBlockToMarkdown(converters: Converters, blockData: DocBlock, doc: DocObject): string;
|
|
4
|
+
export default function toMarkdown(converters: Converters, block: DocBlock, doc: DocObject): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function convertToMarkdown(): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DocBox } from '../../../../../@ones-editor/core';
|
|
2
|
+
interface FileData {
|
|
3
|
+
src: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
fileSize: number;
|
|
6
|
+
fileType: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FileBoxData extends DocBox, FileData {
|
|
9
|
+
}
|
|
10
|
+
export default function convertToMarkdown(converters: unknown, boxData: DocBox): string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import FileBoxToMarkdown from './file';
|
|
2
|
+
import BrBoxToMarkdown from './br';
|
|
3
|
+
import MathjaxBoxToMarkdown from './mathjax';
|
|
4
|
+
import MentionBoxToMarkdown from './mention';
|
|
5
|
+
import TaskLinkBoxToMarkdown from './task-link';
|
|
6
|
+
import KnownLinkBoxToMarkdown from './known-link';
|
|
7
|
+
import DateBoxToMarkdown from './date';
|
|
8
|
+
export declare function getBoxes(): {
|
|
9
|
+
br: typeof BrBoxToMarkdown;
|
|
10
|
+
file: typeof FileBoxToMarkdown;
|
|
11
|
+
mathjax: typeof MathjaxBoxToMarkdown;
|
|
12
|
+
mention: typeof MentionBoxToMarkdown;
|
|
13
|
+
date: typeof DateBoxToMarkdown;
|
|
14
|
+
'task-link': typeof TaskLinkBoxToMarkdown;
|
|
15
|
+
'known-link': typeof KnownLinkBoxToMarkdown;
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DocBox } from '../../../../../@ones-editor/core';
|
|
2
|
+
export interface KnownLinkBoxData extends DocBox {
|
|
3
|
+
linkType: 'wiki' | 'task';
|
|
4
|
+
}
|
|
5
|
+
export interface KnownWikiLinkBoxData extends KnownLinkBoxData {
|
|
6
|
+
linkType: 'wiki';
|
|
7
|
+
spaceUuid: string;
|
|
8
|
+
pageUuid: string;
|
|
9
|
+
query?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
export default function convertToMarkdown(converters: unknown, boxData: DocBox): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function toMarkdown(): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DocEmbedBlock, DocEmbedData, DocObject } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { Converters } from '../types';
|
|
3
|
+
export interface ImageEmbedData extends DocEmbedData {
|
|
4
|
+
src: string | string[];
|
|
5
|
+
widthPercent?: number;
|
|
6
|
+
[index: string]: string | number | string[] | undefined | number[];
|
|
7
|
+
}
|
|
8
|
+
export interface ImageItemData {
|
|
9
|
+
src: string;
|
|
10
|
+
width: number | 'auto';
|
|
11
|
+
height: number | 'auto';
|
|
12
|
+
flex: number;
|
|
13
|
+
virtualSize: boolean;
|
|
14
|
+
downloading?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function getImages(data: ImageEmbedData): ImageItemData[];
|
|
17
|
+
export declare function toImageEmbedData(images: ImageItemData[], widthPercent?: number): ImageEmbedData;
|
|
18
|
+
export default function toMarkdown(converters: Converters, blockData: DocEmbedBlock, doc: DocObject): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DocEmbedBlock } from '../../../../../@ones-editor/core';
|
|
2
|
+
export interface TaskListNextEmbedData {
|
|
3
|
+
title?: string;
|
|
4
|
+
cardUuid?: string;
|
|
5
|
+
height?: number;
|
|
6
|
+
}
|
|
7
|
+
export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DocEmbedBlock } from '../../../../../@ones-editor/core';
|
|
2
|
+
export interface XmindEmbedData {
|
|
3
|
+
thumbnail: string;
|
|
4
|
+
xmindFile: string;
|
|
5
|
+
draftId?: string;
|
|
6
|
+
height?: number;
|
|
7
|
+
}
|
|
8
|
+
export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function docFileToMarkdown(path: string): Promise<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BlockPath, DocBlock, DocBox, DocObject } from '../../../../@ones-editor/core';
|
|
2
|
+
export type BlockConverter = (converters: Converters, blockData: DocBlock, doc: DocObject, path: BlockPath) => string;
|
|
3
|
+
export type BoxConverter = (converters: Converters, boxData: DocBox, doc: DocObject) => string;
|
|
4
|
+
export interface Converters {
|
|
5
|
+
blocks: Map<string, BlockConverter>;
|
|
6
|
+
boxes: Map<string, BoxConverter>;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DocBlock, DocComment, DocObject } from '../../../../@ones-editor/core';
|
|
2
|
+
export type BlocksType = DocBlock[];
|
|
3
|
+
export type CommentsType = {
|
|
4
|
+
[index: string]: DocComment;
|
|
5
|
+
};
|
|
6
|
+
export type MetaType = {
|
|
7
|
+
[index: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type AllBlocksType = {
|
|
10
|
+
[index: string]: BlocksType;
|
|
11
|
+
};
|
|
12
|
+
export type EditorDocBase = {
|
|
13
|
+
blocks: BlocksType;
|
|
14
|
+
comments: CommentsType;
|
|
15
|
+
meta: MetaType;
|
|
16
|
+
};
|
|
17
|
+
export type EditorDoc = EditorDocBase & {
|
|
18
|
+
[index: string]: BlocksType | unknown;
|
|
19
|
+
};
|
|
20
|
+
export declare function isValidEditorDoc(json: any): boolean;
|
|
21
|
+
export declare function editorDoc2DocObject(doc: EditorDoc): DocObject;
|
|
22
|
+
export declare function docObject2EditorDoc(doc: DocObject): EditorDoc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function objectToBase64(obj: Record<string, unknown>): string;
|