0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Updated CTRL+Q blockquote keyboard shortcut to cycle through alt style

refs https://github.com/TryGhost/Team/issues/1239

- updates keyboard shortcut behavior to match the quote icon behavior where it cycles through blockquote->aside->p
This commit is contained in:
Kevin Ansfield 2021-12-08 15:17:28 +00:00
parent 811ca6d08e
commit e21bde39e1

View file

@ -47,6 +47,32 @@ const cycleHeaderLevel = function cycleHeaderLevel(editor, koenig) {
setHeader(headerTag, editor, koenig);
};
const cycleQuoteStyle = function cycleQuoteStyle(editor, koenig) {
if (!editor.activeSection.isMarkerable) {
return;
}
const range = editor.range;
const canKeepRange = !editor.activeSection.isListItem;
let sectionName = 'blockquote';
if (editor.activeSection.tagName === 'blockquote') {
sectionName = 'aside';
}
if (editor.activeSection.tagName === 'aside') {
sectionName = 'p';
}
editor.run((postEditor) => {
koenig.send('toggleSection', sectionName, postEditor);
if (canKeepRange) {
postEditor.setRange(range);
}
});
};
export const DEFAULT_KEY_COMMANDS = [{
str: 'ENTER',
run(editor, koenig) {
@ -358,19 +384,7 @@ export const DEFAULT_KEY_COMMANDS = [{
}, {
str: 'CTRL+Q',
run(editor, koenig) {
if (!editor.activeSection.isMarkerable) {
return;
}
let range = editor.range;
let canKeepRange = !editor.activeSection.isListItem;
editor.run((postEditor) => {
koenig.send('toggleSection', 'blockquote', postEditor);
if (canKeepRange) {
postEditor.setRange(range);
}
});
return cycleQuoteStyle(editor, koenig);
}
}, {
str: 'CTRL+L',