Ghost/ghost/admin/lib/gh-koenig/addon/components/koenig-menu-item.js
Ryan McCarvill c5b0301e87 Koenig tests. (#564)
* 👷   Editor tests
Added acceptance tests for koenig markdown-like support.
Added some unit tests for koenig located in the /lib/koenig/test-support directory.
2017-03-07 23:57:09 +13:00

29 lines
773 B
JavaScript

import Component from 'ember-component';
import layout from '../templates/components/koenig-menu-item';
export default Component.extend({
layout,
tagName: 'li',
init() {
this._super(...arguments);
},
actions: {
select() {
let {section/* , startOffset, endOffset */} = this.get('range');
window.getSelection().removeAllRanges();
let range = document.createRange();
range.setStart(section.renderNode._element, 0); // startOffset-1); // todo
range.setEnd(section.renderNode._element, 0); // endOffset-1);
let selection = window.getSelection();
selection.addRange(range);
this.get('tool').onClick(this.get('editor'));
}
}
});