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:
- Tagging and a tag cloud
- Comment functionality
- Images and links
There is also a lot of things that have to be done for the Workspace:
- Maybe the Workspace should dive directly into the places overview.
- I am very tempted to make the Workspace look like the Notes Workspace with the chicklets.
- The places overview should give more information on each place: when last modified, number of rooms, documents and comments in total.
- Add the 'My space' tab that gives users direct access to their own documents.
So much to do, so little time :-) All comments and suggestions are more than welcome.
Comments
To add a comment, log in or register as new user. It's free and safe.