-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
downcastElementToWidget? #1228
Comments
Hm... we may need to make it clearer. Such a function does not exist. It's theoretical. It was meant to show that you can use any function there, but it does it rather poorly. I'll rewrite that bit. Regarding element => widget. There's |
However, a
|
Besides
|
PS. I'm rising the priority of this issue because it's really unjustified that you need to switch from |
This issue is a bit old thus the link provided does not contains As for the proposition currently you'd have to: const config = {
model: 'simpleBox',
view: {
name: 'section',
classes: 'simple-box'
};
conversion.for( 'upcast' ).elementToElement( config );
conversion.for( 'dataDowncast' ).elementToElement( config )
conversion.for( 'editingDowncast' ).elementToElement( {
model: 'simpleBox',
view: ( element, writer ) => {
const section = writer.createContainerElement( 'section', { class: 'simple-box' } );
return toWidget( section, writer, { label: 'some widget' } );
}
} );
// or probably should work also:
conversion.elementToElement( config );
conversion.for( 'editingDowncast' ).elementToElement( {
model: 'simpleBox',
view: ( element, writer ) => {
const section = writer.createContainerElement( 'section', { class: 'simple-box' } );
return toWidget( section, writer, { label: 'some widget' } );
},
converterPriority: 'high'
} ); a bit of bloat I see but I don't think that I like complexity of the proposal: conversion.elementToElement( {
model: 'simpleBox',
view: {
name: 'section',
classes: 'simple-box'
},
onEditingDowncast: ( element, writer ) => {
const section = writer.createContainerElement( 'section', { class: 'simple-box' } );
return toWidget( section, writer, { label: 'some widget' } );
}
} ); The placement / construct of the
Given the above I don't think that simple general two-way converters should work for every case. They should cover most of the cases but not all. The knowledge behind knowing why I need adding the About complexity: even the "simplest" widget (Media Embed) does way more in the converter callback that used examples and I don't see that packed into one ps.: The TL;DR: I think we're fine with current API and I wouldn't introduce complexity into simple general conversion helper. Also the long-awaited docs for conversion would help (a guide). |
There is still a reference to this Issue in the Documentation, as well as a suggestion to up-vote this (closed) issue.. That link, as well as the comment, should be updated with the current state of things.
|
🆕 Feature request
I notice that the docs allude to downcastElementToWidget (link). This is kind of what I'm looking for I think. However, I can't find where this function actually comes from.
The text was updated successfully, but these errors were encountered: