@ones-editor/editor 0.0.3-beta.159 → 0.0.3-beta.160

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.
@@ -1,4 +1,4 @@
1
- import { OnesEditorInput, OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType } from '../types';
1
+ import { OnesEditorInput, OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
2
2
  import { DocObject } from '../doc';
3
3
  export interface EditorInputCallbacks {
4
4
  onInsertText: (event: Event, text: string) => void;
@@ -10,7 +10,7 @@ export interface EditorInputCallbacks {
10
10
  onFocus: () => void;
11
11
  onBlur: () => void;
12
12
  onPaste: (event: ClipboardEvent) => void;
13
- onPasteText: (text: string) => void;
13
+ onPasteText: (text: string, options?: PasteOptions) => void;
14
14
  onCopy: (event: ClipboardEvent) => void;
15
15
  onCut: (event: ClipboardEvent) => void;
16
16
  addHandler: (handler: OnesEditorInputHandler) => void;
@@ -39,7 +39,7 @@ export declare class EditorInput implements OnesEditorInput {
39
39
  handleCopy: (event: ClipboardEvent) => void;
40
40
  handleCut: (event: ClipboardEvent) => void;
41
41
  handlePaste: (event: ClipboardEvent) => void;
42
- handlePasteText: (text: string) => void;
42
+ handlePasteText: (text: string, options?: PasteOptions) => void;
43
43
  handleChanged(action: OnesEditorUndoAction): void;
44
44
  handleRemoteChanged(type: RemoteChangeType): void;
45
45
  addHandler(handler: OnesEditorInputHandler): void;
@@ -1,7 +1,7 @@
1
- import { OnesEditor, OnesEditorDataConverter, OnesEditorDocs } from '../types';
1
+ import { OnesEditor, OnesEditorDataConverter, OnesEditorDocs, PasteOptions } from '../types';
2
2
  export default class EditorDataConverter implements OnesEditorDataConverter {
3
3
  private converters;
4
4
  constructor();
5
- fromData(editor: OnesEditor, data: DataTransfer): Promise<OnesEditorDocs | undefined>;
5
+ fromData(editor: OnesEditor, data: DataTransfer, options?: PasteOptions): Promise<OnesEditorDocs | undefined>;
6
6
  addConverter(converter: OnesEditorDataConverter): void;
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { EditorInputCallbacks } from '../composition/editor-input';
2
- import { OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType } from '../types';
2
+ import { OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
3
3
  import { DocObject } from '../doc';
4
4
  export declare class EditorInputHandlers implements EditorInputCallbacks {
5
5
  editor: OnesEditor;
@@ -14,7 +14,7 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
14
14
  onCopy(event: ClipboardEvent): void;
15
15
  onCut(event: ClipboardEvent): void;
16
16
  onPaste(event: ClipboardEvent): void;
17
- onPasteText: (text: string) => Promise<void>;
17
+ onPasteText: (text: string, options?: PasteOptions) => Promise<void>;
18
18
  onFocus(): void;
19
19
  onBlur(): void;
20
20
  addHandler(handler: OnesEditorInputHandler): void;
@@ -346,10 +346,10 @@ export interface OnesEditorBlockRenderers {
346
346
  export type OnesEditorDocSource = 'text/html' | 'text/office-html' | 'text/plain' | 'text/markdown' | 'image/*' | 'text/x-ones-editor-doc' | '*';
347
347
  export type OnesEditorDocs = Partial<Record<OnesEditorDocSource, DocObject>>;
348
348
  export interface OnesEditorDataConverter {
349
- fromData: (editor: OnesEditor, data: DataTransfer) => Promise<OnesEditorDocs | undefined>;
349
+ fromData: (editor: OnesEditor, data: DataTransfer, options?: PasteOptions) => Promise<OnesEditorDocs | undefined>;
350
350
  }
351
351
  export interface OnesEditorDataConverters {
352
- fromData: (editor: OnesEditor, data: DataTransfer) => Promise<OnesEditorDocs | undefined>;
352
+ fromData: (editor: OnesEditor, data: DataTransfer, options?: PasteOptions) => Promise<OnesEditorDocs | undefined>;
353
353
  addConverter: (converter: OnesEditorDataConverter) => void;
354
354
  }
355
355
  export interface BreakTextOptions {
@@ -559,6 +559,9 @@ export interface OnesEditorSelection {
559
559
  to: (type: 'text' | 'markdown' | 'html') => string;
560
560
  }
561
561
  export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBlock' | 'DeleteBlock' | 'InsertChildContainer' | 'DeleteChildContainer';
562
+ export type PasteOptions = {
563
+ toPlainText?: boolean;
564
+ };
562
565
  export interface OnesEditorInput {
563
566
  readonly inputElement: HTMLInputElement;
564
567
  destroy: () => void;
@@ -570,7 +573,7 @@ export interface OnesEditorInput {
570
573
  handleKeyDown: (event: KeyboardEvent) => void;
571
574
  handleChanged: (action: OnesEditorUndoAction) => void;
572
575
  handleRemoteChanged: (type: RemoteChangeType) => void;
573
- handlePasteText: (text: string) => void;
576
+ handlePasteText: (text: string, options?: PasteOptions) => void;
574
577
  addHandler: (handler: OnesEditorInputHandler) => void;
575
578
  removeHandler: (handler: OnesEditorInputHandler) => void;
576
579
  defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
@@ -1,4 +1,4 @@
1
- import { OnesEditor, OnesEditorDataConverter, OnesEditorDocs } from '../../../@ones-editor/core';
1
+ import { OnesEditor, OnesEditorDataConverter, OnesEditorDocs, PasteOptions } from '../../../@ones-editor/core';
2
2
  export declare class TextDataConverter implements OnesEditorDataConverter {
3
- fromData(editor: OnesEditor, data: DataTransfer): Promise<OnesEditorDocs | undefined>;
3
+ fromData(editor: OnesEditor, data: DataTransfer, options?: PasteOptions): Promise<OnesEditorDocs | undefined>;
4
4
  }