This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs TryGhost/Ghost#9311 - add a basic HTML card that renders a CodeMirror editor - adjust styles so that CodeMirror styles for the markdown editor don't affect CodeMirror instances inside Koenig
- Loading branch information
1 parent
2d95392
commit 5d0d987
Showing
11 changed files
with
96 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Component from '@ember/component'; | ||
import layout from '../templates/components/koenig-card-html'; | ||
import {set} from '@ember/object'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
layout, | ||
|
||
payload: null, | ||
saveCard: null, | ||
|
||
init() { | ||
this._super(...arguments); | ||
|
||
if (!this.get('payload.html')) { | ||
this.set('payload.html', ''); | ||
} | ||
}, | ||
|
||
actions: { | ||
updateHtml(html) { | ||
let payload = this.get('payload'); | ||
let save = this.get('saveCard'); | ||
|
||
set(payload, 'html', html); | ||
|
||
// update the mobiledoc and stay in edit mode | ||
save(payload, false); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
lib/koenig-editor/addon/templates/components/koenig-card-html.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{{gh-cm-editor payload.html | ||
class="koenig-card-html--editor" | ||
update=(action "updateHtml") | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {default} from 'koenig-editor/components/koenig-card-html'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import {describe, it} from 'mocha'; | ||
import {expect} from 'chai'; | ||
import {setupComponentTest} from 'ember-mocha'; | ||
|
||
describe('Integration: Component: koenig-card-html', function () { | ||
setupComponentTest('koenig-card-html', { | ||
integration: true | ||
}); | ||
|
||
it.skip('renders', function () { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... }); | ||
// Template block usage: | ||
// this.render(hbs` | ||
// {{#koenig-card-html}} | ||
// template content | ||
// {{/koenig-card-html}} | ||
// `); | ||
|
||
this.render(hbs`{{koenig-card-html}}`); | ||
expect(this.$()).to.have.length(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters