1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-09 20:18:08 +02:00

More fixes and enhancements - bbcodes, tinymce, js

This commit is contained in:
CaMer0n
2012-05-28 13:06:09 +00:00
parent e6c44543dd
commit 5139a7d390
75 changed files with 6196 additions and 5347 deletions

View File

@@ -46,6 +46,8 @@ e107::js("core", "plupload/customUpload.js","jquery",3);
e107::js("core", "core/mediaManager.js","jquery",3); e107::js("core", "core/mediaManager.js","jquery",3);
e107::js("core", "tooltip/jquery.qtip-1.0.0-rc3.min.js","jquery",3);
e107::css('core', 'core/admin.jquery.css', 'jquery'); e107::css('core', 'core/admin.jquery.css', 'jquery');
e107::css('core', 'core/all.jquery.css', 'jquery'); e107::css('core', 'core/all.jquery.css', 'jquery');

View File

@@ -210,7 +210,9 @@ class media_form_ui extends e_admin_form_ui
$path = $this->getController()->getListModel()->get('media_url'); $path = $this->getController()->getListModel()->get('media_url');
$preview = basename($path); $preview = basename($path);
return "<input type='button' value='Select' class='e-media-select e-dialog-close' data-target='{$tagid}' data-path='{$path}' data-preview='{$preview}' title=\"Select\" />"; $bbcode = ($_GET['bbcode']==1) ? "file" : "";
return "<input type='button' value='Select' class='e-media-select e-dialog-close' data-target='{$tagid}' data-bbcode='{$bbcode}' data-path='{$path}' data-preview='{$preview}' title=\"Select\" />";
} }
@@ -380,9 +382,12 @@ class media_admin_ui extends e_admin_ui
if($this->getQuery('iframe')) if($this->getQuery('iframe'))
{ {
if($this->getQuery('bbcode')) if($this->getQuery('bbcode'))
{ {
e107::getJs()->headerFile(e_PLUGIN_ABS.'tinymce/tiny_mce_popup.js',2);
e107::getJS()->headerInline(" e107::getJS()->headerInline("
/* Send the generated IMG bbcode back to the textarea/window */ /* Send the generated IMG bbcode back to the textarea/window */
@@ -591,8 +596,8 @@ class media_admin_ui extends e_admin_ui
$text .= "<div style='text-align:right;padding:5px'> $text .= "<div style='text-align:right;padding:5px'>
<button type='submit' class='submit e-dialog-save e-dialog-close' data-target='".$this->getQuery('tagid')."' name='save_image' value='Save' onclick=\"saveBB();\" > <button type='submit' class='submit e-dialog-save e-dialog-close' data-target='".$this->getQuery('tagid')."' name='save_image' value='Save it' >
<span>Save</span> <span>Save IT</span>
</button> </button>
<button type='submit' class='submit e-dialog-close' name='cancel_image' value='Cancel' > <button type='submit' class='submit e-dialog-close' name='cancel_image' value='Cancel' >
<span>Cancel</span> <span>Cancel</span>

View File

@@ -517,6 +517,7 @@ class news_form_ui extends e_admin_form_ui
function headerjs() function headerjs()
{ {
return;
$newspost = e107::getRegistry('_newspost_admin'); $newspost = e107::getRegistry('_newspost_admin');
/* /*
$ret .= "<script type='text/javascript'> $ret .= "<script type='text/javascript'>
@@ -703,9 +704,6 @@ require_once("footer.php");
exit; exit;
// FIXME - news2plugin! Full rewrite.
class admin_newspost class admin_newspost
{ {
var $_request = array(); var $_request = array();
@@ -730,8 +728,8 @@ class admin_newspost
require_once(e_HANDLER."cache_handler.php"); require_once(e_HANDLER."cache_handler.php");
require_once(e_HANDLER."news_class.php"); require_once(e_HANDLER."news_class.php");
require_once(e_HANDLER."calendar/calendar_class.php"); // require_once(e_HANDLER."calendar/calendar_class.php");
$this->_cal = new DHTML_Calendar(true); // $this->_cal = new DHTML_Calendar(true);
$this->_pst = $pstobj; $this->_pst = $pstobj;
@@ -1804,7 +1802,8 @@ echo "date=".$_POST['news_start'];
require_once(e_HANDLER."userclass_class.php"); require_once(e_HANDLER."userclass_class.php");
require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."form_handler.php");
$frm = new e_form(true); //enable inner tabindex counter // $frm = new e_form(true); //enable inner tabindex counter
$frm = e107::getForm();
$text = ''; $text = '';
if (isset($_POST['preview'])) if (isset($_POST['preview']))
@@ -1846,6 +1845,7 @@ echo "date=".$_POST['news_start'];
$_POST['news_title'] = $tp->dataFilter($_POST['news_title']); $_POST['news_title'] = $tp->dataFilter($_POST['news_title']);
} }
} }
/*
if ($sub_action == "upload" && !varset($_POST['preview'])) if ($sub_action == "upload" && !varset($_POST['preview']))
{ {
@@ -1860,6 +1860,7 @@ echo "date=".$_POST['news_start'];
$_POST['news_body'] = $row['upload_description']."\n[b]".NWSLAN_49." [link=".$e107->url->create('user/profile/view', 'id='.$post_author_id.'&name='.$post_author_name)."]".$post_author_name."[/link][/b]\n\n[file=request.php?".$upload_file."]{$row['upload_name']}[/file]\n"; $_POST['news_body'] = $row['upload_description']."\n[b]".NWSLAN_49." [link=".$e107->url->create('user/profile/view', 'id='.$post_author_id.'&name='.$post_author_name)."]".$post_author_name."[/link][/b]\n\n[file=request.php?".$upload_file."]{$row['upload_name']}[/file]\n";
} }
} }
*/
$text .= " $text .= "
<div class='admintabs' id='tab-container'> <div class='admintabs' id='tab-container'>
@@ -1888,17 +1889,14 @@ echo "date=".$_POST['news_start'];
} }
else else
{ {
$text .= " // $text .= $frm->selectbox("cat_id",$this->news_category,$_POST['cat_id']);
".$frm->select_open('cat_id')." $text .= $frm->select_open('cat_id');
";
foreach ($this->news_categories as $row) foreach ($this->news_categories as $row)
{ {
$text .= $frm->option($tp->toHTML($row['category_name'], FALSE, "LINKTEXT"), $row['category_id'], varset($_POST['cat_id']) == $row['category_id']); $text .= $frm->option($tp->toHTML($row['category_name'], FALSE, "LINKTEXT"), $row['category_id'], varset($_POST['cat_id']) == $row['category_id']);
} }
$text .= " $text .= "</select>";
</select>
";
} }
$text .= " $text .= "
</td> </td>
@@ -1972,12 +1970,41 @@ echo "date=".$_POST['news_start'];
"; ";
} }
$text .= "</td></tr>\n";
// -----
$text .= "<tr>
<td>".NWSLAN_13.":<br /></td>
<td>\n";
$text .= "<div class='e-tabs'>
<ul>
<li><a href='#news-body-container'>".NWSLAN_13."</a></li>
<li><a href='#news-extended-container'>".NWSLAN_14."</a></li>
</ul>";
$val = (strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body'])));
$text .= "<div id='news-body-container'>";
$text .= $frm->bbarea('news_body', $val, 'news', 'helpb');
$text .= "</div><div id='news-extended-container'>";
$val = (strstr($tp->post_toForm($_POST['news_extended']), "[img]http") ? $tp->post_toForm($_POST['news_extended']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_extended'])));
$text .= $frm->bbarea('news_extended', $val, 'extended', 'helpc','large');
$text .= "</div>
</div></td></tr>";
//-----------
/*
$text .= " $text .= "
</td>
</tr>
<tr> <tr>
<td>".NWSLAN_13.":<br /></td> <td>".NWSLAN_13.":<br /></td>
<td>"; <td>
";
$val = (strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body']))); $val = (strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body'])));
$text .= $frm->bbarea('news_body', $val, 'news', 'helpb'); $text .= $frm->bbarea('news_body', $val, 'news', 'helpb');
@@ -1998,6 +2025,7 @@ echo "date=".$_POST['news_start'];
</td> </td>
</tr>"; </tr>";
/* /*
/*
$text .= " $text .= "
<tr> <tr>
@@ -2084,7 +2112,6 @@ echo "date=".$_POST['news_start'];
<tr> <tr>
<td class='label'>".NWSLAN_73.":</td> <td class='label'>".NWSLAN_73.":</td>
<td class='control'> <td class='control'>
"; ";
@@ -2101,46 +2128,13 @@ echo "date=".$_POST['news_start'];
<div class='field-spacer'>".NWSLAN_21.":</div> <div class='field-spacer'>".NWSLAN_21.":</div>
<div class='field-spacer'> <div class='field-spacer'>
"; ";
/*
$_startdate = ($_POST['news_start'] > 0) ? date("d/m/Y", $_POST['news_start']) : "";
$cal_options['showsTime'] = false;
$cal_options['showOthers'] = false;
$cal_options['weekNumbers'] = false;
$cal_options['ifFormat'] = "%d/%m/%Y";
$cal_attrib['class'] = "tbox";
$cal_attrib['size'] = "10";
$cal_attrib['name'] = "news_start";
$cal_attrib['value'] = $_startdate;
$cal_attrib['tabindex'] = $frm->getNext();
$text .= $this->_cal->make_input_field($cal_options, $cal_attrib);
*/
$text .= $frm->datepicker("news_start",$_POST['news_start'],"type=datetime"); $text .= $frm->datepicker("news_start",$_POST['news_start'],"type=datetime");
$text .= " - "; $text .= " - ";
/*
$_enddate = ($_POST['news_end'] > 0) ? date("d/m/Y", $_POST['news_end']) : "";
unset($cal_options);
unset($cal_attrib);
$cal_options['showsTime'] = false;
$cal_options['showOthers'] = false;
$cal_options['weekNumbers'] = false;
$cal_options['ifFormat'] = "%d/%m/%Y";
$cal_attrib['class'] = "tbox";
$cal_attrib['size'] = "10";
$cal_attrib['name'] = "news_end";
$cal_attrib['value'] = $_enddate;
$cal_attrib['tabindex'] = $frm->getNext();
$text .= $this->_cal->make_input_field($cal_options, $cal_attrib);
*/
$text .= $frm->datepicker("news_end",$_POST['news_end'],"type=datetime"); $text .= $frm->datepicker("news_end",$_POST['news_end'],"type=datetime");
$text .= " $text .= "</div>
</div>
<div class='field-help'> <div class='field-help'>
".NWSLAN_72." ".NWSLAN_72."
</div> </div>
@@ -2151,30 +2145,21 @@ echo "date=".$_POST['news_start'];
<td class='control'> <td class='control'>
<div class='field-spacer'> <div class='field-spacer'>
"; ";
/*
$_update_datestamp = ($_POST['news_datestamp'] > 0 && !strpos($_POST['news_datestamp'],"/")) ? date("d/m/Y H:i:s", $_POST['news_datestamp']) : trim($_POST['news_datestamp']);
unset($cal_options);
unset($cal_attrib);
$cal_options['showsTime'] = true;
$cal_options['showOthers'] = true;
$cal_options['weekNumbers'] = false;
$cal_options['ifFormat'] = "%d/%m/%Y %H:%M:%S";
$cal_options['timeFormat'] = "24";
$cal_attrib['class'] = "tbox";
$cal_attrib['name'] = "news_datestamp";
$cal_attrib['value'] = $_update_datestamp;
$text .= $this->_cal->make_input_field($cal_options, $cal_attrib);
*/
$text .= $frm->datepicker("news_datestamp",$_POST['news_datestamp'],"type=datetime"); $text .= $frm->datepicker("news_datestamp",$_POST['news_datestamp'],"type=datetime");
$text .= " $text .= "</div>";
</div> /*
<div class='field-spacer'>
$text .= "<div class='field-spacer'>
".$frm->checkbox('update_datestamp', '1', $_POST['update_datestamp']).$frm->label(NWSLAN_105, 'update_datestamp', '1')." ".$frm->checkbox('update_datestamp', '1', $_POST['update_datestamp']).$frm->label(NWSLAN_105, 'update_datestamp', '1')."
</div> </div>
<div class='field-help'> <div class='field-help'>
".LAN_NEWS_33." ".LAN_NEWS_33."
</div> </div>";
*/
$text .= "
</td> </td>
</tr> </tr>
"; ";
@@ -3015,6 +3000,7 @@ echo "date=".$_POST['news_start'];
} }
exit; exit;
} }
/*
function show_options() function show_options()
{ {
@@ -3053,10 +3039,11 @@ echo "date=".$_POST['news_start'];
e_admin_menu(NWSLAN_48, $this->getAction(), $var); e_admin_menu(NWSLAN_48, $this->getAction(), $var);
} }
*/
} }
function newspost_adminmenu() function newspost_adminmenu()
{ {
e107::getRegistry('_newspost_admin')->show_options(); // e107::getRegistry('_newspost_admin')->show_options();
} }

View File

