@adminforth/rich-editor 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -135,9 +135,9 @@ export default class RichEditorPlugin extends AdminForthPlugin {
135
135
  }));
136
136
  // after edit we need to delete attachments that are not in the html anymore
137
137
  // and add new ones
138
- (resourceConfig.hooks.edit.afterSave).push((_a) => __awaiter(this, [_a], void 0, function* ({ recordId, record, adminUser }) {
139
- process.env.HEAVY_DEBUG && console.log('⚓ Cought hook', recordId, 'rec', record);
140
- if (record[this.options.htmlFieldName] === undefined) {
138
+ (resourceConfig.hooks.edit.afterSave).push((_a) => __awaiter(this, [_a], void 0, function* ({ recordId, updates, adminUser }) {
139
+ process.env.HEAVY_DEBUG && console.log('⚓ Cought hook', recordId, 'updates', updates);
140
+ if (updates[this.options.htmlFieldName] === undefined) {
141
141
  // field was not changed, do nothing
142
142
  return { ok: true };
143
143
  }
@@ -146,7 +146,7 @@ export default class RichEditorPlugin extends AdminForthPlugin {
146
146
  Filters.EQ(this.options.attachments.attachmentResourceIdFieldName, resourceConfig.resourceId)
147
147
  ]);
148
148
  const existingS3Paths = existingAparts.map((a) => a[this.options.attachments.attachmentFieldName]);
149
- const newS3Paths = getAttachmentPathes(record[this.options.htmlFieldName]);
149
+ const newS3Paths = getAttachmentPathes(updates[this.options.htmlFieldName]);
150
150
  process.env.HEAVY_DEBUG && console.log('📸 Existing s3Paths (from db)', existingS3Paths);
151
151
  process.env.HEAVY_DEBUG && console.log('📸 Found new s3Paths (from text)', newS3Paths);
152
152
  const toDelete = existingS3Paths.filter(s3Path => !newS3Paths.includes(s3Path));
package/index.ts CHANGED
@@ -172,9 +172,9 @@ export default class RichEditorPlugin extends AdminForthPlugin {
172
172
  // after edit we need to delete attachments that are not in the html anymore
173
173
  // and add new ones
174
174
  (resourceConfig.hooks.edit.afterSave).push(
175
- async ({ recordId, record, adminUser }: { recordId: any, record: any, adminUser: AdminUser }) => {
176
- process.env.HEAVY_DEBUG && console.log('⚓ Cought hook', recordId, 'rec', record);
177
- if (record[this.options.htmlFieldName] === undefined) {
175
+ async ({ recordId, updates, adminUser }: { recordId: any, updates: any, adminUser: AdminUser }) => {
176
+ process.env.HEAVY_DEBUG && console.log('⚓ Cought hook', recordId, 'updates', updates);
177
+ if (updates[this.options.htmlFieldName] === undefined) {
178
178
  // field was not changed, do nothing
179
179
  return { ok: true };
180
180
  }
@@ -183,7 +183,7 @@ export default class RichEditorPlugin extends AdminForthPlugin {
183
183
  Filters.EQ(this.options.attachments.attachmentResourceIdFieldName, resourceConfig.resourceId)
184
184
  ]);
185
185
  const existingS3Paths = existingAparts.map((a: any) => a[this.options.attachments.attachmentFieldName]);
186
- const newS3Paths = getAttachmentPathes(record[this.options.htmlFieldName]);
186
+ const newS3Paths = getAttachmentPathes(updates[this.options.htmlFieldName]);
187
187
  process.env.HEAVY_DEBUG && console.log('📸 Existing s3Paths (from db)', existingS3Paths)
188
188
  process.env.HEAVY_DEBUG && console.log('📸 Found new s3Paths (from text)', newS3Paths);
189
189
  const toDelete = existingS3Paths.filter(s3Path => !newS3Paths.includes(s3Path));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/rich-editor",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Rich editor plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.10.7",
34
- "adminforth": "^3.8.2",
34
+ "adminforth": "^4.7.3",
35
35
  "semantic-release": "^24.2.1",
36
36
  "semantic-release-slack-bot": "^4.0.2",
37
37
  "typescript": "^5.7.3"