@ones-editor/editor 0.0.3-beta.13 → 0.0.3-beta.14

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 (39) hide show
  1. package/@ones-editor/block-locker/src/i18n/en-US.d.ts +8 -0
  2. package/@ones-editor/block-locker/src/i18n/index.d.ts +1 -0
  3. package/@ones-editor/block-locker/src/i18n/zh-CN.d.ts +8 -0
  4. package/@ones-editor/block-locker/src/index.d.ts +2 -0
  5. package/@ones-editor/comments/src/actions/add-comment-to-block.d.ts +3 -2
  6. package/@ones-editor/comments/src/actions/add-comment-to-text-block.d.ts +2 -1
  7. package/@ones-editor/comments/src/actions/editor-add-comment.d.ts +2 -0
  8. package/@ones-editor/comments/src/comments/comments.d.ts +3 -1
  9. package/@ones-editor/comments/src/index.d.ts +1 -0
  10. package/@ones-editor/comments/src/types.d.ts +1 -0
  11. package/@ones-editor/core/src/core/converter/block-to-doc.d.ts +1 -1
  12. package/@ones-editor/core/src/core/converter/selected-block-to-doc.d.ts +3 -1
  13. package/@ones-editor/core/src/core/editor/actions/break-text-block.d.ts +2 -0
  14. package/@ones-editor/core/src/core/input-handler/remove-quoted.d.ts +2 -0
  15. package/@ones-editor/core/src/core/types.d.ts +7 -5
  16. package/@ones-editor/core/src/utils/file.d.ts +1 -0
  17. package/@ones-editor/drop-target/src/drop-indicator.d.ts +1 -0
  18. package/@ones-editor/drop-target/src/drop-target.d.ts +1 -1
  19. package/@ones-editor/drop-target/src/handlers/drag-file.d.ts +8 -0
  20. package/@ones-editor/heading-collapse/src/heading-collapse-button/drop-handler.d.ts +1 -1
  21. package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +5 -1
  22. package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +1 -1
  23. package/@ones-editor/list-block/src/drop/index.d.ts +1 -1
  24. package/@ones-editor/templates/package.json +9 -0
  25. package/@ones-editor/templates/src/index.d.ts +4 -0
  26. package/@ones-editor/templates/src/locale/en-us.d.ts +9 -0
  27. package/@ones-editor/templates/src/locale/index.d.ts +1 -0
  28. package/@ones-editor/templates/src/locale/zh-cn.d.ts +9 -0
  29. package/@ones-editor/templates/src/templates/select-template.d.ts +8 -0
  30. package/@ones-editor/templates/src/templates/types.d.ts +17 -0
  31. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  32. package/@ones-editor/ui/src/index.d.ts +0 -1
  33. package/@ones-editor/ui-base/src/auto-suggest/index.d.ts +2 -2
  34. package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
  35. package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -1
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +153 -153
  38. package/dist/types.d.ts +2 -0
  39. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ locker: {
3
+ lock: string;
4
+ unlock: string;
5
+ lockedBy: string;
6
+ };
7
+ };
8
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ locker: {
3
+ lock: string;
4
+ unlock: string;
5
+ lockedBy: string;
6
+ };
7
+ };
8
+ export default _default;
@@ -1,3 +1,5 @@
1
1
  import BlockLockerHook from './hook';
2
2
  import './style.scss';
3
+ import './i18n';
4
+ export * from './helper';
3
5
  export { BlockLockerHook };
@@ -1,3 +1,4 @@
1
- import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
1
+ import { BlockElement, OnesEditor, OnesEditorComment } from '../../../../@ones-editor/core';
2
2
  import { OnesEditorCommentsProvider } from '../types';
3
- export declare function addCommentToBlock(editor: OnesEditor, block: BlockElement, provider: OnesEditorCommentsProvider): import("@ones-editor/core").OnesEditorComment;
3
+ export declare function updateCommentToBlock(editor: OnesEditor, block: BlockElement, comment: OnesEditorComment): void;
4
+ export declare function addCommentToBlock(editor: OnesEditor, block: BlockElement, provider: OnesEditorCommentsProvider): OnesEditorComment;
@@ -1,3 +1,4 @@
1
- import { OnesEditor, OnesEditorComment, SelectionRange } from '../../../../@ones-editor/core';
1
+ import { OnesEditor, OnesEditorComment, SelectedBlock, SelectionRange } from '../../../../@ones-editor/core';
2
2
  import { OnesEditorCommentsProvider } from '../types';
