UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

52 lines (51 loc) 1.77 kB
/** * DevExtreme (cjs/__internal/ui/html_editor/utils/m_templates_storage.js) * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _type = require("../../../../core/utils/type"); class TemplatesStorage { constructor() { this._storage = {} } set(_ref, value) { let { editorKey: editorKey, marker: marker } = _ref; var _a; (_a = this._storage)[editorKey] ?? (_a[editorKey] = {}); this._storage[editorKey][marker] = value } get(_ref2) { var _Object$values$at, _this$_storage$editor; let { editorKey: editorKey, marker: marker } = _ref2; const isQuillFormatCall = !(0, _type.isDefined)(editorKey); return isQuillFormatCall ? null === (_Object$values$at = Object.values(this._storage).at(-1)) || void 0 === _Object$values$at ? void 0 : _Object$values$at[marker] : null === (_this$_storage$editor = this._storage[editorKey]) || void 0 === _this$_storage$editor ? void 0 : _this$_storage$editor[marker] } delete(_ref3) { let { editorKey: editorKey, marker: marker } = _ref3; if (!this._storage[editorKey]) { return } delete this._storage[editorKey][marker]; if ((0, _type.isEmptyObject)(this._storage[editorKey])) { delete this._storage[editorKey] } } } exports.default = TemplatesStorage;