Update definitions for slate - Text and Editor (#37514)

* Add marks property missing from Text
Add return type to editor.withoutSaving and editor.withoutMerging per
https://docs.slatejs.org/slate-core/commands#miscellaneous-commands

* Lint fixes

* Tests

* Formatting

* Change from List<Mark> to Set<Mark>
This commit is contained in:
Max Vaysburd 2019-08-12 14:58:21 -07:00 committed by Pranav Senthilnathan
parent 8002c111c6
commit 34dddd92f9
2 changed files with 8 additions and 8 deletions

View File

@ -303,7 +303,7 @@ export interface TextProperties {
object?: "text";
key?: string;
text?: string;
marks?: Immutable.List<Mark> | Mark[];
marks?: Immutable.Set<Mark> | Mark[];
}
export interface TextJSON {
@ -325,6 +325,7 @@ export class Text extends Immutable.Record({}) {
key: string;
readonly text: string;
readonly marks: Immutable.Set<Mark> | null;
static create(properties?: TextProperties | TextJSON | Text | string): Text;
static createList(
@ -1817,8 +1818,8 @@ export class Editor implements Controller {
wrapNodeByPath(path: Immutable.List<number>, parent: Block | Document | Inline | Text): Editor;
normalize(): Editor;
withoutNormalizing(fn: () => void): Editor;
withoutSaving(fn: () => void): void;
withoutMerging(fn: () => void): void;
withoutSaving(fn: () => void): Editor;
withoutMerging(fn: () => void): Editor;
redo(): Editor;
undo(): Editor;
save(operation: Operation): void;

View File

@ -477,11 +477,10 @@ editor
properties: {},
newProperties: {},
data: Data.create({})
});
editor.withoutMerging(() => { /* noop */ });
editor.withoutNormalizing(() => { /* noop */ });
editor.withoutSaving(() => { /* noop */ });
})
.withoutMerging(() => { /* noop */ })
.withoutNormalizing(() => { /* noop */ })
.withoutSaving(() => { /* noop */ });
KeyUtils.setGenerator(() => "Test");
KeyUtils.create();