mirror of
https://github.com/discourse/discourse.git
synced 2025-06-08 14:26:21 +08:00
FIX: Keyboard shortcuts closing table builder modal (#26278)
This commit is contained in:
@ -10,6 +10,7 @@ import DModalCancel from "discourse/components/d-modal-cancel";
|
|||||||
import TextField from "discourse/components/text-field";
|
import TextField from "discourse/components/text-field";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
|
||||||
import {
|
import {
|
||||||
arrayToTable,
|
arrayToTable,
|
||||||
findTableRegex,
|
findTableRegex,
|
||||||
@ -30,6 +31,12 @@ export default class SpreadsheetEditor extends Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
this.loadJspreadsheet();
|
this.loadJspreadsheet();
|
||||||
|
KeyboardShortcuts.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
willDestroy() {
|
||||||
|
super.willDestroy(...arguments);
|
||||||
|
KeyboardShortcuts.unpause();
|
||||||
}
|
}
|
||||||
|
|
||||||
get modalAttributes() {
|
get modalAttributes() {
|
||||||
|
@ -142,5 +142,17 @@ describe "Table Builder", type: :system do
|
|||||||
expect(page).to have_css(".dialog-container .dialog-content")
|
expect(page).to have_css(".dialog-container .dialog-content")
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user