Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.toElement( (element) => {
console.log("data.modelToView form element: ")
const id = element.item.getAttribute('id')
const onchange = element.item.getAttribute('onchange')
let container = new ViewContainerElement( 'form', {'id': id, 'onchange': onchange} );
// let container = new ViewContainerElement( 'form', {'id': id} );
return container
})
// Build converter from model element to view element is used to render the getData output for the widget when you create new Elements in the editor.
.toElement( (element) => {
console.log("data.modelToView tangy-acasi element: ")
const introSrc = element.item.getAttribute('intro-src')
const name = element.item.getAttribute('name')
// const name = 'test'
let container = new ViewContainerElement( 'tangy-acasi', {'intro-src': introSrc, 'name': name} );
return container
})
buildModelConverter().for( data.modelToView )
.toElement( (element) => {
console.log("modelToView figure element")
const klass = element.item.getAttribute('class')
const container = new ViewContainerElement( 'figure', { class: klass } );
// let container = new ViewContainerElement( 'figure', {'class': klass}, toImageWidget(new ViewEmptyElement( 'img' )) );
// const widget = toWidget( container );
// widget.setAttribute( 'contenteditable', true );
return container;
} );
.toElement( () => {
const b = new AttributeContainer( 'b' );
const div = new ViewContainer( 'div', null, b );
return toWidget( div );
} );
.toElement( () => {
const element = toWidget( new ViewContainer( 'div' ), { label: 'element label' } );
return element;
} );
.toElement( (element) => {
console.log("modelToView form element")
const formContainer = new ViewContainerElement( 'figure', { class: 'tangy-form' } );
const formWdiget = toFormWidget( 'form', formContainer );
formWdiget.setAttribute( 'contenteditable', true );
return formWdiget;
} );
.toElement( (element) => {
console.log("modelToView tangy-acasi element")
const widgetContainer = new ViewContainerElement( 'figure', { class: 'tangy-acasi' });
const widget = toAcasiWidget( widgetContainer );
widget.setAttribute( 'contenteditable', true );
return widget;
} );
export function elementToElement( modelElementName, viewElement, options = {} ) {
options = Object.assign({}, { priority: 'normal', insertAtStart: true }, options );
viewElement = typeof viewElement == 'string' ? new ViewContainerElement( viewElement ) : viewElement;
return dispatcher => {
dispatcher.on( 'insert:' + modelElementName, insertElement( viewElement, options ), { priority: options.priority } );
}
}
export default function elementToElement( modelElementName, viewElement, options = {} ) {
options = Object.assign( {}, { priority: 'normal', insertAtStart: true }, options );
viewElement = typeof viewElement == 'string' ? new ViewContainerElement( viewElement ) : viewElement;
return dispatcher => {
dispatcher.on( 'insert:' + modelElementName, insertElement( viewElement, options ), { priority: options.priority } );
};
}