@homecode/ui 5.20.6 → 5.20.8
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/esm/src/components/Autocomplete/Autocomplete.js +1 -0
- package/dist/esm/src/components/InputFile/InputFile.js +1 -0
- package/dist/esm/src/components/PromptComposer/usePromptComposerEditor.js +3 -0
- package/dist/esm/src/components/Select/Select.helpers.js +4 -1
- package/dist/esm/src/tiptap/link-highlight/nonInclusiveLink.js +13 -0
- package/dist/esm/types/src/components/Select/Select.types.d.ts +2 -0
- package/dist/esm/types/src/tiptap/link-highlight/index.d.ts +1 -0
- package/dist/esm/types/src/tiptap/link-highlight/linkTyping.test.d.ts +1 -0
- package/dist/esm/types/src/tiptap/link-highlight/nonInclusiveLink.d.ts +7 -0
- package/package.json +2 -1
|
@@ -82,6 +82,7 @@ import '@tiptap/starter-kit';
|
|
|
82
82
|
import '../PromptComposer/PromptComposer.styl.js';
|
|
83
83
|
import '@tiptap/pm/view';
|
|
84
84
|
import 'linkifyjs';
|
|
85
|
+
import '../../tiptap/link-highlight/nonInclusiveLink.js';
|
|
85
86
|
import '../RadioGroup/RadioGroupContext.js';
|
|
86
87
|
import '../RadioButton/RadioButton.styl.js';
|
|
87
88
|
import '../RadioGroup/RadioGroup.styl.js';
|
|
@@ -80,6 +80,7 @@ import '@tiptap/core';
|
|
|
80
80
|
import '@tiptap/pm/state';
|
|
81
81
|
import '@tiptap/pm/view';
|
|
82
82
|
import 'linkifyjs';
|
|
83
|
+
import '../../tiptap/link-highlight/nonInclusiveLink.js';
|
|
83
84
|
import '@tiptap/extension-mention';
|
|
84
85
|
import '../../tiptap/slash-mention/SlashSuggestionList.styl.js';
|
|
85
86
|
import '../RadioGroup/RadioGroupContext.js';
|
|
@@ -4,6 +4,7 @@ import { useEditor } from '@tiptap/react';
|
|
|
4
4
|
import StarterKit from '@tiptap/starter-kit';
|
|
5
5
|
import S from './PromptComposer.styl.js';
|
|
6
6
|
import { createLinkHighlightExtension } from '../../tiptap/link-highlight/createLinkHighlightExtension.js';
|
|
7
|
+
import { NonInclusiveLink } from '../../tiptap/link-highlight/nonInclusiveLink.js';
|
|
7
8
|
import { DEFAULT_CHAT_SLASH_ITEMS } from '../../tiptap/slash-mention/defaultChatSlashItems.js';
|
|
8
9
|
import { createSlashMentionExtension } from '../../tiptap/slash-mention/createSlashMentionExtension.js';
|
|
9
10
|
import { safePromptComposerEditorText, promptComposerSafeEditorDom, syncPromptComposerHeight } from './PromptComposer.helpers.js';
|
|
@@ -103,7 +104,9 @@ function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, sla
|
|
|
103
104
|
blockquote: false,
|
|
104
105
|
codeBlock: false,
|
|
105
106
|
horizontalRule: false,
|
|
107
|
+
link: false,
|
|
106
108
|
}),
|
|
109
|
+
NonInclusiveLink,
|
|
107
110
|
Placeholder.configure({
|
|
108
111
|
placeholder: placeholderText,
|
|
109
112
|
showOnlyWhenEditable: true,
|
|
@@ -28,7 +28,10 @@ function normalize(text) {
|
|
|
28
28
|
function matchesSearch(option, query) {
|
|
29
29
|
if (!query)
|
|
30
30
|
return true;
|
|
31
|
-
|
|
31
|
+
const q = normalize(query);
|
|
32
|
+
if (normalize(option.label).includes(q))
|
|
33
|
+
return true;
|
|
34
|
+
return (option.searchText !== undefined && normalize(option.searchText).includes(q));
|
|
32
35
|
}
|
|
33
36
|
function isSelectable(option) {
|
|
34
37
|
return Boolean(option) && !option.isGroupHeader;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Link } from '@tiptap/extension-link';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Link with autolink, but non-inclusive. Stock Link is inclusive whenever
|
|
5
|
+
* autolink is on, so text typed at a link's edge (e.g. before a URL at the
|
|
6
|
+
* start of the line) joins the link. Autolink still re-links the URL itself
|
|
7
|
+
* once a space is typed after it.
|
|
8
|
+
*/
|
|
9
|
+
const NonInclusiveLink = Link.extend({
|
|
10
|
+
inclusive: () => false,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { NonInclusiveLink };
|
|
@@ -9,6 +9,8 @@ export type Option = {
|
|
|
9
9
|
isGroupHeader?: boolean;
|
|
10
10
|
parentId?: Id;
|
|
11
11
|
label: string;
|
|
12
|
+
/** Extra text that search matches besides `label` (e.g. an id or alias). */
|
|
13
|
+
searchText?: string;
|
|
12
14
|
sortingKey?: string | number;
|
|
13
15
|
children?: Option[];
|
|
14
16
|
render?: (label: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link with autolink, but non-inclusive. Stock Link is inclusive whenever
|
|
3
|
+
* autolink is on, so text typed at a link's edge (e.g. before a URL at the
|
|
4
|
+
* start of the line) joins the link. Autolink still re-links the URL itself
|
|
5
|
+
* once a space is typed after it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const NonInclusiveLink: import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homecode/ui",
|
|
3
|
-
"version": "5.20.
|
|
3
|
+
"version": "5.20.8",
|
|
4
4
|
"description": "React UI components library",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"tests": "jest",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@tiptap/core": "^3.30.5",
|
|
63
|
+
"@tiptap/extension-link": "^3.30.5",
|
|
63
64
|
"@tiptap/extension-mention": "^3.30.5",
|
|
64
65
|
"@tiptap/extensions": "^3.30.5",
|
|
65
66
|
"@tiptap/pm": "^3.30.5",
|