Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat(Share): Copy share link with title

haitao(lj)7d52f6b6e757
diff --git a/ui/src/components/Share/index.tsx b/ui/src/components/Share/index.tsx
index 6b644a60..855b02cb 100644
--- a/ui/src/components/Share/index.tsx
+++ b/ui/src/components/Share/index.tsx
@@ -22,7 +22,6 @@ const Index: FC<IProps> = ({ type, qid, aid, title, slugTitle = '' }) => {
const [showTip, setShowTip] = useState(false);
const [canSystemShare, setSystemShareState] = useState(false);
const { t } = useTranslation();
- // FIXME: pathFactory
let baseUrl =
type === 'question'
? `${window.location.origin}${pathFactory.questionLanding(
@@ -46,7 +45,11 @@ const Index: FC<IProps> = ({ type, qid, aid, title, slugTitle = '' }) => {
const handleCopy = (evt) => {
evt.preventDefault();
evt.stopPropagation();
- copy(baseUrl);
+ let copyText = baseUrl;
+ if (title) {
+ copyText = `${title} ${baseUrl}`;
+ }
+ copy(copyText);
setShowTip(true);
setTimeout(closeShare, 1000);
};