mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
756b6627a9
no issue * split key commands and text expansions into separate files for easier file searches * basic formatting, added a few comments * move editor title input into addon - the editor and title are now tightly integrated so that it's possible to use up/down cursor navigation so it makes more sense to keep them together - start of a deeper component restructure so that we don't need to leak properties/actions to parent components * first pass at refactor of gh-koenig and koenig-title-input - remove need for editor reference to be held outside of the `gh-koenig` component by yielding it from the component so that the integrated title element can sit inside the container's scope - refactor `gh-koenig` to more closely match the default ember mobiledoc addon - fixes runloop issues by starting/ending a manual runloop - refactored the mutation observer and event handlers in `koenig-title-input` so that we're not doing unecessary work on every render/key press - rename CSS classes to be more specific (these may still need more separation between `.gh` and `.kg` later) - `.editor-holder` to `.gh-koenig-container` - `.surface` to `.gh-koenig-surface` * fix tests and start testing refactor * move gh-koenig integration tests into addon, remove empty test files * first-pass at component template cleanup * first pass at koenig-toolbar-button refactor
19 lines
554 B
JavaScript
19 lines
554 B
JavaScript
// Key commands will run any time a particular key or key combination is pressed
|
|
// https://github.com/bustlelabs/mobiledoc-kit#configuring-hot-keys
|
|
|
|
export default function (editor) {
|
|
|
|
let softReturnKeyCommand = {
|
|
str: 'SHIFT+ENTER',
|
|
|
|
run(editor) {
|
|
editor.run((postEditor) => {
|
|
let softReturn = postEditor.builder.createAtom('soft-return');
|
|
postEditor.insertMarkers(editor.range.head, [softReturn]);
|
|
});
|
|
}
|
|
};
|
|
editor.registerKeyCommand(softReturnKeyCommand);
|
|
|
|
}
|