aboutsummaryrefslogtreecommitdiffstats
path: root/library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js
diff options
context:
space:
mode:
authortony baldwin <tonybaldwin@gmx.com>2012-03-21 01:36:23 -0400
committertony baldwin <tonybaldwin@gmx.com>2012-03-21 01:36:23 -0400
commite5c29fcc786cee73c08247824cb87e9ed65a2c36 (patch)
tree1e5a6fcf5ba20e5effdd60e6d6ffa5fadb11d9d7 /library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js
parentcf17606d0f6200296b1e6d67f9ae3fb797e0df69 (diff)
parentb4a2dae0850ed72b61b008e44efa98f300ccd640 (diff)
downloadvolse-hubzilla-e5c29fcc786cee73c08247824cb87e9ed65a2c36.tar.gz
volse-hubzilla-e5c29fcc786cee73c08247824cb87e9ed65a2c36.tar.bz2
volse-hubzilla-e5c29fcc786cee73c08247824cb87e9ed65a2c36.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js')
-rw-r--r--[-rwxr-xr-x]library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js49
1 files changed, 30 insertions, 19 deletions
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js b/library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js
index b78e82f76..9ca955c92 100755..100644
--- a/library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js
+++ b/library/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js
@@ -30,8 +30,6 @@ function init() {
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
- document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');
- document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');
document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
// Link list
@@ -41,6 +39,13 @@ function init() {
else
document.getElementById("linklisthrefcontainer").innerHTML = html;
+ // Anchor list
+ html = getAnchorListHTML('anchorlist','href');
+ if (html == "")
+ document.getElementById("anchorlistrow").style.display = 'none';
+ else
+ document.getElementById("anchorlistcontainer").innerHTML = html;
+
// Resize some elements
if (isVisible('hrefbrowser'))
document.getElementById('href').style.width = '260px';
@@ -49,6 +54,13 @@ function init() {
document.getElementById('popupurl').style.width = '180px';
elm = inst.dom.getParent(elm, "A");
+ if (elm == null) {
+ var prospect = inst.dom.create("p", null, inst.selection.getContent());
+ if (prospect.childNodes.length === 1) {
+ elm = prospect.firstChild;
+ }
+ }
+
if (elm != null && elm.nodeName == "A")
action = "update";
@@ -360,20 +372,22 @@ function setAttrib(elm, attrib, value) {
}
function getAnchorListHTML(id, target) {
- var inst = tinyMCEPopup.editor;
- var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i;
- var html = "";
-
- html += '<select id="' + id + '" name="' + id + '" class="mceAnchorList" o2nfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target + '.value=';
- html += 'this.options[this.selectedIndex].value;">';
- html += '<option value="">---</option>';
+ var ed = tinyMCEPopup.editor, nodes = ed.dom.select('a'), name, i, len, html = "";
- for (i=0; i<nodes.length; i++) {
- if ((name = inst.dom.getAttrib(nodes[i], "name")) != "")
+ for (i=0, len=nodes.length; i<len; i++) {
+ if ((name = ed.dom.getAttrib(nodes[i], "name")) != "")
html += '<option value="#' + name + '">' + name + '</option>';
}
- html += '</select>';
+ if (html == "")
+ return "";
+
+ html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"'
+ + ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"'
+ + '>'
+ + '<option value="">---</option>'
+ + html
+ + '</select>';
return html;
}
@@ -389,7 +403,6 @@ function insertAction() {
// Remove element if there is no href
if (!document.forms[0].href.value) {
- tinyMCEPopup.execCommand("mceBeginUndoLevel");
i = inst.selection.getBookmark();
inst.dom.remove(elm, 1);
inst.selection.moveToBookmark(i);
@@ -398,12 +411,10 @@ function insertAction() {
return;
}
- tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
// Create new anchor elements
if (elm == null) {
inst.getDoc().execCommand("unlink", false, null);
- tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
+ tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';});
for (i=0; i<elementArray.length; i++)
@@ -425,7 +436,7 @@ function insertAction() {
function setAllAttribs(elm) {
var formObj = document.forms[0];
- var href = formObj.href.value;
+ var href = formObj.href.value.replace(/ /g, '%20');
var target = getSelectValue(formObj, 'targetlist');
setAttrib(elm, 'href', href);
@@ -477,7 +488,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) {
var html = "";
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;';
if (typeof(onchange_func) != "undefined")
@@ -499,7 +510,7 @@ function getTargetListHTML(elm_id, target_form_element) {
var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
var html = '';
- html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="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 += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';
html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';