3
+ export declare function addCommentToSelectedTextBlock(editor: OnesEditor, selectedBlock: SelectedBlock, comment: OnesEditorComment): void;
3
4
  export declare function addCommentToTextBlocks(editor: OnesEditor, range: SelectionRange, provider: OnesEditorCommentsProvider): OnesEditorComment;
@@ -0,0 +1,2 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ export declare function editorAddComment(editor: OnesEditor): void;
@@ -7,9 +7,11 @@ export default class OnesEditorComments {
7
7
  private commentList;
8
8
  private mobileCommentList;
9
9
  private miniCommentList;
10
- constructor(editor: OnesEditor, provider: OnesEditorCommentsProvider, parent?: HTMLElement);
10
+ constructor(editor: OnesEditor, provider: OnesEditorCommentsProvider);
11
+ get commentProvider(): OnesEditorCommentsProvider;
11
12
  get isMobile(): boolean;
12
13
  destroy(): void;
14
+ private createRoot;
13
15
  private showComment;
14
16
  showCommentList: (groupId?: string) => void;
15
17
  private handleCommentListClose;
@@ -8,3 +8,4 @@ export { OnesEditorComments };
8
8
  export type { CommentItem } from './comment-item';
9
9
  export type { CommentGroupItem } from './comments-list/group-item';
10
10
  export { removeCommentFromBlock } from './actions/remove-comment-from-block';
11
+ export { editorAddComment } from './actions/editor-add-comment';
@@ -4,6 +4,7 @@ export type CommentData = {
4
4
  [p in string]: unknown;
5
5
  };
6
6
  export interface OnesEditorCommentOptions {
7
+ container?: HTMLElement;
7
8
  hideHeader?: boolean;
8
9
  disableReply?: boolean;
9
10
  disableEdit?: boolean;
@@ -1,3 +1,3 @@
1
1
  import { DocObject } from '../doc';
2
2
  import { BlockElement, OnesEditor } from '../types';
3
- export declare function blockToDoc(editor: OnesEditor, block: BlockElement): DocObject;
3
+ export declare function blockToDoc(editor: OnesEditor, block: BlockElement, ignoreLockInfo?: boolean): DocObject;
@@ -1,3 +1,5 @@
1
1
  import { DocObject } from '../doc';
2
2
  import { OnesEditor, SelectedBlock } from '../types';
3
- export declare function selectedBlockToDoc(editor: OnesEditor, selectedBlock: SelectedBlock): DocObject;
3
+ export declare function selectedBlockToDoc(editor: OnesEditor, selectedBlock: SelectedBlock, options?: {
4
+ ignoreLockInfo: boolean;
5
+ }): DocObject;
@@ -1,6 +1,8 @@
1
1
  import { BlockElement, BreakTextOptions, OnesEditor } from '../../types';
2
+ import { DocBlockAttributes } from '../../doc';
2
3
  export interface BreakTextBlockResult {
3
4
  block: BlockElement;
4
5
  newBlock: BlockElement;
5
6
  }
7
+ export declare function copyBlockAttributes(editor: OnesEditor, block: BlockElement): DocBlockAttributes;
6
8
  export declare function editorBreakTextBlock(editor: OnesEditor, block: BlockElement, offset: number, options?: BreakTextOptions): BreakTextBlockResult;
@@ -0,0 +1,2 @@
1
+ import { BlockElement, OnesEditor } from '../types';
2
+ export declare function removeQuoted(editor: OnesEditor, block: BlockElement): boolean;
@@ -88,8 +88,8 @@ export interface Embed {
88
88
  getOptions?: (editor: OnesEditor) => EmbedOptions;
89
89
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
90
90
  handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocEmbedBlock) => boolean;
91
- handleDropOver?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, x: number, y: number) => DropInsertPos | undefined;
92
- handleDrop?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
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;
93
93
  convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
94
94
  offset: number;
95
95
  data?: DocBlockAttributes;
@@ -118,7 +118,7 @@ export interface CommandItem {
118
118
  value?: string;
119
119
  order?: number;
120
120
  type?: CommandItemType;
121
- element?: HTMLElement;
121
+ element?: HTMLElement | ((item: CommandItem) => HTMLElement);
122
122
  icon?: string;
123
123
  childrenType?: 'menu' | 'toolbar';
124
124
  children?: CommandItem[];
@@ -131,6 +131,7 @@ export interface CommandItem {
131
131
  childrenPlacement?: CommandItemChildrenPlacement;
132
132
  childrenOffset?: [number, number];
133
133
  shortcut?: string;
134
+ defaultCheckedChildren?: string[];
134
135
  setCloseable?: (closeable: Closeable) => void;
135
136
  beforePopup?: (parent: unknown) => void;
136
137
  }
@@ -204,8 +205,8 @@ export interface Block {
204
205
  handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
205
206
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
206
207
  handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
207
- handleDropOver?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, x: number, y: number) => DropInsertPos | undefined;
208
- handleDrop?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
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;
209
210
  getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
210
211
  getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
211
212
  convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
@@ -344,6 +345,7 @@ export interface OnesEditorDataConverters {
344
345
  export interface BreakTextOptions {
345
346
  forceInsertAfter?: boolean;
346
347
  newBlockData?: DocBlock;
348
+ copyBlockAttributes?: boolean;
347
349
  }
348
350
  export interface OnesEditorEvents {
349
351
  'docChanged': (editor: OnesEditor) => void;
@@ -4,6 +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[];
7
8
  export declare function getFileExt(file: string): string;
8
9
  export declare function requestDownload(downloadUrl: string, fileName?: string): void;
9
10
  export {};
@@ -1,4 +1,5 @@
1
1
  import { BlockElement, DropInsertPos, OnesEditor } from '../../../@ones-editor/core';
2
+ export declare const INDICATOR_SIZE = 2;
2
3
  interface DropTarget {
3
4
  block: BlockElement;
4
5
  insertPos: DropInsertPos;
@@ -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, draggedBlock: BlockElement, targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
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
+ }
@@ -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, draggedBlock: BlockElement, targetContainer: ContainerElement, blockIndex: number): boolean | undefined;
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 handleDropOver(editor: OnesEditor, block: BlockElement, dragObject: DragObject, x: number, y: number): ImageDragInsertPos | undefined;
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, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions): boolean | undefined;
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, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions): boolean;
2
+ export declare function handleListDrop(editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions): boolean;
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@ones-editor/templates",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "devDependencies": {},
8
+ "types": "src/index.d.ts"
9
+ }
@@ -0,0 +1,4 @@
1
+ import './locale';
2
+ import { autoShowHideTemplates } from './templates/select-template';
3
+ export * from './templates/types';
4
+ export { autoShowHideTemplates };
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ templates: {
3
+ title: string;
4
+ create: string;
5
+ choose: string;
6
+ customizedMark: string;
7
+ };
8
+ };
9
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ templates: {
3
+ title: string;
4
+ create: string;
5
+ choose: string;
6
+ customizedMark: string;
7
+ };
8
+ };
9
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ import './templates.css';
3
+ import './select-templates.scss';
4
+ interface ShowTemplatesOptions {
5
+ reset?: boolean;
6
+ }
7
+ export declare function autoShowHideTemplates(editor: OnesEditor, options?: ShowTemplatesOptions): void;
8
+ export {};
@@ -0,0 +1,17 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ export interface DocTemplate {
3
+ docId: string;
4
+ name: string;
5
+ token: string;
6
+ thumbnailUrl?: string;
7
+ isStarred?: boolean;
8
+ isCustom?: boolean;
9
+ }
10
+ export interface TemplateOptions {
11
+ templates: DocTemplate[];
12
+ placeHolderImageSrc?: string;
13
+ showTemplateTitleAttr?: boolean;
14
+ onChooseTemplate?: (editor: OnesEditor) => void;
15
+ onApplyTemplate?: (editor: OnesEditor, template: DocTemplate) => Promise<void>;
16
+ onTemplateChooserStatusChanged?: (editor: OnesEditor, cardContainer: HTMLElement | null, status: 'visible' | 'hide') => void;
17
+ }