ContentEditable Area

So i've been thinking about making lots of little, small areas editable in my next applicaiton. All i want the client to able to do is edit the text, NOT FORMAT IT in any shape or form. As Sean Corfield pointed out in the comments of my previous posts using something like Contribute with Fusebox is just impossible (though possbile with Mach-ii if you know the view pages to go to).

Anyway it got me thinking, i dont want to build a whole administration side, i just want a user to be able to go in and edit small bits of text when they are logged in. So i've been playing for the last half hour or so and got the following. Its a bare bones idea to a pluggin that i'm thinking about for FB4. Basically if you use content variables then you can make a <div> region which has a class attribute begining ="edit editable. It does this by adding contentEditable="true" when the content variable is passed (and of course you are logged in), it also highlights the area with a red border and makes it editable (to IE only).
<cfset editable = "true">

\n<cfsavecontent variable="q">
\n<div id="myId" class="editBody">test</div>
\n</cfsavecontent>

\n<cfscript>
\n   if(editAble){
\n      edString = 'style="border:1px solid red" contentEditable="true"';
\n      reDiv = '(<div)[ \\w\\_"=:;]*(class="edit)[ \\w\\_"=:;]*>';
\n      
\n      if(reFind(reDiv, q)){
\n         q = replaceNoCase(q, 'class="
edit', edString&' class="edit', "ALL");
\n      }
\n   }
\n   writeOutput(q);
\n</cfscript>
My next problem is the submiting the page bit???
comments powered by Disqus