Skip to content

Commit c754d2b

Browse files
Remove the filterFunc param from prepareForSerialization introduced in #57 that broke copy scene to clipboard (#59)
1 parent db6962b commit c754d2b

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

src/lib/entity.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ function recursivelyRegenerateId(element) {
136136
export function cloneEntityImpl(entity) {
137137
entity.flushToDOM();
138138
const clone = prepareForSerialization(entity);
139-
if (clone !== null) {
140-
recursivelyRegenerateId(clone);
141-
}
139+
recursivelyRegenerateId(clone);
142140
return clone;
143141
}
144142

@@ -175,15 +173,9 @@ export function getEntityClipboardRepresentation(entity) {
175173
* primitive attributes, mixins and defaults.
176174
*
177175
* @param {Element} entity Root of the DOM hierarchy.
178-
* @param {Function} filterFunc Function to filter out nodes from the serialization
179176
* @return {Element} Copy of the DOM hierarchy ready for serialization.
180177
*/
181-
export function prepareForSerialization(
182-
entity,
183-
filterFunc = (entity) => !entity.classList.contains('autocreated')
184-
) {
185-
if (!filterFunc(entity)) return null;
186-
178+
export function prepareForSerialization(entity) {
187179
var clone = entity.cloneNode(false);
188180
var children = entity.childNodes;
189181
for (var i = 0, l = children.length; i < l; i++) {
@@ -197,10 +189,8 @@ export function prepareForSerialization(
197189
!child.classList.contains('hitEntity') && // entity created by blink-controls
198190
!child.parentElement.hasAttribute('environment')) // children of the environment entity
199191
) {
200-
const childClone = prepareForSerialization(children[i], filterFunc);
201-
if (childClone !== null) {
202-
clone.appendChild(childClone);
203-
}
192+
const childClone = prepareForSerialization(children[i]);
193+
clone.appendChild(childClone);
204194
}
205195
}
206196
optimizeComponents(clone, entity);
@@ -829,9 +819,8 @@ export function elementToObject(element) {
829819
*/
830820
export function exportEntityToObject(entity) {
831821
entity.flushToDOM();
832-
// prepare entity for serialization and check if it's blacklisted
822+
// prepare entity for serialization
833823
const preparedElement = prepareForSerialization(entity);
834-
if (!preparedElement) return null;
835824
// convert entity to object
836825
const entityObj = elementToObject(preparedElement);
837826

0 commit comments

Comments
 (0)