From 53c67676e215af86cffc0359491ae7b8b6f91ad3 Mon Sep 17 00:00:00 2001 From: MiniDigger Date: Sat, 10 Apr 2021 11:21:58 +0200 Subject: [PATCH] bbcode converter preview Signed-off-by: MiniDigger --- frontend/pages/new.vue | 7 +++++-- src/main/java/io/papermc/hangar/utils/BBCodeConverter.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/pages/new.vue b/frontend/pages/new.vue index 21cee4f4b..94225f8ae 100644 --- a/frontend/pages/new.vue +++ b/frontend/pages/new.vue @@ -216,7 +216,6 @@ - @@ -237,7 +236,9 @@ /> - 2 + + + {{ $t('project.new.step4.tutorialInstructions.line1') }}
@@ -277,6 +278,7 @@ import { RootState } from '~/store'; import { ProjectCategory } from '~/types/enums'; import { HangarComponent } from '~/components/mixins'; import { LoggedIn } from '~/utils/perms'; +import Markdown from '~/components/markdown/Markdown.vue'; interface NewProjectForm extends ProjectSettingsForm { ownerId: ProjectOwner['userId']; @@ -286,6 +288,7 @@ interface NewProjectForm extends ProjectSettingsForm { @Component({ components: { + Markdown, StepperStepContent, }, head: { diff --git a/src/main/java/io/papermc/hangar/utils/BBCodeConverter.java b/src/main/java/io/papermc/hangar/utils/BBCodeConverter.java index d2937035c..abaad3cd5 100644 --- a/src/main/java/io/papermc/hangar/utils/BBCodeConverter.java +++ b/src/main/java/io/papermc/hangar/utils/BBCodeConverter.java @@ -37,7 +37,7 @@ public class BBCodeConverter { REPLACERS.put("s", (tag, tagArg, content) -> "~~" + content + "~~"); REPLACERS.put("img", (tag, tagArg, content) -> "![" + content + "](" + content + ")"); REPLACERS.put("url", (tag, tagArg, content) -> { - String url = tagArg; + String url = tagArg == null ? content : tagArg; char firstCharacter = url.length() > 2 ? url.charAt(0) : '-'; if ((firstCharacter == '\'' || firstCharacter == '\"') && url.charAt(url.length() - 1) == firstCharacter) { url = url.substring(1, url.length() - 1);