@@ -21,12 +21,247 @@ include_once(e_HANDLER.'shortcode_handler.php');
e107::coreLan('ren_help'); e107::coreLan('ren_help');
$codes = array('bb', 'bb_help', 'bb_preimagedir'); $codes = array('bb', 'bb_help', 'bb_preimagedir');
register_shortcode('bbcode_shortcodes', $codes); // register_shortcode('bbcode_shortcodes', $codes);
class bbcode_shortcodes class bbcode_shortcodes extends e_shortcode
{ {
// The BBcode Buttons.
function bb_format($id)
{
$text = "<select class='e-bb' id='{$id}' title='Format text' onchange=\"addtext(this.value);this.value=''\">
<option value=''>Format</option>
<option value='[p][/p]'>Paragraph [p]</option>
<option value='[h2][/h2]'>Heading [h2]</option>
<option value='[block][/block]'>Block [div]</option>
<option value='[blockquote][/blockquote]'>Quote [blockquote]</option>
<option value='[code][/code]'>Code [code]</option>
</select>";
return $text;
}
function bb_table($id)
{
// $data = "[table]\n[tr]\n\t[td]Cell 1[/td]\n\t[td]Cell 2[/td]\n[/tr]\n[/table]"; // works with jquery, but not onclick.
$data = "[table][tr][td]Cell 1[/td][td]Cell 2[/td][/tr][/table]";
$event = $this->getEvent('addtext',$data,'Insert a table',1);
$text = "<a {$event} class='e-bb' id='{$id}' data-function='insert' href='#{$this->var['tagid']}' title='Insert a table' data-bbcode='{$data}'>";
$text .= "<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/table.png' alt='' /></a>";
return $text;
}
function bb_list($id)
{
$data = "[list][*]Item 1[*]Item 2[/list]";
// $data = "[list]\n[*]Item 1\n[*]Item 2\n[/list]"; // works with jquery, but not onclick.
$event = $this->getEvent('addtext',$data,LANHELP_36);
$text = "<a {$event} class='e-bb' id='{$id}' data-function='insert' href='#{$this->var['tagid']}' title='".LANHELP_36."' data-bbcode='{$data}'>";
$text .= "<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/list.png' alt='' /></a>";
return $text;
}
function bb_youtube($id)
{
$data = "[youtube]*[/youtube]";
$event = $this->getEvent('addinput',$data,LANHELP_48);
$text = "<a {$event} class='e-bb' id='{$id}' data-function='input' href='#{$this->var['tagid']}' title='".LANHELP_48."' data-bbcode='{$data}'>
<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/youtube.png' alt='' /></a>";
return $text;
}
function bb_link($id)
{
$data = "[link=*]*[/link]";
$event = $this->getEvent('addinput',$data,LANHELP_35);
$text = "<a {$event} class='e-bb' id='{$id}' data-function='input' href='#{$this->var['tagid']}' title='".LANHELP_35."' data-bbcode='{$data}'>
<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/link.png' alt='' /></a>";
return $text;
}
function bb_preimage($id)
{
if($this->var['tagid'] == 'data_') // BC work-around for duplicate IDs.
{
$tag = "data";
}
else
{
list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag.
}
$text = "<a class='e-dialog' id='{$id}' href='".e_ADMIN."image.php?mode=main&action=dialog&for=".$this->var['template']."&tagid=".$tag."&iframe=1&bbcode=1' >";
$text .= "<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/preimage.png' alt='' />";
$text .= "</a>\n";
return $text;
}
function bb_prefile($id)
{
if($this->var['tagid'] == 'data_') // BC work-around for duplicate IDs.
{
$tag = "data";
}
else
{
list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag.
}
$text = "<a class='e-dialog' id='{$id}' href='".e_ADMIN."image.php?mode=dialog&action=list&for=download_file&tagid=".$tag."&iframe=1&bbcode=1' >";
$text .= "<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/prefile.png' alt='' />";
$text .= "</a>\n";
return $text;
}
function bb_fontsize($id)
{
$data = "size";
$formid = $id."_";
$event = $this->getEvent('expandit',$formid, LANHELP_22);
$text = "<a {$event} class='e-bb' data-function='show' href='#{$this->var['tagid']}' title='".LANHELP_22."' data-bbcode='{$data}'>
<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/fontsize.png' alt='' /></a>";
$text .="<!-- Start of Size selector -->
<div style='margin-left:0px;margin-right:0px; position: absolute; left:340px; top:60px;z-index:1000;display:none' id='{$formid}'>";
$text .="<div style='position:absolute; bottom:30px; left:125px; width:100px'>";
$text .= "<table class='fborder' style='background-color: #fff'>
<tr><td class='forumheader3'>
<select class='tbox' name='preimageselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
<option value=''>".LANHELP_41."</option>";
$sizes = array(7,8,9,10,11,12,14,15,18,20,22,24,26,28,30,36);
foreach($sizes as $s){
$text .= "<option value='[size=".$s."][/size]'>".$s."px</option>\n";
}
$text .="</select></td></tr> \n </table></div>
</div>\n<!-- End of Size selector -->";
return $text;
}
function bb_fontcol($id)
{
// $bbcode['fontcol'] = array("e-expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand);
$formid = $id."_";
$event = $this->getEvent('expandit',$formid, LANHELP_22);
$text = "<a {$event} class='e-bb' id='{id}' data-function='show' href='#{$this->var['tagid']}' title='".LANHELP_22."' data-bbcode='{$data}'>
<img class='bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/fontcol.png' alt='' /></a>";
// return $text;
$text .= "<!-- Start of Color selector -->
<div id='{$formid}' style='width: 221px; position: absolute; left:340px; top:60px; margin-right:auto; margin-left:auto; display:none; z-index: 1000; onclick=\"expandit('{$formid}')\" >
<div style='border:1px solid black; position: absolute; top:30px; width: 221px; '>";
$text .= "<script type='text/javascript'>
//<![CDATA[
var maxtd = 18;
var maxtddiv = -1;
var coloursrgb = new Array('00', '33', '66', '99', 'cc', 'ff');
var coloursgrey = new Array('000000', '333333', '666666', '999999', 'cccccc', 'ffffff');
var colourssol = new Array('ff0000', '00ff00', '0000ff', 'ffff00', '00ffff', 'ff00ff');
var rowswitch = 0;
var rowline = '';
var rows1 = '';
var rows2 = '';
var notr = 0;
var tdblk = '<td style=\'background-color: #000000; cursor: default; height: 10px; width: 10px;\'><\/td>';
var g = 1;
var s = 0;
var i, j, k;
function td_render(color) {
return '<td style=\'background-color: #' + color + '; height: 10px; width: 10px;\' onmousedown=\"addtext(\'[color=#' + color + '][/color]\');expandit(\'{$formid}\')\"><\/td>';
}
for (i=0; i < coloursrgb.length; i++) {
for (j=0; j < coloursrgb.length; j++) {
for (k=0; k < coloursrgb.length; k++) {
maxtddiv++;
if (maxtddiv % maxtd == 0) {
if (rowswitch) {
if (notr < 5){
rows1 += '<\/tr><tr>' + td_render(coloursgrey[g]) + tdblk;
g++;
}
rowswitch = 0;
notr++;
}else{
rows2 += '<\/tr><tr>' + td_render(colourssol[s]) + tdblk;
s++;
rowswitch = 1;
}
maxtddiv = 0;
}
rowline = td_render(coloursrgb[j] + coloursrgb[k] + coloursrgb[i]);
if (rowswitch) {
rows1 += rowline;
}else{
rows2 += rowline;
}
}
}
}
document.write('<table cellspacing=\'1\' cellpadding=\'0\' style=\'cursor: pointer; background-color: #000; width: 100%; border: 0px\'><tr>');
document.write(td_render(coloursgrey[0]) + tdblk + rows1 + rows2);
document.write('<\/tr><\/table>');
//]]>
</script>";
$text .="</div>
</div>
<!-- End of Color selector -->";
return $text;
}
// shouldn't be needed when js css selectors are enabled.
function getEvent($func,$func_var,$hint_diz,$emote = '')
{
if($emote)
{
$emote = ",".$emote;
}
$text = "onclick=\"{$func}('".$func_var."'{$emote})\" ";
$bbcode_help = $this->var['hint_func'];
$bbcode_tag = $this->var['tagid'];
$_helptxt = $hint_diz;
// onclick="addtext('[justify][/justify]')" onmouseout="help('','admin')" onmouseover="help('Justify align: [justify]This text will be justified[/justify]','admin')">
$text .= ($this->var['hint_active'] ? "onmouseout=\"{$bbcode_help}('','{$bbcode_tag}')\" onmouseover=\"{$bbcode_help}('".$_helptxt."','{$bbcode_tag}')\"" : "" );
return $text;
}
function sc_bb($parm) function sc_bb($parm)
{ {
if(method_exists($this,"bb_".$parm)) // start of the big cleanup.
{
$meth = "bb_".$parm;
$mes = e107::getMessage();
$mes->debug("Loaded BB: ".$parm);
$unique = $this->var['template']."--".$parm; // works in conjunction with media-manager category
return "\n\n<!-- {$parm} -->\n".$this->$meth($unique);
}
//FIXME - cachevars/getcachedvars! //FIXME - cachevars/getcachedvars!
global $pref, $eplug_bb, $bbcode_func, $bbcode_help, $bbcode_filedir, $bbcode_imagedir, $bbcode_helpactive, $bbcode_helptag, $register_bb; global $pref, $eplug_bb, $bbcode_func, $bbcode_help, $bbcode_filedir, $bbcode_imagedir, $bbcode_helpactive, $bbcode_helptag, $register_bb;
@@ -71,13 +306,14 @@ class bbcode_shortcodes
$bbcode['flash'] = array($bbcode_func,"[flash=width,height][/flash]", LANHELP_47,"flash.png"); $bbcode['flash'] = array($bbcode_func,"[flash=width,height][/flash]", LANHELP_47,"flash.png");
$bbcode['youtube'] = array($bbcode_func,"[youtube][/youtube]", LANHELP_48,"youtube.png"); $bbcode['youtube'] = array($bbcode_func,"[youtube][/youtube]", LANHELP_48,"youtube.png");
$bbcode['sanitised'] = array('', '', ''); $bbcode['sanitised'] = array('', '', '');
$bbcode['format'] = array('dropdown', '[format]', 'da',"<select><option>hello</option></select>");
$bbcode['nobr'] = array($bbcode_func,"[nobr][/nobr]", LANHELP_51, "nobr.png"); // FIXME bbcode icon $bbcode['nobr'] = array($bbcode_func,"[nobr][/nobr]", LANHELP_51, "nobr.png"); // FIXME bbcode icon
$bbcode['br'] = array($bbcode_func,"[br]", LANHELP_52, "br.png"); // FIXME bbcode icon $bbcode['br'] = array($bbcode_func,"[br]", LANHELP_52, "br.png"); // FIXME bbcode icon
$bbcode['block'] = array($bbcode_func,"[block][/block]", LANHELP_54,"block.png"); // FIXME bbcode icon, interactive interface, theme hooks $bbcode['block'] = array($bbcode_func,"[block][/block]", LANHELP_54,"block.png"); // FIXME bbcode icon, interactive interface, theme hooks
$bbcode['fontsize'] = array("expandit","size_selector_".$rand, LANHELP_22,"fontsize.png","Size_Select",'size_selector_'.$rand); $bbcode['fontsize'] = array("expandit","size_selector_".$rand, LANHELP_22,"fontsize.png","Size_Select",'size_selector_'.$rand);
$bbcode['fontcol'] = array("expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand); $bbcode['fontcol'] = array("e-expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand);
$bbcode['preimage'] = array("e-dialog","preimage_selector_".$rand, LANHELP_45.$imagedir_display,"preimage.png","PreImage_Select","preimage_selector_".$rand); $bbcode['preimage'] = array("e-dialog","preimage_selector_".$rand, LANHELP_45.$imagedir_display,"preimage.png","PreImage_Select","preimage_selector_".$rand);
$bbcode['prefile'] = array("expandit","prefile_selector_".$rand, LANHELP_39,"prefile.png","PreFile_Select",'prefile_selector_'.$rand); $bbcode['prefile'] = array("expandit","prefile_selector_".$rand, LANHELP_39,"prefile.png","PreFile_Select",'prefile_selector_'.$rand);
@@ -125,13 +361,14 @@ class bbcode_shortcodes
$_function_var = (isset($bbcode[$parm][5])) ? $bbcode[$parm][5] : ''; $_function_var = (isset($bbcode[$parm][5])) ? $bbcode[$parm][5] : '';
if($_onclick_func == 'e-dialog') if($_onclick_func == 'e-dialog')
{ $tagid = "news-body"; { // $tagid = "news-body";
$pre = "\n<a href='".e_ADMIN."image.php?mode=main&action=dialog&for=news&tagid=".$tagid."&iframe=1&bbcode=1' class='e-dialog' >"; $pre = "\n<a href='".e_ADMIN."image.php?mode=main&action=dialog&for=news&tagid=".$tagid."&iframe=1&bbcode=1' class='e-dialog' >";
$post = "</a>\n"; $post = "</a>\n";
} }
if($bbcode[$parm]) // default - insert text. if($bbcode[$parm]) // default - insert text.
{ {
$text = $pre; $text = $pre;
@@ -139,6 +376,8 @@ class bbcode_shortcodes
$text .= $post; $text .= $post;
} }
if($_function) if($_function)
{ {
@@ -152,14 +391,19 @@ class bbcode_shortcodes
function sc_bb_help($parm) function sc_bb_help($parm)
{ {
// if(defsettrue('e_WYSIWYG')) { return; } /*
global $bbcode_helpactive,$bbcode_helptag, $bbcode_helpsize; global $bbcode_helpactive,$bbcode_helptag, $bbcode_helpsize;
if($parm) $bbcode_helptag = $parm; if($parm) $bbcode_helptag = $parm;
elseif(!varset($bbcode_helptag)) $bbcode_helptag = 'helpb'; elseif(!varset($bbcode_helptag)) $bbcode_helptag = 'helpb';
if($bbcode_helpsize) $bbcode_helpsize = ' '.$bbcode_helpsize; if($bbcode_helpsize) $bbcode_helpsize = ' '.$bbcode_helpsize;
$bbcode_helpactive = TRUE; $bbcode_helpactive = TRUE;
*/
//FIXME - better bb help //FIXME - better bb help
$bbcode_helptag = ($this->var['tagid']) ? $this->var['tagid'] : 'data_';
$bbcode_helpsize = $this->var['size'];
$bbcode_helpactive = $this->var['hint_active'];
return "<input id='{$bbcode_helptag}' class='helpbox {$bbcode_helpsize}' type='text' name='{$bbcode_helptag}' size='90' readonly='readonly' />"; return "<input id='{$bbcode_helptag}' class='helpbox {$bbcode_helpsize}' type='text' name='{$bbcode_helptag}' size='90' readonly='readonly' />";
} }

View File

@@ -1,92 +1,30 @@
$(document).ready(function() $(document).ready(function()
{ {
$(".e-hideme").hide();
$(".e-expandit").show();
$(".e-expandit").click(function () { /*
var id = $(this).attr("href"); $(".field-help").each(function(c) {
$(id).toggle("slow");
});
// Date $(this).before("<a class='field-tip-"+c+"' href='#'><img src='../e107_images/admin_images/info_16.png' /></a>");
$(function() { $(this).hide();
$(".field-tip-"+c).qtip({
$("input.e-date").each(function() { content: $(this).html(),
$(this).datepicker({ show: 'mouseover',
dateFormat: $(this).attr("data-date-format"), hide: 'mouseout',
ampm: $(this).attr("data-date-ampm") style: {
}); name: 'dark', // Inherit from preset style
}); border: { width: 1, radius: 5 },
tip: 'topLeft'
$("input.e-datetime").each(function() {
$(this).datetimepicker({
dateFormat: $(this).attr("data-date-format"),
timeFormat: $(this).attr("data-time-format"),
ampm: $(this).attr("data-date-ampm")
});
});
// Inline versions
$("div.e-date").each(function() {
var id = $(this).attr("id");
var newid = id.replace("inline-", "");
$(this).datepicker({
dateFormat: $(this).attr("data-date-format"),
ampm: $(this).attr("data-date-ampm"),
defaultDate: $("#"+newid).val(),
onSelect: function(dateText, inst) {
$("#"+newid).val(dateText);
} }
})
}); });
}); */
$("div.e-datetime").each(function() {
var id = $(this).attr("id");
var newid = id.replace("inline-", "");
$(this).datetimepicker({
dateFormat: $(this).attr("data-date-format"),
ampm: $(this).attr("data-date-ampm"),
showButtonPanel: false,
onSelect: function(dateText, inst) {
$("#"+newid).val(dateText);
}
});
$(this).datetimepicker('setDate', $("#"+newid).val());
});
});
// Tabs
$(function() {
$( "#tab-container" ).tabs();
});
// Tabs
$(function() {
$( ".e-tabs" ).tabs();
});
$(".e-multiselect").chosen(); $(".e-multiselect").chosen();
// Password
$(function() {
$("#password1").pwdMeter({
minLength: 6,
displayGeneratePassword: true,
generatePassText: "Generate",
randomPassLength: 12
});
});
// Decorate // Decorate
$(".adminlist tr:even").addClass("even"); $(".adminlist tr:even").addClass("even");
@@ -94,41 +32,7 @@ $(document).ready(function()
$(".adminlist tr:first").addClass("first"); $(".adminlist tr:first").addClass("first");
$(".adminlist tr:last").addClass("last"); $(".adminlist tr:last").addClass("last");
// Character Counter
$("textarea").before("<p class=\"remainingCharacters\" id=\"" + $("textarea").attr("name")+ "-remainingCharacters\">&nbsp;</p>");
$("textarea").keyup(function(){
// var max=$(this).attr("maxlength");
var max = 100;
var el = "#" + $(this).attr("name") + "-remainingCharacters";
var valLen=$(this).val().length;
$(el).text( valLen + " characters")
});
// Dialog
$("a.e-dialog").colorbox({
iframe:true,
width:"60%",
height:"70%",
speed:100
});
$(".e-dialog-close").click(function () {
parent.$.colorbox.close()
});
// Modal Box - uses inline hidden content
$(".e-modal").click(function () {
var id = $(this).attr("href");
$(id).dialog({
minWidth: 800,
maxHeight: 700,
modal: true
});
});
// Modal Box - uses inline hidden content // NEEDS work - see customize link for admin-infopanel. // Modal Box - uses inline hidden content // NEEDS work - see customize link for admin-infopanel.
@@ -509,348 +413,5 @@ $(document).ready(function()
}) })
// Legacy Stuff to be converted.
// BC Expandit() function
function expandit(e) {
var href = $(e).attr("href");
if(href === "#" || href == "")
{
idt = $(e).next("div");
$(idt).toggle("slow");
return false;;
}
var id = "#" + e;
$(id).toggle("slow");
return false;
};
var addinput = function(text) {
// quick fix to prevent JS errors - proper match was done only for latin words
var rep = text.match(/\=([^\]]*)\]/);
var val = rep ? prompt(rep[1]) : prompt('http://');
if(!val)
{
return;
}
var newtext = text.replace(rep[1], val);
emote = '';
addtext(newtext, emote);
return;
}
function SyncWithServerTime(serverTime,domain)
{
if (serverTime)
{
/* update time difference cookie */
var serverDelta=Math.floor(localTime-serverTime);
document.cookie = 'e107_tdOffset='+serverDelta+'; path=/; domain= .'+domain;
document.cookie = 'e107_tdSetTime='+(localTime-serverDelta)+'; path=/; domain=.'+domain; /* server time when set */
}
var tzCookie = 'e107_tzOffset=';
// if (document.cookie.indexOf(tzCookie) < 0) {
/* set if not already set */
var timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */
document.cookie = tzCookie + timezoneOffset+'; path=/; domain=.'+domain;
// }
}
function urljump(url){
top.window.location = url;
}
function setInner(id, txt) {
document.getElementById(id).innerHTML = txt;
}
function jsconfirm(thetext){
return confirm(thetext);
}
function insertext(str,tagid,display){
document.getElementById(tagid).value = str;
if(display){
document.getElementById(display).style.display='none';
}
}
function appendtext(str,tagid,display){
document.getElementById(tagid).value += str;
document.getElementById(tagid).focus();
if(display){
document.getElementById(display).style.display='none';
}
}
function open_window(url,wth,hgt) {
if('full' == wth){
pwindow = window.open(url);
} else {
if (wth) {
mywidth=wth;
} else {
mywidth=600;
}
if (hgt) {
myheight=hgt;
} else {
myheight=400;
}
pwindow = window.open(url,'Name', 'top=100,left=100,resizable=yes,width='+mywidth+',height='+myheight+',scrollbars=yes,menubar=yes');
}
pwindow.focus();
}
function ejs_preload(ejs_path, ejs_imageString){
var ejs_imageArray = ejs_imageString.split(',');
for(ejs_loadall=0; ejs_loadall<ejs_imageArray.length; ejs_loadall++){
var ejs_LoadedImage=new Image();
ejs_LoadedImage.src=ejs_path + ejs_imageArray[ejs_loadall];
}
}
function textCounter(field,cntfield) {
cntfield.value = field.value.length;
}
function openwindow() {
opener = window.open("htmlarea/index.php", "popup","top=50,left=100,resizable=no,width=670,height=520,scrollbars=no,menubar=no");
opener.focus();
}
function setCheckboxes(the_form, do_check, the_cb){
var elts = (typeof(document.forms[the_form].elements[the_cb]) != 'undefined') ? document.forms[the_form].elements[the_cb] : document.forms[the_form].elements[the_cb];
if(document.getElementById(the_form))
{
if(the_cb)
{
var elts =(typeof(document.getElementById(the_form).elements[the_cb]) != 'undefined') ? document.getElementById(the_form).elements[the_cb] : document.getElementById(the_form).elements[the_cb];
}
else
{
var elts = document.getElementById(the_form);
}
}
var elts_cnt = (typeof(elts.length) != 'undefined') ? elts.length : 0;
if(elts_cnt){
for(var i = 0; i < elts_cnt; i++){
elts[i].checked = do_check;
}
}else{
elts.checked = do_check;
}
return true;
}
var ref=""+escape(top.document.referrer);
var colord = window.screen.colorDepth;
var res = window.screen.width + "x" + window.screen.height;
var eself = document.location;
/* TODO: @SecretR - Object of removal
// From http://phpbb.com
var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1) && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1) && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
var e107_selectedInputArea;
var e107_selectedRange;
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close){
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2) selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
function mozSwap(txtarea, newtext){
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2) selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + newtext + s3;
return;
}
*/
function storeCaret (textAr){
e107_selectedInputArea = textAr;
/* TODO: @SecretR - Object of removal - not needed anymore
if (textAr.createTextRange){
e107_selectedRange = document.selection.createRange().duplicate();
}*/
}
/**
* New improved version - fixed scroll to top behaviour when inserting BBcodes
* @TODO - improve it more (0.8) - Prototype
*/
function addtext(text, emote) {
if (!window.e107_selectedInputArea) {
return; //[SecretR] TODO - alert the user
}
var eField = e107_selectedInputArea;
var eSelection = false;
var tagOpen = '';
var tagClose = '';
if (emote != true) { // Split if its a paired bbcode
var tmp = text.split('][', 2);
if (tmp[0] == text) {
tagOpen = text;
} else {
tagOpen = tmp[0] + ']';
tagClose = '[' + tmp[1];
}
} else { //Insert Emote
tagOpen = text;
}
// Windows user
if (document.selection) {
eSelection = document.selection.createRange().text;
eField.focus();
if (eSelection) {
document.selection.createRange().text = tagOpen + eSelection + tagClose;
} else {
document.selection.createRange().text = tagOpen + tagClose;
}
eSelection = '';
eField.blur();
eField.focus();
return;
}
var scrollPos = eField.scrollTop;
var selLength = eField.textLength;
var selStart = eField.selectionStart;
var selEnd = eField.selectionEnd;
if (selEnd <= 2 && typeof(selLength) != 'undefined' && (selStart != selEnd)) {
selEnd = selLength;
}
var sel1 = (eField.value).substring(0,selStart);
var sel2 = (eField.value).substring(selStart, selEnd);
var sel3 = (eField.value).substring(selEnd, selLength);
var newStart = selStart + tagOpen.length + sel2.length + tagClose.length;
eField.value = sel1 + tagOpen + sel2 + tagClose + sel3;
eField.focus();
eField.selectionStart = newStart;
eField.selectionEnd = newStart;
eField.scrollTop = scrollPos;
return;
}
function help(helpstr,tagid){
if(tagid){
document.getElementById(tagid).value = helpstr;
} else if(document.getElementById('dataform')) {
document.getElementById('dataform').helpb.value = helpstr;
}
}
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
function eover(object, over) {
object.className = over;
}
var e107_dupCounter = 1;
function duplicateHTML(copy,paste,baseid){
if(document.getElementById(copy)){
e107_dupCounter++;
var type = document.getElementById(copy).nodeName; // get the tag name of the source copy.
var but = document.createElement('input');
var br = document.createElement('br');
but.type = 'button';
but.value = 'x';
but.className = 'button';
but.onclick = function(){ this.parentNode.parentNode.removeChild(this.parentNode); };
var destination = document.getElementById(paste);
var source = document.getElementById(copy).cloneNode(true);
var newentry = document.createElement(type);
newentry.appendChild(source);
newentry.value='';
newentry.appendChild(but);
newentry.appendChild(br);
if(baseid)
{
newid = baseid+e107_dupCounter;
newentry.innerHTML = newentry.innerHTML.replace(new RegExp(baseid, 'g'), newid);
newentry.id=newid;
}
destination.appendChild(newentry);
}
}
function preview_image(src_val,img_path, not_found)
{
var ta;
var desti = src_val + '_prev';
ta = document.getElementById(src_val).value;
if(ta){
document.getElementById(desti).src = img_path + ta;
}else{
document.getElementById(desti).src = not_found;
}
return;
}

View File

@@ -2,8 +2,15 @@
/* CSS File for Javascript library elements in all areas of e107 */ /* CSS File for Javascript library elements in all areas of e107 */
a.e-nav { padding:3px; }
div.e-rate { width:100px; display:inline-block } div.e-rate { width:100px; display:inline-block }
img.e-rate-star { } img.e-rate { }
.e-rate-status { font-weight:bold;vertical-align:middle; padding-right:4px; width:140px; display:inline-block; text-align:right } .e-rate-status { font-weight:bold;vertical-align:middle; padding-right:4px; width:140px; display:inline-block; text-align:right }
.e-rate-status-download { text-align:left; } .e-rate-status-download { text-align:left; }
.e-rate-votes { vertical-align:middle; display:inline-block; width:100px } .e-rate-votes { vertical-align:middle; display:inline-block; width:100px }
select.e-bb { margin-top:4px; display:inline-block; vertical-align:top }
.bbcode_buttons { border:1px solid transparent }
.bbcode_buttons:hover { background-color: silver; border:1px solid black; }

View File

@@ -71,6 +71,72 @@ $(document).ready(function()
$( ".e-tabs" ).tabs(); $( ".e-tabs" ).tabs();
}); });
/*
$("a.e-bb").click(function(){
var add = $(this).attr('data-bbcode');
var func = $(this).attr('data-function');
var diz = $(this).attr('title');
id = $(this).attr('href');
var tmp = id.replace('#','');
//alert(tmp);
if(func == 'insert')
{
addtext(add,true);
return false;
}
if(func == 'input')
{
addinput(add,diz);
return false;
}
if(func == 'show')
{
$('#'+add).show('slow');
// addinput(add,diz);
return false;
}
if(func == 'add')
{
addtext(add);
return false;
}
return false;
});
$("select.e-bb").change(function(){
var add = $(this).val();
addtext(add);
$(this).val('');
return false;
});
$(".e-bb").mouseover(function(){
var id = $(this).attr('id');
var diz = $(this).attr('title');
// alert(id);
var tmp = id.split('--');
// alert('#'+tmp[0]);
$('#'+tmp[0]).val(diz);
return false;
});
$(".e-bb").mouseout(function(){
var id = $(this).attr('id');
var tmp = id.split('--')
$('#'+tmp[0]).val('');
return false;
});
*/
// $(".e-multiselect").chosen(); // $(".e-multiselect").chosen();
@@ -87,7 +153,7 @@ $(document).ready(function()
}); });
// Character Counter // Character Counter
$("textarea").before("<p class=\"remainingCharacters\" id=\"" + $("textarea").attr("name")+ "-remainingCharacters\">&nbsp;</p>"); // $("textarea").before("<p class=\"remainingCharacters\" id=\"" + $("textarea").attr("name")+ "-remainingCharacters\">&nbsp;</p>");
$("textarea").keyup(function(){ $("textarea").keyup(function(){
// var max=$(this).attr("maxlength"); // var max=$(this).attr("maxlength");
@@ -154,7 +220,7 @@ $(document).ready(function()
// targetType : 'number', // targetType : 'number',
targetText : $('#e-rate-'+tmp).text(), targetText : $('#e-rate-'+tmp).text(),
// cancel : true, // cancel : true,
css : 'e-rate-star', // css : 'e-rate-star',
click: function(score, evt) { click: function(score, evt) {
$(this).find('img').unbind('click'); $(this).find('img').unbind('click');
$(this).find('img').unbind(); $(this).find('img').unbind();
@@ -177,12 +243,18 @@ $(document).ready(function()
}); });
}); });
// $( ".field-help" ).tooltip();
// Allow Tabs to be used inside textareas.
$( 'textarea' ).keypress( function( e ) {
if ( e.keyCode == 9 ) {
e.preventDefault();
$( this ).val( $( this ).val() + '\t' );
}
});
// Text-area AutoGrow // Text-area AutoGrow
// $("textarea.e-autoheight").elastic(); $("textarea.e-autoheight").elastic();
@@ -215,17 +287,18 @@ $(document).ready(function()
}; };
var addinput = function(text) { var addinput = function(text,rep) {
// quick fix to prevent JS errors - proper match was done only for latin words // quick fix to prevent JS errors - proper match was done only for latin words
var rep = text.match(/\=([^\]]*)\]/); // var rep = text.match(/\=([^\]]*)\]/);
var val = rep ? prompt(rep[1]) : prompt('http://'); // var rep = '';
var val = rep ? prompt(rep) : prompt('http://');
if(!val) if(!val)
{ {
return; return;
} }
var newtext = text.replace(rep[1], val); var newtext = text.replace('*', val);
emote = ''; emote = '';
addtext(newtext, emote); addtext(newtext, emote);
return; return;
@@ -397,7 +470,7 @@ function mozSwap(txtarea, newtext){
/** /**
* New improved version - fixed scroll to top behaviour when inserting BBcodes * New improved version - fixed scroll to top behaviour when inserting BBcodes
* @TODO - improve it more (0.8) - Prototype * @TODO - improve it more (0.8)
*/ */
function addtext(text, emote) { function addtext(text, emote) {

View File

@@ -3,13 +3,17 @@ $(document).ready(function()
$(".e-dialog-save").click(function () { // FIXME TODO missing caret , text selection overwrite etc. $(".e-dialog-save").click(function () { // FIXME TODO missing caret , text selection overwrite etc.
//alert('hello');
var newval = $('#bbcode_holder').val(); var newval = $('#bbcode_holder').val();
// alert(newval);
var target = $(this).attr('data-target'); var target = $(this).attr('data-target');
('#' + target, window.top.document).insertAtCaret(newVal); //('#' + target, window.top.document).insertAtCaret(newVal);
// $('#' + target, window.parent.document).append(newval); //FIXME caret!! // $('#' + target, window.parent.document).append(newval); //FIXME caret!!
// var t = $('#' + target, window.parent.document).text(); // var t = $('#' + target, window.parent.document).text();
// addtext(newval);
$('#' + target, window.top.document).attr('value',newval); // set new value
// inserttext(newval,target);
// alert(newval); // alert(newval);
}); });
@@ -106,11 +110,21 @@ $(document).ready(function()
var path = $(this).attr('data-path'); var path = $(this).attr('data-path');
var preview = $(this).attr('data-preview'); var preview = $(this).attr('data-preview');
var src = $(this).attr('data-src'); var src = $(this).attr('data-src');
var bbcode = $(this).attr('data-bbcode');
$(this).addClass("media-select-active"); $(this).addClass("media-select-active");
$(this).closest("img").addClass("active"); $(this).closest("img").addClass("active");
$('#' + target, window.top.document).attr('value',path); // set new value // TinyMce?
$('input#' + target, window.top.document).attr('value',path); // set new value
if(bbcode)
{
bbpath = '['+bbcode+']'+ path + '[/' + bbcode + ']';
$('textarea#' + target, window.top.document).attr('value',bbpath);
}
$('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value $('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value
$('div#' + target + "_prev", window.top.document).html(preview); // set new value $('div#' + target + "_prev", window.top.document).html(preview); // set new value
$('span#' + target + "_prev", window.top.document).html(preview); // set new value $('span#' + target + "_prev", window.top.document).html(preview); // set new value

View File

@@ -629,32 +629,35 @@ class e_form
// auto-height support // auto-height support
$options = array('class' => 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg'); $options = array('class' => 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg');
$bbbar = ''; $bbbar = '';
// FIXME - see ren_help.php // FIXME - see ren_help.php
// if(!deftrue('e_WYSIWYG'))
{
require_once(e_HANDLER."ren_help.php"); require_once(e_HANDLER."ren_help.php");
$help_tagid = $this->name2id($name)."--preview"; // required as it needs to have some matching name with textarea.
$options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'"; $options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'";
$bbbar = display_help($help_tagid, $help_mod, 'addtext', 'help', $size); $bbbar = display_help($help_tagid, $help_mod, 'addtext', 'help', $size);
}
$toggleID = "bbcode-panel-".$help_tagid;
$tinyMceID = str_replace("_","-",$name);
$ret = " $ret = "
<div class='bbarea {$size}'> <div class='bbarea {$size}'>
".$this->textarea($name, $value, $rows, 50, $options, $counter)."
<div><a href='#' class='e-wysiwyg-switch' onclick=\"tinyMCE.execCommand('mceToggleEditor',false,'".$tinyMceID."');expandit('".$toggleID."');\">Toggle WYSIWYG</a></div>
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
{$bbbar} {$bbbar}
".$this->textarea($name, $value, $rows, 50, $options, $counter)."
</div> </div>
"; ";
// Quick fix - hide TinyMCE links if not installed, dups are handled by JS handler // Quick fix - hide TinyMCE links if not installed, dups are handled by JS handler
/*
e107::getJs()->footerInline(" e107::getJs()->footerInline("
if(typeof tinyMCE === 'undefined') if(typeof tinyMCE === 'undefined')
{ {
\$$('a.e-wysiwyg-switch').invoke('hide'); \$$('a.e-wysiwyg-switch').invoke('hide');
} }
"); ");
*/
return $ret; return $ret;
} }

View File

@@ -508,14 +508,17 @@ class e_media
document.getElementById('preview').src = '{$realPath}'; document.getElementById('preview').src = '{$realPath}';
return false;"; return false;";
$onclicki = "";
$class .= " e-media-select"; $class .= " e-media-select";
$onclicki = ""; $onclicki = "";
} }
$data_bb = ($bbcode) ? "img" : "";
$img_url = ($cat !='_icon') ? e107::getParser()->thumbUrl($im['media_url'], $att) : $media_path; $img_url = ($cat !='_icon') ? e107::getParser()->thumbUrl($im['media_url'], $att) : $media_path;
$text .= "<a class='{$class} ' data-src='{$media_path}' data-target='{$tagid}' data-path='{$im['media_url']}' data-preview='{$realPath}' title=\"".$diz."\" style='float:left' href='#' onclick=\"{$onclicki}\" >"; $text .= "<a class='{$class} ' data-src='{$media_path}' data-bbcode[{$data_bb}] data-target='{$tagid}' data-path='{$im['media_url']}' data-preview='{$realPath}' title=\"".$diz."\" style='float:left' href='#' onclick=\"{$onclicki}\" >";
$text .= "<img src='".$img_url."' alt=\"".$im['media_title']."\" />"; $text .= "<img src='".$img_url."' alt=\"".$im['media_title']."\" />";
$text .= "</a>\n\n"; $text .= "</a>\n\n";
} }

