This commit is contained in:
parent
fff31fc6fb
commit
e338309791
2 changed files with 41 additions and 5 deletions
|
@ -114,12 +114,23 @@
|
|||
sel = window.getSelection()
|
||||
if (sel) {
|
||||
node = $(sel.anchorNode)
|
||||
if (node && node.parent() && node.parent().is('blockquote')) {
|
||||
|
||||
if (node.closest('blockquote').length > 0) {
|
||||
|
||||
// Special handling when the line is not wrapped inside of a html element.
|
||||
if (!node.is('div') && node.parent().is('blockquote') && node.text()) {
|
||||
e.preventDefault()
|
||||
document.execCommand('Insertparagraph')
|
||||
document.execCommand('Outdent')
|
||||
document.execCommand('formatBlock', false, 'div')
|
||||
document.execCommand('insertParagraph')
|
||||
return
|
||||
}
|
||||
if (!e.shiftKey && node && (node.is('blockquote') || (node.parent() && node.parent().is('blockquote')) || !node.text())) {
|
||||
e.preventDefault()
|
||||
document.execCommand('insertParagraph')
|
||||
document.execCommand('outdent')
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// behavior to enter new line on alt+enter
|
||||
|
|
|
@ -178,6 +178,31 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
|||
end
|
||||
end
|
||||
|
||||
context 'when full quote header setting is enabled' do
|
||||
let(:full_quote_header_setting) { true }
|
||||
|
||||
it 'can breakout with enter from quote block' do
|
||||
within(:active_content) do
|
||||
highlight_and_click_reply
|
||||
|
||||
within(:richtext) do
|
||||
blockquote_empty_line = first('blockquote br:nth-child(2)', visible: :all)
|
||||
page.driver.browser.action.move_to_location(blockquote_empty_line.native.location.x, blockquote_empty_line.native.location.y).click.perform
|
||||
end
|
||||
|
||||
# Special handling for firefox, because the cursor is at the wrong location after the move to with click.
|
||||
if Capybara.current_driver == :zammad_firefox
|
||||
find(:richtext).send_keys(:down)
|
||||
end
|
||||
|
||||
find(:richtext).send_keys(:enter)
|
||||
|
||||
within(:richtext) do
|
||||
expect(page).to have_css('blockquote', count: 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def click_forward
|
||||
|
|
Loading…
Reference in a new issue