DomBinding
Extends:
A binding that binds the children of a YXmlFragment to a DOM element.
This binding is automatically destroyed when its parent is deleted.
Example:
const div = document.createElement('div')
const type = y.define('xml', Y.XmlFragment)
const binding = new Y.QuillBinding(type, div)
Constructor Summary
Public Constructor | ||
public |
constructor(type: YXmlFragment, target: Element, opts: Object) |
Member Summary
Public Members | ||
public |
Maps each DOM element to the type that it is associated with. |
|
public |
Defines which DOM attributes and elements to filter out. |
|
public |
opts: * |
|
public |
Maps each YXml type to the DOM element that it is associated with. |
Method Summary
Public Methods | ||
public |
destroy() Remove all properties that are handled by this class. |
|
public |
enableSmartScrolling(scrollElement: Element) Enables the smart scrolling functionality for a Dom Binding. |
|
public |
setFilter(filter: FilterFunction) NOTE: currently does not apply filter to existing elements! |
Inherited Summary
From class Binding | ||
public |
target: * The target that |
|
public |
type: YType The Yjs type that is bound to |
|
public |
destroy() Remove all data observers (both from the type and the target). |
Public Constructors
public constructor(type: YXmlFragment, target: Element, opts: Object) source
Override:
Binding#constructorParams:
Name | Type | Attribute | Description |
type | YXmlFragment | The bind source. This is the ultimate source of truth. |
|
target | Element | The bind target. Mirrors the target. |
|
opts | Object |
|
Optional configurations |
opts.filter | FilterFunction |
|
The filter function to use. |
Public Members
public filter: FilterFunction source
Defines which DOM attributes and elements to filter out. Also filters remote changes.
public opts: * source
Public Methods
public destroy() source
Remove all properties that are handled by this class.
Override:
Binding#destroypublic enableSmartScrolling(scrollElement: Element) source
Enables the smart scrolling functionality for a Dom Binding. This is useful when YXml is bound to a shared editor. When activated, the viewport will be changed to accommodate remote changes.
Params:
Name | Type | Attribute | Description |
scrollElement | Element | The node that is |
public setFilter(filter: FilterFunction) source
NOTE: currently does not apply filter to existing elements!
Params:
Name | Type | Attribute | Description |
filter | FilterFunction | The filter function to use from now on. |