});
+/**
+ * @class Roo.htmleditor.FilterAttributes
+ * clean attributes and styles including http:// etc.. in attribute
+ * @constructor
+* Run a new Attribute Filter
+* @param {Object} config Configuration options
+ */
+Roo.htmleditor.FilterFileWarning = function(cfg)
+{
+
+ var atag = cfg.node.getElementsByTagName('a');
+ for(var i =0; i < atags.length;i++) {
+ var str = '' + atags.item(i).getAttribute('href');
+ if (str.match(/^file:/)) {
+ throw new Exception ("got file url");
+ }
+ }
+ // less likely
+ atag = cfg.node.getElementsByTagName('img');
+ for(var i =0; i < atags.length;i++) {
+ var str = '' + atags.item(i).getAttribute('src');
+ if (str.match(/^file:/)) {
+ throw new Exception ("got file url");
+ }
+ }
+}
+
/***
* This is based loosely on tinymce
* @class Roo.htmleditor.TidySerializer
this.align = this.getVal(node, 'figure', 'align');
var figcaption = this.getVal(node, 'figcaption', false);
- this.caption = this.getVal(figcaption, 'i', 'html');
+ if (figcaption !== '') {
+ this.caption = this.getVal(figcaption, 'i', 'html');
+ }
+
this.caption_display = this.getVal(node, 'figcaption', 'data-display');
//this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
//Roo.log("HtmlEditorCore:syncValue (EDITOR->TEXT)");
if(this.initialized){
- this.undoManager.addEvent();
+ if (this.undoManager) {
+ this.undoManager.addEvent();
+ }
var bd = (this.doc.body || this.doc.documentElement);
var parser = new Roo.rtf.Parser(cd.getData('text/rtf'));
images = parser.doc ? parser.doc.getElementsByType('pict') : [];
}
- Roo.log(images);
+ //Roo.log(images);
//Roo.log(imgs);
// fixme..
images = images.filter(function(g) { return !g.path.match(/^rtf\/(head|pgdsctbl|listtable|footerf)/); }) // ignore headers/footers etc.
new Roo.htmleditor.FilterParagraph({ node : d });
new Roo.htmleditor.FilterSpan({ node : d });
new Roo.htmleditor.FilterLongBr({ node : d });
+ new Roo.htmleditor.FilterComment({ node : d });
+
+
}
if (this.enableBlocks) {
Roo.htmleditor.Block.initAll(this.doc.body);
}
+ try {
+ new Roo.htmleditor.FilterFileWarning({ node : d });
+ } catch(e) {
+ Roo.MessageBox.alert("Invalid URLS in content", "The pasted Content contains file:// URLS - you probably want to check all the links in this file");
+ }
e.preventDefault();
return false;