1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-01 03:40:27 +02:00

V2.3.0 Fix shortcodeBlock so it also processes inline text following the opening block

This commit is contained in:
trendschau
2024-03-10 22:10:18 +01:00
parent 2c057fa115
commit 998a8833aa
2 changed files with 25 additions and 11 deletions

View File

@@ -758,7 +758,7 @@ class ParsedownExtension extends \ParsedownExtra
protected function blockShortcode($Line)
{
if ($this->dispatcher && preg_match('/^\[:.*:\]/', $Line['text'], $matches))
if ($this->dispatcher && preg_match('/^\[:.*?:\]/', $Line['text'], $matches))
{
if(is_array($this->allowedShortcodes) && empty($this->allowedShortcodes))
{
@@ -790,19 +790,29 @@ class ParsedownExtension extends \ParsedownExtra
{
$html = '<p class="shortcode-alert">No shortcode found.</p>';
}
// Handle the inline content after the block shortcode.
$inlineContent = trim(substr($Line['text'], strlen($matches[0])));
$inlineElements = '';
if($inlineContent && $inlineContent != '')
{
# make sure inline-text with more shortcodes are properly parsed after an opening block-element
$inlineElements = $this->line($inlineContent);
}
return array(
'element' => array(
'rawHtml' => $html,
$Block = [
'element' => [
'rawHtml' => $html . $inlineElements,
'allowRawHtmlInSafeMode' => true,
),
],
'extent' => strlen($matches[0]),
);
}
else
{
return;
'complete' => true, // Close the block at the end of the line.
];
return $Block;
}
return;
}
protected function inlineShortcode($Excerpt)
@@ -856,6 +866,7 @@ class ParsedownExtension extends \ParsedownExtra
}
}
protected $allowedShortcodes = false;
public function setAllowedShortcodes(array $shortcodelist)

View File

@@ -115,7 +115,10 @@ const app = Vue.createApp({
self.showModal = false;
self.messageClass = 'bg-teal-500';
self.message = response.data.message;
if(response.data.logout !== undefined)
{
window.location.replace(data.urlinfo.baseurl + '/tm/logout');
}
window.location.replace(data.urlinfo.baseurl + '/tm/users');
})
.catch(function (error)