fix named links in documents, fixes #3107

This commit is contained in:
j 2018-03-13 18:09:48 +05:30
parent be315323cb
commit 4e4471f1f6
3 changed files with 16 additions and 7 deletions

View file

@ -23,9 +23,13 @@ pandora.URL = (function() {
if (
state.page == 'document'
&& pandora.user.ui.documents[state.part]
&& pandora.user.ui.documents[state.part].position
&& (
pandora.user.ui.documents[state.part].position ||
pandora.user.ui.documents[state.part].name
)
) {
state.span = pandora.user.ui.documents[state.part].position;
state.span = pandora.user.ui.documents[state.part].position ||
pandora.user.ui.documents[state.part].name;
}
}
@ -107,7 +111,6 @@ pandora.URL = (function() {
state.span = [position];
}
}
}
if (
@ -251,7 +254,11 @@ pandora.URL = (function() {
set[!state.item ? 'collectionView' : 'documentView'] = state.view;
}
if (state.span) {
if (Ox.isNumber(state.pan)) {
set['documents.' + state.item] = {position: state.span};
} else {
set['documents.' + state.item] = {name: state.span};
}
}
if (!state.item && state.find) {
set.findDocuments = state.find;

View file

@ -7,7 +7,7 @@ pandora.ui.textPanel = function(text, $toolbar) {
that = Ox.SplitPanel({
elements: [
{
element: textElement = pandora.ui.textHTML(text)
element: textElement = pandora.$ui.textElement = pandora.ui.textHTML(text)
},
{
element: textEmbed = pandora.ui.textEmbed(textElement),
@ -195,7 +195,7 @@ pandora.ui.textHTML = function(text) {
that.update();
},
})
.bindEvent('pandora_documents.' + text.id.toLowerCase(), function(data) {
.bindEvent('pandora_documents.' + pandora.user.ui.document.toLowerCase(), function(data) {
data.value && data.value.name && scrollToPosition();
})
.bindEvent('pandora_texts.' + text.id.toLowerCase(), function(data) {

View file

@ -1994,7 +1994,9 @@ pandora.getSpan = function(state, val, callback) {
if (Ox.contains(['epub', 'pdf', 'txt'], extension)) {
state.span = Ox.limit(parseInt(val), 1, dimensions);
} else if (Ox.contains(['html'], extension)) {
state.span = Ox.limit(parseInt(val), 0, 100);
//fixme: allow numbers or check names?
//state.span = Ox.limit(parseInt(val), 0, 100);
state.span = val
} else if (Ox.contains(['gif', 'jpg', 'png'], extension)) {
values = val.split(',');
if (values.length == 4) {