Skip to content

Commit

Permalink
Fix editOnClick focus on click
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev committed Oct 2, 2024
1 parent d4417cb commit 00b084b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/powergrid.js": "/powergrid.js?id=d79ad6b36ca796706eac797c614deb5d",
"/powergrid.js": "/powergrid.js?id=9d73d8a5f9abad977a66cabf31e89f3d",
"/bootstrap5.css": "/bootstrap5.css?id=a27af22343149104b2aa3283d8fd502b",
"/tailwind.css": "/tailwind.css?id=924477e2afcb2cb56aa392e266ee56ca"
}
2 changes: 1 addition & 1 deletion dist/powergrid.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions resources/js/components/pg-editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default (params) => ({
this.observe(
() => document.getElementById('editable-' + this.hash),
(editableElement) => {
this.setFocusToEnd(editableElement);
setTimeout(() => this.setFocusToEnd(editableElement), 100);
}
);
}
Expand All @@ -46,9 +46,12 @@ export default (params) => ({
this.observe(
() => document.getElementById('editable-' + this.hash),
(editableElement) => {
if (this.store().getTextContent(this.hash)) {
editableElement.textContent = this.store().getTextContent(this.hash);
}
setTimeout(() => {
this.setFocusToEnd(editableElement)
if (this.store().getTextContent(this.hash)) {
editableElement.textContent = this.store().getTextContent(this.hash);
}
}, 100);
}
);

Expand Down

0 comments on commit 00b084b

Please sign in to comment.