Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetDealer committed Feb 12, 2024
1 parent d7e9af3 commit c82ef5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/EditText/EditText.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default class EditText extends HTMLElement {
this.#children.popup.addEventListener('keydown', this.#onKeydown.bind(this));
this.#children.input.onInput(this.#onInput.bind(this));
this.addEventListener("cancel", this.#onEscape.bind(this));
this.querySelector(".popup-content").addEventListener("click", (event) => {
event.stopPropagation();
});
// this.querySelector(".popup-content").addEventListener("click", (event) => {
// event.stopPropagation();
// });
}

#showPopup() {
Expand Down Expand Up @@ -142,7 +142,7 @@ export default class EditText extends HTMLElement {
let {top, left} = this.getBoundingClientRect();
this.#children.popup.style.top = top + window.scrollY + "px";
this.#children.popup.style.left = left + window.scrollX + "px";
this.#children.popup.style['max-width'] = this.offsetWidth + 56 + "px";
this.#children.popup.style['max-width'] = this.offsetWidth + 16 + "px";
}

#isNumberType() {
Expand All @@ -155,7 +155,7 @@ export default class EditText extends HTMLElement {
tempElement.style.visibility = "hidden";
document.body.appendChild(tempElement);
const textWidth = tempElement.offsetWidth;
element.style.width = textWidth + 30 + "px";
element.style.width = textWidth + 16 + "px";
document.body.removeChild(tempElement);
}

Expand Down Expand Up @@ -192,7 +192,7 @@ export default class EditText extends HTMLElement {
patternAttr = `pattern="${this.getAttribute("pattern")}"`
return `<span class="edit-text__text"></span>
<dialog class="edit-text__popup" tabindex="9">
<section class="popup-content">
<text-input
class="text-input--with-right-icon"
label=""
Expand All @@ -206,7 +206,7 @@ export default class EditText extends HTMLElement {
${patternAttr}
type="${typeAttr}"
></text-input>
</section>
</dialog>`;
}

Expand Down
1 change: 1 addition & 0 deletions src/EditText/EditText.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
edit-text {
display: inline-block;
max-width: 100%;
}

.edit-text__popup {
Expand Down

0 comments on commit c82ef5d

Please sign in to comment.