Skip to content

Commit

Permalink
fix(editors): make sure appendChild exist before using it to add Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding-SE committed Mar 24, 2020
1 parent 76b4177 commit 90d4a67
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/common/src/editors/checkboxEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export class CheckboxEditor implements Editor {
this._input.title = title;
this._input.type = 'checkbox';
this._input.value = 'true';
this.args.container.append(this._input);
const cellContainer = this.args?.container;
if (cellContainer && typeof cellContainer.appendChild === 'function') {
cellContainer.appendChild(this._input);
}
this.focus();

// make the checkbox editor act like a regular checkbox that commit the value on click
Expand Down
5 changes: 4 additions & 1 deletion packages/common/src/editors/floatEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export class FloatEditor implements Editor {
this._input.placeholder = placeholder;
this._input.title = title;
this._input.step = this.getInputDecimalSteps();
this.args.container.append(this._input);
const cellContainer = this.args?.container;
if (cellContainer && typeof cellContainer.appendChild === 'function') {
cellContainer.appendChild(this._input);
}

this._input.onkeydown = ((event: KeyboardEvent) => {
this._lastInputEvent = event;
Expand Down
5 changes: 4 additions & 1 deletion packages/common/src/editors/integerEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export class IntegerEditor implements Editor {
this._input.autocomplete = 'off';
this._input.placeholder = placeholder;
this._input.title = title;
this.args.container.append(this._input);
const cellContainer = this.args?.container;
if (cellContainer && typeof cellContainer.appendChild === 'function') {
cellContainer.appendChild(this._input);
}

this._input.onkeydown = ((event: KeyboardEvent) => {
this._lastInputEvent = event;
Expand Down
5 changes: 4 additions & 1 deletion packages/common/src/editors/textEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export class TextEditor implements Editor {
this._input.autocomplete = 'off';
this._input.placeholder = placeholder;
this._input.title = title;
this.args.container.append(this._input);
const cellContainer = this.args?.container;
if (cellContainer && typeof cellContainer.appendChild === 'function') {
cellContainer.appendChild(this._input);
}

this._input.onkeydown = ((event: KeyboardEvent) => {
this._lastInputEvent = event;
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/global-grid-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const GlobalGridOptions: GridOption = {
columnPicker: {
fadeSpeed: 0,
hideForceFitButton: false,
hideSyncResizeButton: true
hideSyncResizeButton: true,
},
cellMenu: {
autoAdjustDrop: true,
Expand Down

0 comments on commit 90d4a67

Please sign in to comment.