Skip to content

Commit

Permalink
fix: field defaults not being defined correctly (#6453)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Sep 27, 2022
1 parent ab03c65 commit eb1b786
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ import * as Xml from './xml.js';
export abstract class Field implements IASTNodeLocationSvg,
IASTNodeLocationWithBlock,
IKeyboardAccessible, IRegistrable {
/** The default value for this field. */
protected DEFAULT_VALUE: any = null;

/** Non-breaking space. */
static readonly NBSP = '\u00A0';

Expand Down Expand Up @@ -208,7 +205,9 @@ export abstract class Field implements IASTNodeLocationSvg,
* A generic value possessed by the field.
* Should generally be non-null, only null when the field is created.
*/
this.value_ = (new.target).prototype.DEFAULT_VALUE;
this.value_ = ('DEFAULT_VALUE' in (new.target).prototype) ?
((new.target).prototype as AnyDuringMigration).DEFAULT_VALUE :
null;

/** The size of the area rendered by the field. */
this.size_ = new Size(0, 0);
Expand Down

0 comments on commit eb1b786

Please sign in to comment.