Files
matrix-screen-controller/核桃派软件源代码/app/static/template-edit-model.js
T

27 lines
757 B
JavaScript

export function createTemplateEditContext(template, baseline) {
return {
type: template.type || "template",
id: template.id,
name: template.name,
revision: template.revision,
readOnly: template.type === "animation" || Boolean(template.read_only ?? template.readOnly),
baseline,
};
}
export function templateEditSnapshot(context, serializedScene) {
if (!context) return null;
return {
type: context.type || "template",
id: context.id,
name: context.name,
revision: context.revision,
readOnly: Boolean(context.readOnly),
dirty: serializedScene !== context.baseline,
};
}
export function sceneNeedsTemplateSave(context, serializedScene) {
return !context || serializedScene !== context.baseline;
}