Function
Static Public Summary | ||
public |
createAssociation(domBinding: DomBinding, dom: Element, type: YXmlElement | YXmlHook) Creates an association (the information that a DOM element belongs to a type). |
|
public |
Creates a mutual exclude function with the following property: |
|
public |
defaultFilter(nodeName: String, attrs: Map): Map | null Default filter method (does nothing). |
|
public |
defragmentItemContent(y: *) Try to merge all items in os with their successors. |
|
public |
domToType(element: Element | TextNode, _document: Document, hooks: Hooks, filter: Filter, binding: DomBinding): YXmlElement | YXmlText Creates a Yjs type (YXml) based on the contents of a DOM Element. |
|
public |
domsToTypes(doms: *, _document: *, hooks: *, filter: *, binding: *): * |
|
public |
filterDomAttributes(dom: *, filter: *): * |
|
public |
fromBinary(y: Y, decoder: BinaryDecoder) Read the Decoder and fill the Yjs instance with data in the decoder. |
|
public |
fromRelativePosition(y: Y, rpos: RelativePosition): AbsolutePosition Transforms a relative position back to a relative position. |
|
public |
generateRandomUint32(): * |
|
public |
getListItemIDByPosition(type: *, i: *): * |
|
public |
getRelativePosition(type: YType, offset: Integer): string[] Create a relativePosition based on a absolute position. |
|
public |
integrateRemoteStructs(y: *, decoder: *) |
|
public |
isParentOf(parent: Type, child: Type): Boolean Check if |
|
public |
|
|
public |
messageToRoomname(buffer: *): * |
|
public |
messageToString(arrayPattern: *[]): * |
|
public |
readDeleteSet(y: *, decoder: *) |
|
public |
readStateSet(decoder: *): * |
|
public |
readSyncStep1(decoder: *, encoder: *, y: *, senderConn: *, sender: *) |
|
public |
readSyncStep2(decoder: *, encoder: *, y: *, senderConn: *, sender: *) |
|
public |
registerStruct(reference: Number, structConstructor: class) Register a new Yjs types. |
|
public |
removeAssociation(domBinding: DomBinding, dom: Element, type: YXmlElement | YXmlHook) Removes an association (the information that a DOM element belongs to a type). |
|
public |
sendSyncStep1(connector: *, syncUser: *) |
|
public |
simpleDiff(a: String, b: String): SimpleDiff Create a diff between two strings. |
|
public |
stringifyDeleteSet(y: *, decoder: *, strBuilder: *): * |
|
public |
stringifyStructs(y: *, decoder: *, strBuilder: *) |
|
public |
stringifySyncStep1(y: *, decoder: *, strBuilder: *) |
|
public |
stringifySyncStep2(y: *, decoder: *, strBuilder: *) |
|
public |
switchAssociation(domBinding: DomBinding, oldDom: Element, newDom: Element) If oldDom is associated with a type, associate newDom with the type and forget about oldDom. |
|
public |
toBinary(y: Y): BinaryEncoder Encode the Yjs model to binary format. |
|
public |
writeDeleteSet(y: *, encoder: *) |
|
public |
writeStateSet(y: *, encoder: *) |
Static Public
public createAssociation(domBinding: DomBinding, dom: Element, type: YXmlElement | YXmlHook) source
import {createAssociation} from 'yjs/src/Bindings/DomBinding/util.js'
Creates an association (the information that a DOM element belongs to a type).
Params:
Name | Type | Attribute | Description |
domBinding | DomBinding | The binding object |
|
dom | Element | The dom that is to be associated with type |
|
type | YXmlElement | YXmlHook | The type that is to be associated with dom |
public createMutualExclude(): Function source
import {createMutualExclude} from 'yjs/src/Util/mutualExclude.js'
Creates a mutual exclude function with the following property:
Example:
const mutualExclude = createMutualExclude()
mutualExclude(function () {
// This function is immediately executed
mutualExclude(function () {
// This function is never executed, as it is called with the same
// mutualExclude
})
})
public defaultFilter(nodeName: String, attrs: Map): Map | null source
import {defaultFilter} from 'yjs/src/Bindings/DomBinding/filter.js'
Default filter method (does nothing).
Return:
Map | null | The allowed attributes or null, if the element should be filtered. |
public defragmentItemContent(y: *) source
import {defragmentItemContent} from 'yjs/src/Util/defragmentItemContent.js'
Try to merge all items in os with their successors.
Some transformations (like delete) fragment items. Item(c: 'ab') + Delete(1,1) + Delete(0, 1) -> Item(c: 'a',deleted);Item(c: 'b',deleted)
This functions merges the fragmented nodes together: Item(c: 'a',deleted);Item(c: 'b',deleted) -> Item(c: 'ab', deleted)
TODO: The Tree implementation does not support deletions in-spot. This is why all deletions must be performed after the traversal.
Params:
Name | Type | Attribute | Description |
y | * |
public domToType(element: Element | TextNode, _document: Document, hooks: Hooks, filter: Filter, binding: DomBinding): YXmlElement | YXmlText source
import domToType from 'yjs/src/Bindings/DomBinding/domToType.js'
Creates a Yjs type (YXml) based on the contents of a DOM Element.
Params:
Name | Type | Attribute | Description |
element | Element | TextNode | The DOM Element |
|
_document | Document |
|
Optional. Provide the global document object |
hooks | Hooks |
|
Optional. Set of Yjs Hooks |
filter | Filter |
|
Optional. Dom element filter |
binding | DomBinding |
|
Warning: This property is for internal use only! |
Return:
YXmlElement | YXmlText |
public domsToTypes(doms: *, _document: *, hooks: *, filter: *, binding: *): * source
import {domsToTypes} from 'yjs/src/Bindings/DomBinding/util.js'
Params:
Name | Type | Attribute | Description |
doms | * | ||
_document | * | ||
hooks | * | ||
filter | * | ||
binding | * |
Return:
* |
public filterDomAttributes(dom: *, filter: *): * source
import {filterDomAttributes} from 'yjs/src/Bindings/DomBinding/filter.js'
Params:
Name | Type | Attribute | Description |
dom | * | ||
filter | * |
Return:
* |
public fromBinary(y: Y, decoder: BinaryDecoder) source
import {fromBinary} from 'yjs/src/MessageHandler/binaryEncode.js'
Read the Decoder and fill the Yjs instance with data in the decoder.
Params:
Name | Type | Attribute | Description |
y | Y | The Yjs instance |
|
decoder | BinaryDecoder | The BinaryDecoder to read from. |
public fromRelativePosition(y: Y, rpos: RelativePosition): AbsolutePosition source
import {fromRelativePosition} from 'yjs/src/Util/relativePosition.js'
Transforms a relative position back to a relative position.
Params:
Name | Type | Attribute | Description |
y | Y | The Yjs instance in which to query for the absolute position. |
|
rpos | RelativePosition | The relative position. |
public generateRandomUint32(): * source
import {generateRandomUint32} from 'yjs/src/Util/generateRandomUint32.js'
Return:
* |
public getListItemIDByPosition(type: *, i: *): * source
import {getListItemIDByPosition} from 'yjs/src/Struct/Type.js'
Params:
Name | Type | Attribute | Description |
type | * | ||
i | * |
Return:
* |
public getRelativePosition(type: YType, offset: Integer): string[] source
import {getRelativePosition} from 'yjs/src/Util/relativePosition.js'
Create a relativePosition based on a absolute position.
Params:
Name | Type | Attribute | Description |
type | YType | The base type (e.g. YText or YArray). |
|
offset | Integer | The absolute position. |
public integrateRemoteStructs(y: *, decoder: *) source
import {integrateRemoteStructs} from 'yjs/src/MessageHandler/integrateRemoteStructs.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
decoder | * |
public isParentOf(parent: Type, child: Type): Boolean source
import isParentOf from 'yjs/src/Util/isParentOf.js'
Check if parent
is a parent of child
.
public logID(id: *): string source
import {logID} from 'yjs/src/MessageHandler/messageToString.js'
Params:
Name | Type | Attribute | Description |
id | * |
public messageToRoomname(buffer: *): * source
import {messageToRoomname} from 'yjs/src/MessageHandler/messageToString.js'
Params:
Name | Type | Attribute | Description |
buffer | * |
Return:
* |
public messageToString(arrayPattern: *[]): * source
import {messageToString} from 'yjs/src/MessageHandler/messageToString.js'
Params:
Name | Type | Attribute | Description |
arrayPattern | *[] |
|
Return:
* |
public readDeleteSet(y: *, decoder: *) source
import {readDeleteSet} from 'yjs/src/MessageHandler/deleteSet.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
decoder | * |
public readStateSet(decoder: *): * source
import {readStateSet} from 'yjs/src/MessageHandler/stateSet.js'
Params:
Name | Type | Attribute | Description |
decoder | * |
Return:
* |
public readSyncStep1(decoder: *, encoder: *, y: *, senderConn: *, sender: *) source
import {readSyncStep1} from 'yjs/src/MessageHandler/syncStep1.js'
Params:
Name | Type | Attribute | Description |
decoder | * | ||
encoder | * | ||
y | * | ||
senderConn | * | ||
sender | * |
public readSyncStep2(decoder: *, encoder: *, y: *, senderConn: *, sender: *) source
import {readSyncStep2} from 'yjs/src/MessageHandler/syncStep2.js'
Params:
Name | Type | Attribute | Description |
decoder | * | ||
encoder | * | ||
y | * | ||
senderConn | * | ||
sender | * |
public registerStruct(reference: Number, structConstructor: class) source
import {registerStruct} from 'yjs/src/Util/structReferences.js'
Register a new Yjs types. The same type must be defined with the same reference on all clients!
Params:
Name | Type | Attribute | Description |
reference | Number | ||
structConstructor | class |
public removeAssociation(domBinding: DomBinding, dom: Element, type: YXmlElement | YXmlHook) source
import {removeAssociation} from 'yjs/src/Bindings/DomBinding/util.js'
Removes an association (the information that a DOM element belongs to a type).
Params:
Name | Type | Attribute | Description |
domBinding | DomBinding | The binding object |
|
dom | Element | The dom that is to be associated with type |
|
type | YXmlElement | YXmlHook | The type that is to be associated with dom |
public sendSyncStep1(connector: *, syncUser: *) source
import {sendSyncStep1} from 'yjs/src/MessageHandler/syncStep1.js'
Params:
Name | Type | Attribute | Description |
connector | * | ||
syncUser | * |
public simpleDiff(a: String, b: String): SimpleDiff source
import simpleDiff from 'yjs/src/Util/simpleDiff.js'
Create a diff between two strings. This diff implementation is highly efficient, but not very sophisticated.
public stringifyDeleteSet(y: *, decoder: *, strBuilder: *): * source
import {stringifyDeleteSet} from 'yjs/src/MessageHandler/deleteSet.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
decoder | * | ||
strBuilder | * |
Return:
* |
public stringifyStructs(y: *, decoder: *, strBuilder: *) source
import {stringifyStructs} from 'yjs/src/MessageHandler/integrateRemoteStructs.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
decoder | * | ||
strBuilder | * |
public stringifySyncStep1(y: *, decoder: *, strBuilder: *) source
import {stringifySyncStep1} from 'yjs/src/MessageHandler/syncStep1.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
decoder | * | ||
strBuilder | * |
public stringifySyncStep2(y: *, decoder: *, strBuilder: *) source
import {stringifySyncStep2} from 'yjs/src/MessageHandler/syncStep2.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
decoder | * | ||
strBuilder | * |
public switchAssociation(domBinding: DomBinding, oldDom: Element, newDom: Element) source
import {switchAssociation} from 'yjs/src/Bindings/DomBinding/util.js'
If oldDom is associated with a type, associate newDom with the type and forget about oldDom. If oldDom is not associated with any type, nothing happens.
Params:
Name | Type | Attribute | Description |
domBinding | DomBinding | The binding object |
|
oldDom | Element | The existing dom |
|
newDom | Element | The new dom object |
public toBinary(y: Y): BinaryEncoder source
import {toBinary} from 'yjs/src/MessageHandler/binaryEncode.js'
Encode the Yjs model to binary format.
Params:
Name | Type | Attribute | Description |
y | Y | The Yjs instance |
public writeDeleteSet(y: *, encoder: *) source
import {writeDeleteSet} from 'yjs/src/MessageHandler/deleteSet.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
encoder | * |
public writeStateSet(y: *, encoder: *) source
import {writeStateSet} from 'yjs/src/MessageHandler/stateSet.js'
Params:
Name | Type | Attribute | Description |
y | * | ||
encoder | * |