View File

@@ -38,6 +38,9 @@ function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $help
$bbcode_help = $helpfunc; $bbcode_help = $helpfunc;
$bbcode_helptag = $tagid; $bbcode_helptag = $tagid;
// $arr = get_defined_vars();
// print_a($arr);
// load the template // load the template
if(is_readable(THEME."bbcode_template.php")) if(is_readable(THEME."bbcode_template.php"))
{ {
@@ -84,8 +87,26 @@ function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $help
if(is_readable(e_CORE."shortcodes/batch/bbcode_shortcodes.php")) if(is_readable(e_CORE."shortcodes/batch/bbcode_shortcodes.php"))
{ {
require_once(e_CORE."shortcodes/batch/bbcode_shortcodes.php");
return "<div id='bbcode-panel-".$tagid."' class='bbcode-panel' {$visible}>".$tp->parseTemplate($BBCODE_TEMPLATE)."</div>"; $sc = e107::getScBatch('bbcode');
if($tagid == 'data') // BC fix.
{
$tagid = 'data_';
}
$data = array(
'tagid' => $tagid,
'template' => $mode,
'trigger' => $addtextfunc,
'hint_func' => $helpfunc,
'hint_active' => $bbcode_helpactive,
'size' => $helpsize
);
$sc->setParserVars($data);
return "<div id='bbcode-panel-".$tagid."' class='mceToolbar bbcode-panel' {$visible}>".$tp->parseTemplate($BBCODE_TEMPLATE)."</div>";
} }
else else
{ {
@@ -118,8 +139,8 @@ function Size_Select($formid='size_selector') {
function Color_Select($formid='col_selector') { function Color_Select($formid='col_selector') {
$text = "<!-- Start of Color selector --> $text = "<!-- Start of Color selector -->
<div style='margin-left: 0px; margin-right: 0px; width: 221px; position: relative; z-index: 1000; float: right; display: none' id='{$formid}' onclick=\"this.style.display='none'\" > <div style='width: 221px; position: absolute; left:340px; top:60px; margin-right:auto; margin-left:auto; display:none; z-index: 1000; id='{$formid}' onclick=\"expandit(this)\" >
<div style='position: absolute; bottom: 30px; right: 145px; width: 221px'>"; <div style='border:1px solid black; position: absolute; top:30px; width: 221px; '>";
$text .= "<script type='text/javascript'> $text .= "<script type='text/javascript'>
//<![CDATA[ //<![CDATA[

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -16,19 +16,76 @@ if (!defined('e107_INIT')) { exit; }
if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") ) if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") )
{ {
require_once(e_PLUGIN."tinymce/wysiwyg.php"); if(e_PAGE != 'image.php')
if(deftrue('TINYMCE_CONFIG'))
{ {
$wy = new wysiwyg(TINYMCE_CONFIG); e107::js('tinymce','tiny_mce.js','jquery');
e107::js('tinymce','wysiwyg.php','jquery');
} }
else else
{ {
$wy = new wysiwyg(); e107::js('tinymce','tiny_mce_popup.js','jquery');
}
// <div><a href='#' class='e-wysiwyg-switch' onclick=\"tinyMCE.execCommand('mceToggleEditor',false,'".$tinyMceID."');expandit('".$toggleID."');\">Toggle WYSIWYG</a></div>
e107::js('inline',"
$(function() {
$('.e-wysiwyg').each(function() {
var id = $(this).attr('id'); // 'e-wysiwyg';
$('#'+id).after('<div><a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle\">Switch to BBCODE</a></div>');
// alert(id);
});
$('a.e-wysiwyg-toggle').toggle(function(){
var id = $(this).attr('id'); // eg. news-body
$('#bbcode-panel-'+id).show();
$(this).text('Switch to WYSIWYG');
tinyMCE.execCommand('mceRemoveControl', false, id);
}, function () {
var id = $(this).attr('id');
$('#bbcode-panel-'+id).hide();
$(this).text('Switch to BBCODE');
tinyMCE.execCommand('mceAddControl', false, id);
});
$('.e-dialog-save').click(function(){
var html = $('#html_holder').val();
// tinyMCE.execCommand('mceInsertContent',false,html);
tinyMCE.execCommand('mceInsertRawHTML',false,html);
tinyMCEPopup.close();
});
});
","jquery");
e107::css('inline',".e-wysiwyg { width:100% }","jquery");
// require_once(e_PLUGIN."tinymce/wysiwyg.php");
if(deftrue('TINYMCE_CONFIG'))
{
// $wy = new wysiwyg(TINYMCE_CONFIG);
}
else
{
// $wy = new wysiwyg();
} }
if(!strpos(e_SELF,e_ADMIN_ABS."image.php")) if(!strpos(e_SELF,e_ADMIN_ABS."image.php"))
{ {
$wy -> render(); // $wy -> render();
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -488,7 +488,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) {
var html = ""; var html = "";
html += '<select id="' + elm_id + '" name="' + elm_id + '"'; html += '<select id="' + elm_id + '" name="' + elm_id + '"';
html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; html += ' class="mceLinkList" onchange="this.form.' + target_form_element + '.value=';
html += 'this.options[this.selectedIndex].value;'; html += 'this.options[this.selectedIndex].value;';
if (typeof(onchange_func) != "undefined") if (typeof(onchange_func) != "undefined")
@@ -510,7 +510,7 @@ function getTargetListHTML(elm_id, target_form_element) {
var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
var html = ''; var html = '';
html += '<select id="' + elm_id + '" name="' + elm_id + '" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; html += '<select id="' + elm_id + '" name="' + elm_id + '" onchange="this.form.' + target_form_element + '.value=';
html += 'this.options[this.selectedIndex].value;">'; html += 'this.options[this.selectedIndex].value;">';
html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>'; html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';
html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>'; html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';

View File

@@ -8,7 +8,7 @@
(function() { (function() {
tinymce.create('tinymce.plugins.e107BBCodePlugin', { tinymce.create('tinymce.plugins.e107BBCodePlugin', {
init : function(ed, url) { init : function(ed, url) {
var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase(); var t = this, dialect = ed.getParam('bbcode_dialect', 'e107').toLowerCase();
ed.onBeforeSetContent.add(function(ed, o) { ed.onBeforeSetContent.add(function(ed, o) {
o.content = t['_' + dialect + '_bbcode2html'](o.content); o.content = t['_' + dialect + '_bbcode2html'](o.content);
@@ -36,7 +36,7 @@
// Private methods // Private methods
// HTML -> BBCode in PunBB dialect // HTML -> BBCode in PunBB dialect
_punbb_html2bbcode : function(s) { _e107_html2bbcode : function(s) {
s = tinymce.trim(s); s = tinymce.trim(s);
function rep(re, str) { function rep(re, str) {
@@ -139,7 +139,7 @@
}, },
// BBCode -> HTML from PunBB dialect // BBCode -> HTML from PunBB dialect
_punbb_bbcode2html : function(s) { _e107_bbcode2html : function(s) {
s = tinymce.trim(s); s = tinymce.trim(s);
function rep(re, str) { function rep(re, str) {
@@ -212,6 +212,7 @@
// rep(/<br \/>/gm, "<br />\n"); // rep(/<br \/>/gm, "<br />\n");
rep(/(\r|\n)$/gim,"<br />"); rep(/(\r|\n)$/gim,"<br />");
// rep(/(\r|\n)/gim,"<br />\n"); // this will break bullets.
// e107 FIXME! // e107 FIXME!

View File

@@ -1 +1 @@
(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent());tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent());d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().firstChild);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})(); (function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent());tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent());d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().firstChild);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();

View File

@@ -79,7 +79,7 @@
vp.h -= 1; vp.h -= 1;
// Use fixed position if it exists // Use fixed position if it exists
if (tinymce.isIE6) if (tinymce.isIE6 || document.compatMode == 'BackCompat')
posCss = 'absolute;top:' + vp.y; posCss = 'absolute;top:' + vp.y;
else else
posCss = 'fixed;top:0'; posCss = 'fixed;top:0';

File diff suppressed because one or more lines are too long

View File

@@ -9,37 +9,518 @@
*/ */
(function() { (function() {
var Event = tinymce.dom.Event; var TreeWalker = tinymce.dom.TreeWalker;
var externalName = 'contenteditable', internalName = 'data-mce-' + externalName;
var VK = tinymce.VK;
function handleContentEditableSelection(ed) {
var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret';
// Setup invisible character use zero width space on Gecko since it doesn't change the height of the container
invisibleChar = tinymce.isGecko ? '\u200B' : '\uFEFF';
// Returns the content editable state of a node "true/false" or null
function getContentEditable(node) {
var contentEditable;
// Ignore non elements
if (node.nodeType === 1) {
// Check for fake content editable
contentEditable = node.getAttribute(internalName);
if (contentEditable && contentEditable !== "inherit") {
return contentEditable;
}
// Check for real content editable
contentEditable = node.contentEditable;
if (contentEditable !== "inherit") {
return contentEditable;
}
}
return null;
};
// Returns the noneditable parent or null if there is a editable before it or if it wasn't found
function getNonEditableParent(node) {
var state;
while (node) {
state = getContentEditable(node);
if (state) {
return state === "false" ? node : null;
}
node = node.parentNode;
}
};
// Get caret container parent for the specified node
function getParentCaretContainer(node) {
while (node) {
if (node.id === caretContainerId) {
return node;
}
node = node.parentNode;
}
};
// Finds the first text node in the specified node
function findFirstTextNode(node) {
var walker;
if (node) {
walker = new TreeWalker(node, node);
for (node = walker.current(); node; node = walker.next()) {
if (node.nodeType === 3) {
return node;
}
}
}
};
// Insert caret container before/after target or expand selection to include block
function insertCaretContainerOrExpandToBlock(target, before) {
var caretContainer, rng;
// Select block
if (getContentEditable(target) === "false") {
if (dom.isBlock(target)) {
selection.select(target);
return;
}
}
rng = dom.createRng();
if (getContentEditable(target) === "true") {
if (!target.firstChild) {
target.appendChild(ed.getDoc().createTextNode('\u00a0'));
}
target = target.firstChild;
before = true;
}
//caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style:'border: 1px solid red'}, invisibleChar);
caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true}, invisibleChar);
if (before) {
target.parentNode.insertBefore(caretContainer, target);
} else {
dom.insertAfter(caretContainer, target);
}
rng.setStart(caretContainer.firstChild, 1);
rng.collapse(true);
selection.setRng(rng);
return caretContainer;
};
// Removes any caret container except the one we might be in
function removeCaretContainer(caretContainer) {
var child, currentCaretContainer, lastContainer;
if (caretContainer) {
rng = selection.getRng(true);
rng.setStartBefore(caretContainer);
rng.setEndBefore(caretContainer);
child = findFirstTextNode(caretContainer);
if (child && child.nodeValue.charAt(0) == invisibleChar) {
child = child.deleteData(0, 1);
}
dom.remove(caretContainer, true);
selection.setRng(rng);
} else {
currentCaretContainer = getParentCaretContainer(selection.getStart());
while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) {
if (currentCaretContainer !== caretContainer) {
child = findFirstTextNode(caretContainer);
if (child && child.nodeValue.charAt(0) == invisibleChar) {
child = child.deleteData(0, 1);
}
dom.remove(caretContainer, true);
}
lastContainer = caretContainer;
}
}
};
// Modifies the selection to include contentEditable false elements or insert caret containers
function moveSelection() {
var nonEditableStart, nonEditableEnd, isCollapsed, rng, element;
// Checks if there is any contents to the left/right side of caret returns the noneditable element or any editable element if it finds one inside
function hasSideContent(element, left) {
var container, offset, walker, node, len;
container = rng.startContainer;
offset = rng.startOffset;
// If endpoint is in middle of text node then expand to beginning/end of element
if (container.nodeType == 3) {
len = container.nodeValue.length;
if ((offset > 0 && offset < len) || (left ? offset == len : offset == 0)) {
return;
}
} else {
// Can we resolve the node by index
if (offset < container.childNodes.length) {
// Browser represents caret position as the offset at the start of an element. When moving right
// this is the element we are moving into so we consider our container to be child node at offset-1
var pos = !left && offset > 0 ? offset-1 : offset;
container = container.childNodes[pos];
if (container.hasChildNodes()) {
container = container.firstChild;
}
} else {
// If not then the caret is at the last position in it's container and the caret container should be inserted after the noneditable element
return !left ? element : null;
}
}
// Walk left/right to look for contents
walker = new TreeWalker(container, element);
while (node = walker[left ? 'prev' : 'next']()) {
if (node.nodeType === 3 && node.nodeValue.length > 0) {
return;
} else if (getContentEditable(node) === "true") {
// Found contentEditable=true element return this one to we can move the caret inside it
return node;
}
}
return element;
};
// Remove any existing caret containers
removeCaretContainer();
// Get noneditable start/end elements
isCollapsed = selection.isCollapsed();
nonEditableStart = getNonEditableParent(selection.getStart());
nonEditableEnd = getNonEditableParent(selection.getEnd());
// Is any fo the range endpoints noneditable
if (nonEditableStart || nonEditableEnd) {
rng = selection.getRng(true);
// If it's a caret selection then look left/right to see if we need to move the caret out side or expand
if (isCollapsed) {
nonEditableStart = nonEditableStart || nonEditableEnd;
var start = selection.getStart();
if (element = hasSideContent(nonEditableStart, true)) {
// We have no contents to the left of the caret then insert a caret container before the noneditable element
insertCaretContainerOrExpandToBlock(element, true);
} else if (element = hasSideContent(nonEditableStart, false)) {
// We have no contents to the right of the caret then insert a caret container after the noneditable element
insertCaretContainerOrExpandToBlock(element, false);
} else {
// We are in the middle of a noneditable so expand to select it
selection.select(nonEditableStart);
}
} else {
rng = selection.getRng(true);
// Expand selection to include start non editable element
if (nonEditableStart) {
rng.setStartBefore(nonEditableStart);
}
// Expand selection to include end non editable element
if (nonEditableEnd) {
rng.setEndAfter(nonEditableEnd);
}
selection.setRng(rng);
}
}
};
function handleKey(ed, e) {
var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;
function getNonEmptyTextNodeSibling(node, prev) {
while (node = node[prev ? 'previousSibling' : 'nextSibling']) {
if (node.nodeType !== 3 || node.nodeValue.length > 0) {
return node;
}
}
};
function positionCaretOnElement(element, start) {
selection.select(element);
selection.collapse(start);
}
function canDelete(backspace) {
var rng, container, offset, nonEditableParent;
function removeNodeIfNotParent(node) {
var parent = container;
while (parent) {
if (parent === node) {
return;
}
parent = parent.parentNode;
}
dom.remove(node);
moveSelection();
}
function isNextPrevTreeNodeNonEditable() {
var node, walker, nonEmptyElements = ed.schema.getNonEmptyElements();
walker = new tinymce.dom.TreeWalker(container, ed.getBody());
while (node = (backspace ? walker.prev() : walker.next())) {
// Found IMG/INPUT etc
if (nonEmptyElements[node.nodeName.toLowerCase()]) {
break;
}
// Found text node with contents
if (node.nodeType === 3 && tinymce.trim(node.nodeValue).length > 0) {
break;
}
// Found non editable node
if (getContentEditable(node) === "false") {
removeNodeIfNotParent(node);
return true;
}
}
// Check if the content node is within a non editable parent
if (getNonEditableParent(node)) {
return true;
}
return false;
}
if (selection.isCollapsed()) {
rng = selection.getRng(true);
container = rng.startContainer;
offset = rng.startOffset;
container = getParentCaretContainer(container) || container;
// Is in noneditable parent
if (nonEditableParent = getNonEditableParent(container)) {
removeNodeIfNotParent(nonEditableParent);
return false;
}
// Check if the caret is in the middle of a text node
if (container.nodeType == 3 && (backspace ? offset > 0 : offset < container.nodeValue.length)) {
return true;
}
// Resolve container index
if (container.nodeType == 1) {
container = container.childNodes[offset] || container;
}
// Check if previous or next tree node is non editable then block the event
if (isNextPrevTreeNodeNonEditable()) {
return false;
}
}
return true;
}
startElement = selection.getStart()
endElement = selection.getEnd();
// Disable all key presses in contentEditable=false except delete or backspace
nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement);
if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) {
// Is Ctrl+c, Ctrl+v or Ctrl+x then use default browser behavior
if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) {
return;
}
e.preventDefault();
// Arrow left/right select the element and collapse left/right
if (keyCode == VK.LEFT || keyCode == VK.RIGHT) {
var left = keyCode == VK.LEFT;
// If a block element find previous or next element to position the caret
if (ed.dom.isBlock(nonEditableParent)) {
var targetElement = left ? nonEditableParent.previousSibling : nonEditableParent.nextSibling;
var walker = new TreeWalker(targetElement, targetElement);
var caretElement = left ? walker.prev() : walker.next();
positionCaretOnElement(caretElement, !left);
} else {
positionCaretOnElement(nonEditableParent, left);
}
}
} else {
// Is arrow left/right, backspace or delete
if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) {
caretContainer = getParentCaretContainer(startElement);
if (caretContainer) {
// Arrow left or backspace
if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) {
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true);
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
e.preventDefault();
if (keyCode == VK.LEFT) {
positionCaretOnElement(nonEditableParent, true);
} else {
dom.remove(nonEditableParent);
return;
}
} else {
removeCaretContainer(caretContainer);
}
}
// Arrow right or delete
if (keyCode == VK.RIGHT || keyCode == VK.DELETE) {
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer);
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
e.preventDefault();
if (keyCode == VK.RIGHT) {
positionCaretOnElement(nonEditableParent, false);
} else {
dom.remove(nonEditableParent);
return;
}
} else {
removeCaretContainer(caretContainer);
}
}
}
if ((keyCode == VK.BACKSPACE || keyCode == VK.DELETE) && !canDelete(keyCode == VK.BACKSPACE)) {
e.preventDefault();
return false;
}
}
}
};
ed.onMouseDown.addToTop(function(ed, e) {
var node = ed.selection.getNode();
if (getContentEditable(node) === "false" && node == e.target) {
// Expand selection on mouse down we can't block the default event since it's used for drag/drop
moveSelection();
}
});
ed.onMouseUp.addToTop(moveSelection);
ed.onKeyDown.addToTop(handleKey);
ed.onKeyUp.addToTop(moveSelection);
};
tinymce.create('tinymce.plugins.NonEditablePlugin', { tinymce.create('tinymce.plugins.NonEditablePlugin', {
init : function(ed, url) { init : function(ed, url) {
var t = this, editClass, nonEditClass, state; var editClass, nonEditClass, nonEditableRegExps;
t.editor = ed; // Converts configured regexps to noneditable span items
editClass = ed.getParam("noneditable_editable_class", "mceEditable"); function convertRegExpsToNonEditable(ed, args) {
nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable"); var i = nonEditableRegExps.length, content = args.content, cls = tinymce.trim(nonEditClass);
ed.onNodeChange.addToTop(function(ed, cm, n) { // Don't replace the variables when raw is used for example on undo/redo
var sc, ec; if (args.format == "raw") {
return;
// Block if start or end is inside a non editable element
sc = ed.dom.getParent(ed.selection.getStart(), function(n) {
return ed.dom.hasClass(n, nonEditClass);
});
ec = ed.dom.getParent(ed.selection.getEnd(), function(n) {
return ed.dom.hasClass(n, nonEditClass);
});
// Block or unblock
if (sc || ec) {
state = 1;
t._setDisabled(1);
return false;
} else if (state == 1) {
t._setDisabled(0);
state = 0;
} }
while (i--) {
content = content.replace(nonEditableRegExps[i], function(match) {
var args = arguments, index = args[args.length - 2];
// Is value inside an attribute then don't replace
if (index > 0 && content.charAt(index - 1) == '"') {
return match;
}
return '<span class="' + cls + '" data-mce-content="' + ed.dom.encode(args[0]) + '">' + ed.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>';
});
}
args.content = content;
};
editClass = " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " ";
nonEditClass = " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
// Setup noneditable regexps array
nonEditableRegExps = ed.getParam("noneditable_regexp");
if (nonEditableRegExps && !nonEditableRegExps.length) {
nonEditableRegExps = [nonEditableRegExps];
}
ed.onPreInit.add(function() {
handleContentEditableSelection(ed);
if (nonEditableRegExps) {
ed.selection.onBeforeSetContent.add(convertRegExpsToNonEditable);
ed.onBeforeSetContent.add(convertRegExpsToNonEditable);
}
// Apply contentEditable true/false on elements with the noneditable/editable classes
ed.parser.addAttributeFilter('class', function(nodes) {
var i = nodes.length, className, node;
while (i--) {
node = nodes[i];
className = " " + node.attr("class") + " ";
if (className.indexOf(editClass) !== -1) {
node.attr(internalName, "true");
} else if (className.indexOf(nonEditClass) !== -1) {
node.attr(internalName, "false");
}
}
});
// Remove internal name
ed.serializer.addAttributeFilter(internalName, function(nodes, name) {
var i = nodes.length, node;
while (i--) {
node = nodes[i];
if (nonEditableRegExps && node.attr('data-mce-content')) {
node.name = "#text";
node.type = 3;
node.raw = true;
node.value = node.attr('data-mce-content');
} else {
node.attr(externalName, null);
node.attr(internalName, null);
}
}
});
// Convert external name into internal name
ed.parser.addAttributeFilter(externalName, function(nodes, name) {
var i = nodes.length, node;
while (i--) {
node = nodes[i];
node.attr(internalName, node.attr(externalName));
node.attr(externalName, null);
}
});
}); });
}, },
@@ -51,42 +532,6 @@
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
},
_block : function(ed, e) {
var k = e.keyCode;
// Don't block arrow keys, pg up/down, and F1-F12
if ((k > 32 && k < 41) || (k > 111 && k < 124))
return;
return Event.cancel(e);
},
_setDisabled : function(s) {
var t = this, ed = t.editor;
tinymce.each(ed.controlManager.controls, function(c) {
c.setDisabled(s);
});
if (s !== t.disabled) {
if (s) {
ed.onKeyDown.addToTop(t._block);
ed.onKeyPress.addToTop(t._block);
ed.onKeyUp.addToTop(t._block);
ed.onPaste.addToTop(t._block);
ed.onContextMenu.addToTop(t._block);
} else {
ed.onKeyDown.remove(t._block);
ed.onKeyPress.remove(t._block);
ed.onKeyUp.remove(t._block);
ed.onPaste.remove(t._block);
ed.onContextMenu.remove(t._block);
}
t.disabled = s;
}
} }
}); });

File diff suppressed because one or more lines are too long

View File

@@ -359,7 +359,7 @@
} }
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
if (tinymce.isIE && document.documentMode >= 9) { if (tinymce.isIE && document.documentMode >= 9 && /<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(o.content)) {
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]); process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);

View File

@@ -93,7 +93,7 @@
<input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" /> <input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
<input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" /> <input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
<input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" /> <input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> <input type="button" id="cancel" name="close" value="{#close}" onclick="tinyMCEPopup.close();" />
</div> </div>
</form> </form>
</body> </body>

File diff suppressed because one or more lines are too long

View File

@@ -208,7 +208,7 @@
}, },
_removeWords : function(w) { _removeWords : function(w) {
var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark(); var ed = this.editor, dom = ed.dom, se = ed.selection, r = se.getRng(true);
each(dom.select('span').reverse(), function(n) { each(dom.select('span').reverse(), function(n) {
if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) { if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
@@ -217,11 +217,11 @@
} }
}); });
se.moveToBookmark(b); se.setRng(r);
}, },
_markWords : function(wl) { _markWords : function(wl) {
var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, b = se.getBookmark(), nl = [], var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, r = se.getRng(true), nl = [],
w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g'); w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');
// Collect all text nodes // Collect all text nodes
@@ -279,7 +279,7 @@
} }
}); });
se.moveToBookmark(b); se.setRng(r);
}, },
_showMenu : function(ed, e) { _showMenu : function(ed, e) {

View File

@@ -5,6 +5,7 @@ select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padd
#box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;} #box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;}
#positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;} #positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;}
#positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;} #positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;}
.panel_toggle_insert_span {padding-top:10px;}
.panel_wrapper div.current {padding-top:10px;height:230px;} .panel_wrapper div.current {padding-top:10px;height:230px;}
.delim {border-left:1px solid gray;} .delim {border-left:1px solid gray;}
.tdelim {border-bottom:1px solid gray;} .tdelim {border-bottom:1px solid gray;}

View File

@@ -1 +1 @@
(function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:320+parseInt(a.getLang("style.delta_height",0)),inline:1},{plugin_url:b,style_text:a.selection.getNode().style.cssText})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})(); (function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){var c=false;var f=a.selection.getSelectedBlocks();var d=[];if(f.length===1){d.push(a.selection.getNode().style.cssText)}else{tinymce.each(f,function(g){d.push(a.dom.getAttrib(g,"style"))});c=true}a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:340+parseInt(a.getLang("style.delta_height",0)),inline:1},{applyStyleToBlocks:c,plugin_url:b,styles:d})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})();

