@ones-editor/editor 2.7.1-beta.1 → 2.8.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.
- package/@ones-editor/core/src/core/blocks/common/block-dom.d.ts +3 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/block-text.d.ts +1 -1
- package/@ones-editor/core/src/core/input-handler/actions.d.ts +4 -0
- package/@ones-editor/core/src/core/input-handler/handle-delete.d.ts +4 -0
- package/@ones-editor/core/src/core/selection/actions/index.d.ts +3 -1
- package/@ones-editor/core/src/core/selection/actions/move-block-end.d.ts +2 -0
- package/@ones-editor/core/src/core/selection/actions/move-block-start.d.ts +2 -0
- package/@ones-editor/core/src/utils/character.d.ts +1 -0
- 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/image.d.ts +5 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/index.d.ts +18 -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/plugin.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/is-binary.d.ts +14 -0
- package/@ones-editor/server-tools/src/utils/object.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +2 -2
- package/@ones-editor/ui/src/shortcuts/align-shortcuts.d.ts +2 -0
- package/@ones-editor/ui/src/shortcuts/index.d.ts +3 -2
- package/@ones-editor/ui/src/shortcuts/text-color-shortcuts.d.ts +2 -0
- package/@ones-editor/ui/src/shortcuts/text-style-shortcuts.d.ts +1 -2
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +3 -0
- package/@ones-editor/ui-base/src/color-button/index.d.ts +1 -2
- package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +2 -0
- package/dist/index.js +950 -518
- package/package.json +9 -1
|
@@ -30,8 +30,9 @@ export declare function createInsertionContentElement(insertionElement: Insertio
|
|
|
30
30
|
export declare function getInsertionContent(insertion: InsertionElement): InsertionContentElement;
|
|
31
31
|
export declare function getPrevBlock(block: BlockElement): BlockElement | null;
|
|
32
32
|
export declare function getNextBlock(block: BlockElement): BlockElement | null;
|
|
33
|
-
export declare function getPrevVisibleBlock(block: BlockElement): BlockElement | null;
|
|
34
|
-
export declare function getNextVisibleBlock(block: BlockElement): BlockElement | null;
|
|
33
|
+
export declare function getPrevVisibleBlock(block: BlockElement, matcher?: (block: BlockElement) => boolean): BlockElement | null;
|
|
34
|
+
export declare function getNextVisibleBlock(block: BlockElement, matcher?: (block: BlockElement) => boolean): BlockElement | null;
|
|
35
|
+
export declare function getBlocksBetween(start: BlockElement, end: BlockElement, matcher: (block: BlockElement) => boolean): BlockElement[];
|
|
35
36
|
export declare function getBlockIndex(block: BlockElement): number;
|
|
36
37
|
export declare function isInBlock(target: EventTarget | null): boolean;
|
|
37
38
|
export declare function isInBlockTools(target: EventTarget | null): boolean;
|
|
@@ -2,7 +2,7 @@ import { BlockElement, OnesEditor } from '../../../types';
|
|
|
2
2
|
import { DocBlockTextOp } from '../../../doc';
|
|
3
3
|
export declare function getTextAfterOffset(editor: OnesEditor, block: BlockElement, offset: number): string;
|
|
4
4
|
export declare function getTextBeforeOffset(editor: OnesEditor, block: BlockElement, offset: number): string;
|
|
5
|
-
export type OffsetCharType = 'box' | 'text' | 'space';
|
|
5
|
+
export type OffsetCharType = 'box' | 'text' | 'space' | 'cjk' | 'cjk_punctuation';
|
|
6
6
|
export interface OffsetInfo {
|
|
7
7
|
op: DocBlockTextOp;
|
|
8
8
|
charType: OffsetCharType;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { OnesEditor } from '../types';
|
|
2
2
|
export declare function editorHandleEnter(editor: OnesEditor, event: Event): boolean;
|
|
3
3
|
export declare function editorHandleDelete(editor: OnesEditor, event: Event): boolean;
|
|
4
|
+
export declare function editorHandleDeleteLeftWord(editor: OnesEditor, event: Event): boolean;
|
|
5
|
+
export declare function editorHandleDeleteRightWord(editor: OnesEditor, event: Event): boolean;
|
|
6
|
+
export declare function editorHandleDeleteAfterWords(editor: OnesEditor, event: Event): boolean;
|
|
7
|
+
export declare function editorHandleDeleteRightChar(editor: OnesEditor, event: Event): boolean;
|
|
4
8
|
export declare function editorHandleBackspace(editor: OnesEditor, event: Event): boolean;
|
|
5
9
|
export declare function editorHandleInsertBr(editor: OnesEditor, event: Event): boolean;
|
|
6
10
|
export declare function editorHandlePastePlainText(editor: OnesEditor): boolean;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { OnesEditor } from '../types';
|
|
2
2
|
export declare function handleEditorDelete(editor: OnesEditor, event: Event): void;
|
|
3
|
+
export declare function handleEditorDeleteLeftWord(editor: OnesEditor, event: Event): boolean;
|
|
4
|
+
export declare function handleEditorDeleteRightWord(editor: OnesEditor, event: Event): boolean;
|
|
5
|
+
export declare function handleEditorDeleteAfterWords(editor: OnesEditor): void;
|
|
6
|
+
export declare function handleEditorDeleteRightChar(editor: OnesEditor): void;
|
|
@@ -24,4 +24,6 @@ import { editorSelectPageUp } from './select-page-up';
|
|
|
24
24
|
import { editorSelectPageDown } from './select-page-down';
|
|
25
25
|
import { editorSelectAll, editorSelectContainer, isContainerSelectedAllChildBlocks } from './select-all';
|
|
26
26
|
import { editorSelectWord } from './select-word';
|
|
27
|
-
|
|
27
|
+
import { editorMoveBlockStart } from './move-block-start';
|
|
28
|
+
import { editorMoveBlockEnd } from './move-block-end';
|
|
29
|
+
export { editorMoveLeft, editorMoveRight, editorMoveUp, editorMoveDown, editorSelectDown, editorSelectUp, editorSelectLeft, editorSelectRight, editorSelectWord, editorMoveWordLeft, editorMoveWordEnd, editorSelectWordLeft, editorSelectWordEnd, editorMoveHome, editorMoveEnd, editorSelectHome, editorSelectEnd, editorMovePageUp, editorMovePageDown, editorSelectPageUp, editorSelectPageDown, editorSelectLineHome, editorSelectLineEnd, editorMoveLineHome, editorMoveLineEnd, editorMoveBlockStart, editorMoveBlockEnd, editorSelectAll, editorSelectContainer, isContainerSelectedAllChildBlocks, };
|
|
@@ -2,4 +2,5 @@ export declare function isNumber(str: string): boolean;
|
|
|
2
2
|
export declare function isLetter(str: string): boolean;
|
|
3
3
|
export declare function isSpace(str: string): boolean;
|
|
4
4
|
export declare function isCJK(str: string): boolean;
|
|
5
|
+
export declare function isCJKPunctuation(char: string): boolean;
|
|
5
6
|
export declare function trimChar(s: string, char: string): string;
|
|
@@ -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,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 @@
|
|
|
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,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;
|