(no subject)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

Egbe Eugene
Hi All,

After writing to the VE surface from a Gadget, the page saves with just
empty '<br></br>' tags with no text. I could be missing something in my
config for VE or use of the model. Please can I get a solution for this?

The sample data and the segment which writes to the model is found here[1].


--
Eugene233

[1] https://etherpad.wikimedia.org/p/sample_VE_model
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Bartosz Dziewoński
On 2019-12-16 10:46, Egbe Eugene wrote:
> After writing to the VE surface from a Gadget, the page saves with just
> empty '<br></br>' tags with no text. I could be missing something in my
> config for VE or use of the model. Please can I get a solution for this?
>
> The sample data and the segment which writes to the model is found here[1].
> [1] https://etherpad.wikimedia.org/p/sample_VE_model

Each item in the data array must be one character. I don't know how this
ends up with '<br></br>', but I get various exceptions when trying to
type (or do anything with the editor) after running your snippet, so
clearly something breaks terribly.

The corrected version would be like this:

var data = [
     {type: 'mwHeading', attributes: {level: 2}},
         'H', 'e', 'a', 'd', 'i', 'n', 'g', ' ', '2',
     {type: '/mwHeading'}
];

Or, more convenient to write (using the "spread syntax" for arrays):

var data = [
     {type: 'mwHeading', attributes: {level: 2}},
         ...'Heading 2'.split( '' ),
     {type: '/mwHeading'}
];



--
Bartosz Dziewoński

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l