← Back to team overview

launchpad-dev team mailing list archive

Re: lazr-js multiline editor weirdness

 

On Thu, Oct 22, 2009 at 8:47 AM, Francis J. Lacoste
<francis.lacoste@xxxxxxxxxxxxx> wrote:
> On October 21, 2009, Deryck Hodge wrote:
>> Take a look at the activation template string in
>> lib.canonical.widgets.lazrjs.TextAreaEditorWidget.  There is a
>> formatter config option that takes the XHTML and formats it nicely.
>> This has to be done because the xhtml response is in <dd> tags via the
>> API.  It's also not tested in the lazr-js example because it's
>> dependent on our real XHR response, so it seemed silly to mock just so
>> the test formatted nicely.  It's hackish, I know.  But I couldn't
>> really work out a nicer way to do it.
>>
>
> Leonard, I think we should remove the default HTML view for the API. People
> don't get that it's meant to be customized. By removing the default view,
> people will get an error and realize that they have to register their own HTML
> view for their content, instead of parsing the default XHTML representation
> and transforming it into what they want. It's the third time around somebody
> does this!!!
>

Ok, so I had a talk with Francis about this, and then spent the last
few hours working with Leonard.  With lots of hacking away at my code
to get something working.

Francis' comment about disabling the default view is misleading.
Afterall, I do have a xhtml view for bug description.  If he would
like the default to die, that's another issue really. :)

The problem is really that I'm patching an entire object to update a
field, and we need to patch only the field.  You can patch using a
field uri and do this, which gives back the xhtml representation of
the field, and only the field html back.  I wasn't aware we could do
this.  We're others?  How has anyone used this if so?

I suspect no one has done this, which is why this is the third time
for formatter hacks.  It seems to me that currently client.js doesn't
know how to deal with single field updates.  PATCHPlugin seems
designed around patching whole objects by building a dict of
patch_payload.  So I have some code working that changes client.js to
allow for both, and I can clean it up later tonight, which is what I
plan to do unless I hear that I'm headed down the wrong path.


Cheers,
deryck


-- 
Deryck Hodge
https://launchpad.net/~deryck
http://www.devurandom.org/



Follow ups

References