@adminforth/rich-editor 1.2.2 → 1.3.0

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/README.md CHANGED
@@ -4,4 +4,4 @@
4
4
 
5
5
  Allows to add a rich text editor to your AdminForth text columns.
6
6
 
7
- ## For ussage, see [AdminForth RichEditor Documentation](https://adminforth.dev/docs/tutorial/Plugins/RichEditor/)
7
+ ## For usage, see [AdminForth RichEditor Documentation](https://adminforth.dev/docs/tutorial/Plugins/RichEditor/)
package/build.log CHANGED
@@ -10,5 +10,5 @@ custom/package.json
10
10
  custom/quillEditor.vue
11
11
  custom/tsconfig.json
12
12
 
13
- sent 20,973 bytes received 115 bytes 42,176.00 bytes/sec
14
- total size is 20,550 speedup is 0.97
13
+ sent 21,044 bytes received 115 bytes 42,318.00 bytes/sec
14
+ total size is 20,627 speedup is 0.97
@@ -26,7 +26,9 @@ import adminforth from '@/adminforth';
26
26
  import AsyncQueue from './async-queue';
27
27
  import Quill from "quill";
28
28
  import "quill/dist/quill.snow.css";
29
+ import { useI18n } from 'vue-i18n';
29
30
 
31
+ const { t } = useI18n();
30
32
  function dbg(title: string,...args: any[]) {
31
33
  // return; // comment for debug
32
34
  console.log(title, ...args.map(a =>JSON.stringify(a, null, 1)));
@@ -130,7 +132,7 @@ async function saveToServer(file: File) {
130
132
 
131
133
  if (error) {
132
134
  adminforth.alert({
133
- message: `File was not uploaded because of error: ${error}`,
135
+ message: `${t('File was not uploaded because of error:')} ${error}`,
134
136
  variant: 'danger'
135
137
  });
136
138
  return;
@@ -155,7 +157,7 @@ async function saveToServer(file: File) {
155
157
  });
156
158
  if (!success) {
157
159
  adminforth.alert({
158
- messageHtml: `<div>Sorry but the file was not uploaded because of S3 Request Error: </div>
160
+ messageHtml: `<div>${t('Sorry but the file was not uploaded because of S3 Request Error:')} </div>
159
161
  <pre style="white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; max-width: 100%;">${
160
162
  xhr.responseText.replace(/</g, '&lt;').replace(/>/g, '&gt;')
161
163
  }</pre>`,
@@ -26,7 +26,9 @@ import adminforth from '@/adminforth';
26
26
  import AsyncQueue from './async-queue';
27
27
  import Quill from "quill";
28
28
  import "quill/dist/quill.snow.css";
29
+ import { useI18n } from 'vue-i18n';
29
30
 
31
+ const { t } = useI18n();
30
32
  function dbg(title: string,...args: any[]) {
31
33
  // return; // comment for debug
32
34
  console.log(title, ...args.map(a =>JSON.stringify(a, null, 1)));
@@ -130,7 +132,7 @@ async function saveToServer(file: File) {
130
132
 
131
133
  if (error) {
132
134
  adminforth.alert({
133
- message: `File was not uploaded because of error: ${error}`,
135
+ message: `${t('File was not uploaded because of error:')} ${error}`,
134
136
  variant: 'danger'
135
137
  });
136
138
  return;
@@ -155,7 +157,7 @@ async function saveToServer(file: File) {
155
157
  });
156
158
  if (!success) {
157
159
  adminforth.alert({
158
- messageHtml: `<div>Sorry but the file was not uploaded because of S3 Request Error: </div>
160
+ messageHtml: `<div>${t('Sorry but the file was not uploaded because of S3 Request Error:')} </div>
159
161
  <pre style="white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; max-width: 100%;">${
160
162
  xhr.responseText.replace(/</g, '&lt;').replace(/>/g, '&gt;')
161
163
  }</pre>`,
package/dist/index.js CHANGED
@@ -101,6 +101,9 @@ export default class RichEditorPlugin extends AdminForthPlugin {
101
101
  })));
102
102
  });
103
103
  const deleteAttachmentRecords = (adminforth, options, s3Paths, adminUser) => __awaiter(this, void 0, void 0, function* () {
104
+ if (!s3Paths.length) {
105
+ return;
106
+ }
104
107
  const attachmentPrimaryKeyField = this.attachmentResource.columns.find(c => c.primaryKey);
105
108
  const attachments = yield adminforth.resource(options.attachments.attachmentResource).list(Filters.IN(options.attachments.attachmentFieldName, s3Paths));
106
109
  yield Promise.all(attachments.map((a) => __awaiter(this, void 0, void 0, function* () {
package/index.ts CHANGED
@@ -122,7 +122,9 @@ export default class RichEditorPlugin extends AdminForthPlugin {
122
122
  const deleteAttachmentRecords = async (
123
123
  adminforth: IAdminForth, options: PluginOptions, s3Paths: string[], adminUser: AdminUser
124
124
  ) => {
125
-
125
+ if (!s3Paths.length) {
126
+ return;
127
+ }
126
128
  const attachmentPrimaryKeyField = this.attachmentResource.columns.find(c => c.primaryKey);
127
129
 
128
130
  const attachments = await adminforth.resource(options.attachments.attachmentResource).list(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/rich-editor",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Rich editor plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",