summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/themes/advanced/js/anchor.js
diff options
context:
space:
mode:
authorsvncommit <devs@roundcube.net>2008-04-15 21:22:00 +0000
committersvncommit <devs@roundcube.net>2008-04-15 21:22:00 +0000
commitd9344fc349e8c5765898c90bf5061e56cd21c8a0 (patch)
treea5916f5f3f88df8d6336b43dde8cdbb49cb47bdc /program/js/tiny_mce/themes/advanced/js/anchor.js
parentd7a411f099596cbc8e749e1f0802ac2bb2c6289e (diff)
HTML editing fixes, upgrade to TinyMCE v3.0.6
Diffstat (limited to 'program/js/tiny_mce/themes/advanced/js/anchor.js')
-rw-r--r--program/js/tiny_mce/themes/advanced/js/anchor.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/program/js/tiny_mce/themes/advanced/js/anchor.js b/program/js/tiny_mce/themes/advanced/js/anchor.js
new file mode 100644
index 000000000..b5efd1ec9
--- /dev/null
+++ b/program/js/tiny_mce/themes/advanced/js/anchor.js
@@ -0,0 +1,37 @@
+tinyMCEPopup.requireLangPack();
+
+var AnchorDialog = {
+ init : function(ed) {
+ var action, elm, f = document.forms[0];
+
+ this.editor = ed;
+ elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
+ v = ed.dom.getAttrib(elm, 'name');
+
+ if (v) {
+ this.action = 'update';
+ f.anchorName.value = v;
+ }
+
+ f.insert.value = ed.getLang(elm ? 'update' : 'insert');
+ },
+
+ update : function() {
+ var ed = this.editor;
+
+ tinyMCEPopup.restoreSelection();
+
+ if (this.action != 'update')
+ ed.selection.collapse(1);
+
+ // Webkit acts weird if empty inline element is inserted so we need to use a image instead
+ if (tinymce.isWebKit)
+ ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
+ else
+ ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
+
+ tinyMCEPopup.close();
+ }
+};
+
+tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);