dce-reactkit 3.5.13 → 3.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/makeLinksClickable.d.ts +4 -2
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/makeLinksClickable.d.ts +4 -2
- package/dist/index.d.ts +4 -2
- package/package.json +1 -1
- package/src/helpers/makeLinksClickable.tsx +6 -4
|
@@ -5,12 +5,14 @@ import React from 'react';
|
|
|
5
5
|
* @param text the text to process
|
|
6
6
|
* @param [opts] options to customize behavior
|
|
7
7
|
* @param [opts.newTab] if true, links will open in a new tab
|
|
8
|
-
* @param [opts.preventPropagation] if true, clicks to link will prevent
|
|
9
|
-
*
|
|
8
|
+
* @param [opts.preventPropagation] if true, clicks to link will prevent
|
|
9
|
+
* propagation
|
|
10
|
+
* @param [opts.inheritColor] if true, inherit text color for links
|
|
10
11
|
* @returns the processed text
|
|
11
12
|
*/
|
|
12
13
|
declare const makeLinksClickable: (text: string, opts?: {
|
|
13
14
|
newTab?: boolean;
|
|
14
15
|
preventPropagation?: boolean;
|
|
16
|
+
inheritColor?: boolean;
|
|
15
17
|
}) => React.ReactNode;
|
|
16
18
|
export default makeLinksClickable;
|
package/dist/esm/index.js
CHANGED
|
@@ -42916,8 +42916,9 @@ const urlRegex = /(https?:\/\/)?([a-z0-9-]+\.)+[a-z0-9]{2,6}(:[0-9]{1,5})?(\/\S*
|
|
|
42916
42916
|
* @param text the text to process
|
|
42917
42917
|
* @param [opts] options to customize behavior
|
|
42918
42918
|
* @param [opts.newTab] if true, links will open in a new tab
|
|
42919
|
-
* @param [opts.preventPropagation] if true, clicks to link will prevent
|
|
42920
|
-
*
|
|
42919
|
+
* @param [opts.preventPropagation] if true, clicks to link will prevent
|
|
42920
|
+
* propagation
|
|
42921
|
+
* @param [opts.inheritColor] if true, inherit text color for links
|
|
42921
42922
|
* @returns the processed text
|
|
42922
42923
|
*/
|
|
42923
42924
|
const makeLinksClickable = (text, opts) => {
|
|
@@ -42944,10 +42945,10 @@ const makeLinksClickable = (text, opts) => {
|
|
|
42944
42945
|
// Add the link
|
|
42945
42946
|
elements.push(React__default.createElement("a", { key: nextKey += 1, href: link, target: newTab ? '_blank' : undefined, rel: newTab ? 'noopener noreferrer' : undefined, style: {
|
|
42946
42947
|
textDecoration: 'underline',
|
|
42948
|
+
color: (opts === null || opts === void 0 ? void 0 : opts.inheritColor) ? 'inherit' : undefined,
|
|
42947
42949
|
}, onClick: (e) => {
|
|
42948
|
-
// Prevent
|
|
42950
|
+
// Prevent propagation if requested
|
|
42949
42951
|
if (opts === null || opts === void 0 ? void 0 : opts.preventPropagation) {
|
|
42950
|
-
e.preventDefault();
|
|
42951
42952
|
e.stopPropagation();
|
|
42952
42953
|
}
|
|
42953
42954
|
} }, link));
|