@ones-editor/editor 2.6.8 → 2.7.0

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.
Files changed (46) hide show
  1. package/@ones-editor/server-tools/package.json +22 -0
  2. package/@ones-editor/server-tools/src/fake-browser.d.ts +1 -0
  3. package/@ones-editor/server-tools/src/from-markdown/index.d.ts +1 -0
  4. package/@ones-editor/server-tools/src/index.d.ts +2 -0
  5. package/@ones-editor/server-tools/src/to-markdown/blocks/code.d.ts +3 -0
  6. package/@ones-editor/server-tools/src/to-markdown/blocks/index.d.ts +12 -0
  7. package/@ones-editor/server-tools/src/to-markdown/blocks/list.d.ts +14 -0
  8. package/@ones-editor/server-tools/src/to-markdown/blocks/table.d.ts +3 -0
  9. package/@ones-editor/server-tools/src/to-markdown/blocks/text.d.ts +4 -0
  10. package/@ones-editor/server-tools/src/to-markdown/boxes/br.d.ts +1 -0
  11. package/@ones-editor/server-tools/src/to-markdown/boxes/date.d.ts +2 -0
  12. package/@ones-editor/server-tools/src/to-markdown/boxes/file.d.ts +11 -0
  13. package/@ones-editor/server-tools/src/to-markdown/boxes/image.d.ts +5 -0
  14. package/@ones-editor/server-tools/src/to-markdown/boxes/index.d.ts +18 -0
  15. package/@ones-editor/server-tools/src/to-markdown/boxes/known-link.d.ts +11 -0
  16. package/@ones-editor/server-tools/src/to-markdown/boxes/mathjax.d.ts +2 -0
  17. package/@ones-editor/server-tools/src/to-markdown/boxes/mention.d.ts +7 -0
  18. package/@ones-editor/server-tools/src/to-markdown/boxes/task-link.d.ts +2 -0
  19. package/@ones-editor/server-tools/src/to-markdown/convert-block.d.ts +3 -0
  20. package/@ones-editor/server-tools/src/to-markdown/convert-box.d.ts +3 -0
  21. package/@ones-editor/server-tools/src/to-markdown/embeds/drawio.d.ts +2 -0
  22. package/@ones-editor/server-tools/src/to-markdown/embeds/file-list.d.ts +5 -0
  23. package/@ones-editor/server-tools/src/to-markdown/embeds/file.d.ts +2 -0
  24. package/@ones-editor/server-tools/src/to-markdown/embeds/flowchart.d.ts +2 -0
  25. package/@ones-editor/server-tools/src/to-markdown/embeds/hr.d.ts +1 -0
  26. package/@ones-editor/server-tools/src/to-markdown/embeds/image.d.ts +18 -0
  27. package/@ones-editor/server-tools/src/to-markdown/embeds/index.d.ts +3 -0
  28. package/@ones-editor/server-tools/src/to-markdown/embeds/mathjax.d.ts +2 -0
  29. package/@ones-editor/server-tools/src/to-markdown/embeds/media.d.ts +2 -0
  30. package/@ones-editor/server-tools/src/to-markdown/embeds/mermaid.d.ts +2 -0
  31. package/@ones-editor/server-tools/src/to-markdown/embeds/plantuml.d.ts +2 -0
  32. package/@ones-editor/server-tools/src/to-markdown/embeds/plugin.d.ts +2 -0
  33. package/@ones-editor/server-tools/src/to-markdown/embeds/sub-pages.d.ts +2 -0
  34. package/@ones-editor/server-tools/src/to-markdown/embeds/task-list.d.ts +7 -0
  35. package/@ones-editor/server-tools/src/to-markdown/embeds/toc.d.ts +2 -0
  36. package/@ones-editor/server-tools/src/to-markdown/embeds/webpage.d.ts +5 -0
  37. package/@ones-editor/server-tools/src/to-markdown/embeds/xmind.d.ts +8 -0
  38. package/@ones-editor/server-tools/src/to-markdown/index.d.ts +1 -0
  39. package/@ones-editor/server-tools/src/to-markdown/types.d.ts +7 -0
  40. package/@ones-editor/server-tools/src/tools.d.ts +1 -0
  41. package/@ones-editor/server-tools/src/utils/editor-doc.d.ts +22 -0
  42. package/@ones-editor/server-tools/src/utils/is-binary.d.ts +14 -0
  43. package/@ones-editor/server-tools/src/utils/object.d.ts +1 -0
  44. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  45. package/dist/index.js +84 -23
  46. 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,2 @@
