Browse Source

Updated extensions, better link normalisation

markseu 1 year ago
parent
commit
8f0aded179

+ 5 - 2
system/extensions/edit.js

@@ -901,8 +901,11 @@ yellow.edit = {
     bindActions: function(element) {
         var elements = element.getElementsByTagName("a");
         for (var i=0, l=elements.length; i<l; i++) {
-            if (elements[i].getAttribute("href") && elements[i].getAttribute("href").substring(0, 13)=="#data-action-") {
-                elements[i].setAttribute("data-action", elements[i].getAttribute("href").substring(13));
+            if (elements[i].getAttribute("href") && elements[i].getAttribute("href").indexOf("#data-action-")!=-1) {
+                var position = elements[i].getAttribute("href").indexOf("#data-action-");
+                var action = elements[i].getAttribute("href").substring(position+13);
+                var href = elements[i].getAttribute("href").substring(0, position);
+                if (href=="" || href==yellow.page.base+yellow.page.location) elements[i].setAttribute("data-action", action);
             }
             if (elements[i].getAttribute("data-action")) elements[i].onclick = yellow.onClickAction;
             if (elements[i].getAttribute("data-action")=="toolbar") elements[i].onmousedown = function(e) { e.preventDefault(); };

+ 1 - 1
system/extensions/edit.php

@@ -2,7 +2,7 @@
 // Edit extension, https://github.com/annaesvensson/yellow-edit
 
 class YellowEdit {
-    const VERSION = "0.8.75";
+    const VERSION = "0.8.76";
     public $yellow;         // access to API
     public $response;       // web response
     public $merge;          // text merge

+ 2 - 2
system/extensions/markdown.php

@@ -2,7 +2,7 @@
 // Markdown extension, https://github.com/annaesvensson/yellow-markdown
 
 class YellowMarkdown {
-    const VERSION = "0.8.25";
+    const VERSION = "0.8.26";
     public $yellow;         // access to API
     
     // Handle initialisation
@@ -3844,7 +3844,7 @@ class YellowMarkdownParser extends MarkdownExtraParser {
         $this->idAttributes = array();
         $this->noticeLevel = 0;
         $this->url_filter_func = function($url) use ($yellow, $page) {
-            return $yellow->lookup->normaliseLocation($url, $page->location);
+            return $yellow->lookup->normaliseLocation($url, $page->getPage("main")->location);
         };
         $this->span_gamut += array("doStrikethrough" => 55);
         $this->block_gamut += array("doNoticeBlocks" => 65);

+ 4 - 4
system/extensions/update-current.ini

@@ -17,11 +17,11 @@ system/layouts/navigation.html: navigation.html, create, update, careful
 system/layouts/pagination.html: pagination.html, create, update, careful
 
 Extension: Edit
-Version: 0.8.75
+Version: 0.8.76
 Description: Edit your website in a web browser.
 DocumentationUrl: https://github.com/annaesvensson/yellow-edit
 DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/edit.zip
-Published: 2023-05-19 00:50:31
+Published: 2023-09-18 20:10:06
 Developer: Anna Svensson
 Tag: feature
 system/extensions/edit.php: edit.php, create, update
@@ -76,11 +76,11 @@ media/downloads/yellow.pdf: yellow.pdf, create
 ./robots.txt: robots.txt, create
 
 Extension: Markdown
-Version: 0.8.25
+Version: 0.8.26
 Description: Text formatting for humans.
 DocumentationUrl: https://github.com/annaesvensson/yellow-markdown
 DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/markdown.zip
-Published: 2023-09-12 11:14:17
+Published: 2023-09-18 20:49:33
 Developer: Anna Svensson
 Tag: feature
 system/extensions/markdown.php: markdown.php, create, update