From 8e96915a27f017eaac5f6f1a0c2e9e9bbb786716 Mon Sep 17 00:00:00 2001 From: Oliver Wales Date: Tue, 31 Jan 2023 17:16:45 +0000 Subject: [PATCH] Reduce WETness --- examples/src/EditableVoidsApp.tsx | 17 ++++++++++------- .../src/placeholder/withStyledPlaceHolders.ts | 8 ++++++-- packages/core/src/utils/misc/isUrl.ts | 3 +++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/examples/src/EditableVoidsApp.tsx b/examples/src/EditableVoidsApp.tsx index 66ff9177e8..26bd229f85 100644 --- a/examples/src/EditableVoidsApp.tsx +++ b/examples/src/EditableVoidsApp.tsx @@ -20,10 +20,13 @@ const plugins = createMyPlugins( } ); -export default () => ( - - editableProps={editableProps} - plugins={plugins} - initialValue={editableVoidsValue} - /> -); +export default () => { + console.log({ handlers: plugins.map((p) => p.handlers) }); + return ( + + editableProps={editableProps} + plugins={plugins} + initialValue={editableVoidsValue} + /> + ); +}; diff --git a/examples/src/placeholder/withStyledPlaceHolders.ts b/examples/src/placeholder/withStyledPlaceHolders.ts index a61fe65b9a..5eacee6e73 100644 --- a/examples/src/placeholder/withStyledPlaceHolders.ts +++ b/examples/src/placeholder/withStyledPlaceHolders.ts @@ -1,4 +1,8 @@ -import { ELEMENT_H1, ELEMENT_PARAGRAPH, withPlaceholders } from '@udecode/plate' +import { + ELEMENT_H1, + ELEMENT_PARAGRAPH, + withPlaceholders, +} from '@udecode/plate'; export const withStyledPlaceHolders = (components: any) => withPlaceholders(components, [ @@ -12,4 +16,4 @@ export const withStyledPlaceHolders = (components: any) => placeholder: 'Untitled', hideOnBlur: false, }, - ]) + ]); diff --git a/packages/core/src/utils/misc/isUrl.ts b/packages/core/src/utils/misc/isUrl.ts index f8f65d5011..9b466b95c7 100644 --- a/packages/core/src/utils/misc/isUrl.ts +++ b/packages/core/src/utils/misc/isUrl.ts @@ -13,6 +13,7 @@ const nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/; * Loosely validate a URL `string`. */ export const isUrl = (string: any) => { + console.log('here'); if (typeof string !== 'string') { return false; } @@ -33,6 +34,8 @@ export const isUrl = (string: any) => { return false; } + console.log('here 2'); + return ( localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol)