@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
28 lines • 1.33 kB
JavaScript
import { NotImplementedException, ArgumentException } from "@aurigma/design-atoms-model/Exception";
import { BaseItemsCommand } from "./BaseItemsCommand";
import { SelectionCommand } from "@aurigma/design-atoms-interfaces";
export class EditPlaceholderCommand extends BaseItemsCommand {
constructor(productHandler, args, historyArgs, _commandManager) {
super(productHandler, historyArgs, args);
this._commandManager = _commandManager;
}
async _executeCommandBody() {
const { placeholder, state } = this._args;
if (placeholder == null)
throw new ArgumentException("EditPlaceholderCommand: placeholder cannot be null!");
if (placeholder.isStubOrEmpty || placeholder.isBarcodePlaceholder || !placeholder.placeholderPermissions.allowEditContent)
return;
const phHandler = this._productHandler.getHandler(placeholder);
if (phHandler == null || phHandler.editing === state)
return;
await this._commandManager.execute(SelectionCommand.selectItems, { items: [placeholder] });
phHandler.editing = state;
}
redo() {
throw new NotImplementedException();
}
undo() {
throw new NotImplementedException();
}
}
//# sourceMappingURL=EditPlaceholderCommand.js.map