From ce6f2dc76edfd42585c62b68c50583afdc9a0459 Mon Sep 17 00:00:00 2001 From: Seyed Mohammad Mahdi Hatami Date: Fri, 23 Jun 2023 19:48:51 +0330 Subject: [PATCH] added _parent and context to data returned by #with in helpers Signed-off-by: Seyed Mohammad Mahdi Hatami --- lib/handlebars/helpers/with.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/handlebars/helpers/with.js b/lib/handlebars/helpers/with.js index 908477bd..c21e7437 100644 --- a/lib/handlebars/helpers/with.js +++ b/lib/handlebars/helpers/with.js @@ -1,5 +1,5 @@ import { Exception } from '@handlebars/parser'; -import { isEmpty, isFunction } from '../utils'; +import { createFrame, isEmpty, isFunction } from '../utils'; export default function (instance) { instance.registerHelper('with', function (context, options) { @@ -13,7 +13,11 @@ export default function (instance) { let fn = options.fn; if (!isEmpty(context)) { - let data = options.data; + let data = createFrame(options.data); + + if (data) { + data.key = context; + } return fn(context, { data: data,