forked from UKSOURCE/cms.lams
feat(cms): enhance policy editor with fullscreen mode and date picking
Improve the policy content management experience by adding a dedicated fullscreen editing mode and a structured date picker for effective dates. - Implement fullscreen toggle in `policies-block-editor.js` with corresponding CSS for an expanded workspace - Add `date` field type to `sharedFields.js` and integrate it into `policiesConfig.js` - Implement date parsing and formatting utilities in `editor-script.ejs` to handle "Effective Date" strings - Update `policiesController.js` to use `updateOne` for more reliable document persistence and state reloading - Add support for `ICON_OPTIONS` in the policy editor configuration - Refine editor UI layout and overflow handling for better stability with long content strings
This commit is contained in:
@@ -163,16 +163,22 @@ module.exports = {
|
||||
delete updatedPolicy.sections;
|
||||
delete updatedPolicy.contentByLanguage;
|
||||
normalizedPolicies.splice(policyIndex, 1, updatedPolicy);
|
||||
doc.policies = normalizedPolicies;
|
||||
doc.hero = {
|
||||
const nextHero = {
|
||||
...(doc.hero || {}),
|
||||
lastUpdated: formatLastUpdated(),
|
||||
};
|
||||
doc.markModified("policies");
|
||||
doc.markModified("hero");
|
||||
await doc.save();
|
||||
await PoliciesPage.updateOne(
|
||||
{ _id: doc._id },
|
||||
{
|
||||
$set: {
|
||||
policies: normalizedPolicies,
|
||||
hero: nextHero,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const afterData = JSON.parse(JSON.stringify(doc.toObject()));
|
||||
const reloadedDoc = await PoliciesPage.findById(doc._id);
|
||||
const afterData = JSON.parse(JSON.stringify(reloadedDoc.toObject()));
|
||||
const changes = diffObject(beforeData, afterData);
|
||||
|
||||
if (changes.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user