Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Koenig - Allow clicks on rich-text captions to place cursor immediately
Browse files Browse the repository at this point in the history
refs TryGhost/Ghost#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
  • Loading branch information
kevinansfield committed Aug 8, 2018
1 parent b2d2978 commit bb9ed97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/koenig-editor/addon/components/koenig-card.js
Expand Up @@ -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();
}

Expand Down
@@ -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>
Expand Down

0 comments on commit bb9ed97

Please sign in to comment.