@ones-editor/editor 0.0.3-beta.62 → 0.0.3-beta.64

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,6 +1,7 @@
1
1
  import { BlockCommands, BlockElement, BlockPath, CommandItem, ContainerElement, DocBlock, OnesEditor, OnesEditorBlockHook } from '../../../@ones-editor/core';
2
2
  export default class BlockLockerHook implements OnesEditorBlockHook {
3
3
  create(editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock): void;
4
+ update(editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock): void;
4
5
  writable(editor: OnesEditor, blockElement: BlockElement): boolean | undefined;
5
6
  commands(editor: OnesEditor, blockElement: BlockElement): BlockCommands;
6
7
  executeCommand: (editor: OnesEditor, blockElement: BlockElement, item: CommandItem) => void;
@@ -1,5 +1,5 @@
1
- import { BlockElement, ContainerElement } from '../../../../@ones-editor/core';
1
+ import { BlockElement, ContainerElement, OnesEditor } from '../../../../@ones-editor/core';
2
2
  export declare function getTextContainer(codeBlock: BlockElement): ContainerElement;
3
3
  export declare function getCaptionContainer(codeBlock: BlockElement): ContainerElement | null;
4
4
  export declare function getCodeChildContainers(codeBlock: BlockElement): ContainerElement[];
5
- export declare function isCodeTextBlock(block: BlockElement): boolean;
5
+ export declare function isCodeTextBlock(editor: OnesEditor, block: BlockElement): boolean;
@@ -1,3 +1,3 @@
1
1
  import { OnesEditor } from '../../../../../@ones-editor/core';
2
- export declare function getDefaultLanguage(editor: OnesEditor): Promise<string>;
3
- export declare function setDefaultLanguage(editor: OnesEditor, lang: string): Promise<void>;
2
+ export declare function getDefaultLanguage(editor: OnesEditor): string;
3
+ export declare function setDefaultLanguage(editor: OnesEditor, lang: string): void;
@@ -7,6 +7,7 @@ export declare function isVisibleBlock(block: BlockElement): boolean;
7
7
  export declare function getBlockId(block: BlockElement): string;
8
8
  export declare function getBlockType(block: BlockElement): string;
9
9
  export declare function getParentBlock(node: Node): BlockElement | null;
10
+ export declare function getParentBlockExcludeSelf(node: Node): BlockElement | null;
10
11
  export declare function getParentContainer(block: BlockElement): ContainerElement;
11
12
  export declare function getBlockContent(block: BlockElement): BlockContentElement;
12
13
  export declare function getBlockTools(block: BlockElement): BlockToolsElement;
@@ -13,6 +13,7 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
13
13
  getVersionHelper(): import("../doc").OnesEditorDocVersionHelper | undefined;
14
14
  getContainerBlocks(containerId: string): DocBlock[];
15
15
  getBlockData(containerId: string, blockIndex: number): DocBlock;
16
+ verifyBlockWritable(containerId: string, blockIndex: number): void;
16
17
  localUpdateBlockText(containerId: string, blockIndex: number, actions: DocBlockTextActions, options?: UpdateBlockOptions): DocBlockText;
17
18
  localUpdateBlockData(containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange): DocBlock;
18
19
  localInsertBlock(containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange, options?: InsertBlockOptions): DocBlock;
@@ -3,7 +3,7 @@ export default class DefaultSettingsProvider implements OnesEditorSettingsProvid
3
3
  private editor;
4
4
  constructor(editor: OnesEditor);
5
5
  getKey(key: string): string;
6
- getItem(key: string): Promise<string | null>;
7
- setItem(key: string, value: string | null): Promise<void>;
8
- removeItem(key: string): Promise<void>;
6
+ getItem(key: string): string | null;
7
+ setItem(key: string, value: string | null): void;
8
+ removeItem(key: string): void;
9
9
  }
