This commit is contained in:
parent
fff31fc6fb
commit
e338309791
2 changed files with 41 additions and 5 deletions
|
@ -114,11 +114,22 @@
|
||||||
sel = window.getSelection()
|
sel = window.getSelection()
|
||||||
if (sel) {
|
if (sel) {
|
||||||
node = $(sel.anchorNode)
|
node = $(sel.anchorNode)
|
||||||
if (node && node.parent() && node.parent().is('blockquote')) {
|
|
||||||
e.preventDefault()
|
if (node.closest('blockquote').length > 0) {
|
||||||
document.execCommand('Insertparagraph')
|
|
||||||
document.execCommand('Outdent')
|
// Special handling when the line is not wrapped inside of a html element.
|
||||||
return
|
if (!node.is('div') && node.parent().is('blockquote') && node.text()) {
|
||||||
|
e.preventDefault()
|
||||||
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,31 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
def click_forward
|
def click_forward
|
||||||
|
|
Loading…
Reference in a new issue