Update of /cvsroot/php-blog/serendipity/htmlarea/plugins/ContextMenu
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12393/htmlarea/plugins/ContextMenu
Modified Files:
context-menu.js menu.css
Log Message:
* Upgraded htmlarea WYSIWYG editor to latest version. Entering links now properly works, as finally does Copy+Paste from Mozilla! (garvinhicking)
Index: menu.css
===================================================================
RCS file: /cvsroot/php-blog/serendipity/htmlarea/plugins/ContextMenu/menu.css,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- menu.css 23 Mar 2004 15:41:07 -0000 1.1
+++ menu.css 11 Jan 2005 15:00:56 -0000 1.2
@@ -7,6 +7,7 @@
border: 1px solid #aca899;
padding: 2px;
background-color: #fff;
+ color: #000;
cursor: default;
z-index: 1000;
}
Index: context-menu.js
===================================================================
RCS file: /cvsroot/php-blog/serendipity/htmlarea/plugins/ContextMenu/context-menu.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- context-menu.js 23 Mar 2004 15:41:07 -0000 1.1
+++ context-menu.js 11 Jan 2005 15:00:55 -0000 1.2
@@ -63,6 +63,26 @@
tbo.buttonPress(editor, opcode);
};
+ function insertPara(after) {
+ var el = currentTarget;
+ var par = el.parentNode;
+ var p = editor._doc.createElement("p");
+ p.appendChild(editor._doc.createElement("br"));
+ par.insertBefore(p, after ? el.nextSibling : el);
+ var sel = editor._getSelection();
+ var range = editor._createRange(sel);
+ if (!HTMLArea.is_ie) {
+ sel.removeAllRanges();
+ range.selectNodeContents(p);
+ range.collapse(true);
+ sel.addRange(range);
+ } else {
+ range.moveToElementText(p);
+ range.collapse(true);
+ range.select();
+ }
+ };
+
for (; target; target = target.parentNode) {
var tag = target.tagName;
if (!tag)
@@ -189,32 +209,41 @@
i18n["Create a link"],
config.btnList["createlink"][1] ]);
- for (var i in elmenus)
+ for (var i = 0; i < elmenus.length; ++i)
menu.push(elmenus[i]);
- menu.push(null,
- [ i18n["Remove the"] + " <" + currentTarget.tagName + "> " + i18n["Element"],
- function() {
- if (confirm(i18n["Please confirm that you want to remove this element:"] + " " + currentTarget.tagName)) {
- var el = currentTarget;
- var p = el.parentNode;
- p.removeChild(el);
- if (HTMLArea.is_gecko) {
- if (p.tagName.toLowerCase() == "td" && !p.hasChildNodes())
- p.appendChild(editor._doc.createElement("br"));
- editor.forceRedraw();
- editor.focusEditor();
- editor.updateToolbar();
- if (table) {
- var save_collapse = table.style.borderCollapse;
- table.style.borderCollapse = "collapse";
- table.style.borderCollapse = "separate";
- table.style.borderCollapse = save_collapse;
+ if (!/html|body/i.test(currentTarget.tagName))
+ menu.push(null,
+ [ i18n["Remove the"] + " <" + currentTarget.tagName + "> " + i18n["Element"],
+ function() {
+ if (confirm(i18n["Please confirm that you want to remove this element:"] + " " +
+ currentTarget.tagName)) {
+ var el = currentTarget;
+ var p = el.parentNode;
+ p.removeChild(el);
+ if (HTMLArea.is_gecko) {
+ if (p.tagName.toLowerCase() == "td" && !p.hasChildNodes())
+ p.appendChild(editor._doc.createElement("br"));
+ editor.forceRedraw();
+ editor.focusEditor();
+ editor.updateToolbar();
+ if (table) {
+ var save_collapse = table.style.borderCollapse;
+ table.style.borderCollapse = "collapse";
+ table.style.borderCollapse = "separate";
+ table.style.borderCollapse = save_collapse;
+ }
}
}
- }
- },
- i18n["Remove this node from the document"] ]);
+ },
+ i18n["Remove this node from the document"] ],
+ [ i18n["Insert paragraph before"],
+ function() { insertPara(false); },
+ i18n["Insert a paragraph before the current node"] ],
+ [ i18n["Insert paragraph after"],
+ function() { insertPara(true); },
+ i18n["Insert a paragraph after the current node"] ]
+ );
return menu;
};
|