1
+ import './fake-browser';
2
+ import './tools';
@@ -0,0 +1,3 @@
1
+ import { DocBlock, DocObject } from '../../../../../@ones-editor/core';
2
+ import { Converters } from '../types';
3
+ export default function toMarkdown(converters: Converters, block: DocBlock, doc: DocObject): string;
@@ -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,3 @@
1
+ import { DocBlock, DocObject, BlockPath } from '../../../../../@ones-editor/core';
2
+ import { Converters } from '../types';
3
+ export default function toMarkdown(converters: Converters, blockData: 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,2 @@
1
+ import { DocBox } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, boxData: DocBox): 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,5 @@
1
+ import { DocBox } from '../../../../../@ones-editor/core';
2
+ export interface ImageBoxData extends DocBox {
3
+ src: string;
4
+ }
5
+ export default function convertToMarkdown(converters: unknown, boxData: DocBox): string;
@@ -0,0 +1,18 @@
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
+ import ImageBoxToMarkdown from './image';
9
+ export declare function getBoxes(): {
10
+ br: typeof BrBoxToMarkdown;
11
+ file: typeof FileBoxToMarkdown;
12
+ math: typeof MathjaxBoxToMarkdown;
13
+ mention: typeof MentionBoxToMarkdown;
14
+ date: typeof DateBoxToMarkdown;
15
+ 'task-link': typeof TaskLinkBoxToMarkdown;
16
+ 'known-link': typeof KnownLinkBoxToMarkdown;
17
+ image: typeof ImageBoxToMarkdown;
18
+ };
@@ -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,2 @@
1
+ import { DocBox } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, boxData: DocBox): string;
@@ -0,0 +1,7 @@
1
+ import { DocBox } from '../../../../../@ones-editor/core';
2
+ export interface MentionBoxData extends DocBox {
3
+ iconUrl: string;
4
+ text: string;
5
+ mentionId: string;
6
+ }
7
+ export default function convertToMarkdown(converters: unknown, boxData: DocBox): string;
@@ -0,0 +1,2 @@
1
+ import { DocBox } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, boxData: DocBox): string;
@@ -0,0 +1,3 @@
1
+ import { BlockPath, DocBlock, DocObject } from '../../../../@ones-editor/core';
2
+ import { Converters } from './types';
3
+ export declare function convertBlock(converters: Converters, blockData: DocBlock, doc: DocObject, path: BlockPath): string;
@@ -0,0 +1,3 @@
1
+ import { DocBox, DocObject } from '../../../../@ones-editor/core';
2
+ import { Converters } from './types';
3
+ export declare function convertBox(converters: Converters, boxData: DocBox, doc: DocObject): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,5 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export interface FileListEmbedData {
3
+ cardUuid: string;
4
+ }
5
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): 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,3 @@
1
+ import { DocBlock, DocObject } from '../../../../../@ones-editor/core';
2
+ import { Converters } from '../types';
3
+ export default function toMarkdown(converters: Converters, block: DocBlock, doc: DocObject): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): 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,2 @@
1
+ import { DocEmbedBlock } from '../../../../../@ones-editor/core';
2
+ export default function convertToMarkdown(converters: unknown, blockData: DocEmbedBlock): string;
@@ -0,0 +1,5 @@
1
+ import { DocEmbedBlock, DocEmbedData } from '../../../../../@ones-editor/core';
2
+ export interface WebPageEmbedData extends DocEmbedData {
3
+ src: string;
4
+ }
5
+ 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,14 @@
1
+ /// <reference types="node" />
2
+ export interface EncodingOpts {
3
+ /** Defaults to 24 */
4
+ chunkLength?: number;
5
+ /** If not provided, will check the start, beginning, and end */
6
+ chunkBegin?: number;
7
+ }
8
+ /**
9
+ * Get the encoding of a buffer.
10
+ * Checks the start, middle, and end of the buffer for characters that are unrecognized within UTF8 encoding.
11
+ * History has shown that inspection at all three locations is necessary.
12
+ * @returns Will be `null` if `buffer` was not provided. Otherwise will be either `'utf8'` or `'binary'`
13
+ */
14
+ export declare function getEncoding(buffer: Buffer | null, opts?: EncodingOpts): 'utf8' | 'binary' | null;
@@ -0,0 +1 @@
1
+ export declare function objectToBase64(obj: Record<string, unknown>): string;