mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
UBERF-7675: Remove heading text action from compact editors (#6143)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
1329fb1d7a
commit
68d401a100
@ -30,6 +30,7 @@ export default mergeIds(textEditorId, textEditor, {
|
||||
MoreImageActions: '' as Resource<TextActionFunction>,
|
||||
|
||||
IsEditableTableActive: '' as Resource<TextActionVisibleFunction>,
|
||||
IsEditable: '' as Resource<TextActionVisibleFunction>
|
||||
IsEditable: '' as Resource<TextActionVisibleFunction>,
|
||||
IsHeadingVisible: '' as Resource<TextActionVisibleFunction>
|
||||
}
|
||||
})
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import { type Resources } from '@hcengineering/platform'
|
||||
import { formatLink } from './kits/default-kit'
|
||||
import { isEditable } from './kits/editor-kit'
|
||||
import { isEditable, isHeadingVisible } from './kits/editor-kit'
|
||||
import { openTableOptions, isEditableTableActive } from './components/extension/table/table'
|
||||
import { openImage, expandImage, moreImageActions } from './components/extension/imageExt'
|
||||
|
||||
@ -87,6 +87,7 @@ export default async (): Promise<Resources> => ({
|
||||
ExpandImage: expandImage,
|
||||
MoreImageActions: moreImageActions,
|
||||
IsEditableTableActive: isEditableTableActive,
|
||||
IsEditable: isEditable
|
||||
IsEditable: isEditable,
|
||||
IsHeadingVisible: isHeadingVisible
|
||||
}
|
||||
})
|
||||
|
@ -21,7 +21,7 @@ import TableHeader from '@tiptap/extension-table-header'
|
||||
import 'prosemirror-codemark/dist/codemark.css'
|
||||
import { getBlobRef, getClient } from '@hcengineering/presentation'
|
||||
import { CodeBlockExtension, codeBlockOptions, CodeExtension, codeOptions } from '@hcengineering/text'
|
||||
import textEditor, { type ExtensionCreator, type TextEditorMode } from '@hcengineering/text-editor'
|
||||
import textEditor, { type ActionContext, type ExtensionCreator, type TextEditorMode } from '@hcengineering/text-editor'
|
||||
|
||||
import { DefaultKit, type DefaultKitOptions } from './default-kit'
|
||||
import { HardBreakExtension } from '../components/extension/hardBreak'
|
||||
@ -247,6 +247,7 @@ async function buildEditorKit (): Promise<Extension<EditorKitOptions, any>> {
|
||||
element: this.options.toolbar?.element,
|
||||
isHidden: this.options.toolbar?.isHidden,
|
||||
ctx: {
|
||||
mode,
|
||||
objectId: this.options.objectId,
|
||||
objectClass: this.options.objectClass,
|
||||
objectSpace: this.options.objectSpace
|
||||
@ -273,3 +274,7 @@ async function buildEditorKit (): Promise<Extension<EditorKitOptions, any>> {
|
||||
export async function isEditable (editor: Editor): Promise<boolean> {
|
||||
return editor.isEditable
|
||||
}
|
||||
|
||||
export async function isHeadingVisible (editor: Editor, ctx: ActionContext): Promise<boolean> {
|
||||
return (await isEditable(editor)) && ctx.mode === 'full'
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ export type TextEditorCommand = (props: TextEditorCommandProps) => boolean
|
||||
* @public
|
||||
*/
|
||||
export interface ActionContext {
|
||||
mode: TextEditorMode
|
||||
objectId?: Ref<Doc>
|
||||
objectClass?: Ref<Class<Doc>>
|
||||
objectSpace?: Ref<Space>
|
||||
|
Loading…
Reference in New Issue
Block a user