mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
FIX: Keyboard shortcuts closing table builder modal (#26278)
This commit is contained in:
parent
2b4eb36a97
commit
2129e9e37a
|
@ -10,6 +10,7 @@ import DModalCancel from "discourse/components/d-modal-cancel";
|
|||
import TextField from "discourse/components/text-field";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
|
||||
import {
|
||||
arrayToTable,
|
||||
findTableRegex,
|
||||
|
@ -30,6 +31,12 @@ export default class SpreadsheetEditor extends Component {
|
|||
constructor() {
|
||||
super(...arguments);
|
||||
this.loadJspreadsheet();
|
||||
KeyboardShortcuts.pause();
|
||||
}
|
||||
|
||||
willDestroy() {
|
||||
super.willDestroy(...arguments);
|
||||
KeyboardShortcuts.unpause();
|
||||
}
|
||||
|
||||
get modalAttributes() {
|
||||
|
|
|
@ -142,5 +142,17 @@ describe "Table Builder", type: :system do
|
|||
expect(page).to have_css(".dialog-container .dialog-content")
|
||||
end
|
||||
end
|
||||
|
||||
it "should not accept default Discourse keyboard shortcuts" do
|
||||
# Some default keyboard shortcuts like Shift + S bring up a modal overriding
|
||||
# the table builder modal and therefore should not be accepted
|
||||
|
||||
topic_page.visit_topic(topic)
|
||||
topic_page.find(".btn-edit-table", visible: :all).click
|
||||
insert_table_modal.find_cell(0, 0)
|
||||
insert_table_modal.send_keys(:shift, "s")
|
||||
expect(page).to have_css(".insert-table-modal")
|
||||
expect(page).to have_no_css(".share-topic-modal")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user