View File

@@ -13,14 +13,30 @@
init : function(ed, url) { init : function(ed, url) {
// Register commands // Register commands
ed.addCommand('mceStyleProps', function() { ed.addCommand('mceStyleProps', function() {
var applyStyleToBlocks = false;
var blocks = ed.selection.getSelectedBlocks();
var styles = [];
if (blocks.length === 1) {
styles.push(ed.selection.getNode().style.cssText);
}
else {
tinymce.each(blocks, function(block) {
styles.push(ed.dom.getAttrib(block, 'style'));
});
applyStyleToBlocks = true;
}
ed.windowManager.open({ ed.windowManager.open({
file : url + '/props.htm', file : url + '/props.htm',
width : 480 + parseInt(ed.getLang('style.delta_width', 0)), width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
height : 320 + parseInt(ed.getLang('style.delta_height', 0)), height : 340 + parseInt(ed.getLang('style.delta_height', 0)),
inline : 1 inline : 1
}, { }, {
applyStyleToBlocks : applyStyleToBlocks,
plugin_url : url, plugin_url : url,
style_text : ed.selection.getNode().style.cssText styles : styles
}); });
}); });

View File

@@ -27,10 +27,41 @@ var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;out
var defaultBorderWidth = "thin;medium;thick"; var defaultBorderWidth = "thin;medium;thick";
var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none"; var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none";
function init() { function aggregateStyles(allStyles) {
var mergedStyles = {};
tinymce.each(allStyles, function(style) {
if (style !== '') {
var parsedStyles = tinyMCEPopup.editor.dom.parseStyle(style);
for (var name in parsedStyles) {
if (parsedStyles.hasOwnProperty(name)) {
if (mergedStyles[name] === undefined) {
mergedStyles[name] = parsedStyles[name];
}
else if (name === 'text-decoration') {
if (mergedStyles[name].indexOf(parsedStyles[name]) === -1) {
mergedStyles[name] = mergedStyles[name] +' '+ parsedStyles[name];
}
}
}
}
}
});
return mergedStyles;
}
var applyActionIsInsert;
var existingStyles;
function init(ed) {
var ce = document.getElementById('container'), h; var ce = document.getElementById('container'), h;
ce.style.cssText = tinyMCEPopup.getWindowArg('style_text'); existingStyles = aggregateStyles(tinyMCEPopup.getWindowArg('styles'));
ce.style.cssText = tinyMCEPopup.editor.dom.serializeStyle(existingStyles);
applyActionIsInsert = ed.getParam("edit_css_style_insert_span", false);
document.getElementById('toggle_insert_span').checked = applyActionIsInsert;
h = getBrowserHTML('background_image_browser','background_image','image','advimage'); h = getBrowserHTML('background_image_browser','background_image','image','advimage');
document.getElementById("background_image_browser").innerHTML = h; document.getElementById("background_image_browser").innerHTML = h;
@@ -368,13 +399,41 @@ function hasEqualValues(a) {
return true; return true;
} }
function toggleApplyAction() {
applyActionIsInsert = ! applyActionIsInsert;
}
function applyAction() { function applyAction() {
var ce = document.getElementById('container'), ed = tinyMCEPopup.editor; var ce = document.getElementById('container'), ed = tinyMCEPopup.editor;
generateCSS(); generateCSS();
tinyMCEPopup.restoreSelection(); tinyMCEPopup.restoreSelection();
ed.dom.setAttrib(ed.selection.getSelectedBlocks(), 'style', tinyMCEPopup.editor.dom.serializeStyle(tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText)));
var newStyles = tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText);
if (applyActionIsInsert) {
ed.formatter.register('plugin_style', {
inline: 'span', styles: existingStyles
});
ed.formatter.remove('plugin_style');
ed.formatter.register('plugin_style', {
inline: 'span', styles: newStyles
});
ed.formatter.apply('plugin_style');
} else {
var nodes;
if (tinyMCEPopup.getWindowArg('applyStyleToBlocks')) {
nodes = ed.selection.getSelectedBlocks();
}
else {
nodes = ed.selection.getNode();
}
ed.dom.setAttrib(nodes, 'style', tinyMCEPopup.editor.dom.serializeStyle(newStyles));
}
} }
function updateAction() { function updateAction() {

View File

@@ -1 +1 @@
tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line Height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet Image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for All",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text Indent","block_text_align":"Text Align","block_vertical_alignment":"Vertical Alignment","block_letterspacing":"Letter Spacing","block_wordspacing":"Word Spacing","background_vpos":"Vertical Position","background_hpos":"Horizontal Position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background Image","background_color":"Background Color","text_none":"None","text_blink":"Blink","text_case":"Case","text_striketrough":"Strikethrough","text_underline":"Underline","text_overline":"Overline","text_decoration":"Decoration","text_color":"Color",text:"Text",background:"Background",block:"Block",box:"Box",border:"Border",list:"List"}); tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line Height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",toggle_insert_span:"Insert span at selection",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet Image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for All",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text Indent","block_text_align":"Text Align","block_vertical_alignment":"Vertical Alignment","block_letterspacing":"Letter Spacing","block_wordspacing":"Word Spacing","background_vpos":"Vertical Position","background_hpos":"Horizontal Position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background Image","background_color":"Background Color","text_none":"None","text_blink":"Blink","text_case":"Case","text_striketrough":"Strikethrough","text_underline":"Underline","text_overline":"Overline","text_decoration":"Decoration","text_color":"Color",text:"Text",background:"Background",block:"Block",box:"Box",border:"Border",list:"List"});

View File

@@ -825,6 +825,11 @@
</div> </div>
</div> </div>
<div class="panel_toggle_insert_span">
<input type="checkbox" class="checkbox" id="toggle_insert_span" name="toggle_insert_span" onClick="toggleApplyAction();" />
<label for="toggle_insert_span">{#style_dlg.toggle_insert_span}</label>
</div>
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="{#update}" /> <input type="submit" id="insert" name="insert" value="{#update}" />
<input type="button" class="button" id="apply" name="apply" value="{#style_dlg.apply}" onClick="applyAction();" /> <input type="button" class="button" id="apply" name="apply" value="{#style_dlg.apply}" onClick="applyAction();" />

View File

@@ -1 +1 @@
(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})(); (function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]:not(iframe)");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();

View File

@@ -22,7 +22,7 @@
var x, i, f, el, v; var x, i, f, el, v;
function find(d) { function find(d) {
el = DOM.select(':input:enabled,*[tabindex]'); el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
function canSelectRecursive(e) { function canSelectRecursive(e) {
return e.nodeName==="BODY" || (e.type != 'hidden' && return e.nodeName==="BODY" || (e.type != 'hidden' &&

File diff suppressed because one or more lines are too long

View File

@@ -1144,7 +1144,9 @@
} }
function getChildForDirection(parent, up) { function getChildForDirection(parent, up) {
return parent && parent[up ? 'lastChild' : 'firstChild']; var child = parent && parent[up ? 'lastChild' : 'firstChild'];
// BR is not a valid table child to return in this case we return the table cell
return child && child.nodeName === 'BR' ? ed.dom.getParent(child, 'td,th') : child;
} }
function moveCursorToStartOfElement(n) { function moveCursorToStartOfElement(n) {

View File

@@ -137,7 +137,7 @@ function updateAction() {
do { do {
if (cell == tdElm) if (cell == tdElm)
break; break;
col += cell.getAttribute("colspan"); col += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;
} while ((cell = nextCell(cell)) != null); } while ((cell = nextCell(cell)) != null);
for (var i=0; i<rows.length; i++) { for (var i=0; i<rows.length; i++) {
@@ -152,7 +152,7 @@ function updateAction() {
cell = updateCell(cell, true); cell = updateCell(cell, true);
break; break;
} }
curr += cell.getAttribute("colspan"); curr += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;
} while ((cell = nextCell(cell)) != null); } while ((cell = nextCell(cell)) != null);
} }

View File

@@ -243,12 +243,13 @@ function insertTable() {
inst.execCommand('mceInsertContent', false, html); inst.execCommand('mceInsertContent', false, html);
tinymce.each(dom.select('table[data-mce-new]'), function(node) { tinymce.each(dom.select('table[data-mce-new]'), function(node) {
var tdorth = dom.select('td,th', node);
// Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document // Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document
if (tinymce.isIE && node.nextSibling == null) { if (tinymce.isIE && node.nextSibling == null) {
dom.insertAfter(dom.create('p'), node); dom.insertAfter(dom.create('p'), node);
} }
var tdorth = dom.select('td,th', node);
try { try {
// IE9 might fail to do this selection // IE9 might fail to do this selection
inst.selection.setCursorLocation(tdorth[0], 0); inst.selection.setCursorLocation(tdorth[0], 0);

View File

@@ -62,12 +62,8 @@
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="{#apply}" /> <input type="submit" id="insert" name="insert" value="{#apply}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();"/>
<div id="preview"></div> <div id="preview_wrapper"><div id="previewblock"><label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" /></div><span id="preview"></span></div>
<div id="previewblock">
<label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" />
</div>
</div> </div>
</form> </form>
</body> </body>

File diff suppressed because one or more lines are too long

View File

@@ -11,6 +11,95 @@
(function(tinymce) { (function(tinymce) {
var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
// Generates a preview for a format
function getPreviewCss(ed, fmt) {
var previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;
previewStyles = ed.settings.preview_styles;
// No preview forced
if (previewStyles === false)
return '';
// Default preview
if (!previewStyles)
previewStyles = 'font-family font-size font-weight text-decoration text-transform color background-color';
// Removes any variables since these can't be previewed
function removeVars(val) {
return val.replace(/%(\w+)/g, '');
};
// Create block/inline element to use for preview
name = fmt.block || fmt.inline || 'span';
previewElm = dom.create(name);
// Add format styles to preview element
each(fmt.styles, function(value, name) {
value = removeVars(value);
if (value)
dom.setStyle(previewElm, name, value);
});
// Add attributes to preview element
each(fmt.attributes, function(value, name) {
value = removeVars(value);
if (value)
dom.setAttrib(previewElm, name, value);
});
// Add classes to preview element
each(fmt.classes, function(value) {
value = removeVars(value);
if (!dom.hasClass(previewElm, value))
dom.addClass(previewElm, value);
});
// Add the previewElm outside the visual area
dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF});
ed.getBody().appendChild(previewElm);
// Get parent container font size so we can compute px values out of em/% for older IE:s
parentFontSize = dom.getStyle(ed.getBody(), 'fontSize', true);
parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;
each(previewStyles.split(' '), function(name) {
var value = dom.getStyle(previewElm, name, true);
// If background is transparent then check if the body has a background color we can use
if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) {
value = dom.getStyle(ed.getBody(), name, true);
// Ignore white since it's the default color, not the nicest fix
if (dom.toHex(value).toLowerCase() == '#ffffff') {
return;
}
}
// Old IE won't calculate the font size so we need to do that manually
if (name == 'font-size') {
if (/em|%$/.test(value)) {
if (parentFontSize === 0) {
return;
}
// Convert font size from em/% to px
value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1);
value = (value * parentFontSize) + 'px';
}
}
previewCss += name + ':' + value + ';';
});
dom.remove(previewElm);
return previewCss;
};
// Tell it to load theme specific language pack(s) // Tell it to load theme specific language pack(s)
tinymce.ThemeManager.requireLangPack('advanced'); tinymce.ThemeManager.requireLangPack('advanced');
@@ -219,15 +308,21 @@
if (ctrl.getLength() == 0) { if (ctrl.getLength() == 0) {
each(ed.dom.getClasses(), function(o, idx) { each(ed.dom.getClasses(), function(o, idx) {
var name = 'style_' + idx; var name = 'style_' + idx, fmt;
ed.formatter.register(name, { fmt = {
inline : 'span', inline : 'span',
attributes : {'class' : o['class']}, attributes : {'class' : o['class']},
selector : '*' selector : '*'
}); };
ctrl.add(o['class'], name); ed.formatter.register(name, fmt);
ctrl.add(o['class'], name, {
style: function() {
return getPreviewCss(ed, fmt);
}
});
}); });
} }
}, },
@@ -239,7 +334,7 @@
ctrl = ctrlMan.createListBox('styleselect', { ctrl = ctrlMan.createListBox('styleselect', {
title : 'advanced.style_select', title : 'advanced.style_select',
onselect : function(name) { onselect : function(name) {
var matches, formatNames = []; var matches, formatNames = [], removedFormat;
each(ctrl.items, function(item) { each(ctrl.items, function(item) {
formatNames.push(item.value); formatNames.push(item.value);
@@ -248,12 +343,18 @@
ed.focus(); ed.focus();
ed.undoManager.add(); ed.undoManager.add();
// Toggle off the current format // Toggle off the current format(s)
matches = ed.formatter.matchAll(formatNames); matches = ed.formatter.matchAll(formatNames);
if (!name || matches[0] == name) { tinymce.each(matches, function(match) {
if (matches[0]) if (!name || match == name) {
ed.formatter.remove(matches[0]); if (match)
} else ed.formatter.remove(match);
removedFormat = true;
}
});
if (!removedFormat)
ed.formatter.apply(name); ed.formatter.apply(name);
ed.undoManager.add(); ed.undoManager.add();
@@ -264,7 +365,7 @@
}); });
// Handle specified format // Handle specified format
ed.onInit.add(function() { ed.onPreInit.add(function() {
var counter = 0, formats = ed.getParam('style_formats'); var counter = 0, formats = ed.getParam('style_formats');
if (formats) { if (formats) {
@@ -276,24 +377,32 @@
if (keys > 1) { if (keys > 1) {
name = fmt.name = fmt.name || 'style_' + (counter++); name = fmt.name = fmt.name || 'style_' + (counter++);
ed.formatter.register(name, fmt); ed.formatter.register(name, fmt);
ctrl.add(fmt.title, name); ctrl.add(fmt.title, name, {
style: function() {
return getPreviewCss(ed, fmt);
}
});
} else } else
ctrl.add(fmt.title); ctrl.add(fmt.title);
}); });
} else { } else {
each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) { each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
var name; var name, fmt;
if (val) { if (val) {
name = 'style_' + (counter++); name = 'style_' + (counter++);
fmt = {
ed.formatter.register(name, {
inline : 'span', inline : 'span',
classes : val, classes : val,
selector : '*' selector : '*'
}); };
ctrl.add(t.editor.translate(key), name); ed.formatter.register(name, fmt);
ctrl.add(t.editor.translate(key), name, {
style: function() {
return getPreviewCss(ed, fmt);
}
});
} }
}); });
} }
@@ -433,7 +542,9 @@
if (c) { if (c) {
each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) { each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {
c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v}); c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v, style: function() {
return getPreviewCss(t.editor, {block: v});
}});
}); });
} }
@@ -507,7 +618,7 @@
// TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for. // TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.
// Maybe actually inherit it from the original textara? // Maybe actually inherit it from the original textara?
n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')}); n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '') + (ed.settings.directionality == "rtl" ? ' mceRtl' : '')});
DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label); DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);
if (!DOM.boxModel) if (!DOM.boxModel)
@@ -552,8 +663,7 @@
if (e.nodeName == 'A') { if (e.nodeName == 'A') {
t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1')); t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
return false;
return Event.cancel(e);
} }
}); });
/* /*
@@ -825,7 +935,7 @@
}, },
_addToolbars : function(c, o) { _addToolbars : function(c, o) {
var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup; var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup, toolbarsExist = false;
toolbarGroup = cf.createToolbarGroup('toolbargroup', { toolbarGroup = cf.createToolbarGroup('toolbargroup', {
'name': ed.getLang('advanced.toolbar'), 'name': ed.getLang('advanced.toolbar'),
@@ -841,6 +951,7 @@
// Create toolbar and add the controls // Create toolbar and add the controls
for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
toolbarsExist = true;
tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
if (s['theme_advanced_buttons' + i + '_add']) if (s['theme_advanced_buttons' + i + '_add'])
@@ -854,6 +965,9 @@
o.deltaHeight -= s.theme_advanced_row_height; o.deltaHeight -= s.theme_advanced_row_height;
} }
// Handle case when there are no toolbar buttons and ensure editor height is adjusted accordingly
if (!toolbarsExist)
o.deltaHeight -= s.theme_advanced_row_height;
h.push(toolbarGroup.renderHTML()); h.push(toolbarGroup.renderHTML());
h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->')); h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
DOM.setHTML(n, h.join('')); DOM.setHTML(n, h.join(''));
@@ -975,19 +1089,17 @@
p = getParent('A'); p = getParent('A');
if (c = cm.get('link')) { if (c = cm.get('link')) {
if (!p || !p.name) { c.setDisabled((!p && co) || (p && !p.href));
c.setDisabled(!p && co); c.setActive(!!p && (!p.name && !p.id));
c.setActive(!!p);
}
} }
if (c = cm.get('unlink')) { if (c = cm.get('unlink')) {
c.setDisabled(!p && co); c.setDisabled(!p && co);
c.setActive(!!p && !p.name); c.setActive(!!p && !p.name && !p.id);
} }
if (c = cm.get('anchor')) { if (c = cm.get('anchor')) {
c.setActive(!co && !!p && p.name); c.setActive(!co && !!p && (p.name || (p.id && !p.href)));
} }
p = getParent('IMG'); p = getParent('IMG');
@@ -1004,10 +1116,15 @@
matches = ed.formatter.matchAll(formatNames); matches = ed.formatter.matchAll(formatNames);
c.select(matches[0]); c.select(matches[0]);
tinymce.each(matches, function(match, index) {
if (index > 0) {
c.mark(match);
}
});
} }
if (c = cm.get('formatselect')) { if (c = cm.get('formatselect')) {
p = getParent(DOM.isBlock); p = getParent(ed.dom.isBlock);
if (p) if (p)
c.select(p.nodeName.toLowerCase()); c.select(p.nodeName.toLowerCase());
@@ -1105,7 +1222,7 @@
return; return;
// Handle prefix // Handle prefix
if (tinymce.isIE && n.scopeName !== 'HTML') if (tinymce.isIE && n.scopeName !== 'HTML' && n.scopeName)
na = n.scopeName + ':' + na; na = n.scopeName + ':' + na;
// Remove internal prefix // Remove internal prefix
@@ -1166,7 +1283,7 @@
if (v) { if (v) {
ti += 'class: ' + v + ' '; ti += 'class: ' + v + ' ';
if (DOM.isBlock(n) || na == 'img' || na == 'span') if (ed.dom.isBlock(n) || na == 'img' || na == 'span')
na += '.' + v; na += '.' + v;
} }
} }
@@ -1294,7 +1411,7 @@
var ed = this.editor; var ed = this.editor;
// Internal image object like a flash placeholder // Internal image object like a flash placeholder
if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)
return; return;
ed.windowManager.open({ ed.windowManager.open({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -6,7 +6,7 @@ var AnchorDialog = {
this.editor = ed; this.editor = ed;
elm = ed.dom.getParent(ed.selection.getNode(), 'A'); elm = ed.dom.getParent(ed.selection.getNode(), 'A');
v = ed.dom.getAttrib(elm, 'name'); v = ed.dom.getAttrib(elm, 'name') || ed.dom.getAttrib(elm, 'id');
if (v) { if (v) {
this.action = 'update'; this.action = 'update';
@@ -17,7 +17,7 @@ var AnchorDialog = {
}, },
update : function() { update : function() {
var ed = this.editor, elm, name = document.forms[0].anchorName.value; var ed = this.editor, elm, name = document.forms[0].anchorName.value, attribName;
if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) { if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {
tinyMCEPopup.alert('advanced_dlg.anchor_invalid'); tinyMCEPopup.alert('advanced_dlg.anchor_invalid');
@@ -29,12 +29,23 @@ var AnchorDialog = {
if (this.action != 'update') if (this.action != 'update')
ed.selection.collapse(1); ed.selection.collapse(1);
var aRule = ed.schema.getElementRule('a');
if (!aRule || aRule.attributes.name) {
attribName = 'name';
} else {
attribName = 'id';
}
elm = ed.dom.getParent(ed.selection.getNode(), 'A'); elm = ed.dom.getParent(ed.selection.getNode(), 'A');
if (elm) { if (elm) {
elm.setAttribute('name', name); elm.setAttribute(attribName, name);
elm.name = name; elm[attribName] = name;
} else } else {
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, '')); // create with zero-sized nbsp so that in Webkit where anchor is on last line by itself caret cannot be placed after it
var attrs = {'class' : 'mceItemAnchor'};
attrs[attribName] = name;
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', attrs, '\uFEFF'));
}
tinyMCEPopup.close(); tinyMCEPopup.close();
} }

View File

@@ -93,41 +93,57 @@ function toHexColor(color) {
return value.length > 1 ? value : '0' + value; // Padd with leading zero return value.length > 1 ? value : '0' + value; // Padd with leading zero
}; };
color = color.replace(/[\s#]+/g, '').toLowerCase(); color = tinymce.trim(color);
color = color.replace(/^[#]/, '').toLowerCase(); // remove leading '#'
color = namedLookup[color] || color; color = namedLookup[color] || color;
matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)|([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})|([a-f0-9])([a-f0-9])([a-f0-9])$/.exec(color);
matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/.exec(color);
if (matches) { if (matches) {
if (matches[1]) {
red = toInt(matches[1]); red = toInt(matches[1]);
green = toInt(matches[2]); green = toInt(matches[2]);
blue = toInt(matches[3]); blue = toInt(matches[3]);
} else if (matches[4]) { } else {
red = toInt(matches[4], 16); matches = /^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(color);
green = toInt(matches[5], 16);
blue = toInt(matches[6], 16); if (matches) {
} else if (matches[7]) { red = toInt(matches[1], 16);
red = toInt(matches[7] + matches[7], 16); green = toInt(matches[2], 16);
green = toInt(matches[8] + matches[8], 16); blue = toInt(matches[3], 16);
blue = toInt(matches[9] + matches[9], 16); } else {
matches = /^([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(color);
if (matches) {
red = toInt(matches[1] + matches[1], 16);
green = toInt(matches[2] + matches[2], 16);
blue = toInt(matches[3] + matches[3], 16);
} else {
return '';
}
}
} }
return '#' + hex(red) + hex(green) + hex(blue); return '#' + hex(red) + hex(green) + hex(blue);
} }
return '';
}
function insertAction() { function insertAction() {
var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
var hexColor = toHexColor(color);
if (hexColor === '') {
var text = tinyMCEPopup.editor.getLang('advanced_dlg.invalid_color_value');
tinyMCEPopup.alert(text + ': ' + color);
}
else {
tinyMCEPopup.restoreSelection(); tinyMCEPopup.restoreSelection();
if (f) if (f)
f(toHexColor(color)); f(hexColor);
tinyMCEPopup.close(); tinyMCEPopup.close();
} }
}
function showColor(color, name) { function showColor(color, name) {
if (name) if (name)

View File

@@ -104,10 +104,12 @@ var ImageDialog = {
}, },
updateStyle : function() { updateStyle : function() {
var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; var dom = tinyMCEPopup.dom, st = {}, v, f = document.forms[0];
if (tinyMCEPopup.editor.settings.inline_styles) { if (tinyMCEPopup.editor.settings.inline_styles) {
st = tinyMCEPopup.dom.parseStyle(this.styleVal); tinymce.each(tinyMCEPopup.dom.parseStyle(this.styleVal), function(value, key) {
st[key] = value;
});
// Handle align // Handle align
v = getSelectValue(f, 'align'); v = getSelectValue(f, 'align');

View File

@@ -16,7 +16,7 @@ function onLoadInit() {
document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true}); document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
setWrap('soft'); turnWrapOn();
document.getElementById('wraped').checked = true; document.getElementById('wraped').checked = true;
} }
@@ -37,12 +37,34 @@ function setWrap(val) {
} }
} }
function toggleWordWrap(elm) { function setWhiteSpaceCss(value) {
if (elm.checked) var el = document.getElementById('htmlSource');
setWrap('soft'); tinymce.DOM.setStyle(el, 'white-space', value);
else }
function turnWrapOff() {
if (tinymce.isWebKit) {
setWhiteSpaceCss('pre');
} else {
setWrap('off'); setWrap('off');
} }
}
function turnWrapOn() {
if (tinymce.isWebKit) {
setWhiteSpaceCss('pre-wrap');
} else {
setWrap('soft');
}
}
function toggleWordWrap(elm) {
if (elm.checked) {
turnWrapOn();
} else {
turnWrapOff();
}
}
function resizeInputs() { function resizeInputs() {
var vp = tinyMCEPopup.dom.getViewPort(window), el; var vp = tinyMCEPopup.dom.getViewPort(window), el;

View File

@@ -1 +1 @@
tinyMCE.addI18n('en.advanced_dlg', {"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character", "charmap_usage":"Use left and right arrows to navigate.","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage","":""}); tinyMCE.addI18n('en.advanced_dlg', {"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character", "charmap_usage":"Use left and right arrows to navigate.","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage","invalid_color_value":"Invalid color value","":""});

View File

@@ -48,3 +48,4 @@ font[face=mceinline] {font-family:inherit !important}
.mceItemEmbeddedAudio {background-image:url(../../img/video.gif)} .mceItemEmbeddedAudio {background-image:url(../../img/video.gif)}
.mceItemIframe {background-image:url(../../img/iframe.gif)} .mceItemIframe {background-image:url(../../img/iframe.gif)}
.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;} .mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}
.mceHideBrInPre pre br {display: none}

View File

@@ -105,11 +105,12 @@ h3 {font-size:14px;}
#plugintable, #about #plugintable td {border:1px solid #919B9C;} #plugintable, #about #plugintable td {border:1px solid #919B9C;}
#plugintable {width:96%; margin-top:10px;} #plugintable {width:96%; margin-top:10px;}
#pluginscontainer {height:290px; overflow:auto;} #pluginscontainer {height:290px; overflow:auto;}
#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} #colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}
#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}
#colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}
#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
#colorpicker #light div {overflow:hidden;} #colorpicker #light div {overflow:hidden;}
#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
#colorpicker .panel_wrapper div.current {height:175px;} #colorpicker .panel_wrapper div.current {height:175px;}
#colorpicker #namedcolors {width:150px;} #colorpicker #namedcolors {width:150px;}
#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}

View File

@@ -83,7 +83,7 @@
.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px} .defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px}
/* Menu */ /* Menu */
.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8} .defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8; direction:ltr}
.defaultSkin .mceNoIcons span.mceIcon {width:0;} .defaultSkin .mceNoIcons span.mceIcon {width:0;}
.defaultSkin .mceNoIcons a .mceText {padding-left:10px} .defaultSkin .mceNoIcons a .mceText {padding-left:10px}
.defaultSkin .mceMenu table {background:#FFF} .defaultSkin .mceMenu table {background:#FFF}
@@ -109,6 +109,10 @@
.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF} .defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}
.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} .defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
/* Rtl */
.mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}
.mceRtl .mceMenuItem .mceText {text-align: right}
/* Formats */ /* Formats */
.defaultSkin .mce_formatPreview a {font-size:10px} .defaultSkin .mce_formatPreview a {font-size:10px}
.defaultSkin .mce_p span.mceText {} .defaultSkin .mce_p span.mceText {}
@@ -212,3 +216,4 @@
.defaultSkin span.mce_pagebreak {background-position:0 -40px} .defaultSkin span.mce_pagebreak {background-position:0 -40px}
.defaultSkin span.mce_restoredraft {background-position:-20px -40px} .defaultSkin span.mce_restoredraft {background-position:-20px -40px}
.defaultSkin span.mce_spellchecker {background-position:-540px -20px} .defaultSkin span.mce_spellchecker {background-position:-540px -20px}
.defaultSkin span.mce_visualblocks {background-position: -40px -40px}

