mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-02 05:33:49 +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 target = e.target as HTMLElement;
|
||||||
const dataType = target.getAttribute('data-type');
|
const dataType = target.getAttribute('data-type');
|
||||||
|
|
||||||
const hasPopup = !isEmpty(popup);
|
let hasPopup = !isEmpty(popup);
|
||||||
|
|
||||||
if (['mention', 'hashtag'].includes(dataType ?? '')) {
|
if (['mention', 'hashtag'].includes(dataType ?? '')) {
|
||||||
return;
|
return;
|
||||||
@ -158,6 +158,7 @@ const BlockEditor = forwardRef<BlockEditorRef, BlockEditorProps>(
|
|||||||
placement: 'top',
|
placement: 'top',
|
||||||
hideOnClick: true,
|
hideOnClick: true,
|
||||||
});
|
});
|
||||||
|
hasPopup = !isEmpty(popup);
|
||||||
} else {
|
} else {
|
||||||
if (hasPopup) {
|
if (hasPopup) {
|
||||||
popup[0].hide();
|
popup[0].hide();
|
||||||
|
@ -27,13 +27,13 @@ import HashList from './HashList';
|
|||||||
export const hashtagSuggestion = () => ({
|
export const hashtagSuggestion = () => ({
|
||||||
items: async ({ query }: { query: string }) => {
|
items: async ({ query }: { query: string }) => {
|
||||||
if (!query) {
|
if (!query) {
|
||||||
const data = await searchData('*', 1, 5, '', '', '', SearchIndex.TABLE);
|
const data = await searchData('', 1, 5, '', '', '', SearchIndex.ALL);
|
||||||
const hits = data.data.hits.hits;
|
const hits = data.data.hits.hits;
|
||||||
|
|
||||||
return hits.map((hit) => ({
|
return hits.map((hit) => ({
|
||||||
id: hit._id,
|
id: hit._id,
|
||||||
name: hit._source.name,
|
name: hit._source.name,
|
||||||
label: hit._source.displayName,
|
label: hit._source.displayName ?? hit._source.name,
|
||||||
fqn: hit._source.fullyQualifiedName,
|
fqn: hit._source.fullyQualifiedName,
|
||||||
href: buildMentionLink(
|
href: buildMentionLink(
|
||||||
hit._source.entityType,
|
hit._source.entityType,
|
||||||
@ -53,7 +53,7 @@ export const hashtagSuggestion = () => ({
|
|||||||
return hits.map((hit) => ({
|
return hits.map((hit) => ({
|
||||||
id: hit._id,
|
id: hit._id,
|
||||||
name: hit._source.name,
|
name: hit._source.name,
|
||||||
label: hit._source.displayName,
|
label: hit._source.displayName ?? hit._source.name,
|
||||||
fqn: hit._source.fullyQualifiedName,
|
fqn: hit._source.fullyQualifiedName,
|
||||||
href: buildMentionLink(
|
href: buildMentionLink(
|
||||||
hit._source.entityType,
|
hit._source.entityType,
|
||||||
@ -72,7 +72,7 @@ export const hashtagSuggestion = () => ({
|
|||||||
render: () => {
|
render: () => {
|
||||||
let component: ReactRenderer;
|
let component: ReactRenderer;
|
||||||
let popup: Instance<Props>[] = [];
|
let popup: Instance<Props>[] = [];
|
||||||
const hasPopup = !isEmpty(popup);
|
let hasPopup = !isEmpty(popup);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onStart: (props: SuggestionProps) => {
|
onStart: (props: SuggestionProps) => {
|
||||||
@ -95,6 +95,7 @@ export const hashtagSuggestion = () => ({
|
|||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
placement: 'bottom-start',
|
placement: 'bottom-start',
|
||||||
});
|
});
|
||||||
|
hasPopup = !isEmpty(popup);
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpdate(props: SuggestionProps) {
|
onUpdate(props: SuggestionProps) {
|
||||||
|
@ -14,7 +14,6 @@ import { ReactRenderer } from '@tiptap/react';
|
|||||||
import { SuggestionKeyDownProps, SuggestionProps } from '@tiptap/suggestion';
|
import { SuggestionKeyDownProps, SuggestionProps } from '@tiptap/suggestion';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import tippy, { Instance, Props } from 'tippy.js';
|
import tippy, { Instance, Props } from 'tippy.js';
|
||||||
import { WILD_CARD_CHAR } from '../../../../constants/char.constants';
|
|
||||||
import {
|
import {
|
||||||
EntityUrlMapType,
|
EntityUrlMapType,
|
||||||
ENTITY_URL_MAP,
|
ENTITY_URL_MAP,
|
||||||
@ -27,13 +26,13 @@ import MentionList from './MentionList';
|
|||||||
export const mentionSuggestion = () => ({
|
export const mentionSuggestion = () => ({
|
||||||
items: async ({ query }: { query: string }) => {
|
items: async ({ query }: { query: string }) => {
|
||||||
if (!query) {
|
if (!query) {
|
||||||
const data = await getSearchedUsers(WILD_CARD_CHAR, 1, 5);
|
const data = await getSearchedUsers('', 1, 5);
|
||||||
const hits = data.data.hits.hits;
|
const hits = data.data.hits.hits;
|
||||||
|
|
||||||
return hits.map((hit) => ({
|
return hits.map((hit) => ({
|
||||||
id: hit._id,
|
id: hit._id,
|
||||||
name: hit._source.name,
|
name: hit._source.name,
|
||||||
label: hit._source.displayName,
|
label: hit._source.displayName ?? hit._source.name,
|
||||||
fqn: hit._source.fullyQualifiedName,
|
fqn: hit._source.fullyQualifiedName,
|
||||||
href: buildMentionLink(
|
href: buildMentionLink(
|
||||||
ENTITY_URL_MAP[hit._source.entityType as EntityUrlMapType],
|
ENTITY_URL_MAP[hit._source.entityType as EntityUrlMapType],
|
||||||
@ -48,7 +47,7 @@ export const mentionSuggestion = () => ({
|
|||||||
return hits.map((hit) => ({
|
return hits.map((hit) => ({
|
||||||
id: hit._id,
|
id: hit._id,
|
||||||
name: hit._source.name,
|
name: hit._source.name,
|
||||||
label: hit._source.displayName,
|
label: hit._source.displayName ?? hit._source.name,
|
||||||
fqn: hit._source.fullyQualifiedName,
|
fqn: hit._source.fullyQualifiedName,
|
||||||
href: buildMentionLink(
|
href: buildMentionLink(
|
||||||
ENTITY_URL_MAP[hit._source.entityType as EntityUrlMapType],
|
ENTITY_URL_MAP[hit._source.entityType as EntityUrlMapType],
|
||||||
@ -62,7 +61,7 @@ export const mentionSuggestion = () => ({
|
|||||||
render: () => {
|
render: () => {
|
||||||
let component: ReactRenderer;
|
let component: ReactRenderer;
|
||||||
let popup: Instance<Props>[] = [];
|
let popup: Instance<Props>[] = [];
|
||||||
const hasPopup = !isEmpty(popup);
|
let hasPopup = !isEmpty(popup);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onStart: (props: SuggestionProps) => {
|
onStart: (props: SuggestionProps) => {
|
||||||
@ -85,6 +84,7 @@ export const mentionSuggestion = () => ({
|
|||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
placement: 'bottom-start',
|
placement: 'bottom-start',
|
||||||
});
|
});
|
||||||
|
hasPopup = !isEmpty(popup);
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpdate(props: SuggestionProps) {
|
onUpdate(props: SuggestionProps) {
|
||||||
|
@ -20,7 +20,7 @@ const renderItems = () => {
|
|||||||
let component: ReactRenderer;
|
let component: ReactRenderer;
|
||||||
let popup: Instance<Props>[] = [];
|
let popup: Instance<Props>[] = [];
|
||||||
let suggestionProps: SuggestionProps;
|
let suggestionProps: SuggestionProps;
|
||||||
const hasPopup = !isEmpty(popup);
|
let hasPopup = !isEmpty(popup);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onStart: (props: SuggestionProps) => {
|
onStart: (props: SuggestionProps) => {
|
||||||
@ -44,6 +44,7 @@ const renderItems = () => {
|
|||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
placement: 'bottom-start',
|
placement: 'bottom-start',
|
||||||
});
|
});
|
||||||
|
hasPopup = !isEmpty(popup);
|
||||||
},
|
},
|
||||||
onUpdate: (props: SuggestionProps) => {
|
onUpdate: (props: SuggestionProps) => {
|
||||||
suggestionProps = props;
|
suggestionProps = props;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user