Support for embedding links and references in text editor (#9003)

Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
Victor Ilyushchenko
2025-05-21 11:45:08 +07:00
committed by GitHub
parent e201abcc91
commit 007b11c9df
39 changed files with 1554 additions and 77 deletions
+33
View File
@@ -33,6 +33,7 @@ import {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import type { EditorKitOptions } from '@hcengineering/text-editor-resources/src/kits/editor-kit'
import textEditor from './plugin'
import view from '@hcengineering/view'
export { textEditorOperation } from './migration'
export { default } from './plugin'
@@ -462,4 +463,36 @@ export function createModel (builder: Builder): void {
category: 110,
index: 10
})
builder.createDoc(textEditor.class.TextEditorAction, core.space.Model, {
kind: 'preview',
action: textEditor.function.CopyPreviewLinkAction,
icon: view.icon.Copy,
visibilityTester: textEditor.function.ShouldShowCopyPreviewLinkAction,
label: view.string.CopyToClipboard,
category: 115,
index: 10
})
builder.createDoc(textEditor.class.TextEditorAction, core.space.Model, {
kind: 'preview',
action: textEditor.function.ConvertToLinkPreviewAction,
icon: textEditor.icon.LinkPreview,
visibilityTester: textEditor.function.ShouldShowConvertToLinkPreviewAction,
isActive: textEditor.function.ConvertToLinkPreviewActionIsActive,
label: textEditor.string.ConvertToLinkPreview,
category: 120,
index: 10
})
builder.createDoc(textEditor.class.TextEditorAction, core.space.Model, {
kind: 'preview',
action: textEditor.function.ConvertToEmbedPreviewAction,
icon: textEditor.icon.EmbedPreview,
visibilityTester: textEditor.function.ShouldShowConvertToEmbedPreviewAction,
isActive: textEditor.function.ConvertToEmbedPreviewActionIsActive,
label: textEditor.string.ConvertToEmbedPreview,
category: 120,
index: 20
})
}
+13
View File
@@ -16,6 +16,7 @@
import { mergeIds, type Resource } from '@hcengineering/platform'
import textEditor, {
type TextActionActiveFunction,
type TextActionFunction,
type TextActionVisibleFunction,
textEditorId
@@ -40,8 +41,20 @@ export default mergeIds(textEditorId, textEditor, {
IsHeadingVisible: '' as Resource<TextActionVisibleFunction>,
CreateInlineComment: '' as Resource<TextActionFunction>,
ShouldShowCreateInlineCommentAction: '' as Resource<TextActionVisibleFunction>,
ShouldShowConvertToLinkPreviewAction: '' as Resource<TextActionVisibleFunction>,
ConvertToLinkPreviewActionIsActive: '' as Resource<TextActionActiveFunction>,
ConvertToLinkPreviewAction: '' as Resource<TextActionFunction>,
ShouldShowConvertToEmbedPreviewAction: '' as Resource<TextActionVisibleFunction>,
ConvertToEmbedPreviewActionIsActive: '' as Resource<TextActionActiveFunction>,
ConvertToEmbedPreviewAction: '' as Resource<TextActionFunction>,
ShouldShowCopyPreviewLinkAction: '' as Resource<TextActionVisibleFunction>,
CopyPreviewLinkAction: '' as Resource<TextActionFunction>,
SetBackgroundColor: '' as Resource<TextActionFunction>,
SetTextColor: '' as Resource<TextActionFunction>
}