View File

@@ -46,3 +46,4 @@ font[face=mceinline] {font-family:inherit !important}
.mceItemAudio {background-image:url(../../img/video.gif)} .mceItemAudio {background-image:url(../../img/video.gif)}
.mceItemIframe {background-image:url(../../img/iframe.gif)} .mceItemIframe {background-image:url(../../img/iframe.gif)}
.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;} .mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}
.mceHideBrInPre pre br {display: none}

View File

@@ -105,11 +105,12 @@ h3 {font-size:14px;}
#plugintable, #about #plugintable td {border:1px solid #919B9C;} #plugintable, #about #plugintable td {border:1px solid #919B9C;}
#plugintable {width:96%; margin-top:10px;} #plugintable {width:96%; margin-top:10px;}
#pluginscontainer {height:290px; overflow:auto;} #pluginscontainer {height:290px; overflow:auto;}
#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} #colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}
#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}
#colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}
#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
#colorpicker #light div {overflow:hidden;} #colorpicker #light div {overflow:hidden;}
#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
#colorpicker .panel_wrapper div.current {height:175px;} #colorpicker .panel_wrapper div.current {height:175px;}
#colorpicker #namedcolors {width:150px;} #colorpicker #namedcolors {width:150px;}
#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}

View File

@@ -86,7 +86,7 @@
.o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden} .o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden}
/* Menu */ /* Menu */
.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD} .o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD; direction:ltr}
.o2k7Skin .mceNoIcons span.mceIcon {width:0;} .o2k7Skin .mceNoIcons span.mceIcon {width:0;}
.o2k7Skin .mceNoIcons a .mceText {padding-left:10px} .o2k7Skin .mceNoIcons a .mceText {padding-left:10px}
.o2k7Skin .mceMenu table {background:#FFF} .o2k7Skin .mceMenu table {background:#FFF}
@@ -112,6 +112,10 @@
.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF} .o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}
.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} .o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
/* Rtl */
.mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}
.mceRtl .mceMenuItem .mceText {text-align: right}
/* Formats */ /* Formats */
.o2k7Skin .mce_formatPreview a {font-size:10px} .o2k7Skin .mce_formatPreview a {font-size:10px}
.o2k7Skin .mce_p span.mceText {} .o2k7Skin .mce_p span.mceText {}
@@ -215,3 +219,4 @@
.o2k7Skin span.mce_pagebreak {background-position:0 -40px} .o2k7Skin span.mce_pagebreak {background-position:0 -40px}
.o2k7Skin span.mce_restoredraft {background-position:-20px -40px} .o2k7Skin span.mce_restoredraft {background-position:-20px -40px}
.o2k7Skin span.mce_spellchecker {background-position:-540px -20px} .o2k7Skin span.mce_spellchecker {background-position:-540px -20px}
.o2k7Skin span.mce_visualblocks {background-position: -40px -40px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,17 @@
| $Id$ | $Id$
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
require_once("../../class2.php");
ob_start();
ob_implicit_flush(0);
header("last-modified: " . gmdate("D, d M Y H:i:s",mktime(0,0,0,15,2,2004)) . " GMT");
header('Content-type: text/javascript', TRUE);
$wy = new wysiwyg();
echo_gzipped_page();
class wysiwyg class wysiwyg
{ {
var $js; var $js;
@@ -49,12 +58,12 @@ class wysiwyg
} }
else else
{*/ {*/
$text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce.js'></script>\n"; // $text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce.js'></script>\n";
//} //}
$text .= "<script type='text/javascript'>\n"; // $text .= "<script type='text/javascript'>\n";
$text .= "\n /* TinyMce Config: ".$this->configName." */"; $text .= "\n /* TinyMce Config: ".$this->configName." */";
$text .= $this->tinyMce_config(); $text .= $this->tinyMce_config();
@@ -80,7 +89,7 @@ class wysiwyg
case 'get_from_editor': case 'get_from_editor':
// Convert HTML to e107-BBcode // Convert HTML to e107-BBcode
source = source.replace(/target=\"_blank\"/, 'rel=\"external\"'); source = source.replace(/target=\"_blank\"/, 'rel=\"external\"');
source = source.replace(/^\s*|\s*$/g,''); // source = source.replace(/^\s*|\s*$/g,'');
"; ";
@@ -123,12 +132,12 @@ class wysiwyg
} }
</script>\n
"; ";
//$text .= "</script>\n";
$this->js = $text; $this->js = $text;
$this->render();
} }
@@ -267,8 +276,6 @@ class wysiwyg
'dialog_type' => "modal", 'dialog_type' => "modal",
// 'theme_advanced_statusbar_location' => 'bottom', // 'theme_advanced_statusbar_location' => 'bottom',
'theme_advanced_resizing' => 'true', 'theme_advanced_resizing' => 'true',
'remove_linebreaks' => 'false', 'remove_linebreaks' => 'false',

