mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-01 21:23:10 +00:00
chore(ui): update block editor extension to show correct data (#13591)
Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
45ad6bd05d
commit
8d4c3bb1a4
@ -121,7 +121,7 @@ const BlockEditor = forwardRef<BlockEditorRef, BlockEditorProps>(
|
||||
const target = e.target as HTMLElement;
|
||||
const dataType = target.getAttribute('data-type');
|
||||
|
||||
const hasPopup = !isEmpty(popup);
|
||||
let hasPopup = !isEmpty(popup);
|
||||
|
||||
if (['mention', 'hashtag'].includes(dataType ?? '')) {
|
||||
return;
|
||||
@ -158,6 +158,7 @@ const BlockEditor = forwardRef<BlockEditorRef, BlockEditorProps>(
|
||||
placement: 'top',
|
||||
hideOnClick: true,
|
||||
});
|
||||
hasPopup = !isEmpty(popup);
|
||||
} else {
|
||||
if (hasPopup) {
|
||||
popup[0].hide();
|
||||
|
@ -27,13 +27,13 @@ import HashList from './HashList';
|
||||
export const hashtagSuggestion = () => ({
|
||||
items: async ({ query }: { query: string }) => {
|
||||
if (!query) {
|
||||
const data = await searchData('*', 1, 5, '', '', '', SearchIndex.TABLE);
|
||||
const data = await searchData('', 1, 5, '', '', '', SearchIndex.ALL);
|
||||
const hits = data.data.hits.hits;
|
||||
|
||||
return hits.map((hit) => ({
|
||||
id: hit._id,
|
||||
name: hit._source.name,
|
||||
label: hit._source.displayName,
|
||||
label: hit._source.displayName ?? hit._source.name,
|
||||
fqn: hit._source.fullyQualifiedName,
|
||||
href: buildMentionLink(
|
||||
hit._source.entityType,
|
||||
@ -53,7 +53,7 @@ export const hashtagSuggestion = () => ({
|
||||
return hits.map((hit) => ({
|
||||
id: hit._id,
|
||||
name: hit._source.name,
|
||||
label: hit._source.displayName,
|
||||
label: hit._source.displayName ?? hit._source.name,
|
||||
fqn: hit._source.fullyQualifiedName,
|
||||
href: buildMentionLink(
|
||||
hit._source.entityType,
|
||||
@ -72,7 +72,7 @@ export const hashtagSuggestion = () => ({
|
||||
render: () => {
|
||||
let component: ReactRenderer;
|
||||
let popup: Instance<Props>[] = [];
|
||||
const hasPopup = !isEmpty(popup);
|
||||
let hasPopup = !isEmpty(popup);
|
||||
|
||||
return {
|
||||
onStart: (props: SuggestionProps) => {
|
||||
@ -95,6 +95,7 @@ export const hashtagSuggestion = () => ({
|
||||
trigger: 'manual',
|
||||
placement: 'bottom-start',
|
||||
});
|
||||
hasPopup = !isEmpty(popup);
|
||||
},
|
||||
|
||||
onUpdate(props: SuggestionProps) {
|
||||
|
@ -14,7 +14,6 @@ import { ReactRenderer } from '@tiptap/react';
|
||||
import { SuggestionKeyDownProps, SuggestionProps } from '@tiptap/suggestion';
|
||||
import { isEmpty } from 'lodash';
|
||||
import tippy, { Instance, Props } from 'tippy.js';
|
||||
import { WILD_CARD_CHAR } from '../../../../constants/char.constants';
|
||||
import {
|
||||
EntityUrlMapType,
|
||||
ENTITY_URL_MAP,
|
||||
@ -27,13 +26,13 @@ import MentionList from './MentionList';
|
||||
export const mentionSuggestion = () => ({
|
||||
items: async ({ query }: { query: string }) => {
|
||||
if (!query) {
|
||||
const data = await getSearchedUsers(WILD_CARD_CHAR, 1, 5);
|
||||
const data = await getSearchedUsers('', 1, 5);
|
||||
const hits = data.data.hits.hits;
|
||||
|
||||
return hits.map((hit) => ({
|
||||
id: hit._id,
|
||||
name: hit._source.name,
|
||||
label: hit._source.displayName,
|
||||
label: hit._source.displayName ?? hit._source.name,
|
||||
fqn: hit._source.fullyQualifiedName,
|
||||
href: buildMentionLink(
|
||||
ENTITY_URL_MAP[hit._source.entityType as EntityUrlMapType],
|
||||
@ -48,7 +47,7 @@ export const mentionSuggestion = () => ({
|
||||
return hits.map((hit) => ({
|
||||
id: hit._id,
|
||||
name: hit._source.name,
|
||||
label: hit._source.displayName,
|
||||
label: hit._source.displayName ?? hit._source.name,
|
||||
fqn: hit._source.fullyQualifiedName,
|
||||
href: buildMentionLink(
|
||||
ENTITY_URL_MAP[hit._source.entityType as EntityUrlMapType],
|
||||
@ -62,7 +61,7 @@ export const mentionSuggestion = () => ({
|
||||
render: () => {
|
||||
let component: ReactRenderer;
|
||||
let popup: Instance<Props>[] = [];
|
||||
const hasPopup = !isEmpty(popup);
|
||||
let hasPopup = !isEmpty(popup);
|
||||
|
||||
return {
|
||||
onStart: (props: SuggestionProps) => {
|
||||
@ -85,6 +84,7 @@ export const mentionSuggestion = () => ({
|
||||
trigger: 'manual',
|
||||
placement: 'bottom-start',
|
||||
});
|
||||
hasPopup = !isEmpty(popup);
|
||||
},
|
||||
|
||||
onUpdate(props: SuggestionProps) {
|
||||
|
@ -20,7 +20,7 @@ const renderItems = () => {
|
||||
let component: ReactRenderer;
|
||||
let popup: Instance<Props>[] = [];
|
||||
let suggestionProps: SuggestionProps;
|
||||
const hasPopup = !isEmpty(popup);
|
||||
let hasPopup = !isEmpty(popup);
|
||||
|
||||
return {
|
||||
onStart: (props: SuggestionProps) => {
|
||||
@ -44,6 +44,7 @@ const renderItems = () => {
|
||||
trigger: 'manual',
|
||||
placement: 'bottom-start',
|
||||
});
|
||||
hasPopup = !isEmpty(popup);
|
||||
},
|
||||
onUpdate: (props: SuggestionProps) => {
|
||||
suggestionProps = props;
|
||||
|
Loading…
x
Reference in New Issue
Block a user