Skip to content

Commit

Permalink
Toolbar imageload fix and undo and redo fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
julmis committed Apr 6, 2004
1 parent d182339 commit 3414788
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions lib/editor/htmlarea.php
@@ -1,15 +1,15 @@
<?php <?php
include("../../config.php"); include("../../config.php");


$lastmodified = filemtime("htmlarea.php"); $lastmodified = filemtime("htmlarea.php");
$lifetime = 1800; $lifetime = 1800;

header("Content-type: application/x-javascript"); // Correct MIME type header("Content-type: application/x-javascript"); // Correct MIME type
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT"); header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
header("Cache-control: max_age = $lifetime"); header("Cache-control: max_age = $lifetime");
header("Pragma: "); header("Pragma: ");

$lang = current_language(); $lang = current_language();


if (empty($lang)) { if (empty($lang)) {
Expand Down Expand Up @@ -45,7 +45,7 @@


// make sure we have a language // make sure we have a language
if (typeof _editor_lang == "string") { if (typeof _editor_lang == "string") {
_editor_lang = _editor_lang.toLowerCase(); _editor_lang = "en"; // should always be english in moodle.
} else { } else {
_editor_lang = "en"; _editor_lang = "en";
} }
Expand All @@ -67,14 +67,10 @@ function HTMLArea(textarea, config) {
this._timerUndo = null; this._timerUndo = null;
this._undoQueue = new Array(this.config.undoSteps); this._undoQueue = new Array(this.config.undoSteps);
this._undoPos = -1; this._undoPos = -1;
this._customUndo = false; this._customUndo = true;
this._mdoc = document; // cache the document, we need it in plugins this._mdoc = document; // cache the document, we need it in plugins
this.doctype = ''; this.doctype = '';
} }
// Hide cut copy paste from gecko browsers.
//if (HTMLArea.is_gecko) {
// this.config.hideSomeButtons(" cut copy paste ");
//}
}; };


// load some scripts // load some scripts
Expand Down Expand Up @@ -580,11 +576,7 @@ function createButton(txt) {
_stopEvent(is_ie ? window.event : ev); _stopEvent(is_ie ? window.event : ev);
} }
}); });
var img = document.createElement("img"); el.innerHTML = '<img src="'+ btn[1] +'" width="18" height="18">';
img.src = btn[1];
img.style.width = "18px";
img.style.height = "18px";
el.appendChild(img);
} else if (!el) { } else if (!el) {
el = createSelect(txt); el = createSelect(txt);
} }
Expand Down Expand Up @@ -1515,19 +1507,19 @@ function (str, l1, l2, l3) {
case "f_align" : img.align = value; break; case "f_align" : img.align = value; break;
case "f_vert" : img.vspace = parseInt(value || "0"); break; case "f_vert" : img.vspace = parseInt(value || "0"); break;
case "f_horiz" : img.hspace = parseInt(value || "0"); break; case "f_horiz" : img.hspace = parseInt(value || "0"); break;
case "f_width" : case "f_width" :
if(value != 0) { if(value != 0) {
img.width = parseInt(value); img.width = parseInt(value);
} else { } else {
break; break;
} }
break; break;
case "f_height" : case "f_height" :
if(value != 0) { if(value != 0) {
img.height = parseInt(value); img.height = parseInt(value);
} else { } else {
break; break;
} }
break; break;
} }
} }
Expand Down Expand Up @@ -1572,7 +1564,7 @@ function (str, l1, l2, l3) {
tdwidth = Math.round(table.width / param["f_cols"]); tdwidth = Math.round(table.width / param["f_cols"]);
} else { } else {
tdwidth = Math.round(100 / param["f_cols"]); tdwidth = Math.round(100 / param["f_cols"]);
} }
td.setAttribute("width",tdwidth + param["f_unit"]); td.setAttribute("width",tdwidth + param["f_unit"]);
td.setAttribute("valign","top"); td.setAttribute("valign","top");
/// Moodle hack -ends /// Moodle hack -ends
Expand Down Expand Up @@ -1635,7 +1627,7 @@ function (str, l1, l2, l3) {
var editor = this; var editor = this;
link = this.getParentElement(); link = this.getParentElement();
editor.selectNodeContents(link); editor.selectNodeContents(link);

this._doc.execCommand("unlink", false, null); this._doc.execCommand("unlink", false, null);
this.focusEditor(); this.focusEditor();
}; };
Expand Down Expand Up @@ -2172,7 +2164,7 @@ function (str, l1, l2, l3) {


// strip host-part of URL which is added by MSIE to links relative to server root // strip host-part of URL which is added by MSIE to links relative to server root
// commented out for moodle // commented out for moodle
//baseurl = baseurl.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1'); //baseurl = baseurl.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1');
basere = new RegExp(baseurl); basere = new RegExp(baseurl);
return string.replace(basere, ""); return string.replace(basere, "");
}; };
Expand Down

0 comments on commit 3414788

Please sign in to comment.