mobx-keystone-yjs
Version:
Yjs bindings for mobx-keystone
41 lines (40 loc) • 1.3 kB
TypeScript
import { IAtom } from 'mobx';
import { Frozen } from 'mobx-keystone';
import * as Y from "yjs";
export declare const yjsTextModelId = "mobx-keystone-yjs/YjsTextModel";
declare const YjsTextModel_base: import('mobx-keystone')._Model<unknown, {
deltaList: import('mobx-keystone').OptionalModelProp<Frozen<unknown[]>[]>;
}, never, never>;
/**
* A mobx-keystone model that represents a Yjs.Text object.
*/
export declare class YjsTextModel extends YjsTextModel_base {
/**
* Helper function to create a YjsTextModel instance with a simple text.
*/
static withText(text: string): YjsTextModel;
/**
* The Y.js path from the bound object to the YjsTextModel instance.
*/
private get _yjsObjectPath();
/**
* The Yjs.Text object present at this mobx-keystone node's path.
*/
private get _yjsObjectAtPath();
/**
* The Yjs.Text object represented by this mobx-keystone node.
*/
get yjsText(): Y.Text;
/**
* Atom that gets changed when the associated Y.js text changes.
*/
yjsTextChangedAtom: IAtom;
/**
* The text value of the Yjs.Text object.
* Shortcut for `yjsText.toString()`, but computed.
*/
get text(): string;
private deltaListToText;
protected onInit(): () => void;
}
export {};