mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
UBERF-8575 Exclude markups from inline attrs bar (#7117)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
afa485deb1
commit
dfb8507d32
@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Class, Data, Doc, Ref } from '@hcengineering/core'
|
||||
import { Class, Data, Doc, Hierarchy, Ref } from '@hcengineering/core'
|
||||
import { InlineAttributeBarEditor } from '..'
|
||||
import { KeyedAttribute } from '../attributes'
|
||||
import { getClient, getFiltredKeys, isCollectionAttr } from '../utils'
|
||||
import { getClient, getFiltredKeys, isCollectionAttr, isCollabAttr, isMarkupAttr } from '../utils'
|
||||
|
||||
export let object: Doc | Data<Doc>
|
||||
export let _class: Ref<Class<Doc>>
|
||||
@ -15,10 +15,15 @@
|
||||
|
||||
const client = getClient()
|
||||
|
||||
function isInlineAttr (hierarchy: Hierarchy, key: KeyedAttribute): boolean {
|
||||
return !isCollectionAttr(hierarchy, key) && !isCollabAttr(hierarchy, key) && !isMarkupAttr(hierarchy, key)
|
||||
}
|
||||
|
||||
function updateKeys (_class: Ref<Class<Doc>>, ignoreKeys: string[], to: Ref<Class<Doc>> | undefined): void {
|
||||
const filtredKeys = getFiltredKeys(client.getHierarchy(), _class, ignoreKeys, to)
|
||||
const hierarchy = client.getHierarchy()
|
||||
const filtredKeys = getFiltredKeys(hierarchy, _class, ignoreKeys, to)
|
||||
keys = filtredKeys.filter(
|
||||
(key) => (extraKeys.includes(key.key) || !isCollectionAttr(client.getHierarchy(), key)) && !key.attr.readonly
|
||||
(key) => (extraKeys.includes(key.key) || isInlineAttr(hierarchy, key)) && key.attr.readonly !== true
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -654,6 +654,20 @@ export function isCollectionAttr (hierarchy: Hierarchy, key: KeyedAttribute): bo
|
||||
return hierarchy.isDerived(key.attr.type._class, core.class.Collection)
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function isMarkupAttr (hierarchy: Hierarchy, key: KeyedAttribute): boolean {
|
||||
return hierarchy.isDerived(key.attr.type._class, core.class.TypeMarkup)
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function isCollabAttr (hierarchy: Hierarchy, key: KeyedAttribute): boolean {
|
||||
return hierarchy.isDerived(key.attr.type._class, core.class.TypeCollaborativeDoc)
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user