From 3c98d97369c804a7f4bda21ff52d603557046e83 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Tue, 23 Aug 2022 16:57:29 +0200 Subject: [PATCH] remove toDom methods --- README.md | 4 ---- src/types/YXmlHook.js | 30 ------------------------------ src/types/YXmlText.js | 23 ----------------------- 3 files changed, 57 deletions(-) diff --git a/README.md b/README.md index 571f0b1a..c9e198d3 100644 --- a/README.md +++ b/README.md @@ -482,8 +482,6 @@ or any of its children.
Clone this type into a fresh Yjs type.
toArray():Array<Y.XmlElement|Y.XmlText>
Copies the children to a new Array.
- toDOM():DocumentFragment -
Transforms this type and all children to new DOM elements.
toString():string
Get the XML serialization of all descendants.
toJSON():string @@ -557,8 +555,6 @@ content and be actually XML compliant.
Clone this type into a fresh Yjs type.
toArray():Array<Y.XmlElement|Y.XmlText>
Copies the children to a new Array.
- toDOM():Element -
Transforms this type and all children to a new DOM element.
toString():string
Get the XML serialization of all descendants.
toJSON():string diff --git a/src/types/YXmlHook.js b/src/types/YXmlHook.js index be8c759b..f136b086 100644 --- a/src/types/YXmlHook.js +++ b/src/types/YXmlHook.js @@ -40,36 +40,6 @@ export class YXmlHook extends YMap { return el } - /** - * Creates a Dom Element that mirrors this YXmlElement. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object.} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type - * @return {Element} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks = {}, binding) { - const hook = hooks[this.hookName] - let dom - if (hook !== undefined) { - dom = hook.createDom(this) - } else { - dom = document.createElement(this.hookName) - } - dom.setAttribute('data-yjs-hook', this.hookName) - if (binding !== undefined) { - binding._createAssociation(dom, this) - } - return dom - } - /** * Transform the properties of this type to binary and write it to an * BinaryEncoder. diff --git a/src/types/YXmlText.js b/src/types/YXmlText.js index 470ce70f..30b87dc8 100644 --- a/src/types/YXmlText.js +++ b/src/types/YXmlText.js @@ -39,29 +39,6 @@ export class YXmlText extends YText { return text } - /** - * Creates a Dom Element that mirrors this YXmlText. - * - * @param {Document} [_document=document] The document object (you must define - * this when calling this method in - * nodejs) - * @param {Object} [hooks] Optional property to customize how hooks - * are presented in the DOM - * @param {any} [binding] You should not set this property. This is - * used if DomBinding wants to create a - * association to the created DOM type. - * @return {Text} The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element} - * - * @public - */ - toDOM (_document = document, hooks, binding) { - const dom = _document.createTextNode(this.toString()) - if (binding !== undefined) { - binding._createAssociation(dom, this) - } - return dom - } - toString () { // @ts-ignore return this.toDelta().map(delta => {