mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Added code formatting key command support to <KoenigBasicHtmlTextarea>
no issue - the component was still using the text-replacement component's key commands which didn't include code formatting because code in text-replacement component is re-purposed for replacement string highlights
This commit is contained in:
parent
8d1c1731eb
commit
ca89bc9522
@ -3,7 +3,7 @@ import Component from '@ember/component';
|
||||
import Editor from 'mobiledoc-kit/editor/editor';
|
||||
import cleanBasicHtml from '@tryghost/kg-clean-basic-html';
|
||||
import defaultAtoms from '../options/atoms';
|
||||
import registerKeyCommands, {TEXT_REPLACEMENT_KEY_COMMANDS} from '../options/key-commands';
|
||||
import registerKeyCommands, {BASIC_TEXTAREA_KEY_COMMANDS} from '../options/key-commands';
|
||||
import validator from 'validator';
|
||||
import {BLANK_DOC, MOBILEDOC_VERSION} from './koenig-editor';
|
||||
import {DRAG_DISABLED_DATA_ATTR} from '../lib/dnd/constants';
|
||||
@ -165,7 +165,7 @@ export default Component.extend({
|
||||
|
||||
editor = new Editor(editorOptions);
|
||||
|
||||
registerKeyCommands(editor, this, TEXT_REPLACEMENT_KEY_COMMANDS);
|
||||
registerKeyCommands(editor, this, BASIC_TEXTAREA_KEY_COMMANDS);
|
||||
registerTextReplacementTextExpansions(editor, this);
|
||||
|
||||
// set up editor hooks
|
||||
|
@ -434,7 +434,23 @@ export const BASIC_KEY_COMMANDS = DEFAULT_KEY_COMMANDS.filter((command) => {
|
||||
return basicCommands.includes(command.str);
|
||||
});
|
||||
|
||||
// key commands that are used in koenig-basic-html-textarea
|
||||
export const BASIC_TEXTAREA_KEY_COMMANDS = DEFAULT_KEY_COMMANDS.filter((command) => {
|
||||
let basicCommands = [
|
||||
'BACKSPACE',
|
||||
'CTRL+K',
|
||||
'META+K',
|
||||
'CTRL+ALT+U',
|
||||
'CTRL+SHIFT+K',
|
||||
'META+SHIFT+K',
|
||||
'ENTER',
|
||||
'SHIFT+ENTER'
|
||||
];
|
||||
return basicCommands.includes(command.str);
|
||||
});
|
||||
|
||||
// key commands that are used in koenig-text-replacement-html-input
|
||||
// (code formatting is not allowed here because it's used to highlight replacement strings)
|
||||
export const TEXT_REPLACEMENT_KEY_COMMANDS = DEFAULT_KEY_COMMANDS.filter((command) => {
|
||||
let commands = [
|
||||
'BACKSPACE',
|
||||
|
Loading…
Reference in New Issue
Block a user