mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
Fixes #6018 - Text formatting bubble menu disappears when using Ctrl+Shift+arrows for text selecting.
This commit is contained in:
parent
928e8a65d6
commit
bbcc70b080
2 changed files with 9 additions and 7 deletions
|
|
@ -78,7 +78,7 @@ class App.WidgetTextTools extends App.Controller
|
|||
@contextData: (ce) ->
|
||||
$(ce.element).data().plugin_texttools?.searchCondition or {}
|
||||
|
||||
@showModal: (e, ce, selection, el) ->
|
||||
@showModal: (e, ce, selection, el, callback) ->
|
||||
textToolId = $(e.target).data('id')
|
||||
|
||||
new App.TextToolsModal(
|
||||
|
|
@ -86,10 +86,12 @@ class App.WidgetTextTools extends App.Controller
|
|||
contextData: @contextData(ce)
|
||||
textTool: App.AITextTool.find(textToolId)
|
||||
selectedText: selection.content
|
||||
approve: (result) -> ce.replaceSelection(selection.ranges, result)
|
||||
approve: (result) ->
|
||||
ce.replaceSelection(selection.ranges, result)
|
||||
callback() if callback
|
||||
)
|
||||
|
||||
@renderDropdown: (e, ce, selection, el) ->
|
||||
@renderDropdown: (e, ce, selection, el, callback) ->
|
||||
bubbleMenuElement = $(e.target).closest('.js-bubbleMenu')
|
||||
popupContainerElement = bubbleMenuElement.find('.dropup-container')
|
||||
|
||||
|
|
@ -107,7 +109,7 @@ class App.WidgetTextTools extends App.Controller
|
|||
|
||||
textToolsDropdown.off('mousedown.text-tools-dropdown').on 'mousedown.text-tools-dropdown', '.js-action', (e) ->
|
||||
e.preventDefault()
|
||||
App.WidgetTextTools.showModal(e, ce, selection, el)
|
||||
App.WidgetTextTools.showModal(e, ce, selection, el, callback)
|
||||
textToolsDropdown.removeClass('open')
|
||||
popupContainerElement.parent().removeClass('show-dropdown')
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ App.RichtextBubbleMenu =
|
|||
actionKey = actionNode.dataset.key
|
||||
activeAction = _.find(@allActions(), (item) -> item.key is actionKey)
|
||||
|
||||
activeAction.action(e, ce, selection, el) if activeAction
|
||||
activeAction.action(e, ce, selection, el, closeDropdown) if activeAction
|
||||
|
||||
return false
|
||||
)
|
||||
|
|
@ -61,8 +61,8 @@ App.RichtextBubbleMenu =
|
|||
|
||||
setTimeout ->
|
||||
$(window).off('click.bubble-menu, keyup.bubble-menu').on 'click.bubble-menu, keyup.bubble-menu', (e) ->
|
||||
return if e.type is 'keyup' and e.key.startsWith('Shift')
|
||||
return if e.target.closest('.bubble-menu') # keep the bubble menu open if click is on the menu itself
|
||||
return if not window.getSelection().isCollapsed # keep the bubble menu open if there is still a selection
|
||||
return if e.target.closest('.bubble-menu') # keep the bubble menu open if the click is on the menu itself
|
||||
|
||||
closeDropdown()
|
||||
$(window).off('click.bubble-menu, keyup.bubble-menu')
|
||||
|
|
|
|||
Loading…
Reference in a new issue