Clicking an external link or a file link in the note tree now opens with target=_new.
This commit is contained in:
parent
3499aa3624
commit
0d4bb81943
|
@ -489,12 +489,12 @@ class Notebooks( object ):
|
||||||
|
|
||||||
# if it has a link target, it's a link to an external web site
|
# if it has a link target, it's a link to an external web site
|
||||||
if target:
|
if target:
|
||||||
items.append( Note_tree_area.make_item( title, attributes, "note_tree_external_link" ) )
|
items.append( Note_tree_area.make_item( title, attributes, u"note_tree_external_link", target = u"_new" ) )
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# if it has '/files/' in its path, it's an uploaded file link
|
# if it has '/files/' in its path, it's an uploaded file link
|
||||||
if self.FILE_PATTERN.search( href ):
|
if self.FILE_PATTERN.search( href ):
|
||||||
items.append( Note_tree_area.make_item( title, attributes, "note_tree_file_link" ) )
|
items.append( Note_tree_area.make_item( title, attributes, u"note_tree_file_link", target = u"_new" ) )
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# if it has a note_id, load that child note and see whether it has any children of its own
|
# if it has a note_id, load that child note and see whether it has any children of its own
|
||||||
|
@ -504,11 +504,11 @@ class Notebooks( object ):
|
||||||
child_note_id = child_note_ids[ 0 ]
|
child_note_id = child_note_ids[ 0 ]
|
||||||
child_note = self.__database.load( Note, child_note_id )
|
child_note = self.__database.load( Note, child_note_id )
|
||||||
if child_note and self.LINK_PATTERN.search( child_note.contents ):
|
if child_note and self.LINK_PATTERN.search( child_note.contents ):
|
||||||
items.append( Note_tree_area.make_item( title, attributes, "note_tree_link", has_children = True ) )
|
items.append( Note_tree_area.make_item( title, attributes, u"note_tree_link", has_children = True ) )
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# otherwise, it's childless
|
# otherwise, it's childless
|
||||||
items.append( Note_tree_area.make_item( title, attributes, "note_tree_link", has_children = False ) )
|
items.append( Note_tree_area.make_item( title, attributes, u"note_tree_link", has_children = False ) )
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
tree_html = unicode( Note_tree_area.make_tree( items ) ),
|
tree_html = unicode( Note_tree_area.make_tree( items ) ),
|
||||||
|
|
|
@ -2690,6 +2690,8 @@ Note_tree.prototype.expand_link = function ( event, note_id ) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: add onclick handler for each link that's to a note
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,15 +35,16 @@ class Note_tree_area( Div ):
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def make_item( title, link_attributes, link_class, has_children = False, root_note_id = None ):
|
def make_item( title, link_attributes, link_class, has_children = False, root_note_id = None, target = None ):
|
||||||
return Tr(
|
return Tr(
|
||||||
has_children and \
|
has_children and \
|
||||||
Td( id = root_note_id and u"note_tree_expander_" + root_note_id or None, class_ = u"tree_expander" ) or
|
Td( id = root_note_id and u"note_tree_expander_" + root_note_id or None, class_ = u"tree_expander" ) or
|
||||||
Td( id = root_note_id and u"note_tree_expander_" + root_note_id or None, class_ = u"tree_expander_empty" ),
|
Td( id = root_note_id and u"note_tree_expander_" + root_note_id or None, class_ = u"tree_expander_empty" ),
|
||||||
Td(
|
Td(
|
||||||
u"<a %s%s class=%s>%s</a>" % (
|
u"<a %s%s%s class=%s>%s</a>" % (
|
||||||
link_attributes,
|
link_attributes,
|
||||||
root_note_id and u" id=note_tree_link_" + root_note_id or None,
|
root_note_id and u' id="note_tree_link_%s"' % root_note_id or "",
|
||||||
|
target and u' target="%s"' % target or "",
|
||||||
link_class,
|
link_class,
|
||||||
title or u"untitled note",
|
title or u"untitled note",
|
||||||
),
|
),
|
||||||
|
|
Reference in New Issue