jodit
Version:
Jodit is an awesome and useful wysiwyg editor with filebrowser
81 lines (80 loc) • 2.3 kB
TypeScript
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/utils
*/
import type { IDictionary } from "../../../types/index";
/**
* @example
* ```js
* const defaultConfig = {
* a: {
* b: {
* c: 2
* },
* e: 5
* },
* d: {
* g: 7
* }
* };
*
* const options = ConfigProto({a: {
* b: {
* c: 1
* }
* }}, defaultConfig);
*
* console.log(options.a.b.c); // 1
* console.log(options.a.e); // 5
* console.log(options.d.g); // 7
*
* defaultConfig.d.g = 8;
* console.log(options.d.g); // 8
*
* ```
*/
export declare function ConfigProto(options: IDictionary, proto: IDictionary, deep?: number): IDictionary;
export declare function ConfigFlatten(obj: IDictionary): IDictionary;
/**
* Returns a plain object from a prototype-based object.
* ```typescript
* const editor = Jodit.make('#editor', {
* image: {
* dialogWidth: 500
* }
* });
*
* console.log(editor.o.image.openOnDblClick) // true
* // But you can't get all options in plain object
* console.log(JSON.stringify(editor.o.image)); // {"dialogWidth":500}
*
* const plain = Jodit.modules.Helpers.ConfigDeepFlatten(editor.o.image);
* console.log(JSON.stringify(plain)); // {"dialogWidth":500, "openOnDblClick": true, "editSrc": true, ...}
* ```
*/
/**
* Deep-merges `source` into `target` in-place.
* Uses the same merge semantics as {@link ConfigProto}:
* - Nested plain objects are merged recursively
* - {@link isAtom | Atomic} values replace the target entirely
* - Everything else (primitives, arrays, class instances) replaces the target value
*
* Designed for patching `Config.defaultOptions` without losing existing keys:
*
* ```js
* Jodit.configure({
* controls: {
* someButton: { group: 'custom' }
* }
* });
* // Only `controls.someButton` is touched — all other controls remain intact.
* ```
*
* @see {@link ConfigProto} for the prototype-chain variant used at editor creation time
*/
export declare function ConfigMerge(target: IDictionary, source: IDictionary): void;
export declare function ConfigDeepFlatten(obj: IDictionary): IDictionary;