mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 19:58:09 +00:00
UBERF-5324: allow cmd-k for editable content (#4601)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
466298d425
commit
7794771694
@ -735,6 +735,7 @@ export function createModel (builder: Builder): void {
|
||||
category: view.category.GeneralNavigation,
|
||||
input: 'none',
|
||||
target: core.class.Doc,
|
||||
allowedForEditableContent: true,
|
||||
context: {
|
||||
mode: ['workbench', 'browser', 'panel', 'editor', 'input']
|
||||
}
|
||||
|
@ -135,13 +135,15 @@ export function canReplyToThread (doc?: ActivityMessage): boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
export async function canCopyMessageLink (doc?: ActivityMessage): Promise<boolean> {
|
||||
if (doc === undefined) {
|
||||
export async function canCopyMessageLink (doc?: ActivityMessage | ActivityMessage[]): Promise<boolean> {
|
||||
const message = Array.isArray(doc) ? doc[0] : doc
|
||||
|
||||
if (message === undefined) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (doc._class === activity.class.DocUpdateMessage) {
|
||||
return (doc as DocUpdateMessage).objectClass !== activity.class.Reaction
|
||||
if (message._class === activity.class.DocUpdateMessage) {
|
||||
return (message as DocUpdateMessage).objectClass !== activity.class.Reaction
|
||||
}
|
||||
|
||||
return true
|
||||
|
@ -131,9 +131,11 @@
|
||||
const targetTagName = (evt.target as any)?.tagName?.toLowerCase()
|
||||
|
||||
let elm = evt.target as HTMLElement
|
||||
let isContentEditable = false
|
||||
|
||||
while (true) {
|
||||
if (elm.contentEditable === 'true') {
|
||||
return
|
||||
if (elm.isContentEditable) {
|
||||
isContentEditable = true
|
||||
}
|
||||
const prt = elm.parentElement
|
||||
if (prt === null) {
|
||||
@ -165,7 +167,13 @@
|
||||
}
|
||||
clearTimeout(timer)
|
||||
|
||||
currentActions = currentActions.filter((p) => p.keyBinding !== undefined && p.keyBinding.length > 0)
|
||||
currentActions = currentActions.filter(({ keyBinding, allowedForEditableContent }) => {
|
||||
const hasKeyBinding = keyBinding !== undefined && keyBinding.length > 0
|
||||
const allowed = !isContentEditable || allowedForEditableContent
|
||||
|
||||
return hasKeyBinding && allowed
|
||||
})
|
||||
|
||||
if (lastKey !== undefined) {
|
||||
for (const a of sequences) {
|
||||
// TODO: Handle multiple keys here
|
||||
|
@ -520,6 +520,7 @@ export interface Action<T extends Doc = Doc, P = Record<string, any>> extends Do
|
||||
|
||||
// Avaible only for workspace owners
|
||||
secured?: boolean
|
||||
allowedForEditableContent?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user