[kupu-checkins] r54983 - in kupu/trunk/kupu: common doc
duncan at codespeak.net
duncan at codespeak.net
Tue May 20 10:31:46 CEST 2008
Author: duncan
Date: Tue May 20 10:31:45 2008
New Revision: 54983
Modified:
kupu/trunk/kupu/common/kupucontentfilters.js
kupu/trunk/kupu/doc/CHANGES.txt
Log:
Fix broken paste from OpenOffice. Style and script tags now removed completely (including their
content). Improved cleanup code to not generate phantom empty paragraphs from nested paragraphs in DOM.
Reject META and TITLE tags.
Modified: kupu/trunk/kupu/common/kupucontentfilters.js
==============================================================================
--- kupu/trunk/kupu/common/kupucontentfilters.js (original)
+++ kupu/trunk/kupu/common/kupucontentfilters.js Tue May 20 10:31:45 2008
@@ -400,6 +400,11 @@
this.badTagAttributes = new this.Set({});
+ // Nasty tags should be initialised from Plone's HTML control panel
+ // but we have a few tags we know for sure aren't going to work
+ // so we can put them in whatever.
+ this.nastyTags = new this.Set({'script':1, 'style':1, 'meta':1, 'title':1});
+
// State array. For each tag identifies what it can contain.
// I'm not attempting to check the order or number of contained
// tags (yet).
@@ -564,7 +569,7 @@
}(this, editor);
// Exclude unwanted tags.
- this.excludeTags(['center']);
+ this.excludeTags(['center', 'meta', 'title']);
if (editor.config && editor.config.htmlfilter) {
this.filterStructure = editor.config.htmlfilter.filterstructure;
@@ -672,9 +677,14 @@
if (n instanceof Array) {
var newp = ownerdoc.createElement('p');
this._xmlCopyAttr(para, newp);
- var ln = n.length-1;
- if (/br/i.test(n[ln].nodeName)) {
- n.splice(ln,1);
+ for (var ln = n.length-1; ln >= 0; ln--) {
+ var nn = n[ln].nodeName.toLowerCase();
+ if (nn=='br' || (nn=='#text' && /^\s*$/.test(n[ln].nodeValue))) {
+ n.splice(ln,1);
+ } else { break; }
+ }
+ if (n.length==0) {
+ continue;
}
for (var j = 0; j < n.length; j++) {
newp.appendChild(n[j]);
@@ -736,6 +746,10 @@
xhtmlnode = null;
}
}
+ } else {
+ // Stripping this tag, maybe we also want to strip the
+ // content of the tag.
+ if (this.nastyTags[nodename]) { return null; }
}
var kids = htmlnode.childNodes;
Modified: kupu/trunk/kupu/doc/CHANGES.txt
==============================================================================
--- kupu/trunk/kupu/doc/CHANGES.txt (original)
+++ kupu/trunk/kupu/doc/CHANGES.txt Tue May 20 10:31:45 2008
@@ -2,7 +2,7 @@
Kupu changes
============
-- SVN (unreleased)
+- 1.4.10
- Purged old Zope2 Interface interfaces for compatibility with Zope 2.12 and Plone 4, while maintaining compatibility
with pre Plone 4 versions of Products.PortalTransforms.
@@ -10,10 +10,13 @@
- Plone tickets
+ * 7779 imageuploader doesn t show the input for file if not in english
* 7958 Kupu: Insert image: KeyError: 'info' (Error 503 loading kupucollection.xml?resource_type=mediaobject)
* 7990 Internal link drawer broken for editors
* 8003 Fixed Kupu translation msgids containing html.
+ * 8009 Pasting from OpenOffice broken / mishandled comments
* 8014 kupu zmi_docs#images link broken
+ * 8039 Kupu locks up on adding images when user does not have manager privileges
* 8080 After uploading image, the "Insert Image" dialog remains open
* 8129 "TypeError: string indices must be integers" error on plonedrawers.py when installing
More information about the kupu-checkins
mailing list