From 9f4688fe63b8cc16d5c1941d06a68e591947eebb Mon Sep 17 00:00:00 2001 From: Kutlu Sahin Date: Thu, 28 Mar 2019 10:22:21 +0100 Subject: [PATCH] merge option added to setOptions --- src/container.ts | 8 ++++++-- src/exportTypes.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/container.ts b/src/container.ts index 3c8c920..c89c8f6 100644 --- a/src/container.ts +++ b/src/container.ts @@ -711,8 +711,12 @@ function Container(element: HTMLElement): (options?: ContainerOptions) => IConta unwrapChildren(container.element); } - function setOptions(options: ContainerOptions) { - containerOptions = Object.assign({}, defaultOptions, containerOptions, options); + function setOptions(options: ContainerOptions, merge = true) { + if (merge === false) { + containerOptions = Object.assign({}, defaultOptions, options); + } else { + containerOptions = Object.assign({}, defaultOptions, containerOptions, options); + } } function getOptions(): ContainerOptions { diff --git a/src/exportTypes.ts b/src/exportTypes.ts index 45b73da..7d7b5d5 100644 --- a/src/exportTypes.ts +++ b/src/exportTypes.ts @@ -1,6 +1,6 @@ export interface SmoothDnD { dispose: () => void; - setOptions: (options: ContainerOptions) => void; + setOptions: (options: ContainerOptions, merge?: boolean) => void; } export type SmoothDnDCreator = ((element: HTMLElement, options?: ContainerOptions) => SmoothDnD) & {