[DE] Refactoring hyperlinks to headings.

This commit is contained in:
Julia Radzhabova 2018-03-30 15:43:48 +03:00
parent c23422465e
commit 469d3c1db1

View file

@ -216,7 +216,9 @@ define([
name : anchor.asc_GetHeadingText(), name : anchor.asc_GetHeadingText(),
level: level, level: level,
index: i+2, index: i+2,
hasParent: hasParent hasParent: hasParent,
type: Asc.c_oAscHyperlinkAnchor.Heading,
headingParagraph: anchor.asc_GetHeadingParagraph()
})); }));
prev_level = level; prev_level = level;
} }
@ -242,7 +244,8 @@ define([
name : anchor.asc_GetBookmarkName(), name : anchor.asc_GetBookmarkName(),
level: 1, level: 1,
index: arr.length, index: arr.length,
hasParent: false hasParent: false,
type: Asc.c_oAscHyperlinkAnchor.Bookmark
})); }));
prev_level = 1; prev_level = 1;
} }
@ -294,8 +297,13 @@ define([
} else { } else {
if (props.is_TopOfDocument()) if (props.is_TopOfDocument())
this.internalList.selectByIndex(0); this.internalList.selectByIndex(0);
else { else if (props.is_Heading()) {
var rec = this.internalList.store.findWhere({name: bookmark}); var heading = props.get_Heading(),
rec = this.internalList.store.findWhere({type: Asc.c_oAscHyperlinkAnchor.Heading, headingParagraph: heading });
if (rec)
this.internalList.scrollToRecord(this.internalList.selectRecord(rec));
} else {
var rec = this.internalList.store.findWhere({type: Asc.c_oAscHyperlinkAnchor.Bookmark, name: bookmark});
if (rec) if (rec)
this.internalList.scrollToRecord(this.internalList.selectRecord(rec)); this.internalList.scrollToRecord(this.internalList.selectRecord(rec));
} }
@ -337,6 +345,9 @@ define([
props.put_Bookmark(rec[0].get('name')); props.put_Bookmark(rec[0].get('name'));
if (rec[0].get('index')==0) if (rec[0].get('index')==0)
props.put_TopOfDocument(); props.put_TopOfDocument();
var para = rec[0].get('headingParagraph');
if (para)
props.put_Heading(para);
display = rec[0].get('name'); display = rec[0].get('name');
} }
} }