Home » Development » Modifications » [MOD] fckeditor html editor integration
| [MOD] fckeditor html editor integration [message #7143] |
Tue, 24 May 2005 13:30  |
dracono
Messages: 55 Registered: April 2005 Location: Gdynia
|
phpCollab lover |
|
|
hello
I have done fckeditor (2.0 Beta 3 verion taken from OpenIT project) html editor integration.
Editor is in the attachment. Unpack it in ../javascript/ directory, edit
fckeditor.js and fckconfig.js if you need and:
1. add new function to ../includes/library.php
# ../includes/library.php
function turnHtmleditorOn($name,$width,$height,$skin,$value) {
$headBonus = '
<script type="text/javascript" src="../javascript/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function() {
var oFCKeditor = new FCKeditor("'.$name.'", "'.$width.'", "'.$height.'", "'.$skin.'", "'.$value.'");
oFCKeditor.ReplaceTextarea() ;
}
</script>';
return $headBonus;
}
[/php:1]
2. add default setting to the ../includes/settings.php
# ../includes/settings.php, anywhere
$enableHtmleditor = "true";
$editorWidth = "700"; # deafault values
$editorHeight = "400";
$editorSkin = "Default";
[/php:1]
3. change convertData function to unparse the html code (is it safe to phpC?)
# ../includes/library.php, inside convertData function, (is it safe for phpC?)
# $data = str_replace('"','"',$data);
# $data = str_replace("'",''',$data);
# $data = str_replace('<','<',$data);
# $data = str_replace('>','>',$data);
[/php:1]
4. Add to every file/form where you want to have fckeditor window
#$bodyCommand = "onLoad=\"document.ptTForm.tpm.focus();\""; # changed
# MOD, use htmleditor, added
if ($enableHtmleditor == "true")
$headBonus=turnHtmleditorOn("TEXT_AREA_NAME",$editorWidth,$editorHeight,$editorSkin,"");
# ---
include('../themes/'.THEME.'/header.php'); # already there
[/php:1]
where TEXT_AREA_NAME is the id of the textarea object.
5. Add to the textrea proper id tag, for example
# ../topics/addpost.php
$block1->contentRow($strings["message"],"<textarea id=\"tpm\" rows=\"10\" style=\"width: 700px; height: 320px;\" name=\"tpm\" cols=\"47\"></textarea>");
[/php:1]
Any comments or suggestions?
I took fckeditor (2.0 Beta 3 v.) from OpenIT because I had learn there how fck works. I tried with new 2.0FC version
and I got some js error... maybe some one found what is the difference.
|
|
|
|
| [MOD] fckeditor html editor integration [message #7146] |
Tue, 24 May 2005 18:12   |
|
|
I prefer to not use html inside the task/project textarea, for a single reason:
if you give to a user a editor wysiwyg he/she will use a lot of color, bold, underline, etc, etc, etc. and this is BAD (no more clear pages). Same problems for the clients.. they have not to modify in any way the data showned in the interface.
A good compromise should be enable only some tags, like anchor, strong and emphasis but no more than those.
Btw, I'll use fckeditor to the newsdesk instead the htmlarea
|
|
|
|
| [MOD] fckeditor html editor integration [message #7147] |
Tue, 24 May 2005 18:28   |
dracono
Messages: 55 Registered: April 2005 Location: Gdynia
|
phpCollab lover |
|
|
| fullo | I prefer to not use html inside the task/project textarea, for a single reason:
if you give to a user a editor wysiwyg he/she will use a lot of color, bold, underline, etc, etc, etc. and this is BAD (no more clear pages). Same problems for the clients.. they have not to modify in any way the data showned in the interface.
|
Yes, I agree with that but I rather mean using html editor not to make eye-candy content but
to make more structural content (lists and outlines). It is very important thing which couse comunication clear and efficiency.
| fullo |
A good compromise should be enable only some tags, like anchor, strong and emphasis but no more than those.
|
Yes, It can be done very well with fck editor. I already done it partly, look at he fckconfig.js.
As I wrote above, I think that the most important are list (<ul> and <ol>) and indentations.
| fullo | Btw, I'll use fckeditor to the newsdesk instead the htmlarea
|
In my opinion in topics it should be used too. Please consider my point of view.
|
|
|
|
|
|
|
|
| Re: [MOD] fckeditor html editor integration [message #7154] |
Wed, 25 May 2005 15:00   |
dracono
Messages: 55 Registered: April 2005 Location: Gdynia
|
phpCollab lover |
|
|
| dracono |
4. Add to every file/form where you want to have fckeditor window
#$bodyCommand = "onLoad=\"document.ptTForm.tpm.focus();\""; # changed
# MOD, use htmleditor, added
if ($enableHtmleditor == "true")
$headBonus=turnHtmleditorOn("TEXT_AREA_NAME",$editorWidth,$editorHeight,$editorSkin,"");
# ---
include('../themes/'.THEME.'/header.php'); # already there
[/php:1]
|
It rather should looks like this:
# MOD, use htmleditor, added
if ($enableHtmleditor == "true")
$headBonus=turnHtmleditorOn("TEXT_AREA_NAME",$editorWidth,$editorHeight,$editorSkin,"");
else
$bodyCommand = "onLoad=\"document.ptTForm.tpm.focus();\"";
# ---
include('../themes/'.THEME.'/header.php'); # already there
[/php:1]
|
|
|
|
|
|
| [MOD] fckeditor html editor integration [message #7244] |
Wed, 08 June 2005 09:16   |
dracono
Messages: 55 Registered: April 2005 Location: Gdynia
|
phpCollab lover |
|
|
hello
fckeditor integration needs also some addons in the autoLinks function to
resolve urls properly. There is need to add "<" char to ftp/http/https:
#../includes/library.php
function autoLinks($data) {
global $newText;
$lines = explode("\n", $data);
while (list ($key, $line) = each ($lines)) {
$line = eregi_replace("([ \t]|^)www\.", " http://www.", $line);
$line = eregi_replace("([ \t]|^)ftp\.", " ftp://ftp.", $line);
# MOD, PS (dracono), added "<" char which mark end of link, needed by fckeditor integration
$line = eregi_replace("(http://[^ <)\r\n]+)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $line); # MOD
$line = eregi_replace("(https://[^ <)\r\n]+)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $line); # MOD
$line = eregi_replace("(ftp://[^ <)\r\n]+)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $line); #MOD
$line = eregi_replace("([-a-z0-9_]+(\.[_a-z0-9-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)+))", "<a href=\"mailto:\\1\">\\1</a>", $line);
if (empty($newText)) {
$newText = $line;
} else {
$newText .= "\n$line";
}
}
}
[/php:1]
|
|
|
|
|
|
Goto Forum:
Current Time: Wed May 22 21:45:05 CEST 2013
Total time taken to generate the page: 0.27723 seconds
|