@ones-editor/editor 0.0.3-beta.2 → 0.0.3-beta.21
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/block-locker/src/i18n/en-US.d.ts +8 -0
- package/@ones-editor/{core/src/utils/logger/fake-process.d.ts → block-locker/src/i18n/index.d.ts} +0 -0
- package/@ones-editor/block-locker/src/i18n/zh-CN.d.ts +8 -0
- package/@ones-editor/block-locker/src/index.d.ts +2 -0
- package/@ones-editor/block-menu/src/block-menu/index.d.ts +1 -0
- package/@ones-editor/block-menu/src/block-menu/items/text-styles/text-style-item.d.ts +4 -3
- package/@ones-editor/comments/src/actions/add-comment-to-block.d.ts +3 -2
- package/@ones-editor/comments/src/actions/add-comment-to-text-block.d.ts +2 -1
- package/@ones-editor/comments/src/actions/editor-add-comment.d.ts +2 -0
- package/@ones-editor/comments/src/block-hook/index.d.ts +3 -1
- package/@ones-editor/comments/src/comment-editor/index.d.ts +3 -5
- package/@ones-editor/comments/src/comment-input-handler/index.d.ts +2 -10
- package/@ones-editor/comments/src/comment-input-handler/input-handler.d.ts +11 -0
- package/@ones-editor/comments/src/comment-input-handler/quick-reply-input-handler.d.ts +7 -0
- package/@ones-editor/comments/src/comment-item/comment-item.d.ts +1 -0
- package/@ones-editor/comments/src/comment-item/index.d.ts +1 -0
- package/@ones-editor/comments/src/comment-item/mobile-comment-item/index.d.ts +1 -0
- package/@ones-editor/comments/src/comment-item/mobile-comment-item/mobile-comment-item.d.ts +18 -0
- package/@ones-editor/comments/src/comments/comments.d.ts +11 -7
- package/@ones-editor/comments/src/comments-button/index.d.ts +3 -1
- package/@ones-editor/comments/src/comments-helper/utils.d.ts +2 -1
- package/@ones-editor/comments/src/comments-list/comments-list.d.ts +1 -9
- package/@ones-editor/comments/src/comments-list/group-list.d.ts +0 -1
- package/@ones-editor/comments/src/comments-list/index.d.ts +1 -0
- package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -5
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/children-list.d.ts +17 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/group-item.d.ts +30 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/group-list.d.ts +29 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/index.d.ts +1 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +28 -0
- package/@ones-editor/comments/src/constant/index.d.ts +1 -1
- package/@ones-editor/comments/src/index.d.ts +1 -1
- package/@ones-editor/comments/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/comments/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/comments/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/comments/src/text-comments/comments-command-provider.d.ts +3 -1
- package/@ones-editor/comments/src/types.d.ts +11 -15
- package/@ones-editor/core/src/common/index.d.ts +2 -2
- package/@ones-editor/core/src/core/converter/block-to-doc.d.ts +1 -1
- package/@ones-editor/core/src/core/converter/selected-block-to-doc.d.ts +3 -1
- package/@ones-editor/core/src/core/doc/rich-text/insert-text.d.ts +2 -1
- package/@ones-editor/core/src/core/editor/actions/break-text-block.d.ts +2 -0
- package/@ones-editor/core/src/core/editor/editor-dom/dom-events.d.ts +3 -3
- package/@ones-editor/core/src/core/input-handler/remove-quoted.d.ts +2 -0
- package/@ones-editor/core/src/core/types.d.ts +18 -6
- package/@ones-editor/core/src/utils/file.d.ts +3 -0
- package/@ones-editor/core/src/utils/logger/index.d.ts +0 -3
- package/@ones-editor/drawio-embed/src/helper/default-style.d.ts +1 -0
- package/@ones-editor/drop-target/src/drop-indicator.d.ts +1 -0
- package/@ones-editor/drop-target/src/drop-target.d.ts +1 -1
- package/@ones-editor/drop-target/src/handlers/drag-file.d.ts +8 -0
- package/@ones-editor/e2e/cypress/support/commands.d.ts +25 -0
- package/@ones-editor/e2e/cypress/support/e2e.d.ts +1 -0
- package/@ones-editor/e2e/cypress.config.d.ts +3 -0
- package/@ones-editor/e2e/package.json +13 -0
- package/@ones-editor/e2e/src/block-menu/case.d.ts +17 -0
- package/@ones-editor/e2e/src/block-menu/menu.cy.d.ts +1 -0
- package/@ones-editor/e2e/src/data.d.ts +131 -0
- package/@ones-editor/e2e/src/input-handlers/case.d.ts +10 -0
- package/@ones-editor/e2e/src/input-handlers/shortcut.cy.d.ts +1 -0
- package/@ones-editor/e2e/src/list-block/case.d.ts +8 -0
- package/@ones-editor/e2e/src/list-block/list.cy.d.ts +1 -0
- package/@ones-editor/e2e/src/toc/case.d.ts +5 -0
- package/@ones-editor/e2e/src/toc/toc.cy.d.ts +1 -0
- package/@ones-editor/embed-block-helper/src/block-properties/embed-block-properties.d.ts +1 -0
- package/@ones-editor/file/package.json +8 -0
- package/@ones-editor/file/src/file-box/index.d.ts +4 -0
- package/@ones-editor/file/src/file-embed/card/file-icon.d.ts +1 -0
- package/@ones-editor/file/src/file-embed/card/index.d.ts +6 -0
- package/@ones-editor/file/src/file-embed/download-file.d.ts +2 -0
- package/@ones-editor/file/src/file-embed/index.d.ts +4 -0
- package/@ones-editor/file/src/index.d.ts +3 -0
- package/@ones-editor/file/src/types.d.ts +22 -0
- package/@ones-editor/find-dialog/src/find-dialog.d.ts +0 -1
- package/@ones-editor/heading-collapse/src/doc-event/index.d.ts +1 -1
- package/@ones-editor/heading-collapse/src/heading-collapse-button/drop-handler.d.ts +1 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +5 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +1 -1
- package/@ones-editor/list-block/src/drop/index.d.ts +1 -1
- package/@ones-editor/list-block/src/lang/en-us.d.ts +3 -0
- package/@ones-editor/list-block/src/lang/zh-cn.d.ts +3 -0
- package/@ones-editor/mention/src/block-mention.d.ts +10 -0
- package/@ones-editor/mention/src/dom/mention-button.d.ts +2 -0
- package/@ones-editor/mention/src/index.d.ts +2 -1
- package/@ones-editor/scroll-container/src/observer/locating-resize-observer.d.ts +12 -0
- package/@ones-editor/scroll-container/src/scroll-listener.d.ts +1 -0
- package/@ones-editor/table-block/src/table-block/doc-table-data.d.ts +1 -1
- package/@ones-editor/table-block/src/table-block/table-resize/resize-gripper.d.ts +1 -1
- package/@ones-editor/templates/package.json +9 -0
- package/@ones-editor/templates/src/index.d.ts +4 -0
- package/@ones-editor/templates/src/locale/en-us.d.ts +9 -0
- package/@ones-editor/templates/src/locale/index.d.ts +1 -0
- package/@ones-editor/templates/src/locale/zh-cn.d.ts +9 -0
- package/@ones-editor/templates/src/templates/select-template.d.ts +8 -0
- package/@ones-editor/templates/src/templates/types.d.ts +14 -0
- package/@ones-editor/toc/src/heading-scroll/index.d.ts +22 -0
- package/@ones-editor/toc/src/heading-scroll/utils.d.ts +7 -0
- package/@ones-editor/toc/src/index.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +3 -1
- package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +2 -4
- package/@ones-editor/ui/src/quick-menu/index.d.ts +1 -6
- package/@ones-editor/ui/src/quick-menu/insert-empty-block.d.ts +4 -2
- package/@ones-editor/ui/src/quick-menu/types.d.ts +24 -1
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +0 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
- package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +2 -1
- package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
- package/dist/comments/comments-provider.d.ts +2 -2
- package/dist/comments/create-comment-editor.d.ts +1 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +374 -29441
- package/dist/types.d.ts +10 -2
- package/package.json +5 -2
|
@@ -49,12 +49,21 @@ export interface ComplexBlockPosition {
|
|
|
49
49
|
isSimple: () => false;
|
|
50
50
|
}
|
|
51
51
|
export type BlockPosition = SimpleBlockPosition | ComplexBlockPosition;
|
|
52
|
+
export interface BoxCommands {
|
|
53
|
+
group: string;
|
|
54
|
+
commands: CommandItem[];
|
|
55
|
+
executeCommand: (editor: OnesEditor, block: BlockElement, box: BoxElement, item: CommandItem) => unknown;
|
|
56
|
+
}
|
|
57
|
+
export interface BoxProperties {
|
|
58
|
+
boxCommands?: Record<string, BoxCommands>;
|
|
59
|
+
}
|
|
52
60
|
export interface Box {
|
|
53
61
|
boxType: string;
|
|
54
62
|
updateBoxContent: (editor: OnesEditor, boxElement: BoxElement, boxContent: BoxContentElement, boxData: DocBox) => void;
|
|
55
63
|
convertFrom?: (editor: OnesEditor, text: string) => DocBox | null;
|
|
56
64
|
handleClickBox?: (editor: OnesEditor, box: BoxElement, event: MouseEvent) => void;
|
|
57
65
|
toStandardText?: (editor: OnesEditor, box: DocBox) => Promise<DocBlockText | undefined>;
|
|
66
|
+
getBoxProperties?: (editor: OnesEditor, boxElement: BoxElement) => BoxProperties;
|
|
58
67
|
}
|
|
59
68
|
export interface Insertion {
|
|
60
69
|
insertionType: string;
|
|
@@ -79,8 +88,8 @@ export interface Embed {
|
|
|
79
88
|
getOptions?: (editor: OnesEditor) => EmbedOptions;
|
|
80
89
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
81
90
|
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocEmbedBlock) => boolean;
|
|
82
|
-
handleDropOver?: (editor: OnesEditor, block: BlockElement,
|
|
83
|
-
handleDrop?: (editor: OnesEditor, block: BlockElement,
|
|
91
|
+
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
|
|
92
|
+
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
|
|
84
93
|
convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
|
|
85
94
|
offset: number;
|
|
86
95
|
data?: DocBlockAttributes;
|
|
@@ -109,7 +118,7 @@ export interface CommandItem {
|
|
|
109
118
|
value?: string;
|
|
110
119
|
order?: number;
|
|
111
120
|
type?: CommandItemType;
|
|
112
|
-
element?: HTMLElement;
|
|
121
|
+
element?: HTMLElement | ((item: CommandItem) => HTMLElement);
|
|
113
122
|
icon?: string;
|
|
114
123
|
childrenType?: 'menu' | 'toolbar';
|
|
115
124
|
children?: CommandItem[];
|
|
@@ -121,6 +130,8 @@ export interface CommandItem {
|
|
|
121
130
|
manualShowChildren?: boolean;
|
|
122
131
|
childrenPlacement?: CommandItemChildrenPlacement;
|
|
123
132
|
childrenOffset?: [number, number];
|
|
133
|
+
shortcut?: string;
|
|
134
|
+
defaultCheckedChildren?: string[];
|
|
124
135
|
setCloseable?: (closeable: Closeable) => void;
|
|
125
136
|
beforePopup?: (parent: unknown) => void;
|
|
126
137
|
}
|
|
@@ -194,8 +205,8 @@ export interface Block {
|
|
|
194
205
|
handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
|
|
195
206
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
196
207
|
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
|
|
197
|
-
handleDropOver?: (editor: OnesEditor, block: BlockElement,
|
|
198
|
-
handleDrop?: (editor: OnesEditor, block: BlockElement,
|
|
208
|
+
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
|
|
209
|
+
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
|
|
199
210
|
getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
|
|
200
211
|
getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
|
|
201
212
|
convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
|
|
@@ -334,6 +345,7 @@ export interface OnesEditorDataConverters {
|
|
|
334
345
|
export interface BreakTextOptions {
|
|
335
346
|
forceInsertAfter?: boolean;
|
|
336
347
|
newBlockData?: DocBlock;
|
|
348
|
+
copyBlockAttributes?: boolean;
|
|
337
349
|
}
|
|
338
350
|
export interface OnesEditorEvents {
|
|
339
351
|
'docChanged': (editor: OnesEditor) => void;
|
|
@@ -411,7 +423,7 @@ export interface CloneBlockResultInfo {
|
|
|
411
423
|
blockIdMap: Map<string, string>;
|
|
412
424
|
}
|
|
413
425
|
export interface OnesEditorDomEvents extends OnesEditorCustom {
|
|
414
|
-
addEventListener: (element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event:
|
|
426
|
+
addEventListener: <T = Event>(element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event: T) => void) => void;
|
|
415
427
|
removeEventListener: (element: Element | Document | Window | null, eventName: string | null, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
|
|
416
428
|
removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
|
|
417
429
|
}
|
|
@@ -4,4 +4,7 @@ interface SelectFileOptions {
|
|
|
4
4
|
export declare function selectFile<T extends SelectFileOptions = SelectFileOptions>(accept: string, options?: T): Promise<T extends {
|
|
5
5
|
multiple: true;
|
|
6
6
|
} ? File[] : File>;
|
|
7
|
+
export declare function isDraggingFiles(v: unknown): v is File[];
|
|
8
|
+
export declare function getFileExt(file: string): string;
|
|
9
|
+
export declare function requestDownload(downloadUrl: string, fileName?: string): void;
|
|
7
10
|
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import './fake-process';
|
|
2
|
-
declare const customChalk: import("chalk").Chalk;
|
|
3
1
|
export declare class Logger {
|
|
4
2
|
private category;
|
|
5
3
|
private times;
|
|
@@ -17,4 +15,3 @@ export declare class Logger {
|
|
|
17
15
|
static setExtParams(params: string): void;
|
|
18
16
|
}
|
|
19
17
|
export declare function getLogger(category: string): Logger;
|
|
20
|
-
export { customChalk as chalk };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_STYLES = "\n<mxStylesheet>\n<add as=\"defaultVertex\">\n<add as=\"shape\" value=\"label\"/>\n<add as=\"perimeter\" value=\"rectanglePerimeter\"/>\n<add as=\"fontSize\" value=\"12\"/>\n<add as=\"fontFamily\" value=\"Helvetica\"/>\n<add as=\"align\" value=\"center\"/>\n<add as=\"verticalAlign\" value=\"middle\"/>\n<add as=\"fillColor\" value=\"#ffffff\"/>\n<add as=\"strokeColor\" value=\"#000000\"/>\n<add as=\"fontColor\" value=\"#000000\"/>\n</add>\n<add as=\"defaultEdge\">\n<add as=\"shape\" value=\"connector\"/>\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"endArrow\" value=\"classic\"/>\n<add as=\"fontSize\" value=\"11\"/>\n<add as=\"fontFamily\" value=\"Helvetica\"/>\n<add as=\"align\" value=\"center\"/>\n<add as=\"verticalAlign\" value=\"middle\"/>\n<add as=\"rounded\" value=\"1\"/>\n<add as=\"strokeColor\" value=\"#000000\"/>\n<add as=\"fontColor\" value=\"#000000\"/>\n</add>\n<add as=\"text\">\n<add as=\"fillColor\" value=\"none\"/>\n<add as=\"gradientColor\" value=\"none\"/>\n<add as=\"strokeColor\" value=\"none\"/>\n<add as=\"align\" value=\"left\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n</add>\n<add as=\"edgeLabel\" extend=\"text\">\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"fontSize\" value=\"11\"/>\n</add>\n<add as=\"label\">\n<add as=\"fontStyle\" value=\"1\"/>\n<add as=\"align\" value=\"left\"/>\n<add as=\"verticalAlign\" value=\"middle\"/>\n<add as=\"spacing\" value=\"2\"/>\n<add as=\"spacingLeft\" value=\"52\"/>\n<add as=\"imageWidth\" value=\"42\"/>\n<add as=\"imageHeight\" value=\"42\"/>\n<add as=\"rounded\" value=\"1\"/>\n</add>\n<add as=\"icon\" extend=\"label\">\n<add as=\"align\" value=\"center\"/>\n<add as=\"imageAlign\" value=\"center\"/>\n<add as=\"verticalLabelPosition\" value=\"bottom\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"spacingTop\" value=\"4\"/>\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"spacing\" value=\"0\"/>\n<add as=\"spacingLeft\" value=\"0\"/>\n<add as=\"spacingTop\" value=\"6\"/>\n<add as=\"fontStyle\" value=\"0\"/>\n<add as=\"imageWidth\" value=\"48\"/>\n<add as=\"imageHeight\" value=\"48\"/>\n</add>\n<add as=\"swimlane\">\n<add as=\"shape\" value=\"swimlane\"/>\n<add as=\"fontSize\" value=\"12\"/>\n<add as=\"fontStyle\" value=\"1\"/>\n<add as=\"startSize\" value=\"23\"/>\n</add>\n<add as=\"group\">\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"fillColor\" value=\"none\"/>\n<add as=\"strokeColor\" value=\"none\"/>\n<add as=\"gradientColor\" value=\"none\"/>\n<add as=\"pointerEvents\" value=\"0\"/>\n</add>\n<add as=\"ellipse\">\n<add as=\"shape\" value=\"ellipse\"/>\n<add as=\"perimeter\" value=\"ellipsePerimeter\"/>\n</add>\n<add as=\"rhombus\">\n<add as=\"shape\" value=\"rhombus\"/>\n<add as=\"perimeter\" value=\"rhombusPerimeter\"/>\n</add>\n<add as=\"triangle\">\n<add as=\"shape\" value=\"triangle\"/>\n<add as=\"perimeter\" value=\"trianglePerimeter\"/>\n</add>\n<add as=\"line\">\n<add as=\"shape\" value=\"line\"/>\n<add as=\"strokeWidth\" value=\"4\"/>\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"spacingTop\" value=\"8\"/>\n</add>\n<add as=\"image\">\n<add as=\"shape\" value=\"image\"/>\n<add as=\"labelBackgroundColor\" value=\"white\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"verticalLabelPosition\" value=\"bottom\"/>\n</add>\n<add as=\"roundImage\" extend=\"image\">\n<add as=\"perimeter\" value=\"ellipsePerimeter\"/>\n</add>\n<add as=\"rhombusImage\" extend=\"image\">\n<add as=\"perimeter\" value=\"rhombusPerimeter\"/>\n</add>\n<add as=\"arrow\">\n<add as=\"shape\" value=\"arrow\"/>\n<add as=\"edgeStyle\" value=\"none\"/>\n<add as=\"fillColor\" value=\"#ffffff\"/>\n</add>\n</mxStylesheet>\n";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BlockElement, ContainerElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
import DropIndicator from './drop-indicator';
|
|
3
3
|
export interface DropHandler {
|
|
4
|
-
handleDrop: (editor: OnesEditor,
|
|
4
|
+
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
5
5
|
}
|
|
6
6
|
export default class OnesEditorDropTarget {
|
|
7
7
|
private editor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OnesEditor, ContainerElement, BlockElement } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { DropHandler } from '../drop-target';
|
|
3
|
+
export declare class DropFileHandler implements DropHandler {
|
|
4
|
+
private editor;
|
|
5
|
+
constructor(editor: OnesEditor);
|
|
6
|
+
private getEmbedClassByFile;
|
|
7
|
+
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
declare namespace Cypress {
|
|
4
|
+
interface Chainable {
|
|
5
|
+
getBlocksByType: (blockType: string) => Chainable<Element>;
|
|
6
|
+
clearAllNoteByKeyboard: () => void;
|
|
7
|
+
getBlockContent: () => Chainable<Element>;
|
|
8
|
+
getBlockContentByBlockId: (blockId: string) => Chainable<Element>;
|
|
9
|
+
cacheBlock: (blockType: string, block: BlockCache) => Chainable<JQuery>;
|
|
10
|
+
createHeadingByShortcut: (blockId: string, level: number, title: string) => Chainable<Element>;
|
|
11
|
+
getMenuItemByDataId: (dataId: string) => Chainable<Element>;
|
|
12
|
+
clickBlockMenuButton: (dataId: string) => Chainable<JQuery>;
|
|
13
|
+
getBlockMenuButton: (dataId: string) => Chainable<JQuery>;
|
|
14
|
+
checkTextStyle: (blockId: string, checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string) => Chainable<JQuery>;
|
|
15
|
+
checkTextColer: (blockId: string, checkSpanIndex: number, expectedClassValue: string, expectBlockAttr: string, expectBlockAttrValue: string, expectedTextValue: string) => Chainable<JQuery>;
|
|
16
|
+
checkHeadingStyle: (blockId: string, expectBlockAttr: string, expectBlockAttrValue: string) => Chainable<JQuery>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
interface BlockCache {
|
|
20
|
+
TitleBlockId: string;
|
|
21
|
+
BlockCacheMap: Map<string, string[]>;
|
|
22
|
+
setBlock(blockType: string, blockId: string): void;
|
|
23
|
+
getLastBlockId(blockType: string): string;
|
|
24
|
+
setTitleBlockId(blockId: string): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './commands';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ones-editor/e2e",
|
|
3
|
+
"private": "true",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "cypress open",
|
|
9
|
+
"e2e-headless": "node ./scripts/e2e-run-tests.js",
|
|
10
|
+
"test-mobile": "cypress open --config viewportWidth=390,viewportHeight=844"
|
|
11
|
+
},
|
|
12
|
+
"types": "src/index.d.ts"
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseAssertion } from '../data';
|
|
2
|
+
declare class Item {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
shortcut: string;
|
|
6
|
+
constructor(id: string, name: string, shortcut: string);
|
|
7
|
+
}
|
|
8
|
+
export declare const items: Map<string, Item>;
|
|
9
|
+
export declare class BlockMenuCase {
|
|
10
|
+
/**
|
|
11
|
+
* howToOpen : clickToOpen | shortcutToOpen:default
|
|
12
|
+
* @returns null
|
|
13
|
+
*/
|
|
14
|
+
checkBlockMenuItem: (howToOpen: string, block: string) => () => void;
|
|
15
|
+
checkBlockMenuButton: (button: string, assertData: BaseAssertion) => () => void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'cypress-real-events';
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export declare class BlockCache {
|
|
2
|
+
TitleBlockId: string;
|
|
3
|
+
BlockCacheMap: Map<string, string[]>;
|
|
4
|
+
constructor();
|
|
5
|
+
setBlock(blockType: string, blockId: string): Map<string, string[]>;
|
|
6
|
+
getLastBlockId(blockType: string): string;
|
|
7
|
+
setTitleBlockId(blockId: string): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class BaseAssertion {
|
|
10
|
+
}
|
|
11
|
+
export declare class TestHeadingStyleData extends BaseAssertion {
|
|
12
|
+
key: string;
|
|
13
|
+
inputStr: string;
|
|
14
|
+
expected: string;
|
|
15
|
+
expectedPlaceholder: string;
|
|
16
|
+
constructor(key: string, inputStr: string, expected: string, expectedPlaceholder: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class CheckBlockData extends BaseAssertion {
|
|
19
|
+
expectBlockAttr: string;
|
|
20
|
+
expectBlockAttrValue: string;
|
|
21
|
+
constructor(expectBlockAttr: string, expectBlockAttrValue: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class CheckTextStyleData extends BaseAssertion {
|
|
24
|
+
checkSpanIndex: number;
|
|
25
|
+
expectedClassValue: string;
|
|
26
|
+
expectedTextValue: string;
|
|
27
|
+
constructor(checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string);
|
|
28
|
+
}
|
|
29
|
+
export declare class TestTextStyleData extends CheckTextStyleData {
|
|
30
|
+
inputStr: string;
|
|
31
|
+
constructor(inputStr: string, checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string);
|
|
32
|
+
}
|
|
33
|
+
export declare class CheckTextColerData extends CheckTextStyleData {
|
|
34
|
+
attr: string;
|
|
35
|
+
attrValue: string;
|
|
36
|
+
constructor(attr: string, attrValue: string, checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string);
|
|
37
|
+
}
|
|
38
|
+
export declare const docTestBlockStyle = "block-style";
|
|
39
|
+
export declare const blockCache: BlockCache;
|
|
40
|
+
export declare const TEXT_BLOCK_ATTRIBUTE: {
|
|
41
|
+
PLACE_HOLDER: {
|
|
42
|
+
KEY: string;
|
|
43
|
+
DEFAULT: string;
|
|
44
|
+
HEADING1: string;
|
|
45
|
+
HEADING2: string;
|
|
46
|
+
HEADING3: string;
|
|
47
|
+
HEADING4: string;
|
|
48
|
+
HEADING5: string;
|
|
49
|
+
HEADING6: string;
|
|
50
|
+
HEADING7: string;
|
|
51
|
+
HEADING8: string;
|
|
52
|
+
};
|
|
53
|
+
STYLE_HEADING: {
|
|
54
|
+
KEY: string;
|
|
55
|
+
};
|
|
56
|
+
STYLE_QUOTE: {
|
|
57
|
+
QUOTECLASSNAME: string;
|
|
58
|
+
};
|
|
59
|
+
STYLE_ALIGN: {
|
|
60
|
+
ALIGN: string;
|
|
61
|
+
};
|
|
62
|
+
STYLE_COLER: {
|
|
63
|
+
TC_COLER: string;
|
|
64
|
+
BC_CLOER: string;
|
|
65
|
+
};
|
|
66
|
+
STYLE_TEXT: {
|
|
67
|
+
BoldStyleClass: string;
|
|
68
|
+
BoldAndItalicStyleClass: string;
|
|
69
|
+
ItalicStyleClass: string;
|
|
70
|
+
CodeStyleClass: string;
|
|
71
|
+
StrikeThrough: string;
|
|
72
|
+
SubscriptCLass: string;
|
|
73
|
+
SuperscriptClass: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export declare const LIST_BLOCK_ATTRIBUTE: {
|
|
77
|
+
PLACE_HOLDER: {
|
|
78
|
+
KEY: string;
|
|
79
|
+
LIST: string;
|
|
80
|
+
};
|
|
81
|
+
LEVEL: string;
|
|
82
|
+
START: string;
|
|
83
|
+
GROUP_ID: string;
|
|
84
|
+
LISTTYPE: string;
|
|
85
|
+
VALUE: {
|
|
86
|
+
LISTTYPE_ORDERED: string;
|
|
87
|
+
LISTTYPE_UNORDERED: string;
|
|
88
|
+
LISTTYPE_CHECKED: string;
|
|
89
|
+
LISTTYPE_UNCHECKED: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export declare const CODE_BLOCK_ATTRIBUTE: {
|
|
93
|
+
DATA_LANGUAGE: string;
|
|
94
|
+
LANGUAGE_PLAIN: string;
|
|
95
|
+
LANGUAGE_GOLANG: string;
|
|
96
|
+
LANGUAGE_JAVA: string;
|
|
97
|
+
LANGUAGE_JAVASCRIPT: string;
|
|
98
|
+
LANGUAGE_HTML_XML: string;
|
|
99
|
+
};
|
|
100
|
+
export declare const EMBED_BLOCK_ATTRIBUTE: {
|
|
101
|
+
HR: {
|
|
102
|
+
TYPE: string;
|
|
103
|
+
CLASS: string;
|
|
104
|
+
};
|
|
105
|
+
MERMAID: {
|
|
106
|
+
TYPE: string;
|
|
107
|
+
EMPTY_TIPS: string;
|
|
108
|
+
EMPTY_REPLACE: string;
|
|
109
|
+
ARIA_EXPANDED: string;
|
|
110
|
+
IMAGE_CLASS: string;
|
|
111
|
+
};
|
|
112
|
+
PLANTUML: {
|
|
113
|
+
TYPE: string;
|
|
114
|
+
EMPTY_TIPS: string;
|
|
115
|
+
EMPTY_REPLACE: string;
|
|
116
|
+
ARIA_EXPANDED: string;
|
|
117
|
+
IMAGE_CLASS: string;
|
|
118
|
+
};
|
|
119
|
+
TOC: {
|
|
120
|
+
TYPE: string;
|
|
121
|
+
CONTAINER_CLASS: string;
|
|
122
|
+
EMPTY_REPLACE: string;
|
|
123
|
+
EMPTY_CLASS: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export declare class TocNode {
|
|
127
|
+
children: TocNode[];
|
|
128
|
+
title: string;
|
|
129
|
+
level: number;
|
|
130
|
+
block: string;
|
|
131
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TestHeadingStyleData, TestTextStyleData } from '../data';
|
|
2
|
+
export declare class ShortcutCase {
|
|
3
|
+
testHeadingStyleShortcut: (data: TestHeadingStyleData) => () => void;
|
|
4
|
+
testShortcutMethod: (data: TestTextStyleData) => () => void;
|
|
5
|
+
testQuoteBlockStyleShortcut: () => () => void;
|
|
6
|
+
testEmberStyleBrShortcut: () => () => void;
|
|
7
|
+
testEmberStyleMermaidPlantumlShortcut: (input: string, embedType: string, emptyReplace: string) => () => void;
|
|
8
|
+
testListBlockStyleShortcut: (input: string, expected: string, start: number, level: number) => () => void;
|
|
9
|
+
testCodeBlockShortcut: (input: string, expected: string) => () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'cypress-real-events';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'cypress-real-events';
|
|
2
|
+
export declare class ListCase {
|
|
3
|
+
OrderListCreate: () => () => void;
|
|
4
|
+
OrderListAddLevel: () => () => void;
|
|
5
|
+
OrderListFirstNodeAddLevel: () => () => void;
|
|
6
|
+
OrderListSoluction4: () => () => void;
|
|
7
|
+
OrderListPalceholder: () => () => void;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'cypress-real-events';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'cypress-real-events';
|
|
@@ -5,6 +5,7 @@ export interface StandardEmbedBlockProperties<T = PresetCommandId> {
|
|
|
5
5
|
extCommands?: CommandItem[];
|
|
6
6
|
handleExecuteCommand?: (editor: OnesEditor, block: BlockElement, item: CommandItem) => boolean;
|
|
7
7
|
}
|
|
8
|
+
export declare function addCommentToBlock(editor: OnesEditor, block: BlockElement): boolean;
|
|
8
9
|
export declare class StandardEmbedBlockCommands<T = PresetCommandId> implements BlockCommands {
|
|
9
10
|
protected editor: OnesEditor;
|
|
10
11
|
protected properties?: StandardEmbedBlockProperties<T> | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getFileIcon(fileName: string, fileType: string): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BlockContentElement } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { FileEmbedData } from '../../types';
|
|
3
|
+
export declare function renderFileCard(content: BlockContentElement, data: FileEmbedData): {
|
|
4
|
+
card: HTMLDivElement;
|
|
5
|
+
downloadButton: HTMLButtonElement;
|
|
6
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BlockElement, BoxElement, DocBox, DocEmbedData, OnesEditor } from '../../../@ones-editor/core';
|
|
2
|
+
export 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 declare enum FilePreviewType {
|
|
11
|
+
Card = "card",
|
|
12
|
+
Preview = "preview"
|
|
13
|
+
}
|
|
14
|
+
export interface FileEmbedData extends DocEmbedData, FileData {
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
previewType?: FilePreviewType;
|
|
18
|
+
}
|
|
19
|
+
export interface FileOptions {
|
|
20
|
+
onClick?: (editor: OnesEditor, elem: BlockElement | BoxElement, event: MouseEvent) => void;
|
|
21
|
+
onDownloadFile?: (editor: OnesEditor, data: FileData) => void;
|
|
22
|
+
}
|
|
@@ -4,5 +4,5 @@ export declare class HeadingBlockDocEvents implements OnesEditorDocCallbacks {
|
|
|
4
4
|
constructor(editor: OnesEditor);
|
|
5
5
|
onInsertBlock(containerId: string, blockIndex: number, blockData: DocBlock, local: boolean): void;
|
|
6
6
|
onUpdateBlockData(containerId: string, blockIndex: number, delta: DocBlockDelta, local: boolean): void;
|
|
7
|
-
updateBlockIfNeeded(blockId: string): void;
|
|
7
|
+
updateBlockIfNeeded(blockId: string, delta?: DocBlockDelta): void;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropHandler } from '../../../../@ones-editor/drop-target';
|
|
2
2
|
import { OnesEditor, BlockElement, ContainerElement } from '../../../../@ones-editor/core';
|
|
3
3
|
export default class HeadingBlockDropHandler implements DropHandler {
|
|
4
|
-
handleDrop(editor: OnesEditor,
|
|
4
|
+
handleDrop(editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number): boolean | undefined;
|
|
5
5
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { BlockElement, DragObject, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
2
|
import { ImageDragInsertPos } from './types';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function getDragInsertPos(editor: OnesEditor, block: BlockElement, images: HTMLElement[], x: number, y?: number): {
|
|
4
|
+
rect: DOMRect;
|
|
5
|
+
data: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function handleDropOver(editor: OnesEditor, block: BlockElement, dragObject: DragObject | null, x: number, y: number): ImageDragInsertPos | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { BlockElement, DragObject, DropInsertPos, DropOptions, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
export declare function handleDrop(editor: OnesEditor, block: BlockElement,
|
|
2
|
+
export declare function handleDrop(editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions): boolean | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { OnesEditor, BlockElement, DragObject, DropInsertPos, DropOptions } from '../../../../@ones-editor/core';
|
|
2
|
-
export declare function handleListDrop(editor: OnesEditor, block: BlockElement,
|
|
2
|
+
export declare function handleListDrop(editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OnesEditorCustom, OnesEditor } from '../../../@ones-editor/core';
|
|
2
|
+
export default class OnesEditorBlockMention implements OnesEditorCustom {
|
|
3
|
+
private editor;
|
|
4
|
+
mentionButton: HTMLButtonElement;
|
|
5
|
+
constructor(editor: OnesEditor);
|
|
6
|
+
private shouldBlockShowMention;
|
|
7
|
+
private handleHoveringBlock;
|
|
8
|
+
private handleMouseDown;
|
|
9
|
+
destroy: () => void;
|
|
10
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import OnesEditorMention from './mention';
|
|
2
2
|
import MentionBox from './mention-box';
|
|
3
|
+
import OnesEditorBlockMention from './block-mention';
|
|
3
4
|
import './mention-style.scss';
|
|
4
|
-
export { OnesEditorMention, MentionBox };
|
|
5
|
+
export { OnesEditorMention, MentionBox, OnesEditorBlockMention };
|
|
5
6
|
export * from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScrollContainerElement, ScrollCore } from '../common-types';
|
|
2
|
+
export declare class LocatingContainerResizeObserver {
|
|
3
|
+
private scrollCore;
|
|
4
|
+
private resizeObserver;
|
|
5
|
+
private scrollContainersMap;
|
|
6
|
+
constructor(scrollCore: ScrollCore);
|
|
7
|
+
private handleResizeEntry;
|
|
8
|
+
private handleResize;
|
|
9
|
+
bind(scrollContainer: ScrollContainerElement): void;
|
|
10
|
+
unbind(scrollContainer: ScrollContainerElement): void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
@@ -12,6 +12,7 @@ export declare class ScrollListener extends TypedEmitter<ChildEvents> implements
|
|
|
12
12
|
private containerScrollObserver;
|
|
13
13
|
private parentContainerScrollObserver;
|
|
14
14
|
private scrollWrapResizeObserve;
|
|
15
|
+
private locatingContainerResizeObserver;
|
|
15
16
|
private isWindowEventBind;
|
|
16
17
|
containers: ScrollCore['containers'];
|
|
17
18
|
constructor(parentContainer: ParentContainerElement);
|
|
@@ -8,4 +8,4 @@ export declare function getExistsResizeGripper(editor: OnesEditor, block: BlockE
|
|
|
8
8
|
export declare function createResizeGripper(editor: OnesEditor, block: BlockElement): HTMLDivElement;
|
|
9
9
|
export declare function updateResizeGripper(editor: OnesEditor, block: BlockElement, cell: HTMLTableCellElement): void;
|
|
10
10
|
export declare function removeAllResizeGripper(editor: OnesEditor): void;
|
|
11
|
-
export declare function setTableColumnWidths(editor: OnesEditor, block: BlockElement,
|
|
11
|
+
export declare function setTableColumnWidths(editor: OnesEditor, block: BlockElement, colsWidth: number[]): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|