Choose existing page for page links only

Present new page chooser when editing any other link type.
pull/2661/merge
riceyrice 2016-06-01 14:47:59 +01:00 zatwierdzone przez Matt Westcott
rodzic bfa255537f
commit 05d9fceaa7
3 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -11,6 +11,8 @@ Changelog
1.5.1 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~~~
* Fix: When editing a document link in rich text, the document ID is no longer erroneously interpreted as a page ID (Stephen Rice)
1.5 (31.05.2016)
~~~~~~~~~~~~~~~~

Wyświetl plik

@ -14,3 +14,4 @@ What's new
Bug fixes
~~~~~~~~~
* When editing a document link in rich text, the document ID is no longer erroneously interpreted as a page ID (Stephen Rice)

Wyświetl plik

@ -31,7 +31,7 @@
}
});
addButton.on('click', function() {
var enclosingLink, lastSelection, url, urlParams, href, pageId;
var enclosingLink, lastSelection, url, urlParams, href, pageId, linkType;
// Defaults.
url = window.chooserUrls.pageChooser;
@ -46,17 +46,18 @@
if (enclosingLink) {
href = enclosingLink.getAttribute('href');
pageId = enclosingLink.getAttribute('data-id');
linkType = enclosingLink.getAttribute('data-linktype');
urlParams['link_text'] = enclosingLink.innerText;
if (pageId) {
if (linkType == 'page' && pageId) {
// TODO: Actually show the parent not the page itself.
url = window.chooserUrls.pageChooser + pageId.toString() + '/';
} else if (href.startsWith('mailto:')) {
url = window.chooserUrls.emailLinkChooser;
href = href.replace('mailto:', '');
urlParams['link_url'] = href;
} else {
} else if (linkType == '') {
url = window.chooserUrls.externalLinkChooser;
urlParams['link_url'] = href;
}