Skip to content

Commit

Permalink
feat/JL-273-added-option-to-disable-url-regex-check
Browse files Browse the repository at this point in the history
  • Loading branch information
TomWebbio committed Jan 23, 2024
1 parent ca8c1db commit c6c4303
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const InternalLinkForm = ({ link, setLink, errors, setErrors, attributeOptions }
const { formatMessage } = useIntl();
const { data: pluginConfig, isLoading: isLoadingConfig } = useGetConfig({});
const useSinglePageType = !!pluginConfig?.useSinglePageType || pluginConfig?.pageBuilder?.enabled;
const noUrlValidation = pluginConfig?.noUrlValidation;
const pageBuilderEnabled = pluginConfig?.pageBuilder?.enabled;

// More information including tests: https://regexr.com/7p9qh
Expand Down Expand Up @@ -127,6 +128,10 @@ const InternalLinkForm = ({ link, setLink, errors, setErrors, attributeOptions }
const newValue = event.target.value;
const urlSchema = yup.string().required().matches(regexObject);

if (noUrlValidation) {
return;
}

if (newValue) {
try {
await urlSchema.validate(event.target.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface IInternalLinkAttribute {
slug?: string;
'link-regex'?: string;
noTitle?: boolean;
noLinkCheck?: boolean;
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface GlobalPluginConfig {
environment?: string;
useSinglePageType?: string; // Optional option to use a single page type like the page builder (without page builder options) eg. 'api::page.page'
noUrlValidation?: boolean;
defaultNoTitle?: boolean;
enableUrlAddition: boolean;
pageBuilder?: {
Expand Down

0 comments on commit c6c4303

Please sign in to comment.