File tree Expand file tree Collapse file tree 1 file changed +6
-27
lines changed Expand file tree Collapse file tree 1 file changed +6
-27
lines changed Original file line number Diff line number Diff line change @@ -501,35 +501,14 @@ function getUniqueId(baseId) {
501501}
502502
503503export function getComponentClipboardRepresentation ( entity , componentName ) {
504- /**
505- * Get the list of modified properties
506- * @param {Element } entity Entity where the component belongs
507- * @param {string } componentName Component name
508- * @return {object } List of modified properties with their value
509- */
510- function getModifiedProperties ( entity , componentName ) {
511- var data = entity . components [ componentName ] . data ;
512- var defaultData = entity . components [ componentName ] . schema ;
513- var diff = { } ;
514- for ( var key in data ) {
515- // Prevent adding unknown attributes
516- if ( ! defaultData [ key ] ) {
517- continue ;
518- }
519-
520- var defaultValue = defaultData [ key ] . default ;
521- var currentValue = data [ key ] ;
522-
523- // Some parameters could be null and '' like mergeTo
524- if ( ( currentValue || defaultValue ) && currentValue !== defaultValue ) {
525- diff [ key ] = data [ key ] ;
526- }
527- }
528- return diff ;
504+ entity . flushToDOM ( ) ;
505+ const data = entity . getDOMAttribute ( componentName ) ;
506+ if ( ! data ) {
507+ return componentName ;
529508 }
530509
531- const diff = getModifiedProperties ( entity , componentName ) ;
532- const attributes = AFRAME . utils . styleParser . stringify ( diff ) ;
510+ const schema = entity . components [ componentName ] . schema ;
511+ const attributes = stringifyComponentValue ( schema , data ) ;
533512 return `${ componentName } ="${ attributes } "` ;
534513}
535514
You can’t perform that action at this time.
0 commit comments