@@ -208,7 +208,7 @@ export interface Block {
208
208
  handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
209
209
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
210
210
  handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
211
- handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
211
+ handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | false | undefined;
212
212
  handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
213
213
  getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
214
214
  getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
@@ -366,9 +366,9 @@ export interface OnesEditorEvents {
366
366
  'focus': (editor: OnesEditor) => void;
367
367
  }
368
368
  export interface OnesEditorSettingsProvider {
369
- getItem: (key: string) => Promise<string | null>;
370
- setItem: (key: string, value: string | null) => Promise<void>;
371
- removeItem: (key: string) => Promise<void>;
369
+ getItem: (key: string) => string | null;
370
+ setItem: (key: string, value: string | null) => void;
371
+ removeItem: (key: string) => void;
372
372
  }
373
373
  export interface OnesEditorOptionalOptions {
374
374
  shortcuts?: ShortcutRecords[];
@@ -1,8 +1,16 @@
1
+ export declare enum LogLevel {
2
+ DEBUG = "DEBUG",
3
+ INFO = "INFO ",
4
+ WARN = "WARN ",
5
+ ERROR = "ERROR"
6
+ }
1
7
  export declare class Logger {
2
8
  private category;
3
9
  private times;
4
10
  static debugMode: boolean;
11
+ static level: LogLevel;
5
12
  constructor(category: string);
13
+ shouldLog(level: LogLevel): boolean;
6
14
  private _log;
7
15
  log(msg: string | object, context?: string): void;
8
16
  debug(msg: string | object, context?: string): void;
@@ -8,10 +8,11 @@ export interface StandardEmbedBlockProperties<T = PresetCommandId> {
8
8
  export declare function addCommentToBlock(editor: OnesEditor, block: BlockElement): boolean;
9
9
  export declare class StandardEmbedBlockCommands<T = PresetCommandId> implements BlockCommands {
10
10
  protected editor: OnesEditor;
11
+ protected block: BlockElement;
11
12
  protected properties?: StandardEmbedBlockProperties<T> | undefined;
12
13
  group: string;
14
+ constructor(editor: OnesEditor, block: BlockElement, properties?: StandardEmbedBlockProperties<T> | undefined);
13
15
  _commands: CommandItem[];
14
- constructor(editor: OnesEditor, properties?: StandardEmbedBlockProperties<T> | undefined);
15
16
  get commands(): CommandItem[];
16
17
  executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
17
18
  }
@@ -1,4 +1,4 @@
1
- import { BlockElement, OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks } from '../../../@ones-editor/core';
1
+ import { BlockElement, OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks, OnesEditorUser } from '../../../@ones-editor/core';
2
2
  import { ExclusiveBlockMessage } from './types';
3
3
  export declare class OnesEditorExclusiveBlock implements OnesEditorCustom, OnesEditorDocCallbacks {
4
4
  private editor;
@@ -8,7 +8,7 @@ export declare class OnesEditorExclusiveBlock implements OnesEditorCustom, OnesE
8
8
  constructor(editor: OnesEditor);
9
9
  destroy(): void;
10
10
  onCustomMessage(msg: unknown): void;
11
- handleUserChanged: () => void;
11
+ handleUserChanged: (users: OnesEditorUser[]) => void;
12
12
  getExclusiveMessage(blockId: string): ExclusiveBlockMessage | undefined;
13
13
  broadcastExclusiveBlockMessage(blocks: BlockElement[], exclusive: boolean): void;
14
14
  exclusiveBlock(block: BlockElement): void;
@@ -1,5 +1,5 @@
1
1
  import { BlockProperties } from '../../../../@ones-editor/core';
2
- import type { OnesEditor, BlockContentElement, DocEmbedBlock, Logger } from '../../../../@ones-editor/core';
2
+ import type { OnesEditor, BlockContentElement, DocEmbedBlock, BlockElement, Logger } from '../../../../@ones-editor/core';
3
3
  import type { GraphType, GraphEmbedBlockProperties } from './graph-block-commands';
4
4
  export default abstract class GraphBase {
5
5
  private graphType;
@@ -19,6 +19,6 @@ export default abstract class GraphBase {
19
19
  protected updateImage(embed: HTMLDivElement, code: string | undefined, url: string | undefined | null, err: Error | null): Promise<void>;
20
20
  protected updateClasses(embed: HTMLDivElement, code: string | undefined, err: Error | null): void;
21
21
  editGraph(content: BlockContentElement): void;
22
- getBlockProperties(properties?: GraphEmbedBlockProperties): BlockProperties;
22
+ getBlockProperties(block: BlockElement, properties?: GraphEmbedBlockProperties): BlockProperties;
23
23
  private hasChanged;
24
24
  }
@@ -6,14 +6,15 @@ export type GraphType = 'mermaid' | 'flowchart' | 'plantuml';
6
6
  export type GraphEmbedBlockProperties = StandardEmbedBlockProperties<PresetCommandId>;
7
7
  declare class GraphBlockCommands extends StandardEmbedBlockCommands<PresetCommandId> {
8
8
  editor: OnesEditor;
9
+ block: BlockElement;
9
10
  graphType: GraphType;
10
11
  properties?: GraphEmbedBlockProperties | undefined;
11
12
  group: string;
12
13
  _commands: CommandItem[];
13
- constructor(editor: OnesEditor, graphType: GraphType, properties?: GraphEmbedBlockProperties | undefined);
14
+ constructor(editor: OnesEditor, block: BlockElement, graphType: GraphType, properties?: GraphEmbedBlockProperties | undefined);
14
15
  executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
15
16
  }
16
- export declare function getGraphEmbedBlockProperties(editor: OnesEditor, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
17
+ export declare function getGraphEmbedBlockProperties(editor: OnesEditor, block: BlockElement, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
17
18
  blockCommands: {
18
19
  'hovering-toolbar': GraphBlockCommands;
19
20
  };
@@ -1,4 +1,4 @@
1
- import { BlockElement, ComplexBlockPosition, OnesEditor } from '../../../../@ones-editor/core';
1
+ import { BlockElement, ComplexBlockPosition, OnesEditor, SelectionRange } from '../../../../@ones-editor/core';
2
2
  export declare function getTableSelectionRange(tableBlock: BlockElement, start: ComplexBlockPosition, end: ComplexBlockPosition): {
3
3
  fromRow: number;
4
4
  toRow: number;
@@ -9,3 +9,4 @@ export declare function getTableSelectedRowsAndColumns(editor: OnesEditor, table
9
9
  selectedRows: Set<number>;
10
10
  selectedColumns: Set<number>;
11
11
  };
12
+ export declare function findActiveTableBlockAsRange(editor: OnesEditor, range: SelectionRange): BlockElement | null;