View File

@@ -5,30 +5,6 @@ define('STANDARDS_MODE', TRUE);
include_lan(e_THEME."_blank/languages/".e_LANGUAGE.".php"); include_lan(e_THEME."_blank/languages/".e_LANGUAGE.".php");
// jQUERY scripts
e107::js('core', 'colorbox/jquery.colorbox-min.js', 'jquery', 2);
e107::css('core', 'colorbox/colorbox.css', 'jquery');
e107::js('core', 'jquery.elastic.js', 'jquery', 2);
e107::js('core', 'jquery-ui-timepicker-addon.js', 'jquery', 2);
e107::js('core', 'plupload/plupload.full.js', 'jquery', 2);
e107::css('core', 'plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', 'jquery');
e107::js('core', 'plupload/jquery.plupload.queue/jquery.plupload.queue.js', 'jquery', 2);
e107::css('core', 'chosen/chosen.css', 'jquery');
e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2);
e107::css('core', 'password/style.css', 'jquery');
e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2);
//
e107::js("core", "plupload/customUpload.js","jquery",3);
e107::js("core", "core/mediaManager.js","jquery",3);
e107::css('core', 'core/admin.css', 'jquery');
e107::js('core', 'core/admin.jquery.js', 'jquery', 4);

View File

@@ -16,8 +16,8 @@
// $register_bb['blank'] = array("", "[blank][/blank]","Blank example helper text",e_IMAGE."bbcode/template.png"); // $register_bb['blank'] = array("", "[blank][/blank]","Blank example helper text",e_IMAGE."bbcode/template.png");
// Simplified default bbcode bar - removed P, H, BR and NOBR bbcodes // Simplified default bbcode bar - removed P, H, BR and NOBR bbcodes
$BBCODE_TEMPLATE = " $BBCODE_TEMPLATE = "
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left}{BB=right} {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=justify}{BB=center}{BB=left}{BB=right}
{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=youtube} {BB=bq}{BB=list}{BB=table}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=youtube}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
"; ";
@@ -31,8 +31,8 @@ $BBCODE_TEMPLATE_SUBMITNEWS = "
{BB_HELP} {BB_HELP}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
{BB=link}{BB=h}{BB=p}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left}{BB=right} {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left}{BB=right}
{BB=bq}{BB=code}{BB=list}{BB=block}{BB=nobr}{BB=br}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=flash}{BB=youtube} {BB=bq}{BB=list}{BB=nobr}{BB=br}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=flash}{BB=youtube}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
"; ";
@@ -42,8 +42,8 @@ $BBCODE_TEMPLATE_SUBMITNEWS = "
$BBCODE_TEMPLATE_ADMIN = " $BBCODE_TEMPLATE_ADMIN = "
{BB_HELP=admin} {BB_HELP=admin}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
{BB=link}{BB=h}{BB=p}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left} {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=justify}{BB=center}{BB=left}
{BB=right}{BB=bq}{BB=code}{BB=list}{BB=block}{BB=nobr}{BB=br}{BB=fontcol}{BB=fontsize}{BB=emotes} {BB=right}{BB=bq}{BB=list}{BB=table}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR} {BB_PREIMAGEDIR}
{BB=preimage}{BB=prefile}{BB=flash}{BB=youtube} {BB=preimage}{BB=prefile}{BB=flash}{BB=youtube}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
@@ -52,8 +52,8 @@ $BBCODE_TEMPLATE_ADMIN = "
$BBCODE_TEMPLATE_MAILOUT = " $BBCODE_TEMPLATE_MAILOUT = "
{BB_HELP=admin} {BB_HELP=admin}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
{BB=link}{BB=h}{BB=p}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left} {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left}
{BB=right}{BB=bq}{BB=code}{BB=list}{BB=block}{BB=nobr}{BB=br}{BB=fontcol}{BB=fontsize}{BB=emotes} {BB=right}{BB=bq}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR} {BB_PREIMAGEDIR}
{BB=preimage}{BB=prefile}{BB=flash}{BB=shortcode} {BB=preimage}{BB=prefile}{BB=flash}{BB=shortcode}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
@@ -64,8 +64,8 @@ $BBCODE_TEMPLATE_MAILOUT = "
$BBCODE_TEMPLATE_NEWSPOST = " $BBCODE_TEMPLATE_NEWSPOST = "
{BB_HELP=$mode} {BB_HELP=$mode}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
{BB=link}{BB=h}{BB=p}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left} {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=justify}{BB=center}{BB=left}
{BB=right}{BB=bq}{BB=code}{BB=list}{BB=block}{BB=nobr}{BB=br}{BB=fontcol}{BB=fontsize}{BB=emotes} {BB=right}{BB=bq}{BB=list}{BB=table}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR=news} {BB_PREIMAGEDIR=news}
{BB=preimage}{BB=prefile}{BB=flash}{BB=youtube} {BB=preimage}{BB=prefile}{BB=flash}{BB=youtube}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
@@ -75,8 +75,8 @@ $BBCODE_TEMPLATE_CPAGE = "
{BB_HELP} {BB_HELP}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>
{BB=newpage} {BB=newpage}
{BB=link}{BB=h}{BB=p}{BB=b}{BB=i}{BB=u}{BB=img}{BB=justify}{BB=center}{BB=left}{BB=right} {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=justify}{BB=center}{BB=left}{BB=right}
{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=block}{BB=nobr}{BB=br}{BB=fontsize}{BB=emotes} {BB=bq}{BB=list}{BB=table}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR=page} {BB_PREIMAGEDIR=page}
{BB=preimage}{BB=prefile}{BB=flash}{BB=youtube} {BB=preimage}{BB=prefile}{BB=flash}{BB=youtube}
<div class='field-spacer'><!-- --></div> <div class='field-spacer'><!-- --></div>