From 0bb4633b141290b3f8e154a9b86317f6758ff80e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 27 Mar 2012 06:18:07 +0900 Subject: [PATCH] filter html editor html --- aqt/editor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aqt/editor.py b/aqt/editor.py index de979250d..8bc83fa49 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -515,8 +515,11 @@ class Editor(object): form.textEdit.setPlainText(self.note.fields[self.currentField]) form.textEdit.moveCursor(QTextCursor.End) d.exec_() - self.note.fields[self.currentField] = unicode( - form.textEdit.toPlainText()) + html = form.textEdit.toPlainText() + # filter html through beautifulsoup so we can strip out things like a + # leading + html = unicode(BeautifulSoup(html)) + self.note.fields[self.currentField] = html self.loadNote() # Tag & deck handling