Ask a Question related to Coldfusion Flash Integration, Design and Development.
-
existdissolve #1
URL Function in Rich Text Editor
I have grabbed Philippe Maegerman's and am trying to adjust it to allow for the
user to specify a url and apply it to the input text (like on the forums here).
Ideally, I would like to have a popup where teh user could specify the url;
however, I would also be happy with simply attaching a typed out url to the
input text. As of now, I can get it so that the input text is properly wrapped
with the <a></a> tags. HOwever, what I cannot figure out is how to pass the
value of another form input field (say, "link_fld") on the onClick event of the
url button. Any help or ideas would be much appreciated! Here is the code:
<cfsilent>
<!--- rich text area --->
<cfset buttonWidth="25">
<cfset selectWidth="100">
<cffunction name="setFormat" output="yes">
<cfargument name="mType">
<cfargument name="mValue">
<cfargument name="contentField">
<cfsaveContent variable="mReturn">
//if the source control is a button we simply catch the selection indexes
//if the source control is a select we catch the selection indexes from the
global variables that have been set by the onClick event of the select
if('#mType#' == 'font' || '#mType#' == 'size' || '#mType#' == 'color'){
var sStart=_global.sStart;
var sEnd=_global.sEnd;
}
else{
var sStart=Selection['lastBeginIndex'];
var sEnd=Selection['lastEndIndex'];
}
_global.currentTextFormat = #contentField#.getTextFormat(sStart, sEnd);
if (sStart != sEnd && _global.currentTextFormat.#mType# != true){
if('#mType#' == 'font' || '#mType#' == 'size' || '#mType#' == 'color')
//we get the selected value from the select passed as argument
_global.currentTextFormat.#mType# = _root.#mValue#.selectedItem.data;
else
_global.currentTextFormat.#mType# = '#mValue#';
}
else _global.currentTextFormat.#mType# = false;
#contentField#.setTextFormat(sStart, sEnd, _global.currentTextFormat);
</cfsavecontent>
<cfreturn mReturn>
</cffunction>
</cfsilent>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<cfform name="mine" format="flash" width="1000" height="1000" method="post"
skin="haloblue">
<!--- Advanced Textarea by Philippe Maegerman --->
<cfformgroup type="panel" label="Edit Slide">
<!--- BUTTONS GROUP --->
<cfformgroup type="horizontal" width="650" style="indicatorGap:4">
<!--- STYLES BUTTONS --->
<cfinput type="button" name="bold" value="B" width="#buttonWidth#"
style="font-weight:bold; borderThickness:1;"
onClick="#setFormat('bold','true','texte.label')#;
texteHTML.text=texte.htmlText;">
<cfinput type="button" name="italic_btn" value="I" width="#buttonWidth#"
style="font-style:italic; borderThickness:1"
onClick="#setFormat('italic','true','texte.label') #;
texteHTML.text=texte.htmlText;">
<cfinput type="button" name="underline_btn" value="U"
width="#buttonWidth#" style="text-decoration:underline; borderThickness:1;"
onClick="#setFormat('underline','true','texte.labe l')#;
texteHTML.text=texte.htmlText;">
<!--- SEPARATOR --->
<cfformitem type="vrule" height="22" width="10" />
<!--- ALIGN BUTTONS --->
<cfinput type="button" name="left_btn" src="images/AlignLeft16.gif"
width="#buttonWidth#" tooltip="Align Left" value="" style="borderThickness:1;"
height="22"
onClick="#setFormat('align','left','texte.label')# ;texteHTML.text=texte.htmlText
;">
<cfinput type="button" name="center_btn" src="images/AlignCenter16.gif"
width="#buttonWidth#" tooltip="Align Center" value=""
style="borderThickness:1;" height="22"
onClick="#setFormat('align','center','texte.label' )#;texteHTML.text=texte.htmlTe
xt;">
<cfinput type="button" name="right_btn" src="images/AlignRight16.gif"
width="#buttonWidth#" tooltip="Align Right" value="" style="borderThickness:1;"
height="22"
onClick="#setFormat('align','right','texte.label') #;texteHTML.text=texte.htmlTex
t;">
<!--- SEPARATOR --->
<cfformitem type="vrule" height="22" width="10" />
<!--- BULLET BUTTON --->
<cfinput type="button" name="bullet_btn" value="" width="#buttonWidth#"
tooltip="Bullet" style="borderThickness:1;" height="22"
src="images/bullet16.gif"
onClick="#setFormat('bullet','true','texte.label') #;texteHTML.text=texte.htmlTex
t;">
<cfformitem type="vrule" height="22" width="10" />
<cfinput type="button" name="link_btn" value="" width="#buttonWidth#"
tooltip="Link" style="borderThickness:1;" heigth="22"
onClick="#setFormat('url','true','texte.label')#;t exteHTML.text=texte.htmlText;"<cfinput type="button" name="emoticon" value="" width="#buttonWidth#">
tooltip="Emoticon" style="borderThickness:1;" height="22"
onClick="#setFormat('mailto','true','texte.label') #;texteHTML.text=texte.htmlTex
t;">
<!--- SELECTS GROUP --->
<!--- FONT SELCT --->
<!--- clicking the select, the Selection would loose its lastBeginIndex
and lastEndIndex --->
<!--- we assign then the values to _global variables for further use in
the setFormat() function --->
<cfselect name="font_select" label="Font" width="#selectWidth#"
onmousedown="_global.sStart=Selection['lastBeginIndex'];_global.sEnd=Selec
tion['lastEndIndex'];"
onchange="#setFormat('font','font_select','texte.l abel')#;font_select.sele
ctedIndex=0;texteHTML.text=texte.htmlText;">
<!--- the selectedIndex is reset to 0 at the end of the onChange event,
we do this because the select uses the onChanged event to apply the style,
which wouldn't be triggered if we wanted to apply the same style to another
selection --->
<cfset fontList="Arial,Arial Black,Verdana,Impact,Courier
New,Georgia,Helvetica,Times New Roman">
<option value="null">-</OPTION>
<cfloop list="#fontList#" index="i">
<option
value="<cfoutput>#i#</cfoutput>"><cfoutput>#i#</cfoutput></OPTION>
</cfloop>
</cfselect>
<!--- SIZE SELECT --->
<cfselect name="size_select" label="Size" width="50"
onmousedown="_global.sStart=Selection['lastBeginIndex'];_global.sEnd=Selec
tion['lastEndIndex'];"
onchange="#setFormat('size','size_select','texte.l abel')#;size_select.sele
ctedIndex=0;texteHTML.text=texte.htmlText;">
<option value="null">-</OPTION>
<cfloop from="6" to="100" index="i" step="2">
<option
value="<cfoutput>#i#</cfoutput>"><cfoutput>#i#</cfoutput></OPTION>
</cfloop>
</cfselect>
<cfselect name="color_select" label="Color" width="#selectWidth#"
onmousedown="_global.sStart=Selection['lastBeginIndex'];_global.sEnd=Selec
tion['lastEndIndex'];"
onchange="#setFormat('color','color_select','texte .label')#;color_select.s
electedIndex=0;texteHTML.text=texte.htmlText;">
<option value="null">-</OPTION>
<option value="0xFF0000">Red</OPTION>
<option value="0x00FF00">Green</OPTION>
<option value="0x0000FF">Blue</OPTION>
<option value="0x000000">Black</OPTION>
<option value="0xFFFF00">Yellow</OPTION>
<option value="0xFFCC00">Orange</OPTION>
<option value="0x888888">Gray</OPTION>
<option value="0x333333">Dark Gray</OPTION>
<option value="0xcccccc">Light Gray</OPTION>
<option value="0xCC00FF">Purple</OPTION>
<option value="0xFF00CC">Pink</OPTION>
<option value="0x666699">Custom</OPTION>
</cfselect>
</cfformgroup>
<!--- TEST DEFAULT CONTENT --->
<cfformgroup type="TABNAVIGATOR">
<cfformgroup type="PAGE" label="Preview">
<!--- TEXTAREA FOR EDITING --->
<cftextarea name="texte" value=""
onChange="texteHTML.text=texte.htmlText;"></cftextarea>
</cfformgroup>
<cfformgroup type="PAGE" label="Code">
<!-- TEXTAREA FOR RETRIEVING VALUE / WOULD BE A HIDDEN FIELD USED BY THE
POSTED FORM -->
<cftextarea name="texteHTML" value="" ></cftextarea>
<cfinput type="button" name="updateHTML" value="update HTML"
onClick="texte.htmlText=texteHTML.text;">
</cfformgroup>
</cfformgroup>
<!--- TRIGGER TO TELL OUR TEXTAREA TO ACCEPT HTML --->
</cfformgroup>
</cfform>
</body>
</html>
existdissolve Guest
-
Rich Text Editor
Hi! I know that exists many rich text editor on internet. But i want lear how to do it. I learn to do, but i?m not getting to aply the bold... -
superscript in Rich text Editor
Help!!!:brokenheart; Is there a way to add superscript/subscript in rich text editor? Current editor does not support this. Can any one give me... -
Rich Text Editor in DW ?
Looking for a way to edit a MySQL db text field as RTF...is there an RTE extension / add in / whatever that will allow me to do that ? Thanks, Nick -
Rich Text Editor with POST?
I just downloaded the cross-browser rich text editor from Kevin Roth. http://www.kevinroth.com/rte/demo.htm Sample fo the html code: <!--... -
OT: Rich Text Box editor (IE object)
Hi, I am looking for a way to have a textbox, but with some rich text box type properties. Most importently, it should let a user create...



Reply With Quote

