mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-26 19:44:57 +02:00
UBERF-9279: Ctrl/Cmd + K for hyperlinks (#7857)
Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
@@ -140,6 +140,9 @@
|
||||
let elm = evt.target as HTMLElement
|
||||
let isContentEditable = false
|
||||
|
||||
const selection = window.getSelection()
|
||||
const haveRangeSelection = !(selection?.isCollapsed ?? true)
|
||||
|
||||
while (true) {
|
||||
if (elm.isContentEditable) {
|
||||
isContentEditable = true
|
||||
@@ -195,9 +198,20 @@
|
||||
let postpone = false
|
||||
let nonSequenceAction: Action | undefined
|
||||
|
||||
const checkIsAllowedContentMode = (mode?: 'always' | 'noSelection'): boolean => {
|
||||
if (!isContentEditable) return true
|
||||
switch (mode) {
|
||||
case 'always':
|
||||
return true
|
||||
case 'noSelection':
|
||||
return !haveRangeSelection
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
for (const a of currentActions) {
|
||||
if (a.keyBinding === undefined || a.keyBinding.length < 1) continue
|
||||
if (isContentEditable && a.allowedForEditableContent !== true) continue
|
||||
if (!checkIsAllowedContentMode(a.allowedForEditableContent)) continue
|
||||
const t = lastKey
|
||||
if (t !== undefined && a.keyBinding.some((it) => matchKeySequence(evt, it, t))) {
|
||||
evt.preventDefault()
|
||||
|
||||
Reference in New Issue
Block a user