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

Koenig - Update {{koenig-card-html}} to use new {{koenig-card}} container

refs https://github.com/TryGhost/Ghost/issues/9311
- wraps embed card in same container as the markdown card to handle mouse selection/edit toggles etc
- add render mode to embed card
- autofocus CodeMirror editor when switching to edit mode
- fix incorrect pointer on cards
This commit is contained in:
Kevin Ansfield 2018-02-15 15:57:44 +00:00
parent 26dd4ffb4a
commit 3f1e5b9fa9
5 changed files with 23 additions and 6 deletions

View file

@ -21,6 +21,7 @@ const CmEditorComponent = Component.extend(InvokeActionMixin, {
indentUnit: 4,
mode: 'htmlmixed',
theme: 'xq-light',
autofocus: false,
_editor: null, // reference to CodeMirror editor
_value: boundOneWay('value'), // make sure a value exists

View file

@ -384,7 +384,7 @@
width: calc(100% + 60px);
margin-left: -50px;
max-width: none;
cursor: pointer;
cursor: default;
caret-color: auto; /* override hidden cursors around cards */
}

View file

@ -3,10 +3,14 @@ import layout from '../templates/components/koenig-card-html';
import {set} from '@ember/object';
export default Component.extend({
tagName: '',
layout,
// attrs
payload: null,
isSelected: false,
isEditing: false,
// closure actions
saveCard: null,
init() {

View file

@ -1,4 +1,17 @@
{{#koenig-card
icon="koenig/embed"
isSelected=isSelected
isEditing=isEditing
selectCard=(action selectCard)
editCard=(action editCard)
}}
{{#if isEditing}}
{{gh-cm-editor payload.html
class="koenig-card-html--editor"
autofocus=true
update=(action "updateHtml")
}}
{{else}}
{{{payload.html}}}
{{/if}}
{{/koenig-card}}

View file

@ -1,6 +1,5 @@
{{#koenig-card
icon="koenig/markdown"
toolbar=toolbar
isSelected=isSelected
isEditing=isEditing
onEnterEdit=(action "enterEditMode")