Anonymous
Domino 2.0 Rich Internet Applications with IBM Lotus Notes/Domino
You are here: Today » Domino Workspace: blog post now has rich text editing
« Looking for a nice file upload control
Domino Workspace: The blog calendar »

Domino Workspace: blog post now has rich text editing

The JavaScript needed is added to the page when in 'edit' or 'new' mode. To generate the correct HTML, I've created a LotusScript function:

Sub getRtField(Byval label As String, Byval fieldName As String)
    Dim tmp As String
    
    tmp=Join(ws.doc.getitemvalue(fieldname), NEWLINE)
    ws.body |<li class="big">|
    ws.body |<label for="f| &fieldName & |">| & label & "</label>"
    ws.body |<div class="rich-text"><div></div>|
    ws.body |<textarea name="| & fieldName & |" id="f| & fieldName & |" rows="10" cols="80">| & tmp & |</textarea>|
    ws.body |</div>|
    ws.body |</li>|
    
End Sub

Saving the correct values

To make sure the correct values are saved, I've added an onsubmit action to the form with JavaScript:

G.form={
init:function(){
    var m=this,o=$('notesForm')
    if(!o)return
    o.onsubmit=m.submit
},
submit:function(){
    G.edit.onSave()
}
}

This executes the new 'onsave' and 'prepareSave' of the edit component:

G.edit={
// ...
onSave:function(){
    var m=this,o=$$('div'),i
    for(i=0;i<o.length;i++)if(o[i].className=='rich-text')m.prepareSave(o[i])
},
prepareSave:function(a){
    var m=this,v=a.rte.document.body,t=a.source,ob
    ob=(t.style.display=='none')
    if(!ob)v.innerHTML=t.value
    if(G.gecko)m.removeEmpty(v)
    t.value=m.clean(v)
}
}

Next steps

There is still some work to do for my first Room type:

There is also a lot of things that have to be done for the Workspace:

So much to do, so little time :-) All comments and suggestions are more than welcome.

Star rating

0%

Comments

To add a comment, log in or register as new user. It's free and safe.