add back in accidentally deleted method
This commit is contained in:
parent
5abd8e166b
commit
da76f23274
2 changed files with 33 additions and 2 deletions
|
@ -275,8 +275,8 @@ Pattern.prototype.__init = function () {
|
|||
this.__runHooks('preInit')
|
||||
// Say hello
|
||||
this.store.log.info(
|
||||
`New \`${this.designConfig?.data?.name || 'No Name'}:` +
|
||||
`${this.designConfig?.data?.version || 'No version'}\` ` +
|
||||
`New \`${this.designConfig.data?.name || 'No Name'}:` +
|
||||
`${this.designConfig.data?.version || 'No version'}\` ` +
|
||||
`pattern using \`@freesewing/core:${version}\``
|
||||
)
|
||||
|
||||
|
|
|
@ -99,6 +99,37 @@ PatternDrafter.prototype.draftPartForSet = function (partName, set) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a part for the given set of settings.
|
||||
* Handles injection
|
||||
* @param {String} partName the name of the part to create
|
||||
* @param {Number} set the settings index
|
||||
* @private
|
||||
*/
|
||||
PatternDrafter.prototype.__createPartForSet = function (partName, set = 0) {
|
||||
// gotta protect against attacks
|
||||
if (set === '__proto__') {
|
||||
throw new Error('malicious attempt at altering Object.prototype. Stopping action')
|
||||
}
|
||||
// Create parts
|
||||
this.activeStore.log.debug(`📦 Creating part \`${partName}\` (set ${set})`)
|
||||
this.pattern.parts[set][partName] = this.__createPartWithContext(partName, set)
|
||||
|
||||
// Handle inject/inheritance
|
||||
const parent = this.pattern.config.inject[partName]
|
||||
if (typeof parent === 'string') {
|
||||
this.activeStore.log.debug(`Creating part \`${partName}\` from part \`${parent}\``)
|
||||
try {
|
||||
this.pattern.parts[set][partName].__inject(this.pattern.parts[set][parent])
|
||||
} catch (err) {
|
||||
this.activeStore.log.error([
|
||||
`Could not inject part \`${parent}\` into part \`${partName}\``,
|
||||
err,
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Part instance and populates it with the pattern context
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue