UNPKG

@chief-editor/editor

Version:

FlowEditor Editor

1 lines 931 B
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var s in e=arguments[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};export function setBrick(t,e){var r=t.options,n=t.templateId,s=e.getTemplate(n);if(!s)return[!1,t];var i=r.filter((function(t){var e=t.brickId,r=t.props,n=s.getBrick(e);if(!n)return!1;var i={};return r.forEach((function(t){var e;Object.assign(i,((e={})[t.key.slice(7)]=t.value,e))})),n.setBrickLayout(i),!0}));return s.emitChange(),[!!i.length,__assign(__assign({},t),{options:i})]}export function resetSetBrick(t,e){var r=t.options.map((function(t){return __assign(__assign({},t),{props:t.props.map((function(t){return{key:t.key,value:t.oldValue,oldValue:t.value}}))})}));return setBrick(__assign(__assign({},t),{options:r}),e)[0]}export default{execute:setBrick,reset:resetSetBrick};