Koenig - Allow clicks on rich-text captions to place cursor immediately

refs https://github.com/TryGhost/Ghost/issues/9724
- add a `data-kg-allow-clickthrough` attribute so that it's possible to explicitly allow non-input elements to be clicked immediately when clicking on a card
This commit is contained in:
Kevin Ansfield 2018-08-08 15:48:31 +01:00
parent b2d29780e9
commit bb9ed97c24
2 changed files with 5 additions and 2 deletions

View File

@ -152,7 +152,9 @@ export default Component.extend({
// immediately when clicked
let targetTagName = event.target.tagName;
let allowedTagNames = ['INPUT', 'TEXTAREA'];
if (!allowedTagNames.includes(targetTagName)) {
let allowClickthrough = !!event.target.closest('[data-kg-allow-clickthrough]');
console.log('allowClickthrough', allowClickthrough);
if (!allowedTagNames.includes(targetTagName) && !allowClickthrough) {
event.preventDefault();
}

View File

@ -1,8 +1,9 @@
<div class="koenig-basic-html-input__editor-wrappper">
<div class="koenig-basic-html-input__editor-wrappper" style="cursor: text">
<div
class="koenig-basic-html-input__editor"
data-gramm="false"
data-kg="editor"
data-kg-allow-clickthrough
data-placeholder={{placeholder}}
></div>
</div>