summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/themes/advanced/js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js/tiny_mce/themes/advanced/js')
-rw-r--r--program/js/tiny_mce/themes/advanced/js/color_picker.js12
-rw-r--r--program/js/tiny_mce/themes/advanced/js/image.js2
-rw-r--r--program/js/tiny_mce/themes/advanced/js/link.js43
3 files changed, 47 insertions, 10 deletions
diff --git a/program/js/tiny_mce/themes/advanced/js/color_picker.js b/program/js/tiny_mce/themes/advanced/js/color_picker.js
index da833dc94..fd9700f22 100644
--- a/program/js/tiny_mce/themes/advanced/js/color_picker.js
+++ b/program/js/tiny_mce/themes/advanced/js/color_picker.js
@@ -230,7 +230,7 @@ function updateLight(r, g, b) {
color = finalR + finalG + finalB;
- document.getElementById('gs' + i).style.backgroundColor = '#'+color;
+ setCol('gs' + i, '#'+color);
}
}
@@ -238,8 +238,16 @@ function changeFinalColor(color) {
if (color.indexOf('#') == -1)
color = convertRGBToHex(color);
- document.getElementById('preview').style.backgroundColor = color;
+ setCol('preview', color);
document.getElementById('color').value = color;
}
+function setCol(e, c) {
+ try {
+ document.getElementById(e).style.backgroundColor = c;
+ } catch (ex) {
+ // Ignore IE warning
+ }
+}
+
tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/themes/advanced/js/image.js b/program/js/tiny_mce/themes/advanced/js/image.js
index 038ace79f..4982ce0c8 100644
--- a/program/js/tiny_mce/themes/advanced/js/image.js
+++ b/program/js/tiny_mce/themes/advanced/js/image.js
@@ -88,7 +88,7 @@ var ImageDialog = {
if (el && el.nodeName == 'IMG') {
ed.dom.setAttribs(el, args);
} else {
- ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" src="javascript:;" />', {skip_undo : 1});
+ ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
ed.dom.setAttribs('__mce_tmp', args);
ed.dom.setAttrib('__mce_tmp', 'id', '');
ed.undoManager.add();
diff --git a/program/js/tiny_mce/themes/advanced/js/link.js b/program/js/tiny_mce/themes/advanced/js/link.js
index ab434da3d..2974878e1 100644
--- a/program/js/tiny_mce/themes/advanced/js/link.js
+++ b/program/js/tiny_mce/themes/advanced/js/link.js
@@ -34,10 +34,10 @@ var LinkDialog = {
var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
tinyMCEPopup.restoreSelection();
+ e = ed.dom.getParent(ed.selection.getNode(), 'A');
// Remove element if there is no href
if (!f.href.value) {
- e = ed.dom.getParent(ed.selection.getNode(), 'A');
if (e) {
tinyMCEPopup.execCommand("mceBeginUndoLevel");
b = ed.selection.getBookmark();
@@ -49,13 +49,42 @@ var LinkDialog = {
}
}
- ed.execCommand('mceInsertLink', false, {
- href : f.href.value,
- title : f.linktitle.value,
- target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
- 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
- });
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+ // Create new anchor elements
+ if (e == null) {
+ tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
+
+ tinymce.each(ed.dom.select("a"), function(n) {
+ if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
+ e = n;
+
+ ed.dom.setAttribs(e, {
+ href : f.href.value,
+ title : f.linktitle.value,
+ target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
+ 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
+ });
+ }
+ });
+ } else {
+ ed.dom.setAttribs(e, {
+ href : f.href.value,
+ title : f.linktitle.value,
+ target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
+ 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
+ });
+ }
+
+ // Don't move caret if selection was image
+ if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
+ ed.focus();
+ ed.selection.select(e);
+ ed.selection.collapse(0);
+ tinyMCEPopup.storeSelection();
+ }
+
+ tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
},