From 8a71c6f17d0f54db630f2e3a79bec7fecc8c266d Mon Sep 17 00:00:00 2001
From: Matthew Kilgore <tankerkiller125@gmail.com>
Date: Sun, 1 Mar 2020 09:52:30 -0500
Subject: [PATCH] Hide mentions in inline spoilers

Fixes #2033
---
 extensions/markdown/extend.php      |  4 +++-
 extensions/markdown/less/forum.less | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 extensions/markdown/less/forum.less

diff --git a/extensions/markdown/extend.php b/extensions/markdown/extend.php
index bf29dc91e..f9de9d290 100644
--- a/extensions/markdown/extend.php
+++ b/extensions/markdown/extend.php
@@ -12,10 +12,12 @@ use s9e\TextFormatter\Configurator;
 
 return [
     (new Extend\Frontend('forum'))
-        ->js(__DIR__.'/js/dist/forum.js'),
+        ->js(__DIR__.'/js/dist/forum.js')
+        ->css(__DIR__.'/less/forum.less'),
 
     (new Extend\Formatter)
         ->configure(function (Configurator $config) {
             $config->Litedown;
+            $config->tags['ispoiler']->template = '<span class="spoiler" data-s9e-livepreview-ignore-attrs="style" onclick="removeAttribute(\'style\'); removeAttribute(\'class\')" style="background:#444;color:transparent"><xsl:apply-templates/></span>';
         })
 ];
diff --git a/extensions/markdown/less/forum.less b/extensions/markdown/less/forum.less
new file mode 100644
index 000000000..4467dbb35
--- /dev/null
+++ b/extensions/markdown/less/forum.less
@@ -0,0 +1,14 @@
+/*
+ * This file is part of Flarum.
+ *
+ * For detailed copyright and license information, please view the
+ * LICENSE file that was distributed with this source code.
+ */
+
+.PostMention, .UserMention {
+  .spoiler & {
+    background: #444;
+    color: transparent;
+    padding: 0;
+  }
+}