Skip to content

Commit

Permalink
Merge pull request #31 from webbio/fix/NP-234-modal-title-overwrite-c…
Browse files Browse the repository at this point in the history
…onfig-option

v1.4.6
  • Loading branch information
Martijn-Schoenmaker-Webbio authored Jan 30, 2024
2 parents 4ece970 + e5bb6cb commit 8b6b19a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ import { Label } from '../label';

interface IProps extends Omit<IUseInternalLinkInputReturn, 'initialLink' | 'isInitialData' | 'resetInternalLink'> {
attributeOptions?: IInternalLinkAttribute['options'];
shouldShowTitle?: boolean;
}

const InternalLinkForm = ({ link, setLink, errors, setErrors, attributeOptions }: IProps): JSX.Element => {
const InternalLinkForm = ({
link,
setLink,
errors,
setErrors,
attributeOptions,
shouldShowTitle
}: IProps): JSX.Element => {
const { formatMessage } = useIntl();
const { data: pluginConfig, isLoading: isLoadingConfig } = useGetConfig({});
const useSinglePageType = !!pluginConfig?.useSinglePageType || pluginConfig?.pageBuilder?.enabled;
Expand All @@ -46,9 +54,6 @@ const InternalLinkForm = ({ link, setLink, errors, setErrors, attributeOptions }
usePlatformOptions({ page, pageOptionsIsLoading });
const [isExternalTab, setIsExternalTab] = useState<boolean>(link.type === 'external');
const translationLinkKey = !isExternalTab ? 'generated-link' : 'link';
const shouldShowTitle =
!isLoadingConfig &&
(typeof attributeOptions?.noTitle === 'boolean' ? !attributeOptions?.noTitle : !pluginConfig?.defaultNoTitle);

const onToggleCheckbox = (): void => {
setIsExternalTab((prev) => !prev);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const InternalLinkModal = ({
errors={errors}
setErrors={setErrors}
attributeOptions={attribute?.options}
shouldShowTitle={shouldShowTitle}
/>
</Typography>
</ModalBody>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/strapi-plugin-internal-links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webbio/strapi-plugin-internal-links",
"version": "1.4.5",
"version": "1.4.6",
"description": "A custom field for Strapi that can create internal links",
"scripts": {
"develop": "tsc -p tsconfig.server.json -w",
Expand Down

0 comments on commit 8b6b19a

Please sign in to comment.