editate 0.6.6 → 0.6.7

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/README.md CHANGED
@@ -25,9 +25,11 @@ npm install editate
25
25
 
26
26
  ### Supported browsers
27
27
 
28
- Browser versions supporting [beforeinput event](https://developer.mozilla.org/en-US/docs/Web/API/Element/beforeinput_event#browser_compatibility) are supported.
28
+ Both desktop and mobile browsers that support [beforeinput event](https://developer.mozilla.org/en-US/docs/Web/API/Element/beforeinput_event#browser_compatibility) are supported. Basically tested with Mac / Windows / iOS / Android.
29
29
 
30
- Mobile browsers are also supported, but with some issues (https://github.com/inokawa/editate/issues/97).
30
+ - Chrome
31
+ - Safari
32
+ - Firefox
31
33
 
32
34
  ## Getting started
33
35
 
package/lib/commands.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Editor } from "./editor.js";
2
- import type { DocNode, InferBlockNode, InferInlineNode, Range, TextNode } from "./doc/types.js";
1
+ import { Editor } from './editor.js';
2
+ import { DocNode, InferBlockNode, InferInlineNode, Range, TextNode } from './doc/types.js';
3
3
  /**
4
4
  * Delete content in the selection or specified range.
5
5
  */
package/lib/doc/edit.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DocNode, Fragment, Path, BlockNode, Node, DomPosition, Range } from "./types.js";
1
+ import { DocNode, Fragment, Path, BlockNode, Node, DomPosition, Range } from './types.js';
2
2
  declare const OP_DELETE = "delete";
3
3
  type DeleteOperation = Readonly<{
4
4
  type: typeof OP_DELETE;
@@ -1,2 +1,2 @@
1
- export { createParser } from "./parser.js";
2
- export { defaultIsBlockNode } from "./default.js";
1
+ export { createParser } from './parser.js';
2
+ export { defaultIsBlockNode } from './default.js';
@@ -1 +1,6 @@
1
- export type Parser = <T>(scopeFn: () => T, root?: Node, startNode?: Node) => T;
1
+ interface ParserContext {
2
+ }
3
+ export interface Parser {
4
+ <T>(scopeFn: (ctx: ParserContext) => T, root?: Node): T;
5
+ }
6
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/lib/editor.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- import type { DocNode, Fragment, Selection } from "./doc/types.js";
3
- import { type Operation } from "./doc/edit.js";
4
- import type { Parser } from "./dom/parser.js";
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { DocNode, Fragment, Selection } from './doc/types.js';
3
+ import { Operation } from './doc/edit.js';
4
+ import { Parser } from './dom/parser.js';
5
5
  type EditorCommandOrPlugin<A extends unknown[], T extends DocNode = DocNode> = (editor: Editor<T>, ...args: A) => void | undefined;
6
6
  type EditorQuery<A extends unknown[], V, T extends DocNode = DocNode> = (editor: Editor<T>, ...args: A) => V;
7
7
  /**
@@ -56,10 +56,10 @@ export type CopyHook = (dataTransfer: DataTransfer) => void;
56
56
  /**
57
57
  * Functions to handle paste / drop events
58
58
  */
59
- export type PasteHook = (dataTransfer: DataTransfer, parser: Parser) => string | Fragment | null;
59
+ export type PasteHook = (dataTransfer: DataTransfer) => string | Fragment | null;
60
60
  type EditorHookMap = {
61
61
  apply: (op: Operation, next: (op?: Operation) => void) => void;
62
- mount: (element: HTMLElement) => void | (() => void);
62
+ mount: (element: HTMLElement, parser: Parser) => void | (() => void);
63
63
  keyboard: KeyboardHook;
64
64
  copy: CopyHook;
65
65
  paste: PasteHook;