Working on HTML WYSIWYG editor for notes

svn: r19696
This commit is contained in:
Doug Blank 2012-05-29 14:08:38 +00:00
parent abbb02a08e
commit 9212e21eb6

View File

@ -772,7 +772,7 @@ class StyledNoteFormatter(object):
if not text: if not text:
return '' return ''
s_tags = styledtext.get_tags() s_tags = styledtext.get_tags()
markuptext = self._backend.add_markup_from_styled(text, s_tags, split='\n').replace("\n", "<br/>") markuptext = self._backend.add_markup_from_styled(text, s_tags, split='\n').replace("\n\n", "<p/>").replace("\n", "<br/>")
return markuptext return markuptext
def build_link(self, prop, handle, obj_class): def build_link(self, prop, handle, obj_class):
@ -873,6 +873,9 @@ class WebAppParser(HTMLParser):
elif tag == "p": elif tag == "p":
self.__text += "\n\n" self.__text += "\n\n"
return return
elif tag == "div":
self.__text += "\n\n"
return
elif tag == "a": elif tag == "a":
tagtype = self.LINK tagtype = self.LINK
# "a": get /object/handle, or url # "a": get /object/handle, or url
@ -888,6 +891,8 @@ class WebAppParser(HTMLParser):
else: else:
return return
print "Unhandled tag: '%s'" % tag print "Unhandled tag: '%s'" % tag
if start_pos == len(self.__text): return # does nothing
key = ((tagtype, u''), arg) key = ((tagtype, u''), arg)
if key not in self.__tags: if key not in self.__tags:
self.__tags[key] = [] self.__tags[key] = []